Alert notification template editing

The alert page has an implemented feature of notification template editing #3137, but since it felt unfit for production it was disabled in code. Now that work on Alert page is being done, this feature deserves attention and revival.

Here’s a recap of what we have:

Concerns I have:

  1. Is having a a template engine really necessary? Maybe I’m missing context - the usage example given at the PR, uses the looping ability but doesn’t look like a real user scenario.

  2. There’s one template for all states. I feel that a template for “triggered” would not be a good fit for “ok”. Maybe allow different templates per state.

  3. rows, cols and state are the vars available. I think it could use also value, threshold, and condition, alert_name, alert_url, query_url. Maybe even… snapshot?! :astonished:

  4. Some destinations allow customizing a template in their config (email, chatwork). This might get confusing. I think this needs consolidation.

  5. There’s a “show as html” feature, meaning the template can be in html format. But that assumes all destinations have the ability to parse html. Maybe we should allow to enable/disable the template for each alert destination.

Yes.

This can be done using the template engine (using ifs). I wouldn’t bother complicating this now as mostly the template/message is relevant for the triggered case anyway.

Yes, definitely. But it’s simple to add and doesn’t change the implementation.

Definitely. The per-destination configurations were an interim solution, which eventually will be removed.

Good point. I would consider removing the HTML preview and if we feel it’s needed in the future bring back and add a comment about which destinations support it.

1 Like

So here’s a few suggestions:

Default template:

Clicking the “Preview” button opens a dialog or popout.

Custom template:
Clicking the “Edit” button opens a dialog with form and preview in split panes.

Why dialog?

Cause then we don’t have to cramp ui elements into a small space.

BUT @arikfr I made a non-dialog version:

  • Kept the preview in dialog. Not worth the extra content imho.
  • Pre-filled with default subject/body.

Wdyt?

Why have it in the sidebar? Why not below the Criteria Section?

Cause the template is directly connected to Alert subscriptions (without subscriptions, this feature is meaningless)

Also, I think moving it to the main area won’t make much of a difference. Adding in the preview would contribute to calamity even if there’s psychical room for it.

Keeping it minimal allows the screen to be light and coherent.

More on my reasoning to keep this feature partially hidden - it’s content that doesn’t need constant visibility and therefore has no justification to take up so much real-estate.

This brings us back to discussing view/edit modes - you suggested to minimize it in view and maximize in edit. I don’t feel it changes things to tell you the truth but I realize I have to bring forth view mode before I can answer that. So stay tuned.

I don’t think it’s more connected to the subscriptions than to the alert itself. Also the template shares the save button with the criteria while destinations have their own life cycle.

Basically: alert is an object, which has the criteria and template definitn. The destination subscriptions are subscribed to it.

But I agree that the preview should be in a dialog rather than inline.

I’m experimenting with placing the template edit feature on the left:

but now I realize I can’t show a preview for the default template cause it’s actually different for each destination (including their own config overrides). Same goes for pre-filling the custom subject/body (so there’s a convinient starting point).

I’ll deal with it, but I want to point out it’s a missing piece we might want to complete later.

Here’s my latest version:

  1. No preview for default template.
  2. Preview button is a toggle.

Here’s an alert with a template https://deploy-preview-4081–redash-preview.netlify.com/alerts/11

1 Like

@ranbena, wdyt about showing it as content instead of using the inputs for Preview mode?

I thought of it but didn’t go for it cause:

  1. In certain cases It would cause a harsher “jump” between the two modes.
  2. I don’t see a benefit to it.

I would happily consider it if you have better reasoning and/or demo.

:+1:

Just one thing, here’s how the font looks like on Firefox/Ubuntu:

image

1 Like

@arikfr do you think it’s ROI worthy to integrate ace-editor for variable autocomplete?

how can i use this template ?
by this template can i recieve notification every time even if the query status doesn’t change ?
@arikfr @ranbena

Hey @AmiraShaker, this feature does not touch on the frequency or logic of notification sending but rather allows you to override the default subject and body texts that are sent in the notifications.

Perhaps read up on the Alert page feature as a whole in Alerts feature breakdown Aug '19

Notice, this is still in development and will land with https://github.com/getredash/redash/pull/4081.