Commit 74d6ebaa authored by Justin Ho Tuan Duong's avatar Justin Ho Tuan Duong Committed by Phil Hughes

Add Service Templates deprecation warning banner

Use User Callouts to allow user to dismiss message
parent 6697b542
import PersistentUserCallout from '~/persistent_user_callout';
document.addEventListener('DOMContentLoaded', () => {
const callout = document.querySelector('.js-service-templates-deprecated');
PersistentUserCallout.factory(callout);
});
......@@ -5,6 +5,7 @@ module UserCalloutsHelper
GKE_CLUSTER_INTEGRATION = 'gke_cluster_integration'
GCP_SIGNUP_OFFER = 'gcp_signup_offer'
SUGGEST_POPOVER_DISMISSED = 'suggest_popover_dismissed'
SERVICE_TEMPLATES_DEPRECATED = 'service_templates_deprecated'
TABS_POSITION_HIGHLIGHT = 'tabs_position_highlight'
WEBHOOKS_MOVED = 'webhooks_moved'
CUSTOMIZE_HOMEPAGE = 'customize_homepage'
......@@ -37,6 +38,10 @@ module UserCalloutsHelper
!user_dismissed?(SUGGEST_POPOVER_DISMISSED)
end
def show_service_templates_deprecated?
!user_dismissed?(SERVICE_TEMPLATES_DEPRECATED)
end
def show_webhooks_moved_alert?
!user_dismissed?(WEBHOOKS_MOVED)
end
......
......@@ -17,6 +17,7 @@ module UserCalloutEnums
suggest_popover_dismissed: 9,
tabs_position_highlight: 10,
webhooks_moved: 13,
service_templates_deprecated: 14,
admin_integrations_moved: 15,
personal_access_token_expiry: 21, # EE-only
suggest_pipeline: 22,
......
- page_title _("Service Templates")
- @content_class = 'limit-container-width' unless fluid_layout
- if show_service_templates_deprecated?
.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 gl-alert-action btn-secondary gl-button', target: '_blank', rel: 'noopener noreferrer'
%h3.page-title Service templates
%p.light= s_('AdminSettings|Service template allows you to set default values for integrations')
.table-holder
%table.table
%colgroup
%col
%col
%col
%col{ width: 135 }
%thead
%tr
%th
......
......@@ -3,7 +3,7 @@
%col
%col
%col.d-none.d-sm-table-column
%col{ width: 130 }
%col{ width: 135 }
%thead{ role: 'rowgroup' }
%tr{ role: 'row' }
%th{ role: 'columnheader', scope: 'col', 'aria-colindex': 1 }
......
---
title: Add Service Templates deprecation warning banner
merge_request: 25587
author:
type: changed
......@@ -1833,6 +1833,9 @@ msgstr ""
msgid "AdminSettings|Select a template"
msgstr ""
msgid "AdminSettings|Service Templates will soon be deprecated."
msgstr ""
msgid "AdminSettings|Service template allows you to set default values for integrations"
msgstr ""
......@@ -1848,6 +1851,9 @@ 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."
msgstr ""
msgid "AdminSettings|Try using the latest version of Integrations instead."
msgstr ""
msgid "AdminSettings|When creating a new environment variable it will be protected by default."
msgstr ""
......@@ -11683,6 +11689,9 @@ msgstr ""
msgid "Go to %{strongStart}Issues%{strongEnd} > %{strongStart}Boards%{strongEnd} to access your personalized learning issue board."
msgstr ""
msgid "Go to Integrations"
msgstr ""
msgid "Go to Webhooks"
msgstr ""
......
......@@ -81,6 +81,26 @@ RSpec.describe UserCalloutsHelper do
end
end
describe '.show_service_templates_deprecated?' do
subject { helper.show_service_templates_deprecated? }
context 'when user has not dismissed' do
before do
allow(helper).to receive(:user_dismissed?).with(described_class::SERVICE_TEMPLATES_DEPRECATED) { false }
end
it { is_expected.to be true }
end
context 'when user dismissed' do
before do
allow(helper).to receive(:user_dismissed?).with(described_class::SERVICE_TEMPLATES_DEPRECATED) { true }
end
it { is_expected.to be false }
end
end
describe '.show_customize_homepage_banner?' do
let(:customize_homepage) { true }
......
# 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