Commit aa5821e5 authored by Stan Hu's avatar Stan Hu

Assorted Bitbucket Server importer code cleanup based on review

parent 636bcebc
...@@ -13,7 +13,7 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -13,7 +13,7 @@ class Import::BitbucketServerController < Import::BaseController
# Repository names are limited to 128 characters. They must start with a # Repository names are limited to 128 characters. They must start with a
# letter or number and may contain spaces, hyphens, underscores, and periods. # letter or number and may contain spaces, hyphens, underscores, and periods.
# (https://community.atlassian.com/t5/Answers-Developer-Questions/stash-repository-names/qaq-p/499054) # (https://community.atlassian.com/t5/Answers-Developer-Questions/stash-repository-names/qaq-p/499054)
VALID_BITBUCKET_CHARS = /\A[a-zA-z0-9\-_\.\s]+\z/ VALID_BITBUCKET_CHARS = /\A[\w\-_\.\s]+\z/
def new def new
end end
......
...@@ -41,12 +41,9 @@ ...@@ -41,12 +41,9 @@
= link_to project.full_path, [project.namespace.becomes(Namespace), project] = link_to project.full_path, [project.namespace.becomes(Namespace), project]
%td.job-status %td.job-status
- if project.import_status == 'finished' - if project.import_status == 'finished'
%span = icon('check', text: 'Done')
%i.fa.fa-check
Done
- elsif project.import_status == 'started' - elsif project.import_status == 'started'
%i.fa.fa-spinner.fa-spin = icon('spin', text: 'started')
started
- else - else
= project.human_import_status_name = project.human_import_status_name
......
...@@ -12,10 +12,10 @@ module BitbucketServer ...@@ -12,10 +12,10 @@ module BitbucketServer
ConnectionError = Class.new(StandardError) ConnectionError = Class.new(StandardError)
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[:user] @username = options[:user]
@token = options[:password] @token = options[:password]
end end
def get(path, extra_query = {}) def get(path, extra_query = {})
......
...@@ -20,7 +20,7 @@ module BitbucketServer ...@@ -20,7 +20,7 @@ module BitbucketServer
private private
def parse_attrs(raw) def parse_attrs(raw)
raw.slice(*%w(size nextPageStart isLastPage)).symbolize_keys raw.slice('size', 'nextPageStart', 'isLastPage').symbolize_keys
end end
def parse_values(raw, bitbucket_rep_class) def parse_values(raw, bitbucket_rep_class)
......
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