Skip to content

Commit e00826b

Browse files
committed
requested changes done #78148
1 parent 10cf1ec commit e00826b

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

x-pack/plugins/stack_alerts/server/alert_types/index_threshold/action_context.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ export interface BaseActionContext extends AlertInstanceContext {
2929
value: number;
3030
// the function that is used
3131
function: string;
32-
// the time window for aggregation
33-
window: string;
3432
}
3533

3634
export function addMessages(
@@ -46,6 +44,7 @@ export function addMessages(
4644
},
4745
});
4846

47+
const window = `${params.timeWindowSize}${params.timeWindowUnit}`;
4948
const message = i18n.translate(
5049
'xpack.stackAlerts.indexThreshold.alertTypeContextMessageDescription',
5150
{
@@ -56,7 +55,7 @@ export function addMessages(
5655
group: baseContext.group,
5756
value: baseContext.value,
5857
function: baseContext.function,
59-
window: baseContext.window,
58+
window,
6059
date: baseContext.date,
6160
},
6261
}

x-pack/plugins/stack_alerts/server/alert_types/index_threshold/alert_type.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,7 @@ export function getAlertType(service: Service): AlertType<Params, {}, {}, Action
8686
const actionVariableContextFunctionLabel = i18n.translate(
8787
'xpack.stackAlerts.indexThreshold.actionVariableContextFunctionLabel',
8888
{
89-
defaultMessage: 'A string formatted values combining threshold comparator and threshold',
90-
}
91-
);
92-
93-
const actionVariableContextWindowLabel = i18n.translate(
94-
'xpack.stackAlerts.indexThreshold.actionVariableContextWindowLabel',
95-
{
96-
defaultMessage: 'A string formatted values combining time window size and time window unit',
89+
defaultMessage: 'A string describing the threshold comparator and threshold',
9790
}
9891
);
9992

@@ -122,7 +115,6 @@ export function getAlertType(service: Service): AlertType<Params, {}, {}, Action
122115
{ name: 'date', description: actionVariableContextDateLabel },
123116
{ name: 'value', description: actionVariableContextValueLabel },
124117
{ name: 'function', description: actionVariableContextFunctionLabel },
125-
{ name: 'window', description: actionVariableContextWindowLabel },
126118
],
127119
params: [
128120
{ name: 'threshold', description: actionVariableContextThresholdLabel },
@@ -179,14 +171,11 @@ export function getAlertType(service: Service): AlertType<Params, {}, {}, Action
179171
const agg = params.aggField ? `${params.aggType}(${params.aggField})` : `${params.aggType}`;
180172
const humanFn = `${agg} ${params.thresholdComparator} ${params.threshold.join(',')}`;
181173

182-
const window = `${params.timeWindowSize}${params.timeWindowUnit}`;
183-
184174
const baseContext: BaseActionContext = {
185175
date,
186176
group: instanceId,
187177
value,
188178
function: humanFn,
189-
window,
190179
};
191180
const actionContext = addMessages(options, baseContext, params);
192181
const alertInstance = options.services.alertInstanceFactory(instanceId);

x-pack/plugins/triggers_actions_ui/public/application/components/builtin_alert_types/threshold/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function getAlertType(): AlertTypeModel<IndexThresholdAlertParams, Alerts
2020
defaultActionMessage: i18n.translate(
2121
'xpack.triggersActionsUI.builtin_alert_types.threshold.alertDefaultActionMessage',
2222
{
23-
defaultMessage: `alert \\{\\{alertName\\}\\} group \\{\\{context.group\\}\\} value \\{\\{context.value\\}\\} exceeded threshold \\{\\{context.function\\}\\} over \\{\\{context.window\\}\\} on \\{\\{context.date\\}\\}`,
23+
defaultMessage: `alert \\{\\{alertName\\}\\} group \\{\\{context.group\\}\\} value \\{\\{context.value\\}\\} exceeded threshold \\{\\{context.function\\}\\} over \\{\\{params.timeWindowSize\\}\\}\\{\\{params.timeWindowUnit\\}\\} on \\{\\{context.date\\}\\}`,
2424
}
2525
),
2626
requiresAppContext: false,

0 commit comments

Comments
 (0)