Skip to content
代码片段 群组 项目
提交 dde121ca 编辑于 作者: 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
No related branches found
No related tags found
无相关合并请求
......@@ -7,6 +7,10 @@ class IntegrationsController < Groups::ApplicationController
before_action :authorize_admin_group!
def index
@integrations = []
end
private
# TODO: Make this compatible with group-level integration
......
......@@ -11,7 +11,18 @@ def group_overview_nav_link_paths
end
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
def group_packages_nav_link_paths
......
......@@ -62,10 +62,6 @@ def disable_fields_service?(service)
!current_controller?("admin/services") && service.deprecated?
end
def edit_integration_path(integration)
edit_admin_application_settings_integration_path(integration)
end
def scoped_integrations_path
if @project.present?
project_settings_integrations_path(@project)
......@@ -86,6 +82,16 @@ def scoped_integration_path(integration)
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)
if @project.present?
test_project_settings_integration_path(@project, integration)
......
......@@ -18,7 +18,7 @@
%p
= s_('AdminSettings|Integrations configured here will automatically apply to all projects on this instance.')
= link_to _('Learn more'), '#'
= render 'projects/services/integrations'
= render 'shared/integrations/integrations', integrations: @integrations
- else
= 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 @@
= link_to group_settings_ci_cd_path(@group), title: _('CI / CD') do
%span
= _('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"
......
......@@ -12,12 +12,12 @@
%th{ role: 'columnheader', scope: 'col', 'aria-colindex': 4 }= _('Last updated')
%tbody{ role: 'rowgroup' }
- @integrations.each do |integration|
- integrations.each do |integration|
%tr{ role: 'row' }
%td{ role: 'cell', 'aria-colindex': 1 }
= boolean_to_icon integration.activated?
%td{ role: 'cell', 'aria-colindex': 2 }
= link_to edit_integration_path(integration) do
= link_to scoped_edit_integration_path(integration) do
%strong= integration.title
%td.d-none.d-sm-block{ role: 'cell', 'aria-colindex': 3 }
= integration.description
......
......@@ -10310,6 +10310,9 @@ msgstr ""
msgid "GroupSAML|should be a random persistent ID, emails are discouraged"
msgstr ""
 
msgid "GroupSettings|Apply integration settings to all Projects"
msgstr ""
msgid "GroupSettings|Auto DevOps pipeline was updated for the group"
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."
msgstr ""
 
msgid "GroupSettings|Integrations configured here will automatically apply to all projects in this group."
msgstr ""
msgid "GroupSettings|Learn more about badges."
msgstr ""
 
......
......@@ -11,17 +11,40 @@
sign_in(user)
end
describe '#edit' 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 :edit, params: { group_id: group, id: Service.available_services_names.sample }
describe '#index' do
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
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
it 'renders not_found' do
get :edit, params: { group_id: group, id: Service.available_services_names.sample }
......@@ -35,6 +58,16 @@
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 :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|
context "#{integration_name}" do
it 'successfully displays the template' do
......
......@@ -120,6 +120,7 @@
_('General'),
_('Projects'),
_('CI / CD'),
_('Integrations'),
_('Webhooks'),
_('Audit Events')
]
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册