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
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
......
......@@ -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'
......@@ -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
......
......@@ -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
......
......@@ -27,6 +27,10 @@ module BitbucketServer
end
end
def merged?
state == 'merged'
end
def created_at
raw['createdDate']
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