Alerting: Preserve new-lines from custom email templates in rendered email (#52253)

* Add line break, regenerate, and fix

* Left-align custom text in addition to preserving newlines
This commit is contained in:
Alexander Weaver
2022-07-19 11:05:50 -05:00
committed by GitHub
parent 16f813fc04
commit 39d7fdbbbc
9 changed files with 60 additions and 43 deletions

View File

@ -1,3 +1,3 @@
{{> body }}
Sent by Grafana v[[.BuildVersion]] (c) 2021 Grafana Labs
Sent by Grafana v[[.BuildVersion]] (c) 2022 Grafana Labs

View File

@ -4,6 +4,21 @@
[[Subject .Subject "[[.Title]]"]]
[[ define "alert" ]]
[[ if ne .ImageURL "" ]]
<tr>
<td colspan="2" class="value">
<img src="[[.ImageURL]]" class="fluid-centered" alt="Alerting Panel" />
</td>
</tr>
[[ end ]]
[[ if ne .EmbeddedImage "" ]]
<tr>
<td colspan="2" class="value">
<img src="cid:[[.EmbeddedImage]]" alt="Alerting Chart Attached Below" />
</td>
</tr>
[[ end ]]
<tr>
<td colspan="2" class="value">
<span class="value-heading">Value:</span> <span class="value-value">[[ .ValueString ]]</span>
@ -101,7 +116,7 @@
[[ end ]]
[[ if gt (len .Message) 0 ]]
[[ .Message ]]
<div style="white-space: pre-line;" align="left">[[ .Message ]]</span>
[[ else ]]
<style>