Commit 1c2554bf authored by George Koltsov's avatar George Koltsov

Add BitBucketServerImport project filtering

parent 95075fee
...@@ -57,7 +57,7 @@ class Import::BitbucketServerController < Import::BaseController ...@@ -57,7 +57,7 @@ class Import::BitbucketServerController < Import::BaseController
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def status def status
@collection = bitbucket_client.repos(page_offset: page_offset, limit: limit_per_page) @collection = bitbucket_client.repos(page_offset: page_offset, limit: limit_per_page, filter: params[:filter_bitbucket_projects])
@repos, @incompatible_repos = @collection.partition { |repo| repo.valid? } @repos, @incompatible_repos = @collection.partition { |repo| repo.valid? }
# Use the import URL to filter beyond what BaseService#find_already_added_projects # Use the import URL to filter beyond what BaseService#find_already_added_projects
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
.btn-group .btn-group
= link_to('Reconfigure', configure_import_bitbucket_server_path, class: 'btn btn-primary', method: :post) = link_to('Reconfigure', configure_import_bitbucket_server_path, class: 'btn btn-primary', method: :post)
.input-btn-group.float-right
= form_tag status_import_bitbucket_server_path, :method => 'get' do
= text_field_tag :filter_bitbucket_projects, params[:filter_bitbucket_projects], class: 'form-control', placeholder: _('Filter your projects by name'), size: 40
.table-responsive.prepend-top-10 .table-responsive.prepend-top-10
%table.table.import-jobs %table.table.import-jobs
%colgroup.import-jobs-from-col %colgroup.import-jobs-from-col
......
...@@ -23,8 +23,9 @@ module BitbucketServer ...@@ -23,8 +23,9 @@ module BitbucketServer
BitbucketServer::Representation::Repo.new(parsed_response) BitbucketServer::Representation::Repo.new(parsed_response)
end end
def repos(page_offset: 0, limit: nil) def repos(page_offset: 0, limit: nil, filter: nil)
path = "/repos" path = "/repos"
path += "?q=name=#{filter}" if filter
get_collection(path, :repo, page_offset: page_offset, limit: limit) get_collection(path, :repo, page_offset: page_offset, limit: limit)
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