2021-03-02 13:11:20 -05:00
import { s _ _ , _ _ } from '~/locale' ;
2020-07-02 17:09:14 -04:00
export const i18n = {
2021-03-02 13:11:20 -05:00
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-08 11:09:06 -04:00
'AlertSettings|Free versions of GitLab are limited to one integration per type. To add more, %{linkStart}upgrade your subscription%{linkEnd}.' ,
2021-03-02 13:11:20 -05:00
) ,
} ,
nameIntegration : {
label : s _ _ ( 'AlertSettings|Name integration' ) ,
placeholder : s _ _ ( 'AlertSettings|Enter integration name' ) ,
activeToggle : _ _ ( 'Active' ) ,
2021-03-25 17:09:13 -04:00
error : _ _ ( "Name can't be blank" ) ,
} ,
enableIntegration : {
label : s _ _ ( 'AlertSettings|Enable integration' ) ,
help : s _ _ (
2021-04-08 11:09:06 -04:00
'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-03-25 17:09:13 -04:00
) ,
2021-03-02 13:11:20 -05:00
} ,
setupCredentials : {
help : s _ _ (
2021-04-08 11:09:06 -04:00
'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-03-02 13:11:20 -05:00
) ,
prometheusHelp : s _ _ (
2021-04-08 11:09:06 -04:00
'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-03-02 13:11:20 -05:00
) ,
webhookUrl : s _ _ ( 'AlertSettings|Webhook URL' ) ,
authorizationKey : s _ _ ( 'AlertSettings|Authorization key' ) ,
reset : s _ _ ( 'AlertSettings|Reset Key' ) ,
} ,
2021-03-25 17:09:13 -04:00
mapFields : {
label : s _ _ ( 'AlertSettings|Customize alert payload mapping (optional)' ) ,
help : s _ _ (
2021-04-08 11:09:06 -04:00
'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-03-02 13:11:20 -05:00
) ,
placeholder : s _ _ ( 'AlertSettings|{ "events": [{ "application": "Name of application" }] }' ) ,
2021-03-25 17:09:13 -04:00
editPayload : s _ _ ( 'AlertSettings|Edit payload' ) ,
parsePayload : s _ _ ( 'AlertSettings|Parse payload fields' ) ,
payloadParsedSucessMsg : s _ _ (
'AlertSettings|Sample payload has been parsed. You can now map the fields.' ,
) ,
2021-03-02 13:11:20 -05:00
resetHeader : s _ _ ( 'AlertSettings|Reset the mapping' ) ,
2021-04-08 11:09:06 -04:00
resetBody : s _ _ ( 'AlertSettings|If you edit the payload, you must re-map the fields again.' ) ,
2021-03-02 13:11:20 -05:00
resetOk : s _ _ ( 'AlertSettings|Proceed with editing' ) ,
2021-03-25 17:09:13 -04:00
mapIntro : s _ _ (
2021-04-08 11:09:06 -04:00
'AlertSettings|You can map default GitLab alert fields to your payload keys in the dropdowns below.' ,
2021-03-02 13:11:20 -05:00
) ,
} ,
2021-03-25 17:09:13 -04:00
testPayload : {
help : s _ _ (
2021-04-08 11:09:06 -04:00
'AlertSettings|Enter an example payload from your selected monitoring tool. This supports sending alerts to a GitLab endpoint.' ,
2021-03-02 13:11:20 -05:00
) ,
2021-03-25 17:09:13 -04:00
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-03-02 13:11:20 -05:00
} ,
prometheusFormUrl : {
label : s _ _ ( 'AlertSettings|Prometheus API base URL' ) ,
2021-04-08 11:09:06 -04:00
help : s _ _ ( 'AlertSettings|URL cannot be blank and must start with http: or https:.' ) ,
2021-03-31 02:08:58 -04:00
blankUrlError : _ _ ( 'URL cannot be blank' ) ,
invalidUrlError : _ _ ( 'URL is invalid' ) ,
2021-03-02 13:11:20 -05:00
} ,
restKeyInfo : {
label : s _ _ (
2021-04-08 11:09:06 -04:00
'AlertSettings|If you reset the authorization key for this project, you must update the key in every enabled alert source.' ,
2021-03-02 13:11:20 -05:00
) ,
} ,
} ,
saveIntegration : s _ _ ( 'AlertSettings|Save integration' ) ,
2021-03-25 17:09:13 -04:00
saveAndTestIntegration : s _ _ ( 'AlertSettings|Save & create test alert' ) ,
2021-03-02 13:11:20 -05:00
cancelAndClose : _ _ ( 'Cancel and close' ) ,
2021-03-25 17:09:13 -04:00
send : _ _ ( 'Send' ) ,
2021-03-02 13:11:20 -05:00
copy : _ _ ( 'Copy' ) ,
2021-03-25 17:09:13 -04:00
integrationCreated : {
title : s _ _ ( 'AlertSettings|Integration successfully saved' ) ,
successMsg : s _ _ (
2021-04-08 11:09:06 -04:00
'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.' ,
2021-03-25 17:09:13 -04:00
) ,
btnCaption : s _ _ ( 'AlertSettings|View URL and authorization key' ) ,
} ,
2021-04-08 11:09:06 -04:00
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.' ) ,
2021-03-25 17:09:13 -04:00
addNewIntegration : s _ _ ( 'AlertSettings|Add new integration' ) ,
2021-06-04 02:09:57 -04:00
settingsTabs : {
currentIntegrations : s _ _ ( 'AlertSettings|Current integrations' ) ,
integrationSettings : s _ _ ( 'AlertSettings|Alert settings' ) ,
} ,
2020-07-02 17:09:14 -04:00
} ;
2021-03-05 10:09:12 -05:00
export const integrationSteps = {
selectType : 'SELECT_TYPE' ,
nameIntegration : 'NAME_INTEGRATION' ,
2021-03-25 17:09:13 -04:00
enableHttpIntegration : 'ENABLE_HTTP_INTEGRATION' ,
enablePrometheusIntegration : 'ENABLE_PROMETHEUS_INTEGRATION' ,
2021-03-05 10:09:12 -05:00
customizeMapping : 'CUSTOMIZE_MAPPING' ,
} ;
export const createStepNumbers = {
[ integrationSteps . selectType ] : 1 ,
[ integrationSteps . nameIntegration ] : 2 ,
2021-03-25 17:09:13 -04:00
[ integrationSteps . enableHttpIntegration ] : 3 ,
[ integrationSteps . enablePrometheusIntegration ] : 2 ,
2021-03-05 10:09:12 -05:00
[ integrationSteps . customizeMapping ] : 4 ,
} ;
export const editStepNumbers = {
[ integrationSteps . nameIntegration ] : 1 ,
2021-03-25 17:09:13 -04:00
[ integrationSteps . enableHttpIntegration ] : 2 ,
[ integrationSteps . enablePrometheusIntegration ] : null ,
2021-03-05 10:09:12 -05:00
[ integrationSteps . customizeMapping ] : 3 ,
} ;
2021-02-23 16:10:44 -05:00
export const integrationTypes = {
none : { value : '' , text : s _ _ ( 'AlertSettings|Select integration type' ) } ,
http : { value : 'HTTP' , text : s _ _ ( 'AlertSettings|HTTP Endpoint' ) } ,
2021-03-25 17:09:13 -04:00
prometheus : { value : 'PROMETHEUS' , text : s _ _ ( 'AlertSettings|Prometheus' ) } ,
2021-02-23 16:10:44 -05:00
} ;
2020-07-08 05:09:17 -04:00
2020-11-04 07:09:14 -05:00
export const typeSet = {
http : 'HTTP' ,
prometheus : 'PROMETHEUS' ,
} ;
2020-11-06 13:09:07 -05:00
export const integrationToDeleteDefault = { id : null , name : '' } ;
2020-07-08 05:09:17 -04:00
export const JSON _VALIDATE _DELAY = 250 ;
2020-07-15 02:09:35 -04:00
export const targetPrometheusUrlPlaceholder = 'http://prometheus.example.com/' ;
2020-10-07 11:08:40 -04:00
2020-10-07 20:08:30 -04:00
/ * *
2020-10-28 20:08:36 -04:00
* Tracks snowplow event when user views alerts integration list
2020-10-07 20:08:30 -04:00
* /
2020-10-28 20:08:36 -04:00
export const trackAlertIntegrationsViewsOptions = {
2021-03-05 10:09:12 -05:00
/* eslint-disable-next-line @gitlab/require-i18n-strings */
2020-10-28 20:08:36 -04:00
category : 'Alert Integrations' ,
2020-10-07 20:08:30 -04:00
action : 'view_alert_integrations_list' ,
} ;
2021-02-23 16:10:44 -05:00
export const mappingFields = {
mapping : 'mapping' ,
fallback : 'fallback' ,
} ;
2021-03-05 10:09:12 -05:00
2021-03-25 17:09:13 -04:00
export const tabIndices = {
configureDetails : 0 ,
viewCredentials : 1 ,
sendTestAlert : 2 ,
} ;
export const testAlertModalId = 'confirmSendTestAlert' ;
2021-06-04 02:09:57 -04:00
/* 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' ,
) ,
} ,
} ;
export const NO _ISSUE _TEMPLATE _SELECTED = { key : '' , name : _ _ ( 'No template selected' ) } ;
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' ;