-
Notifications
You must be signed in to change notification settings - Fork 8.1k
/
index.ts
36 lines (33 loc) · 1.43 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { lazy } from 'react';
import { i18n } from '@kbn/i18n';
import { validateExpression } from './validation';
import { IndexThresholdAlertParams } from './types';
import { AlertTypeModel } from '../../../../triggers_actions_ui/public';
export function getAlertType(): AlertTypeModel<IndexThresholdAlertParams> {
return {
id: '.index-threshold',
description: i18n.translate('xpack.stackAlerts.threshold.ui.alertType.descriptionText', {
defaultMessage: 'Alert when an aggregated query meets the threshold.',
}),
iconClass: 'alert',
documentationUrl: (docLinks) => docLinks.links.alerting.indexThreshold,
alertParamsExpression: lazy(() => import('./expression')),
validate: validateExpression,
defaultActionMessage: i18n.translate(
'xpack.stackAlerts.threshold.ui.alertType.defaultActionMessage',
{
defaultMessage: `alert '\\{\\{alertName\\}\\}' is active for group '\\{\\{context.group\\}\\}':
- Value: \\{\\{context.value\\}\\}
- Conditions Met: \\{\\{context.conditions\\}\\} over \\{\\{params.timeWindowSize\\}\\}\\{\\{params.timeWindowUnit\\}\\}
- Timestamp: \\{\\{context.date\\}\\}`,
}
),
requiresAppContext: false,
};
}