Commit ef3ab73f authored by Justin Ho's avatar Justin Ho

Add group integrations listing

- Move _integrations.html partial to shared folder
- Add sidebar link and make it active when integration
pages are open
- Add group/integrations_controller with index action
parent 4a0b0e55
...@@ -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 = Project.first.find_or_initialize_services
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
...@@ -160,6 +160,11 @@ ...@@ -160,6 +160,11 @@
%span %span
= _('CI / CD') = _('CI / CD')
= 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"
= render_if_exists "groups/ee/administration_nav" = render_if_exists "groups/ee/administration_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
......
...@@ -10250,6 +10250,9 @@ msgstr "" ...@@ -10250,6 +10250,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 ""
...@@ -10286,6 +10289,9 @@ msgstr "" ...@@ -10286,6 +10289,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,6 +11,39 @@ describe Groups::Settings::IntegrationsController do ...@@ -11,6 +11,39 @@ describe Groups::Settings::IntegrationsController do
sign_in(user) sign_in(user)
end end
describe '#index' do
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
context 'when user is not owner' do
it 'renders not_found' do
get :index, params: { group_id: group }
expect(response).to have_gitlab_http_status(:not_found)
end
end
context 'when user is owner' do
before do
group.add_owner(user)
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 describe '#edit' do
context 'when group_level_integrations not enabled' do context 'when group_level_integrations not enabled' do
it 'returns not_found' do it 'returns not_found' 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