diff options
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 5 | ||||
-rw-r--r-- | app/views/import/bitbucket_server/new.html.haml | 21 | ||||
-rw-r--r-- | app/views/import/bitbucket_server/status.html.haml | 18 | ||||
-rw-r--r-- | lib/bitbucket_server/connection.rb | 2 | ||||
-rw-r--r-- | lib/bitbucket_server/representation/pull_request.rb | 4 |
5 files changed, 31 insertions, 19 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index 36229bcafc9..0d4197c6a43 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -14,8 +14,7 @@ class Import::BitbucketServerController < Import::BaseController repo = bitbucket_client.repo(project_slug, repo_slug) project_name = params[:new_name].presence || repo.name - repo_owner = repo.owner - repo_owner = current_user.username if repo_owner == bitbucket_client.user.username + repo_owner = current_user.username namespace_path = params[:new_namespace].presence || repo_owner target_namespace = find_or_create_namespace(namespace_path, current_user) @@ -85,7 +84,7 @@ class Import::BitbucketServerController < Import::BaseController def credentials { 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] } end diff --git a/app/views/import/bitbucket_server/new.html.haml b/app/views/import/bitbucket_server/new.html.haml index 3588cc48922..d9407dabf4a 100644 --- a/app/views/import/bitbucket_server/new.html.haml +++ b/app/views/import/bitbucket_server/new.html.haml @@ -9,11 +9,18 @@ %p = _('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-group - = text_field_tag :bitbucket_server_url, '', class: 'form-control append-right-8', placeholder: _('https://bitbucket-server'), size: 40 - - = text_field_tag :bitbucket_username, '', class: 'form-control append-right-8', placeholder: _('username'), size: 40 - - = text_field_tag :personal_access_token, '', class: 'form-control append-right-8', placeholder: _('Personal Access Token'), size: 40 += form_tag configure_import_bitbucket_server_path, method: :post do + .form-group.row + = label_tag :bitbucket_server_url, 'Bitbucket Server URL', class: 'col-form-label col-md-2' + .col-md-4 + = text_field_tag :bitbucket_server_url, '', class: 'form-control append-right-8', placeholder: _('https://bitbucket-server'), size: 40 + .form-group.row + = 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' diff --git a/app/views/import/bitbucket_server/status.html.haml b/app/views/import/bitbucket_server/status.html.haml index 50cbc7d1653..e179502a923 100644 --- a/app/views/import/bitbucket_server/status.html.haml +++ b/app/views/import/bitbucket_server/status.html.haml @@ -4,20 +4,22 @@ %h3.page-title %i.fa.fa-bitbucket Import projects from Bitbucket Server + = link_to('Reconfigure', configure_import_bitbucket_server_path, class: 'btn btn-primary float-right', method: :post) - if @repos.any? %p.light Select projects you want to import. %hr %p - - if @incompatible_repos.any? - = button_tag class: 'btn btn-import btn-success js-import-all' do - Import all compatible projects - = icon('spinner spin', class: 'loading-icon') - - else - = button_tag class: 'btn btn-import btn-success js-import-all' do - Import all projects - = icon('spinner spin', class: 'loading-icon') + - if @incompatible_repos.any? + = button_tag class: 'btn btn-import btn-success js-import-all' do + Import all compatible projects + = icon('spinner spin', class: 'loading-icon') + - else + = button_tag class: 'btn btn-import btn-success js-import-all' do + Import all projects + = icon('spinner spin', class: 'loading-icon') + %p .table-responsive %table.table.import-jobs diff --git a/lib/bitbucket_server/connection.rb b/lib/bitbucket_server/connection.rb index 7374b73fa60..5c3bea3b743 100644 --- a/lib/bitbucket_server/connection.rb +++ b/lib/bitbucket_server/connection.rb @@ -7,7 +7,7 @@ module BitbucketServer def initialize(options = {}) @api_version = options.fetch(:api_version, DEFAULT_API_VERSION) @base_uri = options[:base_uri] - @username = options[:username] + @username = options[:user] @token = options[:password] end diff --git a/lib/bitbucket_server/representation/pull_request.rb b/lib/bitbucket_server/representation/pull_request.rb index 96a27564641..3e460f04064 100644 --- a/lib/bitbucket_server/representation/pull_request.rb +++ b/lib/bitbucket_server/representation/pull_request.rb @@ -27,6 +27,10 @@ module BitbucketServer end end + def merged? + state == 'merged' + end + def created_at raw['createdDate'] end |