Commit 3735ce43 authored by Stan Hu's avatar Stan Hu

Add a Reconfigure button and improve layout of import screen

parent 6b698a93
...@@ -14,8 +14,7 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -14,8 +14,7 @@ class Import::BitbucketServerController < Import::BaseController
repo = bitbucket_client.repo(project_slug, repo_slug) repo = bitbucket_client.repo(project_slug, repo_slug)
project_name = params[:new_name].presence || repo.name project_name = params[:new_name].presence || repo.name
repo_owner = repo.owner repo_owner = current_user.username
repo_owner = current_user.username if repo_owner == bitbucket_client.user.username
namespace_path = params[:new_namespace].presence || repo_owner namespace_path = params[:new_namespace].presence || repo_owner
target_namespace = find_or_create_namespace(namespace_path, current_user) target_namespace = find_or_create_namespace(namespace_path, current_user)
...@@ -85,7 +84,7 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -85,7 +84,7 @@ class Import::BitbucketServerController < Import::BaseController
def credentials def credentials
{ {
base_uri: session[bitbucket_server_url_key], base_uri: session[bitbucket_server_url_key],
username: session[bitbucket_server_username_key], user: session[bitbucket_server_username_key],
password: session[personal_access_token_key] password: session[personal_access_token_key]
} }
end end
......
...@@ -9,11 +9,18 @@ ...@@ -9,11 +9,18 @@
%p %p
= _('Enter in your Bitbucket Server URL and personal access token below') = _('Enter in your Bitbucket Server URL and personal access token below')
= form_tag configure_import_bitbucket_server_path, method: :post, class: 'form-inline' do = form_tag configure_import_bitbucket_server_path, method: :post do
.form-group .form-group.row
= text_field_tag :bitbucket_server_url, '', class: 'form-control append-right-8', placeholder: _('https://bitbucket-server'), size: 40 = label_tag :bitbucket_server_url, 'Bitbucket Server URL', class: 'col-form-label col-md-2'
.col-md-4
= text_field_tag :bitbucket_username, '', class: 'form-control append-right-8', placeholder: _('username'), size: 40 = text_field_tag :bitbucket_server_url, '', class: 'form-control append-right-8', placeholder: _('https://bitbucket-server'), size: 40
.form-group.row
= text_field_tag :personal_access_token, '', class: 'form-control append-right-8', placeholder: _('Personal Access Token'), size: 40 = label_tag :bitbucket_server_url, 'Username', class: 'col-form-label col-md-2'
.col-md-4
= text_field_tag :bitbucket_username, '', class: 'form-control append-right-8', placeholder: _('username'), size: 40
.form-group.row
= label_tag :personal_access_token, 'Password/Personal Access Token', class: 'col-form-label col-md-2'
.col-md-4
= text_field_tag :personal_access_token, '', class: 'form-control append-right-8', placeholder: _('Personal Access Token'), size: 40
.form-actions
= submit_tag _('List your Bitbucket Server repositories'), class: 'btn btn-success' = submit_tag _('List your Bitbucket Server repositories'), class: 'btn btn-success'
...@@ -4,20 +4,22 @@ ...@@ -4,20 +4,22 @@
%h3.page-title %h3.page-title
%i.fa.fa-bitbucket %i.fa.fa-bitbucket
Import projects from Bitbucket Server Import projects from Bitbucket Server
= link_to('Reconfigure', configure_import_bitbucket_server_path, class: 'btn btn-primary float-right', method: :post)
- if @repos.any? - if @repos.any?
%p.light %p.light
Select projects you want to import. Select projects you want to import.
%hr %hr
%p %p
- if @incompatible_repos.any? - if @incompatible_repos.any?
= button_tag class: 'btn btn-import btn-success js-import-all' do = button_tag class: 'btn btn-import btn-success js-import-all' do
Import all compatible projects Import all compatible projects
= icon('spinner spin', class: 'loading-icon') = icon('spinner spin', class: 'loading-icon')
- else - else
= button_tag class: 'btn btn-import btn-success js-import-all' do = button_tag class: 'btn btn-import btn-success js-import-all' do
Import all projects Import all projects
= icon('spinner spin', class: 'loading-icon') = icon('spinner spin', class: 'loading-icon')
%p
.table-responsive .table-responsive
%table.table.import-jobs %table.table.import-jobs
......
...@@ -7,7 +7,7 @@ module BitbucketServer ...@@ -7,7 +7,7 @@ module BitbucketServer
def initialize(options = {}) def initialize(options = {})
@api_version = options.fetch(:api_version, DEFAULT_API_VERSION) @api_version = options.fetch(:api_version, DEFAULT_API_VERSION)
@base_uri = options[:base_uri] @base_uri = options[:base_uri]
@username = options[:username] @username = options[:user]
@token = options[:password] @token = options[:password]
end end
......
...@@ -27,6 +27,10 @@ module BitbucketServer ...@@ -27,6 +27,10 @@ module BitbucketServer
end end
end end
def merged?
state == 'merged'
end
def created_at def created_at
raw['createdDate'] raw['createdDate']
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment