diff --git a/ui/src/alerting/components/notifications/utils/index.ts b/ui/src/alerting/components/notifications/utils/index.ts index 96b1087bbb..ad914c011c 100644 --- a/ui/src/alerting/components/notifications/utils/index.ts +++ b/ui/src/alerting/components/notifications/utils/index.ts @@ -24,6 +24,9 @@ type RuleVariantFields = | PagerDutyNotificationRuleBase | HTTPNotificationRuleBase +const defaultMessage = + 'Notification Rule: ${ r._notification_rule_name } triggered by check: ${ r._check_name }' + export const getRuleVariantDefaults = ( endpoints: NotificationEndpoint[], id: string @@ -32,11 +35,11 @@ export const getRuleVariantDefaults = ( switch (endpoint.type) { case 'slack': { - return {messageTemplate: '', channel: '', type: 'slack'} + return {messageTemplate: defaultMessage, channel: '', type: 'slack'} } case 'pagerduty': { - return {messageTemplate: '', type: 'pagerduty'} + return {messageTemplate: defaultMessage, type: 'pagerduty'} } case 'http': { diff --git a/ui/src/alerting/constants/index.ts b/ui/src/alerting/constants/index.ts index c97fb9d8f1..ad9bf94f81 100644 --- a/ui/src/alerting/constants/index.ts +++ b/ui/src/alerting/constants/index.ts @@ -18,6 +18,8 @@ export const DEFAULT_CHECK_EVERY = '5m' export const DEFAULT_CHECK_OFFSET = '0s' export const DEFAULT_CHECK_REPORT_ZERO = false export const DEFAULT_DEADMAN_LEVEL: CheckStatusLevel = 'CRIT' +export const DEFAULT_STATUS_MESSAGE = + 'Check: ${ r._check_name }\n\nIs at level: ${ r._level }' export const CHECK_EVERY_OPTIONS = DURATIONS @@ -58,6 +60,7 @@ export const DEFAULT_THRESHOLD_CHECK: Partial = { thresholds: [], every: DEFAULT_CHECK_EVERY, offset: DEFAULT_CHECK_OFFSET, + statusMessageTemplate: DEFAULT_STATUS_MESSAGE, } export const DEFAULT_DEADMAN_CHECK: Partial = { @@ -68,6 +71,7 @@ export const DEFAULT_DEADMAN_CHECK: Partial = { offset: DEFAULT_CHECK_OFFSET, reportZero: DEFAULT_CHECK_REPORT_ZERO, level: DEFAULT_DEADMAN_LEVEL, + statusMessageTemplate: DEFAULT_STATUS_MESSAGE, } export const CHECK_QUERY_FIXTURE: DashboardQuery = { diff --git a/ui/src/timeMachine/actions/index.ts b/ui/src/timeMachine/actions/index.ts index fea8fbdd1c..84414f407f 100644 --- a/ui/src/timeMachine/actions/index.ts +++ b/ui/src/timeMachine/actions/index.ts @@ -611,7 +611,7 @@ export const setXAxisLabel = (xAxisLabel: string): SetXAxisLabelAction => ({ }) export const setCheckStatus = (checkStatus: RemoteDataState) => ({ - type: 'SET_TIMEMACHINE_CHECK_STATUS' as 'SET_TIMEMACHINE_CHECK_STATUS', + type: 'SET_TIME_MACHINE_CHECK_STATUS' as 'SET_TIME_MACHINE_CHECK_STATUS', payload: {checkStatus}, }) @@ -619,17 +619,17 @@ export const setTimeMachineCheck = ( checkStatus: RemoteDataState, check: Partial ) => ({ - type: 'SET_TIMEMACHINE_CHECK' as 'SET_TIMEMACHINE_CHECK', + type: 'SET_TIME_MACHINE_CHECK' as 'SET_TIME_MACHINE_CHECK', payload: {checkStatus, check}, }) export const updateTimeMachineCheck = (checkUpdate: Partial) => ({ - type: 'UPDATE_TIMEMACHINE_CHECK' as 'UPDATE_TIMEMACHINE_CHECK', + type: 'UPDATE_TIME_MACHINE_CHECK' as 'UPDATE_TIME_MACHINE_CHECK', payload: {checkUpdate}, }) export const changeCheckType = (toType: CheckType) => ({ - type: 'CHANGE_TIMEMACHINE_CHECK_TYPE' as 'CHANGE_TIMEMACHINE_CHECK_TYPE', + type: 'CHANGE_TIME_MACHINE_CHECK_TYPE' as 'CHANGE_TIME_MACHINE_CHECK_TYPE', payload: {toType}, }) diff --git a/ui/src/timeMachine/reducers/index.ts b/ui/src/timeMachine/reducers/index.ts index 3b1389f080..be04a22a70 100644 --- a/ui/src/timeMachine/reducers/index.ts +++ b/ui/src/timeMachine/reducers/index.ts @@ -829,20 +829,20 @@ export const timeMachineReducer = ( }) } - case 'SET_TIMEMACHINE_CHECK_STATUS': { + case 'SET_TIME_MACHINE_CHECK_STATUS': { const {checkStatus} = action.payload return {...state, alerting: {...state.alerting, checkStatus}} } - case 'SET_TIMEMACHINE_CHECK': + case 'SET_TIME_MACHINE_CHECK': const alerting = { check: action.payload.check, checkStatus: action.payload.checkStatus, } return {...state, alerting} - case 'UPDATE_TIMEMACHINE_CHECK': + case 'UPDATE_TIME_MACHINE_CHECK': return produce(state, draftState => { draftState.alerting.check = { ...draftState.alerting.check, @@ -862,7 +862,7 @@ export const timeMachineReducer = ( } }) - case 'CHANGE_TIMEMACHINE_CHECK_TYPE': + case 'CHANGE_TIME_MACHINE_CHECK_TYPE': return produce(state, draftState => { const exCheck = draftState.alerting.check