Commit 3d5513c7 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '325196-service-template-deprecation-ui-updates' into 'master'

Remove ability to create new service templates

See merge request gitlab-org/gitlab!58624
parents 0b0be3c4 f6e1e66d
...@@ -9,7 +9,7 @@ class Admin::ServicesController < Admin::ApplicationController ...@@ -9,7 +9,7 @@ class Admin::ServicesController < Admin::ApplicationController
feature_category :integrations feature_category :integrations
def index def index
@services = Service.find_or_create_templates.sort_by(&:title) @activated_services = Service.for_template.active.sort_by(&:title)
@existing_instance_types = Service.for_instance.pluck(:type) # rubocop: disable CodeReuse/ActiveRecord @existing_instance_types = Service.for_instance.pluck(:type) # rubocop: disable CodeReuse/ActiveRecord
end end
......
= render "service_templates_deprecated_alert"
%h3.page-title %h3.page-title
= @service.title = @service.title
%p #{@service.description} template. %p= @service.description
= form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'fieldset-form js-integration-settings-form' } do |form| = form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'fieldset-form js-integration-settings-form' } do |form|
= render 'shared/service_settings', form: form, integration: @service = render 'shared/service_settings', form: form, integration: @service
- doc_link_start = "<a href=\"#{integrations_help_page_path}\" target='_blank' rel='noopener noreferrer'>".html_safe
- settings_link_start = "<a href=\"#{integrations_admin_application_settings_path}\">".html_safe
.gl-alert.gl-alert-danger.gl-mt-5{ role: 'alert' }
= sprite_icon('error', css_class: 'gl-alert-icon gl-alert-icon-no-title')
%h4.gl-alert-title= s_('AdminSettings|Service templates are deprecated and will be removed in GitLab 14.0.')
.gl-alert-body
= html_escape_once(s_("AdminSettings|You can't add new templates. To migrate or remove a Service template, create a new integration at %{settings_link_start}Settings &gt; Integrations%{link_end}. Learn more about %{doc_link_start}Project integration management%{link_end}.")).html_safe % { settings_link_start: settings_link_start, doc_link_start: doc_link_start, link_end: '</a>'.html_safe }
- page_title _("Service Templates") - page_title _("Service Templates")
- @content_class = 'limit-container-width' unless fluid_layout - @content_class = 'limit-container-width' unless fluid_layout
- if show_service_templates_deprecated? = render "service_templates_deprecated_alert"
.gl-alert.gl-alert-tip.js-service-templates-deprecated.gl-mt-5{ role: 'alert', data: { feature_id: UserCalloutsHelper::SERVICE_TEMPLATES_DEPRECATED, dismiss_endpoint: user_callouts_path } }
= sprite_icon('bulb', css_class: 'gl-alert-icon gl-alert-icon-no-title')
%button.js-close.gl-alert-dismiss{ type: 'button', aria: { label: _('Dismiss') } }
= sprite_icon('close')
%h4.gl-alert-title= s_('AdminSettings|Service Templates will soon be deprecated.')
.gl-alert-body
= s_('AdminSettings|Try using the latest version of Integrations instead.')
.gl-alert-actions
= link_to _('Go to Integrations'), integrations_admin_application_settings_path, class: 'btn btn-info gl-alert-action gl-button'
= link_to _('Learn more'), help_page_path('user/admin_area/settings/project_integration_management'), class: 'btn btn-default gl-alert-action btn-secondary gl-button', target: '_blank', rel: 'noopener noreferrer'
%h3.page-title Service templates - if @activated_services.any?
%p.light= s_('AdminSettings|Service template allows you to set default values for integrations') %h3.page-title Service templates
%p= s_('AdminSettings|Service template allows you to set default values for integrations')
.table-holder %table.table.b-table.gl-table
%table.table
%colgroup %colgroup
%col %col
%col %col
...@@ -29,7 +19,7 @@ ...@@ -29,7 +19,7 @@
%th= _('Service') %th= _('Service')
%th= _('Description') %th= _('Description')
%th= _('Last edit') %th= _('Last edit')
- @services.each do |service| - @activated_services.each do |service|
- if service.type.in?(@existing_instance_types) - if service.type.in?(@existing_instance_types)
%tr %tr
%td %td
......
---
title: Remove ability to create new service templates
merge_request: 58624
author:
type: removed
...@@ -2328,10 +2328,10 @@ msgstr "" ...@@ -2328,10 +2328,10 @@ msgstr ""
msgid "AdminSettings|Select a template" msgid "AdminSettings|Select a template"
msgstr "" msgstr ""
msgid "AdminSettings|Service Templates will soon be deprecated." msgid "AdminSettings|Service template allows you to set default values for integrations"
msgstr "" msgstr ""
msgid "AdminSettings|Service template allows you to set default values for integrations" msgid "AdminSettings|Service templates are deprecated and will be removed in GitLab 14.0."
msgstr "" msgstr ""
msgid "AdminSettings|Session duration for Git operations when 2FA is enabled (minutes)" msgid "AdminSettings|Session duration for Git operations when 2FA is enabled (minutes)"
...@@ -2352,10 +2352,10 @@ msgstr "" ...@@ -2352,10 +2352,10 @@ msgstr ""
msgid "AdminSettings|The required pipeline configuration can be selected from the %{code_start}gitlab-ci%{code_end} directory inside of the configured %{link_start}instance template repository%{link_end} or from GitLab provided configurations." msgid "AdminSettings|The required pipeline configuration can be selected from the %{code_start}gitlab-ci%{code_end} directory inside of the configured %{link_start}instance template repository%{link_end} or from GitLab provided configurations."
msgstr "" msgstr ""
msgid "AdminSettings|Try using the latest version of Integrations instead." msgid "AdminSettings|When creating a new environment variable it will be protected by default."
msgstr "" msgstr ""
msgid "AdminSettings|When creating a new environment variable it will be protected by default." msgid "AdminSettings|You can't add new templates. To migrate or remove a Service template, create a new integration at %{settings_link_start}Settings &gt; Integrations%{link_end}. Learn more about %{doc_link_start}Project integration management%{link_end}."
msgstr "" msgstr ""
msgid "AdminStatistics|Active Users" msgid "AdminStatistics|Active Users"
...@@ -14774,9 +14774,6 @@ msgstr "" ...@@ -14774,9 +14774,6 @@ msgstr ""
msgid "Go full screen" msgid "Go full screen"
msgstr "" msgstr ""
msgid "Go to Integrations"
msgstr ""
msgid "Go to Webhooks" msgid "Go to Webhooks"
msgstr "" msgstr ""
......
...@@ -249,6 +249,14 @@ RSpec.describe 'Admin updates settings' do ...@@ -249,6 +249,14 @@ RSpec.describe 'Admin updates settings' do
expect(page).to have_content "Application settings saved successfully" expect(page).to have_content "Application settings saved successfully"
expect(current_settings.hide_third_party_offers).to be true expect(current_settings.hide_third_party_offers).to be true
end end
end
context 'when the Slack Notifications Service template is active' do
before do
create(:service, :template, type: 'SlackService', active: true)
visit general_admin_application_settings_path
end
it 'change Slack Notifications Service template settings', :js do it 'change Slack Notifications Service template settings', :js do
first(:link, 'Service Templates').click first(:link, 'Service Templates').click
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin activates Prometheus', :js do
let(:admin) { create(:user, :admin) }
before do
sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin)
visit(admin_application_settings_services_path)
click_link('Prometheus')
end
it 'activates service' do
check('Active')
fill_in('API URL', with: 'http://prometheus.example.com')
click_button('Save changes')
expect(page).to have_content('Application settings saved successfully')
end
end
...@@ -9,23 +9,45 @@ RSpec.describe 'Admin visits service templates' do ...@@ -9,23 +9,45 @@ RSpec.describe 'Admin visits service templates' do
before do before do
sign_in(admin) sign_in(admin)
gitlab_enable_admin_mode_sign_in(admin) gitlab_enable_admin_mode_sign_in(admin)
visit(admin_application_settings_services_path)
end end
context 'without instance-level integration' do context 'without an active service template' do
it 'shows a link to service template' do before do
expect(page).to have_link('Slack', href: edit_admin_application_settings_service_path(slack_service.id)) visit(admin_application_settings_services_path)
expect(page).not_to have_link('Slack', href: edit_admin_application_settings_integration_path(slack_service)) end
it 'does not show service template content' do
expect(page).not_to have_content('Service template allows you to set default values for integrations')
end end
end end
context 'with instance-level integration' do context 'with an active service template' do
let_it_be(:slack_instance_integration) { create(:slack_service, instance: true, project: nil) } before do
create(:slack_service, :template, active: true)
visit(admin_application_settings_services_path)
end
it 'shows service template content' do
expect(page).to have_content('Service template allows you to set default values for integrations')
end
context 'without instance-level integration' do
it 'shows a link to service template' do
expect(page).to have_link('Slack', href: edit_admin_application_settings_service_path(slack_service.id))
expect(page).not_to have_link('Slack', href: edit_admin_application_settings_integration_path(slack_service))
end
end
context 'with instance-level integration' do
before do
create(:slack_service, instance: true, project: nil)
visit(admin_application_settings_services_path)
end
it 'shows a link to instance-level integration' do it 'shows a link to instance-level integration' do
expect(page).not_to have_link('Slack', href: edit_admin_application_settings_service_path(slack_service.id)) expect(page).not_to have_link('Slack', href: edit_admin_application_settings_service_path(slack_service.id))
expect(page).to have_link('Slack', href: edit_admin_application_settings_integration_path(slack_service)) expect(page).to have_link('Slack', href: edit_admin_application_settings_integration_path(slack_service))
end
end end
end end
end end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/services/index.html.haml' do
before do
assign(:services, build_stubbed_list(:service, 1))
assign(:existing_instance_types, [])
end
context 'user has not dismissed Service Templates deprecation message' do
it 'shows the message' do
allow(view).to receive(:show_service_templates_deprecated?).and_return(true)
render
expect(rendered).to have_content('Service Templates will soon be deprecated.')
end
end
context 'user has dismissed Service Templates deprecation message' do
it 'does not show the message' do
allow(view).to receive(:show_service_templates_deprecated?).and_return(false)
render
expect(rendered).not_to have_content('Service Templates will soon be deprecated.')
end
end
end
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