Commit 824f0647 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch 'add-search-group-settings' into 'master'

Add search to group settings

See merge request gitlab-org/gitlab!56238
parents faca625f 74da9f50
...@@ -4,7 +4,6 @@ import initSharedRunnersForm from '~/group_settings/mount_shared_runners'; ...@@ -4,7 +4,6 @@ import initSharedRunnersForm from '~/group_settings/mount_shared_runners';
import { FILTERED_SEARCH } from '~/pages/constants'; import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import { initInstallRunner } from '~/pages/shared/mount_runner_instructions'; import { initInstallRunner } from '~/pages/shared/mount_runner_instructions';
import initSearchSettings from '~/search_settings';
import initSettingsPanels from '~/settings_panels'; import initSettingsPanels from '~/settings_panels';
// Initialize expandable settings panels // Initialize expandable settings panels
...@@ -21,5 +20,3 @@ initSharedRunnersForm(); ...@@ -21,5 +20,3 @@ initSharedRunnersForm();
initVariableList(); initVariableList();
initInstallRunner(); initInstallRunner();
initSearchSettings();
import initSearchSettings from '~/search_settings';
initSearchSettings();
import bundle from '~/packages_and_registries/settings/group/bundle'; import bundle from '~/packages_and_registries/settings/group/bundle';
import initSearchSettings from '~/search_settings';
bundle(); bundle();
document.addEventListener('DOMContentLoaded', initSearchSettings);
import DueDateSelectors from '~/due_date_select'; import DueDateSelectors from '~/due_date_select';
import initSearchSettings from '~/search_settings';
import initSettingsPanels from '~/settings_panels'; import initSettingsPanels from '~/settings_panels';
// Initialize expandable settings panels // Initialize expandable settings panels
initSettingsPanels(); initSettingsPanels();
new DueDateSelectors(); // eslint-disable-line no-new new DueDateSelectors(); // eslint-disable-line no-new
initSearchSettings();
...@@ -5,6 +5,7 @@ module Groups ...@@ -5,6 +5,7 @@ module Groups
class CiCdController < Groups::ApplicationController class CiCdController < Groups::ApplicationController
include RunnerSetupScripts include RunnerSetupScripts
layout 'group_settings'
skip_cross_project_access_check :show skip_cross_project_access_check :show
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :authorize_update_max_artifacts_size!, only: [:update] before_action :authorize_update_max_artifacts_size!, only: [:update]
......
...@@ -9,6 +9,8 @@ module Groups ...@@ -9,6 +9,8 @@ module Groups
feature_category :integrations feature_category :integrations
layout 'group_settings'
def index def index
@integrations = Service.find_or_initialize_all_non_project_specific(Service.for_group(group)).sort_by(&:title) @integrations = Service.find_or_initialize_all_non_project_specific(Service.for_group(group)).sort_by(&:title)
end end
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Groups module Groups
module Settings module Settings
class PackagesAndRegistriesController < Groups::ApplicationController class PackagesAndRegistriesController < Groups::ApplicationController
layout 'group_settings'
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :verify_packages_enabled! before_action :verify_packages_enabled!
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Groups module Groups
module Settings module Settings
class RepositoryController < Groups::ApplicationController class RepositoryController < Groups::ApplicationController
layout 'group_settings'
skip_cross_project_access_check :show skip_cross_project_access_check :show
before_action :authorize_create_deploy_token! before_action :authorize_create_deploy_token!
before_action :define_deploy_token_variables before_action :define_deploy_token_variables
......
- enable_search_settings locals: { container_class: 'gl-my-5' }
= form_for @group, html: { multipart: true, class: 'gl-show-field-errors js-general-settings-form' }, authenticity_token: true do |f| = form_for @group, html: { multipart: true, class: 'gl-show-field-errors js-general-settings-form' }, authenticity_token: true do |f|
%input{ type: 'hidden', name: 'update_section', value: 'js-general-settings' } %input{ type: 'hidden', name: 'update_section', value: 'js-general-settings' }
= form_errors(@group) = form_errors(@group)
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
- expanded = expanded_by_default? - expanded = expanded_by_default?
- general_expanded = @group.errors.empty? ? expanded : true - general_expanded = @group.errors.empty? ? expanded : true
- enable_search_settings locals: { container_class: 'gl-my-5' }
-# Given we only have one field in this form which is also admin-only, -# Given we only have one field in this form which is also admin-only,
-# we don't want to show an empty section to non-admin users, -# we don't want to show an empty section to non-admin users,
- if can?(current_user, :update_max_artifacts_size, @group) - if can?(current_user, :update_max_artifacts_size, @group)
......
...@@ -2,6 +2,4 @@ ...@@ -2,6 +2,4 @@
- page_title _('Packages & Registries') - page_title _('Packages & Registries')
- @content_class = 'limit-container-width' unless fluid_layout - @content_class = 'limit-container-width' unless fluid_layout
- enable_search_settings locals: { container_class: 'gl-my-5' }
%section#js-packages-and-registries-settings{ data: { default_expanded: expanded_by_default?.to_s, group_path: @group.full_path } } %section#js-packages-and-registries-settings{ data: { default_expanded: expanded_by_default?.to_s, group_path: @group.full_path } }
- breadcrumb_title _('Repository Settings') - breadcrumb_title _('Repository Settings')
- page_title _('Repository') - page_title _('Repository')
- enable_search_settings locals: { container_class: 'gl-my-5' }
- deploy_token_description = s_('DeployTokens|Group deploy tokens allow access to the packages, repositories, and registry images within the group.') - deploy_token_description = s_('DeployTokens|Group deploy tokens allow access to the packages, repositories, and registry images within the group.')
= render "shared/deploy_tokens/index", group_or_project: @group, description: deploy_token_description = render "shared/deploy_tokens/index", group_or_project: @group, description: deploy_token_description
......
- page_title _("Settings") - page_title _("Settings")
- nav "group" - nav "group"
- enable_search_settings locals: { container_class: 'gl-my-5' }
= render template: "layouts/group" = render template: "layouts/group"
import initSearchSettings from '~/search_settings';
initSearchSettings();
import initSearchSettings from '~/search_settings';
initSearchSettings();
import storageCounter from 'ee/storage_counter'; import storageCounter from 'ee/storage_counter';
import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs'; import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs';
import initSearchSettings from '~/search_settings';
if (document.querySelector('#js-storage-counter-app')) { if (document.querySelector('#js-storage-counter-app')) {
storageCounter(); storageCounter();
...@@ -11,3 +12,5 @@ if (document.querySelector('#js-storage-counter-app')) { ...@@ -11,3 +12,5 @@ if (document.querySelector('#js-storage-counter-app')) {
hashedTabs: true, hashedTabs: true,
}); });
} }
initSearchSettings();
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User searches group settings', :js do
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) }
before do
group.add_owner(user)
sign_in(user)
end
context 'in Webhooks page' do
before do
visit group_hooks_path(group)
end
it_behaves_like 'can highlight results', 'Group Hooks'
end
context 'in Usage Quotas page' do
before do
visit group_usage_quotas_path(group)
end
it_behaves_like 'can highlight results', 'Usage of group'
end
end
...@@ -5,19 +5,26 @@ require 'spec_helper' ...@@ -5,19 +5,26 @@ require 'spec_helper'
RSpec.describe 'User searches group settings', :js do RSpec.describe 'User searches group settings', :js do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group) } let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :repository, namespace: group) }
before do before do
group.add_owner(user) group.add_owner(user)
sign_in(user) sign_in(user)
end end
context 'in general settings page' do context 'in General settings page' do
let(:visit_path) { edit_group_path(group) } let(:visit_path) { edit_group_path(group) }
it_behaves_like 'can search settings with feature flag check', 'Naming', 'Permissions' it_behaves_like 'can search settings with feature flag check', 'Naming', 'Permissions'
end end
context 'in Integrations page' do
before do
visit group_settings_integrations_path(group)
end
it_behaves_like 'can highlight results', 'integration settings'
end
context 'in Repository page' do context 'in Repository page' do
before do before do
visit group_settings_repository_path(group) visit group_settings_repository_path(group)
...@@ -33,4 +40,12 @@ RSpec.describe 'User searches group settings', :js do ...@@ -33,4 +40,12 @@ RSpec.describe 'User searches group settings', :js do
it_behaves_like 'can search settings', 'Variables', 'Runners' it_behaves_like 'can search settings', 'Variables', 'Runners'
end end
context 'in Packages & Registries page' do
before do
visit group_settings_packages_and_registries_path(group)
end
it_behaves_like 'can highlight results', 'GitLab Packages'
end
end end
...@@ -7,9 +7,7 @@ RSpec.shared_examples 'cannot search settings' do ...@@ -7,9 +7,7 @@ RSpec.shared_examples 'cannot search settings' do
end end
RSpec.shared_examples 'can search settings' do |search_term, non_match_section| RSpec.shared_examples 'can search settings' do |search_term, non_match_section|
it 'has search settings field' do it_behaves_like 'can highlight results', search_term
expect(page).to have_field(placeholder: SearchHelpers::INPUT_PLACEHOLDER)
end
it 'hides unmatching sections on search' do it 'hides unmatching sections on search' do
expect(page).to have_content(non_match_section) expect(page).to have_content(non_match_section)
...@@ -21,6 +19,23 @@ RSpec.shared_examples 'can search settings' do |search_term, non_match_section| ...@@ -21,6 +19,23 @@ RSpec.shared_examples 'can search settings' do |search_term, non_match_section|
end end
end end
RSpec.shared_examples 'can highlight results' do |search_term|
it 'has search settings field' do
expect(page).to have_field(placeholder: SearchHelpers::INPUT_PLACEHOLDER)
end
it 'highlights the search terms' do
selector = '.gl-bg-orange-50'
fill_in SearchHelpers::INPUT_PLACEHOLDER, with: search_term
expect(page).to have_css(selector)
page.find_all(selector) do |element|
expect(element).to have_content(search_term)
end
end
end
RSpec.shared_examples 'can search settings with feature flag check' do |search_term, non_match_section| RSpec.shared_examples 'can search settings with feature flag check' do |search_term, non_match_section|
let(:flag) { true } let(:flag) { true }
......
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