Skip to content

[Alert] New property to defined default message #79279

Open

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.
Screenshot 2020-10-02 at 14 24 49

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions