diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2019-08-12 12:58:05 +0000 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2019-08-12 12:58:05 +0000 |
commit | d2ecbd747b148d965a7f7ab4f438ad02ca21faf9 (patch) | |
tree | c50c706adde38e29b7b9cd4b0da2abe56f1de739 /app | |
parent | 832824f46eced9c5e781bd41082a4743600fb050 (diff) | |
parent | 485b8b86edaeed1ba3a8bf55df23ca6cbc1f015b (diff) | |
download | gitlab-ce-d2ecbd747b148d965a7f7ab4f438ad02ca21faf9.tar.gz |
Merge branch 'georgekoltsov/51260-add-filtering-to-bitbucket-server-import' into 'master'
Add BitBucketServerImport project filtering
See merge request gitlab-org/gitlab-ce!31420
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 8 | ||||
-rw-r--r-- | app/views/import/bitbucket_server/status.html.haml | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index f71ea8642cd..dc72a4e4fd9 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Import::BitbucketServerController < Import::BaseController + include ActionView::Helpers::SanitizeHelper + before_action :verify_bitbucket_server_import_enabled before_action :bitbucket_auth, except: [:new, :configure] before_action :validate_import_params, only: [:create] @@ -57,7 +59,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: sanitized_filter_param) @repos, @incompatible_repos = @collection.partition { |repo| repo.valid? } # Use the import URL to filter beyond what BaseService#find_already_added_projects @@ -147,4 +149,8 @@ class Import::BitbucketServerController < Import::BaseController def limit_per_page BitbucketServer::Paginator::PAGE_LENGTH end + + def sanitized_filter_param + sanitize(params[:filter]) + end end diff --git a/app/views/import/bitbucket_server/status.html.haml b/app/views/import/bitbucket_server/status.html.haml index 40609fddbde..aac09801d91 100644 --- a/app/views/import/bitbucket_server/status.html.haml +++ b/app/views/import/bitbucket_server/status.html.haml @@ -17,8 +17,13 @@ = button_tag class: 'btn btn-import btn-success js-import-all' do = _('Import all projects') = icon('spinner spin', class: 'loading-icon') - .btn-group - = link_to('Reconfigure', configure_import_bitbucket_server_path, class: 'btn btn-primary', method: :post) + +.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, sanitize(params[:filter]), class: 'form-control append-bottom-10', placeholder: _('Filter your projects by name'), size: 40, autoFocus: true .table-responsive.prepend-top-10 %table.table.import-jobs @@ -62,7 +67,7 @@ = text_field_tag :path, current_user.namespace_path, class: "input-group-text input-large form-control", tabindex: 1, disabled: true %span.input-group-prepend .input-group-text / - = text_field_tag :path, sanitize_project_name(repo.slug), class: "input-mini form-control", tabindex: 2, autofocus: true, required: true + = text_field_tag :path, sanitize_project_name(repo.slug), class: "input-mini form-control", tabindex: 2, required: true %td.import-actions.job-status = button_tag class: 'btn btn-import js-add-to-import' do Import |