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' ;