From cab2ed82e8b4f2e7c268a03ed6eb587b55ed8281 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20Dombya?=
<135591453+hervedombya@users.noreply.github.com>
Date: Tue, 17 Dec 2024 12:00:04 +0100
Subject: [PATCH] Update alert email to display severity icon correctly
---
ui/public/brand/email.html | 53 +++++++++++---------------------------
1 file changed, 15 insertions(+), 38 deletions(-)
diff --git a/ui/public/brand/email.html b/ui/public/brand/email.html
index c7b0d502cc..5deb52bb8b 100644
--- a/ui/public/brand/email.html
+++ b/ui/public/brand/email.html
@@ -224,7 +224,8 @@
align="center"
class="links-color"
>
-
+
@@ -338,10 +339,7 @@
"
>
- {{ .Alerts | len }} alert{{ if gt (len
- .Alerts) 1 }}s{{ end }} for {{ range
- .GroupLabels.SortedPairs }} {{ .Name }}={{
- .Value }} {{ end }}
@@ -526,8 +524,7 @@
"
>
{{ .Alerts.Firing | len }} Alert{{ if gt
- (len .Alerts.Firing) 1 }}s{{ end }}
+ >{{ .Alerts.Firing | len }} Alert{{ if gt (len .Alerts.Firing) 1 }}s{{ end }}
currently firing
@@ -615,29 +612,18 @@
{{ if eq .Labels.severity "critical" }}
-
- (critical) {{ else if eq .Labels.severity
- "warning" }}
-
- (warning) {{ else }} {{ .Labels.severity }} {{
- end }}
+ (critical)
+ {{ else if eq .Labels.severity "warning" }}
+ (warning)
+ {{ else }} {{ .Labels.severity }} {{ end }}
|
{{ .Labels.alertname }} |
- {{if .Annotations.description }} {{
- .Annotations.description }} {{ else if
- .Annotations.message }} {{ .Annotations.message
- }} {{ else if .Annotations.summary }} {{
- .Annotations.summary }} {{ else }} No
+ {{if .Annotations.description }} {{ .Annotations.description }} {{ else if .Annotations.message }} {{ .Annotations.message }} {{ else if .Annotations.summary }} {{ .Annotations.summary }} {{ else }} No
description {{ end }}
|
- {{ .StartsAt.Format "2006-01-02 15:04:05
- (Z07:00)" }}
+ {{ .StartsAt.Format "2006-01-02 15:04:05 (Z07:00)" }}
|
{{ end }}
@@ -862,8 +848,7 @@
"
>
{{ .Alerts.Resolved | len }} Alert{{ if gt
- (len .Alerts.Resolved) 1 }}s{{ end }}
+ >{{ .Alerts.Resolved | len }} Alert{{ if gt (len .Alerts.Resolved) 1 }}s{{ end }}
resolved
@@ -955,24 +940,16 @@
src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtdGltZXMtY2lyY2xlIGZhLXctMTYgZmEtMXggc2MtSFVyclcgZ2duVWxGIiB3aWR0aD0iMjQiIGNvbG9yPSIjRDY1NDVBIiBhcmlhLWhpZGRlbj0idHJ1ZSIgYXJpYS1sYWJlbD0iVGltZXMtY2lyY2xlIHN0YXR1cyBjcml0aWNhbCIgZGF0YS1pY29uPSJ0aW1lcy1jaXJjbGUiIGRhdGEtcHJlZml4PSJmYXMiIGZvY3VzYWJsZT0iZmFsc2UiIHJvbGU9ImltZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0yNTYgOEMxMTkgOCA4IDExOSA4IDI1NnMxMTEgMjQ4IDI0OCAyNDggMjQ4LTExMSAyNDgtMjQ4UzM5MyA4IDI1NiA4em0xMjEuNiAzMTMuMWM0LjcgNC43IDQuNyAxMi4zIDAgMTdMMzM4IDM3Ny42Yy00LjcgNC43LTEyLjMgNC43LTE3IDBMMjU2IDMxMmwtNjUuMSA2NS42Yy00LjcgNC43LTEyLjMgNC43LTE3IDBMMTM0LjQgMzM4Yy00LjctNC43LTQuNy0xMi4zIDAtMTdsNjUuNi02NS02NS42LTY1LjFjLTQuNy00LjctNC43LTEyLjMgMC0xN2wzOS42LTM5LjZjNC43LTQuNyAxMi4zLTQuNyAxNyAwbDY1IDY1LjcgNjUuMS02NS42YzQuNy00LjcgMTIuMy00LjcgMTcgMGwzOS42IDM5LjZjNC43IDQuNyA0LjcgMTIuMyAwIDE3TDMxMiAyNTZsNjUuNiA2NS4xeiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+Cg=="
/>
{{ else if eq .Labels.severity "warning" }}
-
+
{{ else }} {{ .Labels.severity }} {{ end }}
{{ .Labels.alertname }} |
- {{if .Annotations.description }} {{
- .Annotations.description }} {{ else if
- .Annotations.message }} {{ .Annotations.message
- }} {{ else if .Annotations.summary }} {{
- .Annotations.summary }} {{ else }} No
+ {{if .Annotations.description }} {{ .Annotations.description }} {{ else if .Annotations.message }} {{ .Annotations.message }} {{ else if .Annotations.summary }} {{ .Annotations.summary }} {{ else }} No
description {{ end }}
|
- {{ .StartsAt.Format "2006-01-02 15:04:05
- (Z07:00)" }} - {{ .EndsAt.Format "2006-01-02
- 15:04:05 (Z07:00)" }}
+ {{ .StartsAt.Format "2006-01-02 15:04:05 (Z07:00)" }} - {{ .EndsAt.Format "2006-01-02 15:04:05 (Z07:00)" }}
|
{{ end }}
@@ -994,4 +971,4 @@