Commit dde121ca authored by Tim Zallmann's avatar Tim Zallmann

Merge branch '209823-add-integrations-menu-item-and-list-to-group-settings' into 'master'

Add Integrations Menu Item and List to Group Settings

See merge request gitlab-org/gitlab!27975
parents a8a8dad5 23d13fb8
...@@ -7,6 +7,10 @@ module Groups ...@@ -7,6 +7,10 @@ module Groups
before_action :authorize_admin_group! before_action :authorize_admin_group!
def index
@integrations = []
end
private private
# TODO: Make this compatible with group-level integration # TODO: Make this compatible with group-level integration
......
...@@ -11,7 +11,18 @@ module GroupsHelper ...@@ -11,7 +11,18 @@ module GroupsHelper
end end
def group_nav_link_paths def group_nav_link_paths
%w[groups#projects groups#edit badges#index ci_cd#show ldap_group_links#index hooks#index audit_events#index pipeline_quota#index] %w[
groups#projects
groups#edit
badges#index
ci_cd#show
integrations#index
integrations#edit
ldap_group_links#index
hooks#index
audit_events#index
pipeline_quota#index
]
end end
def group_packages_nav_link_paths def group_packages_nav_link_paths
......
...@@ -62,10 +62,6 @@ module ServicesHelper ...@@ -62,10 +62,6 @@ module ServicesHelper
!current_controller?("admin/services") && service.deprecated? !current_controller?("admin/services") && service.deprecated?
end end
def edit_integration_path(integration)
edit_admin_application_settings_integration_path(integration)
end
def scoped_integrations_path def scoped_integrations_path
if @project.present? if @project.present?
project_settings_integrations_path(@project) project_settings_integrations_path(@project)
...@@ -86,6 +82,16 @@ module ServicesHelper ...@@ -86,6 +82,16 @@ module ServicesHelper
end end
end end
def scoped_edit_integration_path(integration)
if @project.present?
edit_project_settings_integration_path(@project, integration)
elsif @group.present?
edit_group_settings_integration_path(@group, integration)
else
edit_admin_application_settings_integration_path(integration)
end
end
def scoped_test_integration_path(integration) def scoped_test_integration_path(integration)
if @project.present? if @project.present?
test_project_settings_integration_path(@project, integration) test_project_settings_integration_path(@project, integration)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
%p %p
= s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.') = s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.')
= link_to _('Learn more'), '#' = link_to _('Learn more'), '#'
= render 'projects/services/integrations' = render 'shared/integrations/integrations', integrations: @integrations
- else - else
= render_if_exists 'admin/application_settings/elasticsearch_form' = render_if_exists 'admin/application_settings/elasticsearch_form'
......
- breadcrumb_title _('Integrations')
- page_title _('Integrations')
- @content_class = 'limit-container-width' unless fluid_layout
%h4= s_('GroupSettings|Apply integration settings to all Projects')
%p
= s_('GroupSettings|Integrations configured here will automatically apply to all projects in this group.')
= link_to _('Learn more'), '#'
= render 'shared/integrations/integrations', integrations: @integrations
...@@ -159,6 +159,11 @@ ...@@ -159,6 +159,11 @@
= link_to group_settings_ci_cd_path(@group), title: _('CI / CD') do = link_to group_settings_ci_cd_path(@group), title: _('CI / CD') do
%span %span
= _('CI / CD') = _('CI / CD')
- if Feature.enabled?(:group_level_integrations, @group)
= nav_link(controller: :integrations) do
= link_to group_settings_integrations_path(@group), title: _('Integrations') do
%span
= _('Integrations')
= render_if_exists "groups/ee/settings_nav" = render_if_exists "groups/ee/settings_nav"
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
%th{ role: 'columnheader', scope: 'col', 'aria-colindex': 4 }= _('Last updated') %th{ role: 'columnheader', scope: 'col', 'aria-colindex': 4 }= _('Last updated')
%tbody{ role: 'rowgroup' } %tbody{ role: 'rowgroup' }
- @integrations.each do |integration| - integrations.each do |integration|
%tr{ role: 'row' } %tr{ role: 'row' }
%td{ role: 'cell', 'aria-colindex': 1 } %td{ role: 'cell', 'aria-colindex': 1 }
= boolean_to_icon integration.activated? = boolean_to_icon integration.activated?
%td{ role: 'cell', 'aria-colindex': 2 } %td{ role: 'cell', 'aria-colindex': 2 }
= link_to edit_integration_path(integration) do = link_to scoped_edit_integration_path(integration) do
%strong= integration.title %strong= integration.title
%td.d-none.d-sm-block{ role: 'cell', 'aria-colindex': 3 } %td.d-none.d-sm-block{ role: 'cell', 'aria-colindex': 3 }
= integration.description = integration.description
......
...@@ -10310,6 +10310,9 @@ msgstr "" ...@@ -10310,6 +10310,9 @@ msgstr ""
msgid "GroupSAML|should be a random persistent ID, emails are discouraged" msgid "GroupSAML|should be a random persistent ID, emails are discouraged"
msgstr "" msgstr ""
msgid "GroupSettings|Apply integration settings to all Projects"
msgstr ""
msgid "GroupSettings|Auto DevOps pipeline was updated for the group" msgid "GroupSettings|Auto DevOps pipeline was updated for the group"
msgstr "" msgstr ""
...@@ -10346,6 +10349,9 @@ msgstr "" ...@@ -10346,6 +10349,9 @@ msgstr ""
msgid "GroupSettings|If the parent group's visibility is lower than the group current visibility, visibility levels for subgroups and projects will be changed to match the new parent group's visibility." msgid "GroupSettings|If the parent group's visibility is lower than the group current visibility, visibility levels for subgroups and projects will be changed to match the new parent group's visibility."
msgstr "" msgstr ""
msgid "GroupSettings|Integrations configured here will automatically apply to all projects in this group."
msgstr ""
msgid "GroupSettings|Learn more about badges." msgid "GroupSettings|Learn more about badges."
msgstr "" msgstr ""
......
...@@ -11,17 +11,40 @@ describe Groups::Settings::IntegrationsController do ...@@ -11,17 +11,40 @@ describe Groups::Settings::IntegrationsController do
sign_in(user) sign_in(user)
end end
describe '#edit' do describe '#index' do
context 'when group_level_integrations not enabled' do context 'when user is not owner' do
it 'returns not_found' do it 'renders not_found' do
stub_feature_flags(group_level_integrations: { enabled: false, thing: group }) get :index, params: { group_id: group }
get :edit, params: { group_id: group, id: Service.available_services_names.sample }
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
context 'when user is owner' do
before do
group.add_owner(user)
end
context 'when group_level_integrations not enabled' do
it 'returns not_found' do
stub_feature_flags(group_level_integrations: { enabled: false, thing: group })
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(:not_found)
end
end
it 'successfully displays the template' do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
end
end
describe '#edit' do
context 'when user is not owner' do context 'when user is not owner' do
it 'renders not_found' do it 'renders not_found' do
get :edit, params: { group_id: group, id: Service.available_services_names.sample } get :edit, params: { group_id: group, id: Service.available_services_names.sample }
...@@ -35,6 +58,16 @@ describe Groups::Settings::IntegrationsController do ...@@ -35,6 +58,16 @@ describe Groups::Settings::IntegrationsController do
group.add_owner(user) group.add_owner(user)
end end
context 'when group_level_integrations not enabled' do
it 'returns not_found' do
stub_feature_flags(group_level_integrations: { enabled: false, thing: group })
get :edit, params: { group_id: group, id: Service.available_services_names.sample }
expect(response).to have_gitlab_http_status(:not_found)
end
end
Service.available_services_names.each do |integration_name| Service.available_services_names.each do |integration_name|
context "#{integration_name}" do context "#{integration_name}" do
it 'successfully displays the template' do it 'successfully displays the template' do
......
...@@ -120,6 +120,7 @@ RSpec.shared_context 'group navbar structure' do ...@@ -120,6 +120,7 @@ RSpec.shared_context 'group navbar structure' do
_('General'), _('General'),
_('Projects'), _('Projects'),
_('CI / CD'), _('CI / CD'),
_('Integrations'),
_('Webhooks'), _('Webhooks'),
_('Audit Events') _('Audit Events')
] ]
......
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