Description
Describe the feature:
Alert provides a way to define a default message that is going to be used when a user selects one of the available actions. This is possible because of a property called defaultActionMessage
which is set while registering an alert.
I would like to propose a new property that could be called getDefaultActionMessage
, which is a function and it would receive as an argument the alert parameters and would also return a string. But the difference is that I would be able to create custom messages based on the values the user selected in the alert conditions.
alertTypeRegistry.register({
id: 'alert_id',
name: 'amazing alert',
iconClass: 'bell',
alertParamsExpression: lazy(() => import('./XXX')),
validate: () => ({errors: [],}),
requiresAppContext: true,
getDefaultActionMessage: (alertParams: AlertTypeParams) => {
if(alertParams.aggregationType === 'avg'){
return 'a nice message when user selects avg '
} else if (alertParams.aggregationType === '95th') {
return 'another custom message when user selects 95th'
}
return 'otherwise default message '
}
Describe a specific use case for the feature:
On APM we'd like to set different messages based on user selection.
The new function, getDefaultActionMessage
would be called every time a user adds a new action. In the image above depending on what option the user selected in the When
field, we'd define a custom message for that option.