alerta / alerta-webui

Alerta Web UI 7.0
https://try.alerta.io
Apache License 2.0
109 stars 55 forks source link

allow for modifying Alert copy-button behavior #555

Closed emillen closed 1 year ago

emillen commented 1 year ago

Use nunjucks-templates to modify AlertDetail copy-button behavior

Description Sometimes you want the ability to copy an alert so you can paste into a third party system (slack, email, etc) in human-readable way. This PR allows for setting a nunjuck-template used for formatting the JSON before putting it in the clipboard.

Fixes #522

Changes

If you think this is a good idea and merge this, I will add PR's for adding the setting in the backend, and also add it to the docs.


Ex:

Provided following alert-json

{
  "text": "this is a major alert",
  "environment": "prod"
}

and this template

{
  "clipboard_template": "[{{environment | upper}}] Alert!\n{{text}}"
}

would put the following text in your clipboard

[PROD] Alert!
this is a major alert
netlify[bot] commented 1 year ago

Deploy Preview for peaceful-beignet-dcf974 ready!

Name Link
Latest commit 21b85696359c64402219debc81af94bf32d4c59e
Latest deploy log https://app.netlify.com/sites/peaceful-beignet-dcf974/deploys/640836de6048cb0008b4e346
Deploy Preview https://deploy-preview-555--peaceful-beignet-dcf974.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

emillen commented 1 year ago

What do you say - does this need more work, or are we fine like this?

satterly commented 1 year ago

Can you include a screenshot in the PR description? Thanks.

satterly commented 1 year ago

Actually ignore that. There's probably nothing different. I'll merge.