debian-mirror-gitlab/app/assets/javascripts/alerts_settings/constants.js

191 lines
7.4 KiB
JavaScript
Raw Normal View History

2021-04-17 20:07:23 +05:30
import { s__, __ } from '~/locale';
2020-07-28 23:09:34 +05:30
export const i18n = {
2021-04-17 20:07:23 +05:30
integrationTabs: {
configureDetails: s__('AlertSettings|Configure details'),
viewCredentials: s__('AlertSettings|View credentials'),
sendTestAlert: s__('AlertSettings|Send test alert'),
},
integrationFormSteps: {
selectType: {
label: s__('AlertSettings|Select integration type'),
enterprise: s__(
2021-04-29 21:17:54 +05:30
'AlertSettings|Free versions of GitLab are limited to one integration per type. To add more, %{linkStart}upgrade your subscription%{linkEnd}.',
2021-04-17 20:07:23 +05:30
),
},
nameIntegration: {
label: s__('AlertSettings|Name integration'),
placeholder: s__('AlertSettings|Enter integration name'),
activeToggle: __('Active'),
2021-04-29 21:17:54 +05:30
error: __("Name can't be blank"),
},
enableIntegration: {
label: s__('AlertSettings|Enable integration'),
help: s__(
'AlertSettings|A webhook URL and authorization key is generated for the integration. After you save the integration, both are visible under the “View credentials” tab.',
),
2021-04-17 20:07:23 +05:30
},
setupCredentials: {
help: s__(
2021-04-29 21:17:54 +05:30
'AlertSettings|Use the URL and authorization key below to configure how an external service sends alerts to GitLab. %{linkStart}How do I configure the endpoint?%{linkEnd}',
2021-04-17 20:07:23 +05:30
),
prometheusHelp: s__(
2021-04-29 21:17:54 +05:30
'AlertSettings|Use the URL and authorization key below to configure how Prometheus sends alerts to GitLab. Review the %{linkStart}GitLab documentation%{linkEnd} to learn how to configure your endpoint.',
2021-04-17 20:07:23 +05:30
),
webhookUrl: s__('AlertSettings|Webhook URL'),
authorizationKey: s__('AlertSettings|Authorization key'),
reset: s__('AlertSettings|Reset Key'),
},
2021-04-29 21:17:54 +05:30
mapFields: {
label: s__('AlertSettings|Customize alert payload mapping (optional)'),
help: s__(
'AlertSettings|To create a custom mapping, enter an example payload from your monitoring tool, in JSON format. Select the "Parse payload fields" button to continue.',
2021-04-17 20:07:23 +05:30
),
placeholder: s__('AlertSettings|{ "events": [{ "application": "Name of application" }] }'),
editPayload: s__('AlertSettings|Edit payload'),
2021-04-29 21:17:54 +05:30
parsePayload: s__('AlertSettings|Parse payload fields'),
2021-04-17 20:07:23 +05:30
payloadParsedSucessMsg: s__(
'AlertSettings|Sample payload has been parsed. You can now map the fields.',
),
2021-04-29 21:17:54 +05:30
resetHeader: s__('AlertSettings|Reset the mapping'),
resetBody: s__('AlertSettings|If you edit the payload, you must re-map the fields again.'),
resetOk: s__('AlertSettings|Proceed with editing'),
mapIntro: s__(
'AlertSettings|You can map default GitLab alert fields to your payload keys in the dropdowns below.',
),
2021-04-17 20:07:23 +05:30
},
2021-04-29 21:17:54 +05:30
testPayload: {
help: s__(
'AlertSettings|Enter an example payload from your selected monitoring tool. This supports sending alerts to a GitLab endpoint.',
2021-04-17 20:07:23 +05:30
),
2021-04-29 21:17:54 +05:30
placeholder: s__('AlertSettings|{ "events": [{ "application": "Name of application" }] }'),
modalTitle: s__('AlertSettings|The form has unsaved changes'),
modalBody: s__('AlertSettings|The form has unsaved changes. How would you like to proceed?'),
savedAndTest: s__('AlertSettings|Save integration & send'),
proceedWithoutSave: s__('AlertSettings|Send without saving'),
cancel: __('Cancel'),
2021-04-17 20:07:23 +05:30
},
prometheusFormUrl: {
label: s__('AlertSettings|Prometheus API base URL'),
2021-04-29 21:17:54 +05:30
help: s__('AlertSettings|URL cannot be blank and must start with http: or https:.'),
blankUrlError: __('URL cannot be blank'),
invalidUrlError: __('URL is invalid'),
2021-04-17 20:07:23 +05:30
},
restKeyInfo: {
label: s__(
2021-04-29 21:17:54 +05:30
'AlertSettings|If you reset the authorization key for this project, you must update the key in every enabled alert source.',
2021-04-17 20:07:23 +05:30
),
},
},
saveIntegration: s__('AlertSettings|Save integration'),
2021-04-29 21:17:54 +05:30
saveAndTestIntegration: s__('AlertSettings|Save & create test alert'),
2021-04-17 20:07:23 +05:30
cancelAndClose: __('Cancel and close'),
2021-04-29 21:17:54 +05:30
send: __('Send'),
2021-04-17 20:07:23 +05:30
copy: __('Copy'),
2021-04-29 21:17:54 +05:30
integrationCreated: {
title: s__('AlertSettings|Integration successfully saved'),
successMsg: s__(
'AlertSettings|GitLab has created a URL and authorization key for your integration. You can use them to set up a webhook and authorize your endpoint to send alerts to GitLab.',
),
btnCaption: s__('AlertSettings|View URL and authorization key'),
},
changesSaved: s__('AlertsIntegrations|The integration is saved.'),
integrationRemoved: s__('AlertsIntegrations|The integration is deleted.'),
alertSent: s__('AlertsIntegrations|The test alert should now be visible in your alerts list.'),
addNewIntegration: s__('AlertSettings|Add new integration'),
2021-09-04 01:27:46 +05:30
settingsTabs: {
currentIntegrations: s__('AlertSettings|Current integrations'),
integrationSettings: s__('AlertSettings|Alert settings'),
},
2020-07-28 23:09:34 +05:30
};
2021-04-17 20:07:23 +05:30
export const integrationSteps = {
selectType: 'SELECT_TYPE',
nameIntegration: 'NAME_INTEGRATION',
2021-04-29 21:17:54 +05:30
enableHttpIntegration: 'ENABLE_HTTP_INTEGRATION',
enablePrometheusIntegration: 'ENABLE_PROMETHEUS_INTEGRATION',
2021-04-17 20:07:23 +05:30
customizeMapping: 'CUSTOMIZE_MAPPING',
};
export const createStepNumbers = {
[integrationSteps.selectType]: 1,
[integrationSteps.nameIntegration]: 2,
2021-04-29 21:17:54 +05:30
[integrationSteps.enableHttpIntegration]: 3,
[integrationSteps.enablePrometheusIntegration]: 2,
2021-04-17 20:07:23 +05:30
[integrationSteps.customizeMapping]: 4,
};
export const editStepNumbers = {
[integrationSteps.nameIntegration]: 1,
2021-04-29 21:17:54 +05:30
[integrationSteps.enableHttpIntegration]: 2,
[integrationSteps.enablePrometheusIntegration]: null,
2021-04-17 20:07:23 +05:30
[integrationSteps.customizeMapping]: 3,
};
export const integrationTypes = {
none: { value: '', text: s__('AlertSettings|Select integration type') },
http: { value: 'HTTP', text: s__('AlertSettings|HTTP Endpoint') },
2021-04-29 21:17:54 +05:30
prometheus: { value: 'PROMETHEUS', text: s__('AlertSettings|Prometheus') },
2021-04-17 20:07:23 +05:30
};
2021-01-29 00:20:46 +05:30
export const typeSet = {
http: 'HTTP',
prometheus: 'PROMETHEUS',
};
export const integrationToDeleteDefault = { id: null, name: '' };
2020-07-28 23:09:34 +05:30
export const JSON_VALIDATE_DELAY = 250;
export const targetPrometheusUrlPlaceholder = 'http://prometheus.example.com/';
2021-01-03 14:25:43 +05:30
/**
2021-01-29 00:20:46 +05:30
* Tracks snowplow event when user views alerts integration list
2021-01-03 14:25:43 +05:30
*/
2021-01-29 00:20:46 +05:30
export const trackAlertIntegrationsViewsOptions = {
2021-04-17 20:07:23 +05:30
/* eslint-disable-next-line @gitlab/require-i18n-strings */
2021-01-29 00:20:46 +05:30
category: 'Alert Integrations',
2021-01-03 14:25:43 +05:30
action: 'view_alert_integrations_list',
};
2021-04-17 20:07:23 +05:30
export const mappingFields = {
mapping: 'mapping',
fallback: 'fallback',
};
2021-04-29 21:17:54 +05:30
export const tabIndices = {
configureDetails: 0,
viewCredentials: 1,
sendTestAlert: 2,
};
export const testAlertModalId = 'confirmSendTestAlert';
2021-09-04 01:27:46 +05:30
/* Alerts integration settings constants */
export const I18N_ALERT_SETTINGS_FORM = {
saveBtnLabel: __('Save changes'),
introText: __('Action to take when receiving an alert. %{docsLink}'),
introLinkText: __('Learn more.'),
createIncident: {
label: __('Create an incident. Incidents are created for each alert triggered.'),
},
incidentTemplate: {
label: __('Incident template (optional).'),
},
sendEmail: {
label: __('Send a single email notification to Owners and Maintainers for new alerts.'),
},
autoCloseIncidents: {
label: __(
'Automatically close associated incident when a recovery alert notification resolves an alert',
),
},
};
2023-05-27 22:25:52 +05:30
export const NO_ISSUE_TEMPLATE_SELECTED = { value: '', text: __('No template selected') };
2021-09-04 01:27:46 +05:30
export const TAKING_INCIDENT_ACTION_DOCS_LINK =
'/help/operations/metrics/alerts#trigger-actions-from-alerts';
export const ISSUE_TEMPLATES_DOCS_LINK =
'/help/user/project/description_templates#create-an-issue-template';