Commit 3ec8025b authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '208330-operations-clean-up' into 'master'

Operations Settings forms cleanup

See merge request gitlab-org/gitlab!62034
parents 2d07c4f9 72c6aa67
...@@ -155,7 +155,7 @@ export default { ...@@ -155,7 +155,7 @@ export default {
<span v-if="item.active" data-testid="integration-activated-status"> <span v-if="item.active" data-testid="integration-activated-status">
<gl-icon <gl-icon
v-gl-tooltip v-gl-tooltip
name="check-circle-filled" name="check"
:size="16" :size="16"
class="gl-text-green-500 gl-hover-cursor-pointer gl-mr-3" class="gl-text-green-500 gl-hover-cursor-pointer gl-mr-3"
:title="$options.i18n.status.enabled.tooltip" :title="$options.i18n.status.enabled.tooltip"
......
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
if (testAfterSubmit) { if (testAfterSubmit) {
this.viewIntegration(integration, tabIndices.sendTestAlert); this.viewIntegration(integration, tabIndices.sendTestAlert);
} else { } else {
this.clearCurrentIntegration(type); this.clearCurrentIntegration({ type });
} }
createFlash({ createFlash({
......
import { IntrospectionFragmentMatcher } from 'apollo-cache-inmemory';
import produce from 'immer'; import produce from 'immer';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import introspectionQueryResultData from './graphql/fragmentTypes.json';
import getCurrentIntegrationQuery from './graphql/queries/get_current_integration.query.graphql'; import getCurrentIntegrationQuery from './graphql/queries/get_current_integration.query.graphql';
const fragmentMatcher = new IntrospectionFragmentMatcher({
introspectionQueryResultData,
});
Vue.use(VueApollo); Vue.use(VueApollo);
const resolvers = { const resolvers = {
...@@ -50,7 +56,9 @@ const resolvers = { ...@@ -50,7 +56,9 @@ const resolvers = {
export default new VueApollo({ export default new VueApollo({
defaultClient: createDefaultClient(resolvers, { defaultClient: createDefaultClient(resolvers, {
cacheConfig: {}, cacheConfig: {
fragmentMatcher,
},
assumeImmutableResults: true, assumeImmutableResults: true,
}), }),
}); });
{"__schema":{"types":[{"kind":"UNION","name":"AlertManagementIntegration","possibleTypes":[{"name":"AlertManagementHttpIntegration"},{"name":"AlertManagementPrometheusIntegration"}]}]}}
<script> <script>
import { GlButton, GlFormGroup, GlFormInput, GlFormCheckbox, GlIcon, GlLink } from '@gitlab/ui'; import {
GlButton,
GlFormGroup,
GlFormInput,
GlFormCheckbox,
GlIcon,
GlLink,
GlSprintf,
} from '@gitlab/ui';
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { helpPagePath } from '~/helpers/help_page_helper'; import { helpPagePath } from '~/helpers/help_page_helper';
...@@ -11,6 +19,7 @@ export default { ...@@ -11,6 +19,7 @@ export default {
GlFormInput, GlFormInput,
GlIcon, GlIcon,
GlLink, GlLink,
GlSprintf,
}, },
data() { data() {
return { return {
...@@ -78,13 +87,11 @@ export default { ...@@ -78,13 +87,11 @@ export default {
</div> </div>
<div class="settings-content"> <div class="settings-content">
<form> <form>
<gl-form-checkbox <gl-form-group :label="__('Enable authentication')" label-for="grafana-integration-enabled">
id="grafana-integration-enabled" <gl-form-checkbox id="grafana-integration-enabled" v-model="integrationEnabled">
v-model="integrationEnabled"
class="mb-4"
>
{{ s__('GrafanaIntegration|Active') }} {{ s__('GrafanaIntegration|Active') }}
</gl-form-checkbox> </gl-form-checkbox>
</gl-form-group>
<gl-form-group <gl-form-group
:label="s__('GrafanaIntegration|Grafana URL')" :label="s__('GrafanaIntegration|Grafana URL')"
label-for="grafana-url" label-for="grafana-url"
...@@ -95,18 +102,27 @@ export default { ...@@ -95,18 +102,27 @@ export default {
<gl-form-group :label="s__('GrafanaIntegration|API token')" label-for="grafana-token"> <gl-form-group :label="s__('GrafanaIntegration|API token')" label-for="grafana-token">
<gl-form-input id="grafana-token" v-model="localGrafanaToken" /> <gl-form-input id="grafana-token" v-model="localGrafanaToken" />
<p class="form-text text-muted"> <p class="form-text text-muted">
{{ s__('GrafanaIntegration|Enter the Grafana API token.') }} <gl-sprintf
<a :message="
s__('GrafanaIntegration|Enter the %{docLinkStart}Grafana API token%{docLinkEnd}.')
"
>
<template #docLink="{ content }">
<gl-link
href="https://grafana.com/docs/http_api/auth/#create-api-token" href="https://grafana.com/docs/http_api/auth/#create-api-token"
target="_blank" target="_blank"
rel="noopener noreferrer" >{{ content }} <gl-icon name="external-link" class="gl-vertical-align-middle"
> /></gl-link>
{{ __('More information.') }} </template>
<gl-icon name="external-link" class="vertical-align-middle" /> </gl-sprintf>
</a>
</p> </p>
</gl-form-group> </gl-form-group>
<gl-button variant="success" category="primary" @click="updateGrafanaIntegration"> <gl-button
variant="confirm"
category="primary"
data-testid="save-grafana-settings-button"
@click="updateGrafanaIntegration"
>
{{ __('Save changes') }} {{ __('Save changes') }}
</gl-button> </gl-button>
</form> </form>
......
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
ref="submitBtn" ref="submitBtn"
data-qa-selector="save_changes_button" data-qa-selector="save_changes_button"
:disabled="loading" :disabled="loading"
variant="success" variant="confirm"
type="submit" type="submit"
class="js-no-auto-disable" class="js-no-auto-disable"
> >
......
...@@ -11,7 +11,6 @@ import { ...@@ -11,7 +11,6 @@ import {
GlModal, GlModal,
GlModalDirective, GlModalDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { isEqual } from 'lodash';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import { I18N_PAGERDUTY_SETTINGS_FORM, CONFIGURE_PAGERDUTY_WEBHOOK_DOCS_LINK } from '../constants'; import { I18N_PAGERDUTY_SETTINGS_FORM, CONFIGURE_PAGERDUTY_WEBHOOK_DOCS_LINK } from '../constants';
...@@ -50,14 +49,8 @@ export default { ...@@ -50,14 +49,8 @@ export default {
pagerduty_active: this.active, pagerduty_active: this.active,
}; };
}, },
isFormUpdated() {
return isEqual(this.pagerDutySettings, {
active: this.active,
webhookUrl: this.webhookUrl,
});
},
isSaveDisabled() { isSaveDisabled() {
return this.isFormUpdated || this.loading || this.resettingWebhook; return this.loading || this.resettingWebhook;
}, },
webhookUpdateAlertMsg() { webhookUpdateAlertMsg() {
return this.webhookUpdateFailed return this.webhookUpdateFailed
...@@ -123,13 +116,15 @@ export default { ...@@ -123,13 +116,15 @@ export default {
</template> </template>
</gl-sprintf> </gl-sprintf>
</p> </p>
<form ref="settingsForm" @submit.prevent="updatePagerDutyIntegrationSettings"> <form ref="settingsForm">
<gl-form-group class="col-8 col-md-9 gl-p-0"> <gl-form-group class="col-8 col-md-9 gl-p-0">
<gl-toggle <gl-toggle
id="active" id="active"
v-model="active" v-model="active"
:disabled="isSaveDisabled"
:is-loading="loading" :is-loading="loading"
:label="$options.i18n.activeToggle.label" :label="$options.i18n.activeToggle.label"
@change="updatePagerDutyIntegrationSettings"
/> />
</gl-form-group> </gl-form-group>
...@@ -166,15 +161,6 @@ export default { ...@@ -166,15 +161,6 @@ export default {
{{ $options.i18n.webhookUrl.restKeyInfo }} {{ $options.i18n.webhookUrl.restKeyInfo }}
</gl-modal> </gl-modal>
</gl-form-group> </gl-form-group>
<gl-button
ref="submitBtn"
:disabled="isSaveDisabled"
variant="success"
type="submit"
class="js-no-auto-disable"
>
{{ $options.i18n.saveBtnLabel }}
</gl-button>
</form> </form>
</div> </div>
</template> </template>
...@@ -23,7 +23,7 @@ export const I18N_INTEGRATION_TABS = { ...@@ -23,7 +23,7 @@ export const I18N_INTEGRATION_TABS = {
headerText: s__('IncidentSettings|Incidents'), headerText: s__('IncidentSettings|Incidents'),
expandBtnLabel: __('Expand'), expandBtnLabel: __('Expand'),
subHeaderText: s__( subHeaderText: s__(
'IncidentSettings|Set up integrations with external tools to help better manage incidents.', 'IncidentSettings|Fine-tune incident settings and set up integrations with external tools to help better manage incidents.',
), ),
}; };
......
...@@ -34,19 +34,19 @@ export default { ...@@ -34,19 +34,19 @@ export default {
<h4 <h4
class="js-section-header settings-title js-settings-toggle js-settings-toggle-trigger-only" class="js-section-header settings-title js-settings-toggle js-settings-toggle-trigger-only"
> >
{{ s__('MetricsSettings|Metrics dashboard') }} {{ s__('MetricsSettings|Metrics') }}
</h4> </h4>
<gl-button class="js-settings-toggle">{{ __('Expand') }}</gl-button> <gl-button class="js-settings-toggle">{{ __('Expand') }}</gl-button>
<p class="js-section-sub-header"> <p class="js-section-sub-header">
{{ s__('MetricsSettings|Manage Metrics Dashboard settings.') }} {{ s__('MetricsSettings|Manage metrics dashboard settings.') }}
<gl-link :href="helpPage">{{ __('Learn more') }}</gl-link> <gl-link :href="helpPage">{{ __('Learn more.') }}</gl-link>
</p> </p>
</div> </div>
<div class="settings-content"> <div class="settings-content">
<form> <form>
<dashboard-timezone /> <dashboard-timezone />
<external-dashboard /> <external-dashboard />
<gl-button variant="success" category="primary" @click="saveChanges"> <gl-button variant="confirm" category="primary" @click="saveChanges">
{{ __('Save Changes') }} {{ __('Save Changes') }}
</gl-button> </gl-button>
</form> </form>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%section.settings.no-animate#js-alert-management-settings{ class: ('expanded' if expanded) } %section.settings.no-animate#js-alert-management-settings{ class: ('expanded' if expanded) }
.settings-header .settings-header
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
= _('Alert integrations') = _('Alerts')
%button.gl-button.btn.btn-default.js-settings-toggle{ type: 'button' } %button.gl-button.btn.btn-default.js-settings-toggle{ type: 'button' }
= _('Expand') = _('Expand')
%p %p
......
- setting = tracing_setting - setting = tracing_setting
- has_jaeger_url = setting.external_url.present?
%section.settings.border-0.no-animate %section.settings.border-0.no-animate
.settings-header{ :class => "border-top" } .settings-header{ :class => 'border-top' }
%h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only %h4.settings-title.js-settings-toggle.js-settings-toggle-trigger-only
= _("Jaeger tracing") = _('Tracing')
%button.btn.btn-default.gl-button.js-settings-toggle{ type: 'button' } %button.btn.btn-default.gl-button.js-settings-toggle{ type: 'button' }
= _('Expand') = _('Expand')
%p %p
- if has_jaeger_url = _('Embed an image of your existing Jaeger server in GitLab.')
- tracing_link = link_to sanitize(setting.external_url, scrubber: Rails::Html::TextOnlyScrubber.new), target: "_blank", rel: 'noopener noreferrer' do
%span
= _('Tracing')
= sprite_icon('external-link', css_class: 'ml-1 vertical-align-middle')
- else
- tracing_link = link_to project_tracing_path(@project) do
%span
= _('Tracing')
= _("To open Jaeger from GitLab to view tracing from the %{link} page, add a URL to your Jaeger server.").html_safe % { link: tracing_link }
= link_to _('Learn more.'), help_page_path('operations/tracing'), target: '_blank', rel: 'noopener noreferrer' = link_to _('Learn more.'), help_page_path('operations/tracing'), target: '_blank', rel: 'noopener noreferrer'
.settings-content .settings-content
= form_for @project, url: project_settings_operations_path(@project), method: :patch do |f| = form_for @project, url: project_settings_operations_path(@project), method: :patch do |f|
...@@ -27,8 +17,8 @@ ...@@ -27,8 +17,8 @@
= form.label :external_url, _('Jaeger URL'), class: 'label-bold' = form.label :external_url, _('Jaeger URL'), class: 'label-bold'
= form.url_field :external_url, class: 'form-control gl-form-input', placeholder: 'https://jaeger.example.com' = form.url_field :external_url, class: 'form-control gl-form-input', placeholder: 'https://jaeger.example.com'
%p.form-text.text-muted %p.form-text.text-muted
- jaeger_help_url = "https://www.jaegertracing.io/docs/getting-started/" - jaeger_help_url = 'https://www.jaegertracing.io/docs/getting-started/'
- link_start_tag = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: jaeger_help_url } - link_start_tag = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: jaeger_help_url }
- link_end_tag = "#{sprite_icon('external-link', css_class: 'ml-1 vertical-align-middle')}</a>".html_safe - link_end_tag = "#{sprite_icon('external-link', css_class: 'gl-ml-2 gl-vertical-align-middle')}</a>".html_safe
= _("Learn more about %{link_start_tag}Jaeger configuration%{link_end_tag}.").html_safe % { link_start_tag: link_start_tag, link_end_tag: link_end_tag } = _('Learn more about %{link_start_tag}Jaeger configuration%{link_end_tag}.').html_safe % { link_start_tag: link_start_tag, link_end_tag: link_end_tag }
= f.submit _('Save changes'), class: 'gl-button btn btn-confirm' = f.submit _('Save changes'), class: 'gl-button btn btn-confirm'
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
- page_title title - page_title title
- breadcrumb_title title - breadcrumb_title title
= render 'projects/settings/operations/metrics_dashboard'
= render 'projects/settings/operations/tracing'
= render 'projects/settings/operations/error_tracking'
= render 'projects/settings/operations/alert_management' = render 'projects/settings/operations/alert_management'
= render 'projects/settings/operations/incidents' = render 'projects/settings/operations/incidents'
= render 'projects/settings/operations/error_tracking'
= render 'projects/settings/operations/prometheus', service: prometheus_service if Feature.enabled?(:settings_operations_prometheus_service)
= render 'projects/settings/operations/metrics_dashboard'
= render 'projects/settings/operations/grafana_integration' = render 'projects/settings/operations/grafana_integration'
= render 'projects/settings/operations/tracing'
= render_if_exists 'projects/settings/operations/status_page' = render_if_exists 'projects/settings/operations/status_page'
= render 'projects/settings/operations/prometheus', service: prometheus_service if Feature.enabled?(:settings_operations_prometheus_service)
...@@ -20,7 +20,7 @@ to use this endpoint. ...@@ -20,7 +20,7 @@ to use this endpoint.
With Maintainer or higher [permissions](../../user/permissions.md), With Maintainer or higher [permissions](../../user/permissions.md),
you can view the list of configured alerts integrations by navigating to **Settings > Operations** you can view the list of configured alerts integrations by navigating to **Settings > Operations**
in your project's sidebar menu, and expanding the **Alert integrations** section. The list displays in your project's sidebar menu, and expanding the **Alerts** section. The list displays
the integration name, type, and status (enabled or disabled): the integration name, type, and status (enabled or disabled):
![Current Integrations](img/integrations_list_v13_5.png) ![Current Integrations](img/integrations_list_v13_5.png)
...@@ -39,7 +39,7 @@ receive alert payloads in JSON format. You can always ...@@ -39,7 +39,7 @@ receive alert payloads in JSON format. You can always
1. Sign in to GitLab as a user with maintainer [permissions](../../user/permissions.md) 1. Sign in to GitLab as a user with maintainer [permissions](../../user/permissions.md)
for a project. for a project.
1. Navigate to **Settings > Operations** in your project. 1. Navigate to **Settings > Operations** in your project.
1. Expand the **Alert integrations** section, and in the **Select integration type** dropdown menu, 1. Expand the **Alerts** section, and in the **Select integration type** dropdown menu,
select **HTTP Endpoint**. select **HTTP Endpoint**.
1. Toggle the **Active** alert setting. The URL and Authorization Key for the webhook configuration 1. Toggle the **Active** alert setting. The URL and Authorization Key for the webhook configuration
are available in the **View credentials** tab after you save the integration. You must also input are available in the **View credentials** tab after you save the integration. You must also input
...@@ -56,7 +56,7 @@ and you can [customize the payload](#customize-the-alert-payload-outside-of-gitl ...@@ -56,7 +56,7 @@ and you can [customize the payload](#customize-the-alert-payload-outside-of-gitl
1. Sign in to GitLab as a user with maintainer [permissions](../../user/permissions.md) 1. Sign in to GitLab as a user with maintainer [permissions](../../user/permissions.md)
for a project. for a project.
1. Navigate to **Settings > Operations** in your project. 1. Navigate to **Settings > Operations** in your project.
1. Expand the **Alert integrations** section. 1. Expand the **Alerts** section.
1. For each endpoint you want to create: 1. For each endpoint you want to create:
1. Click the **Add new integration** button. 1. Click the **Add new integration** button.
......
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
{{ $options.i18n.validFeedback }} {{ $options.i18n.validFeedback }}
</template> </template>
</gl-form-group> </gl-form-group>
<gl-button variant="success" type="submit" :disabled="disableSubmit" :loading="loading"> <gl-button variant="confirm" type="submit" :disabled="disableSubmit" :loading="loading">
{{ __('Save changes') }} {{ __('Save changes') }}
</gl-button> </gl-button>
</gl-form> </gl-form>
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
activeLabel: s__('StatusPage|Active'), activeLabel: s__('StatusPage|Active'),
url: { url: {
label: s__('StatusPage|Status page URL'), label: s__('StatusPage|Status page URL'),
linkText: s__('StatusPage|Status page frontend documentation'), linkText: __('Configuration help'),
}, },
bucket: { bucket: {
label: s__('StatusPage|S3 Bucket name'), label: s__('StatusPage|S3 Bucket name'),
...@@ -67,7 +67,9 @@ export default { ...@@ -67,7 +67,9 @@ export default {
{ key: 'awsSecretKey', updateFn: 'setStatusPageSecretAccessKey' }, { key: 'awsSecretKey', updateFn: 'setStatusPageSecretAccessKey' },
]), ]),
statusPageHelpUrl() { statusPageHelpUrl() {
return helpPagePath('operations/incident_management/status_page'); return helpPagePath('/operations/incident_management/status_page', {
anchor: 'configure-gitlab-with-cloud-provider-information',
});
}, },
}, },
methods: { methods: {
...@@ -190,7 +192,7 @@ export default { ...@@ -190,7 +192,7 @@ export default {
<gl-button <gl-button
ref="submitBtn" ref="submitBtn"
:disabled="loading" :disabled="loading"
variant="success" variant="confirm"
category="primary" category="primary"
type="submit" type="submit"
class="js-no-auto-disable" class="js-no-auto-disable"
......
---
title: Update Operations settings forms to be UX consistent
merge_request: 62034
author:
type: changed
...@@ -67,7 +67,7 @@ exports[`Alert integration settings form should match the default snapshot 1`] = ...@@ -67,7 +67,7 @@ exports[`Alert integration settings form should match the default snapshot 1`] =
icon="" icon=""
size="medium" size="medium"
type="submit" type="submit"
variant="success" variant="confirm"
> >
Save changes Save changes
......
...@@ -71,11 +71,11 @@ exports[`Status Page settings form default state should match the default snapsh ...@@ -71,11 +71,11 @@ exports[`Status Page settings form default state should match the default snapsh
class="form-text text-muted" class="form-text text-muted"
> >
<gl-link-stub <gl-link-stub
href="/help/operations/incident_management/status_page" href="/help/operations/incident_management/status_page#configure-gitlab-with-cloud-provider-information"
target="_blank" target="_blank"
> >
Status page frontend documentation Configuration help
</gl-link-stub> </gl-link-stub>
</p> </p>
...@@ -153,7 +153,7 @@ exports[`Status Page settings form default state should match the default snapsh ...@@ -153,7 +153,7 @@ exports[`Status Page settings form default state should match the default snapsh
icon="" icon=""
size="medium" size="medium"
type="submit" type="submit"
variant="success" variant="confirm"
> >
Save changes Save changes
......
...@@ -2859,9 +2859,6 @@ msgid_plural "Alerts" ...@@ -2859,9 +2859,6 @@ msgid_plural "Alerts"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" msgstr[1] ""
msgid "Alert integrations"
msgstr ""
msgid "AlertManagement|Acknowledged" msgid "AlertManagement|Acknowledged"
msgstr "" msgstr ""
...@@ -8424,6 +8421,9 @@ msgstr "" ...@@ -8424,6 +8421,9 @@ msgstr ""
msgid "Configuration" msgid "Configuration"
msgstr "" msgstr ""
msgid "Configuration help"
msgstr ""
msgid "Configure GitLab runners to start using the Web Terminal. %{helpStart}Learn more.%{helpEnd}" msgid "Configure GitLab runners to start using the Web Terminal. %{helpStart}Learn more.%{helpEnd}"
msgstr "" msgstr ""
...@@ -12130,6 +12130,9 @@ msgstr "" ...@@ -12130,6 +12130,9 @@ msgstr ""
msgid "Embed" msgid "Embed"
msgstr "" msgstr ""
msgid "Embed an image of your existing Jaeger server in GitLab."
msgstr ""
msgid "Empty file" msgid "Empty file"
msgstr "" msgstr ""
...@@ -12214,6 +12217,9 @@ msgstr "" ...@@ -12214,6 +12217,9 @@ msgstr ""
msgid "Enable authenticated API request rate limit" msgid "Enable authenticated API request rate limit"
msgstr "" msgstr ""
msgid "Enable authentication"
msgstr ""
msgid "Enable automatic repository housekeeping (git repack, git gc)" msgid "Enable automatic repository housekeeping (git repack, git gc)"
msgstr "" msgstr ""
...@@ -15509,7 +15515,7 @@ msgstr "" ...@@ -15509,7 +15515,7 @@ msgstr ""
msgid "GrafanaIntegration|Active" msgid "GrafanaIntegration|Active"
msgstr "" msgstr ""
msgid "GrafanaIntegration|Enter the Grafana API token." msgid "GrafanaIntegration|Enter the %{docLinkStart}Grafana API token%{docLinkEnd}."
msgstr "" msgstr ""
msgid "GrafanaIntegration|Enter the base URL of the Grafana instance." msgid "GrafanaIntegration|Enter the base URL of the Grafana instance."
...@@ -17382,6 +17388,9 @@ msgstr "" ...@@ -17382,6 +17388,9 @@ msgstr ""
msgid "IncidentSettings|Alert integration" msgid "IncidentSettings|Alert integration"
msgstr "" msgstr ""
msgid "IncidentSettings|Fine-tune incident settings and set up integrations with external tools to help better manage incidents."
msgstr ""
msgid "IncidentSettings|Grafana integration" msgid "IncidentSettings|Grafana integration"
msgstr "" msgstr ""
...@@ -17397,9 +17406,6 @@ msgstr "" ...@@ -17397,9 +17406,6 @@ msgstr ""
msgid "IncidentSettings|PagerDuty integration" msgid "IncidentSettings|PagerDuty integration"
msgstr "" msgstr ""
msgid "IncidentSettings|Set up integrations with external tools to help better manage incidents."
msgstr ""
msgid "IncidentSettings|Time limit" msgid "IncidentSettings|Time limit"
msgstr "" msgstr ""
...@@ -18560,9 +18566,6 @@ msgstr "" ...@@ -18560,9 +18566,6 @@ msgstr ""
msgid "Jaeger URL" msgid "Jaeger URL"
msgstr "" msgstr ""
msgid "Jaeger tracing"
msgstr ""
msgid "Jan" msgid "Jan"
msgstr "" msgstr ""
...@@ -20907,10 +20910,10 @@ msgstr "" ...@@ -20907,10 +20910,10 @@ msgstr ""
msgid "MetricsSettings|External dashboard URL" msgid "MetricsSettings|External dashboard URL"
msgstr "" msgstr ""
msgid "MetricsSettings|Manage Metrics Dashboard settings." msgid "MetricsSettings|Manage metrics dashboard settings."
msgstr "" msgstr ""
msgid "MetricsSettings|Metrics dashboard" msgid "MetricsSettings|Metrics"
msgstr "" msgstr ""
msgid "MetricsSettings|UTC (Coordinated Universal Time)" msgid "MetricsSettings|UTC (Coordinated Universal Time)"
...@@ -31126,9 +31129,6 @@ msgstr "" ...@@ -31126,9 +31129,6 @@ msgstr ""
msgid "StatusPage|Status page URL" msgid "StatusPage|Status page URL"
msgstr "" msgstr ""
msgid "StatusPage|Status page frontend documentation"
msgstr ""
msgid "StatusPage|To publish incidents to an external status page, GitLab stores a JSON file in your Amazon S3 account at a location that your external status page service can access. Make sure to also set up %{docsLink}" msgid "StatusPage|To publish incidents to an external status page, GitLab stores a JSON file in your Amazon S3 account at a location that your external status page service can access. Make sure to also set up %{docsLink}"
msgstr "" msgstr ""
...@@ -34049,9 +34049,6 @@ msgstr "" ...@@ -34049,9 +34049,6 @@ msgstr ""
msgid "To only use CI/CD features for an external repository, choose %{strong_open}CI/CD for external repo%{strong_close}." msgid "To only use CI/CD features for an external repository, choose %{strong_open}CI/CD for external repo%{strong_close}."
msgstr "" msgstr ""
msgid "To open Jaeger from GitLab to view tracing from the %{link} page, add a URL to your Jaeger server."
msgstr ""
msgid "To pass variables to the triggered pipeline, add %{code_start}variables[VARIABLE]=VALUE%{code_end} to the API request." msgid "To pass variables to the triggered pipeline, add %{code_start}variables[VARIABLE]=VALUE%{code_end} to the API request."
msgstr "" msgstr ""
......
...@@ -25,7 +25,7 @@ RSpec.describe 'Alert integrations settings form', :js do ...@@ -25,7 +25,7 @@ RSpec.describe 'Alert integrations settings form', :js do
it 'shows the alerts setting form title' do it 'shows the alerts setting form title' do
page.within('#js-alert-management-settings') do page.within('#js-alert-management-settings') do
expect(find('h4')).to have_content('Alert integrations') expect(find('h4')).to have_content('Alerts')
end end
end end
......
...@@ -63,7 +63,7 @@ RSpec.describe 'User searches project settings', :js do ...@@ -63,7 +63,7 @@ RSpec.describe 'User searches project settings', :js do
visit project_settings_operations_path(project) visit project_settings_operations_path(project)
end end
it_behaves_like 'can search settings', 'Alert integrations', 'Error tracking' it_behaves_like 'can search settings', 'Alerts', 'Error tracking'
end end
context 'in Pages page' do context 'in Pages page' do
......
...@@ -80,7 +80,7 @@ describe('AlertIntegrationsList', () => { ...@@ -80,7 +80,7 @@ describe('AlertIntegrationsList', () => {
const cell = finsStatusCell().at(0); const cell = finsStatusCell().at(0);
const activatedIcon = cell.find(GlIcon); const activatedIcon = cell.find(GlIcon);
expect(cell.text()).toBe(i18n.status.enabled.name); expect(cell.text()).toBe(i18n.status.enabled.name);
expect(activatedIcon.attributes('name')).toBe('check-circle-filled'); expect(activatedIcon.attributes('name')).toBe('check');
expect(activatedIcon.attributes('title')).toBe(i18n.status.enabled.tooltip); expect(activatedIcon.attributes('title')).toBe(i18n.status.enabled.tooltip);
}); });
......
...@@ -43,14 +43,18 @@ exports[`grafana integration component default state to match the default snapsh ...@@ -43,14 +43,18 @@ exports[`grafana integration component default state to match the default snapsh
class="settings-content" class="settings-content"
> >
<form> <form>
<gl-form-group-stub
label="Enable authentication"
label-for="grafana-integration-enabled"
>
<gl-form-checkbox-stub <gl-form-checkbox-stub
class="mb-4"
id="grafana-integration-enabled" id="grafana-integration-enabled"
> >
Active Active
</gl-form-checkbox-stub> </gl-form-checkbox-stub>
</gl-form-group-stub>
<gl-form-group-stub <gl-form-group-stub
description="Enter the base URL of the Grafana instance." description="Enter the base URL of the Grafana instance."
...@@ -76,32 +80,19 @@ exports[`grafana integration component default state to match the default snapsh ...@@ -76,32 +80,19 @@ exports[`grafana integration component default state to match the default snapsh
<p <p
class="form-text text-muted" class="form-text text-muted"
> >
<gl-sprintf-stub
Enter the Grafana API token. message="Enter the %{docLinkStart}Grafana API token%{docLinkEnd}."
<a
href="https://grafana.com/docs/http_api/auth/#create-api-token"
rel="noopener noreferrer"
target="_blank"
>
More information.
<gl-icon-stub
class="vertical-align-middle"
name="external-link"
size="16"
/> />
</a>
</p> </p>
</gl-form-group-stub> </gl-form-group-stub>
<gl-button-stub <gl-button-stub
buttontextclasses="" buttontextclasses=""
category="primary" category="primary"
data-testid="save-grafana-settings-button"
icon="" icon=""
size="medium" size="medium"
variant="success" variant="confirm"
> >
Save changes Save changes
......
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { mount, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import { deprecatedCreateFlash as createFlash } from '~/flash'; import { deprecatedCreateFlash as createFlash } from '~/flash';
import GrafanaIntegration from '~/grafana_integration/components/grafana_integration.vue'; import GrafanaIntegration from '~/grafana_integration/components/grafana_integration.vue';
import { createStore } from '~/grafana_integration/store'; import { createStore } from '~/grafana_integration/store';
...@@ -51,8 +52,7 @@ describe('grafana integration component', () => { ...@@ -51,8 +52,7 @@ describe('grafana integration component', () => {
it('renders as an expand button by default', () => { it('renders as an expand button by default', () => {
wrapper = shallowMount(GrafanaIntegration, { store }); wrapper = shallowMount(GrafanaIntegration, { store });
const button = wrapper.find(GlButton); const button = wrapper.findComponent(GlButton);
expect(button.text()).toBe('Expand'); expect(button.text()).toBe('Expand');
}); });
}); });
...@@ -70,6 +70,7 @@ describe('grafana integration component', () => { ...@@ -70,6 +70,7 @@ describe('grafana integration component', () => {
describe('form', () => { describe('form', () => {
beforeEach(() => { beforeEach(() => {
jest.spyOn(axios, 'patch').mockImplementation(); jest.spyOn(axios, 'patch').mockImplementation();
wrapper = mountExtended(GrafanaIntegration, { store });
}); });
afterEach(() => { afterEach(() => {
...@@ -77,7 +78,7 @@ describe('grafana integration component', () => { ...@@ -77,7 +78,7 @@ describe('grafana integration component', () => {
}); });
describe('submit button', () => { describe('submit button', () => {
const findSubmitButton = () => wrapper.find('.settings-content form').find(GlButton); const findSubmitButton = () => wrapper.findByTestId('save-grafana-settings-button');
const endpointRequest = [ const endpointRequest = [
operationsSettingsEndpoint, operationsSettingsEndpoint,
...@@ -93,9 +94,7 @@ describe('grafana integration component', () => { ...@@ -93,9 +94,7 @@ describe('grafana integration component', () => {
]; ];
it('submits form on click', () => { it('submits form on click', () => {
wrapper = mount(GrafanaIntegration, { store });
axios.patch.mockResolvedValue(); axios.patch.mockResolvedValue();
findSubmitButton(wrapper).trigger('click'); findSubmitButton(wrapper).trigger('click');
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest); expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
...@@ -104,7 +103,6 @@ describe('grafana integration component', () => { ...@@ -104,7 +103,6 @@ describe('grafana integration component', () => {
it('creates flash banner on error', () => { it('creates flash banner on error', () => {
const message = 'mockErrorMessage'; const message = 'mockErrorMessage';
wrapper = mount(GrafanaIntegration, { store });
axios.patch.mockRejectedValue({ response: { data: { message } } }); axios.patch.mockRejectedValue({ response: { data: { message } } });
findSubmitButton().trigger('click'); findSubmitButton().trigger('click');
......
...@@ -103,7 +103,7 @@ exports[`Alert integration settings form default state should match the default ...@@ -103,7 +103,7 @@ exports[`Alert integration settings form default state should match the default
icon="" icon=""
size="medium" size="medium"
type="submit" type="submit"
variant="success" variant="confirm"
> >
Save changes Save changes
......
...@@ -30,7 +30,7 @@ exports[`IncidentsSettingTabs should render the component 1`] = ` ...@@ -30,7 +30,7 @@ exports[`IncidentsSettingTabs should render the component 1`] = `
<p> <p>
Set up integrations with external tools to help better manage incidents. Fine-tune incident settings and set up integrations with external tools to help better manage incidents.
</p> </p>
</div> </div>
......
...@@ -66,20 +66,6 @@ exports[`Alert integration settings form should match the default snapshot 1`] = ...@@ -66,20 +66,6 @@ exports[`Alert integration settings form should match the default snapshot 1`] =
</gl-modal-stub> </gl-modal-stub>
</gl-form-group-stub> </gl-form-group-stub>
<gl-button-stub
buttontextclasses=""
category="primary"
class="js-no-auto-disable"
icon=""
size="medium"
type="submit"
variant="success"
>
Save changes
</gl-button-stub>
</form> </form>
</div> </div>
`; `;
import { GlAlert, GlModal } from '@gitlab/ui'; import { GlAlert, GlModal, GlToggle } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import PagerDutySettingsForm from '~/incidents_settings/components/pagerduty_form.vue'; import PagerDutySettingsForm from '~/incidents_settings/components/pagerduty_form.vue';
...@@ -8,13 +8,13 @@ describe('Alert integration settings form', () => { ...@@ -8,13 +8,13 @@ describe('Alert integration settings form', () => {
const resetWebhookUrl = jest.fn(); const resetWebhookUrl = jest.fn();
const service = { updateSettings: jest.fn().mockResolvedValue(), resetWebhookUrl }; const service = { updateSettings: jest.fn().mockResolvedValue(), resetWebhookUrl };
const findForm = () => wrapper.find({ ref: 'settingsForm' }); const findWebhookInput = () => wrapper.findByTestId('webhook-url');
const findWebhookInput = () => wrapper.find('[data-testid="webhook-url"]'); const findFormToggle = () => wrapper.findComponent(GlToggle);
const findModal = () => wrapper.find(GlModal); const findModal = () => wrapper.findComponent(GlModal);
const findAlert = () => wrapper.find(GlAlert); const findAlert = () => wrapper.findComponent(GlAlert);
beforeEach(() => { beforeEach(() => {
wrapper = shallowMount(PagerDutySettingsForm, { wrapper = shallowMountExtended(PagerDutySettingsForm, {
provide: { provide: {
service, service,
pagerDutySettings: { pagerDutySettings: {
...@@ -27,18 +27,15 @@ describe('Alert integration settings form', () => { ...@@ -27,18 +27,15 @@ describe('Alert integration settings form', () => {
}); });
afterEach(() => { afterEach(() => {
if (wrapper) {
wrapper.destroy(); wrapper.destroy();
wrapper = null;
}
}); });
it('should match the default snapshot', () => { it('should match the default snapshot', () => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('should call service `updateSettings` on form submit', () => { it('should call service `updateSettings` on toggle change', () => {
findForm().trigger('submit'); findFormToggle().vm.$emit('change', true);
expect(service.updateSettings).toHaveBeenCalledWith( expect(service.updateSettings).toHaveBeenCalledWith(
expect.objectContaining({ pagerduty_active: wrapper.vm.active }), expect.objectContaining({ pagerduty_active: wrapper.vm.active }),
); );
......
...@@ -56,7 +56,7 @@ describe('operation settings external dashboard component', () => { ...@@ -56,7 +56,7 @@ describe('operation settings external dashboard component', () => {
it('renders header text', () => { it('renders header text', () => {
mountComponent(); mountComponent();
expect(wrapper.find('.js-section-header').text()).toBe('Metrics dashboard'); expect(wrapper.find('.js-section-header').text()).toBe('Metrics');
}); });
describe('expand/collapse button', () => { describe('expand/collapse button', () => {
...@@ -77,13 +77,13 @@ describe('operation settings external dashboard component', () => { ...@@ -77,13 +77,13 @@ describe('operation settings external dashboard component', () => {
}); });
it('renders descriptive text', () => { it('renders descriptive text', () => {
expect(subHeader.text()).toContain('Manage Metrics Dashboard settings.'); expect(subHeader.text()).toContain('Manage metrics dashboard settings.');
}); });
it('renders help page link', () => { it('renders help page link', () => {
const link = subHeader.find(GlLink); const link = subHeader.find(GlLink);
expect(link.text()).toBe('Learn more'); expect(link.text()).toBe('Learn more.');
expect(link.attributes().href).toBe(helpPage); expect(link.attributes().href).toBe(helpPage);
}); });
}); });
......
...@@ -36,7 +36,7 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -36,7 +36,7 @@ RSpec.describe 'projects/settings/operations/show' do
it 'renders the Operations Settings page' do it 'renders the Operations Settings page' do
render render
expect(rendered).to have_content _('Alert integrations') expect(rendered).to have_content _('Alerts')
expect(rendered).to have_content _('Display alerts from all configured monitoring tools.') expect(rendered).to have_content _('Display alerts from all configured monitoring tools.')
end end
end end
...@@ -77,41 +77,11 @@ RSpec.describe 'projects/settings/operations/show' do ...@@ -77,41 +77,11 @@ RSpec.describe 'projects/settings/operations/show' do
end end
describe 'Operations > Tracing' do describe 'Operations > Tracing' do
context 'with project.tracing_external_url' do context 'Settings page ' do
it 'links to project.tracing_external_url' do it 'renders the Tracing Settings page' do
render
expect(rendered).to have_link('Tracing', href: tracing_setting.external_url)
end
context 'with malicious external_url' do
let(:malicious_tracing_url) { "https://replaceme.com/'><script>alert(document.cookie)</script>" }
let(:cleaned_url) { "https://replaceme.com/'>" }
before do
tracing_setting.update_column(:external_url, malicious_tracing_url)
end
it 'sanitizes external_url' do
render
expect(tracing_setting.external_url).to eq(malicious_tracing_url)
expect(rendered).to have_link('Tracing', href: cleaned_url)
end
end
end
context 'without project.tracing_external_url' do
let(:tracing_setting) { build(:project_tracing_setting, project: project) }
before do
tracing_setting.external_url = nil
end
it 'links to Tracing page' do
render render
expect(rendered).to have_link('Tracing', href: project_tracing_path(project)) expect(rendered).to have_content _('Embed an image of your existing Jaeger server in GitLab.')
end end
end 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