diff options
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 2 | ||||
-rw-r--r-- | app/views/import/bitbucket_server/status.html.haml | 4 | ||||
-rw-r--r-- | lib/bitbucket_server/client.rb | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index f71ea8642cd..f5ea33a8880 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -57,7 +57,7 @@ class Import::BitbucketServerController < Import::BaseController # rubocop: disable CodeReuse/ActiveRecord 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? } # Use the import URL to filter beyond what BaseService#find_already_added_projects diff --git a/app/views/import/bitbucket_server/status.html.haml b/app/views/import/bitbucket_server/status.html.haml index 40609fddbde..29cfa0d3f4c 100644 --- a/app/views/import/bitbucket_server/status.html.haml +++ b/app/views/import/bitbucket_server/status.html.haml @@ -20,6 +20,10 @@ .btn-group = 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.table.import-jobs %colgroup.import-jobs-from-col diff --git a/lib/bitbucket_server/client.rb b/lib/bitbucket_server/client.rb index 6a608058813..d1661fe92ba 100644 --- a/lib/bitbucket_server/client.rb +++ b/lib/bitbucket_server/client.rb @@ -23,8 +23,9 @@ module BitbucketServer BitbucketServer::Representation::Repo.new(parsed_response) end - def repos(page_offset: 0, limit: nil) + def repos(page_offset: 0, limit: nil, filter: nil) path = "/repos" + path += "?q=name=#{filter}" if filter get_collection(path, :repo, page_offset: page_offset, limit: limit) end |