From 3e2095d4d91f5e744086047b885e2b9fa021c562 Mon Sep 17 00:00:00 2001 From: Zacqary Xeper Date: Tue, 31 Mar 2020 14:43:48 -0500 Subject: [PATCH] i18nize action variables --- .../register_metric_threshold_alert_type.ts | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts index 31844a1b86ca51..57f9124db923ca 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_alert_type.ts @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +import { i18n } from '@kbn/i18n'; import uuid from 'uuid'; import { schema } from '@kbn/config-schema'; import { PluginSetupContract } from '../../../../../alerting/server'; @@ -49,6 +50,37 @@ export async function registerMetricThresholdAlertType(alertingPlugin: PluginSet metric: schema.never(), }); + const groupActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.threshold.alerting.groupActionVariableDescription', + { + defaultMessage: 'Name of the group reporting data', + } + ); + + const valueOfActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.threshold.alerting.valueOfActionVariableDescription', + { + defaultMessage: + 'Record of the current value of the watched metric; grouped by condition, i.e valueOf.condition0, valueOf.condition1, etc.', + } + ); + + const thresholdOfActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.threshold.alerting.thresholdOfActionVariableDescription', + { + defaultMessage: + 'Record of the alerting threshold; grouped by condition, i.e thresholdOf.condition0, thresholdOf.condition1, etc.', + } + ); + + const metricOfActionVariableDescription = i18n.translate( + 'xpack.infra.metrics.alerting.threshold.alerting.metricOfActionVariableDescription', + { + defaultMessage: + 'Record of the watched metric; grouped by condition, i.e metricOf.condition0, metricOf.condition1, etc.', + } + ); + alertingPlugin.registerType({ id: METRIC_THRESHOLD_ALERT_TYPE_ID, name: 'Metric Alert - Threshold', @@ -64,10 +96,10 @@ export async function registerMetricThresholdAlertType(alertingPlugin: PluginSet executor: createMetricThresholdExecutor(alertUUID), actionVariables: { context: [ - { name: 'group', description: 'Alerting group' }, - { name: 'valueOf', description: 'Values' }, - { name: 'thresholdOf', description: 'Thresholds' }, - { name: 'metricOf', description: 'Metrics' }, + { name: 'group', description: groupActionVariableDescription }, + { name: 'valueOf', description: valueOfActionVariableDescription }, + { name: 'thresholdOf', description: thresholdOfActionVariableDescription }, + { name: 'metricOf', description: metricOfActionVariableDescription }, ], }, });