diff --git a/emails/templates/partials/alerting/instance_details.mjml b/emails/templates/partials/alerting/instance_details.mjml
index 26a4bbd7856..458124dd974 100644
--- a/emails/templates/partials/alerting/instance_details.mjml
+++ b/emails/templates/partials/alerting/instance_details.mjml
@@ -1,71 +1,47 @@
-
- {{ if .ImageURL }}
-
+{{ if .ImageURL }}
-
- {{ end }}
-
+{{ end }}
-
- {{ if .EmbeddedImage }}
-
+{{ if .EmbeddedImage }}
-
- {{ end }}
-
+{{ end }}
-
- {{ if .Annotations.summary }}
-
+ {{ if .Annotations.summary }}
Summary
-
- {{- .Annotations.summary -}}
-
-
- {{ end }}
-
+ {{- .Annotations.summary -}}
+ {{ end }}
-
- {{ if .Annotations.description }}
-
+ {{ if .Annotations.description }}
Description
-
- {{ range $line := (splitList "\n" .Annotations.description) }}
-
+ {{ range $line := (splitList "\n" .Annotations.description) }}
{{ $line }}
-
- {{ end }}
-
+ {{ end }}
-
- {{ end }}
-
+ {{ end }}
-
- {{ if .Values }}
-
+{{ if .Values }}
@@ -76,80 +52,56 @@
-
- {{ range $refID, $value := .Values }}
-
+ {{ range $refID, $value := .Values }}
{{ $refID }}={{ $value }}
-
- {{ end }}
-
+ {{ end }}
-
- {{ end }}
-
+{{ end }}
-
- {{ if .Labels.SortedPairs }}
-
+ {{ if .Labels.SortedPairs }}
Labels
-
- {{ range .Labels.SortedPairs }}
-
+ {{ range .Labels.SortedPairs }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
-
- {{ end }}
-
+ {{ end }}
-
-
- {{ if .Annotations.SortedPairs }}
-
+
+ {{ if (without .Annotations.SortedPairs.Names "description" "summary") }}
Annotations
-
- {{ range .Annotations.SortedPairs }}
-
+ {{ range .Annotations.SortedPairs }}
+ {{ if and (ne .Name "description") (ne .Name "summary") }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
+ {{ end }}
-
- {{ end }}
-
+ {{ end }}
@@ -178,9 +130,7 @@
{{ end }}
{{ if .PanelURL }}
-
- View panel
-
+ View panel
{{ end }}
@@ -189,7 +139,8 @@
- Observed {{ ago .StartsAt }} before this notification was delivered, at {{ .StartsAt }}
+ Observed {{ ago .StartsAt }} before this notification was delivered, at
+ {{ .StartsAt }}
diff --git a/pkg/services/ngalert/notifier/email_test.go b/pkg/services/ngalert/notifier/email_test.go
index 7bcd66a10a2..6bbae47a275 100644
--- a/pkg/services/ngalert/notifier/email_test.go
+++ b/pkg/services/ngalert/notifier/email_test.go
@@ -112,11 +112,11 @@ func TestEmailNotifierIntegration(t *testing.T) {
expSnippets: []string{
"2 firing instances",
"severity",
- "warning\n",
- "critical\n",
+ "warning",
+ "critical",
"alertname",
- "FiringTwo\n",
- "FiringOne\n",
+ "FiringTwo",
+ "FiringOne",
"
-
- {{ range $line := (splitList "\n" .Annotations.description) }}
-
+ {{ range $line := (splitList "\n" .Annotations.description) }}
{{ $line }}
-
- {{ end }}
-
+ {{ end }}
|
@@ -533,12 +529,8 @@
|
-
- {{ range $refID, $value := .Values }}
-
- {{ $refID }}={{ $value }}
- {{ end }}
-
+ {{ range $refID, $value := .Values }}
+ {{ $refID }}={{ $value }} {{ end }}
|
@@ -576,24 +568,18 @@
-
- {{ range .Labels.SortedPairs }}
-
+ {{ range .Labels.SortedPairs }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
|
- {{ end }}{{ if .Annotations.SortedPairs }}
+ {{ end }}{{ if (without .Annotations.SortedPairs.Names "description" "summary") }}
|
Annotations
@@ -602,20 +588,16 @@
|
-
- {{ range .Annotations.SortedPairs }}
-
+ {{ range .Annotations.SortedPairs }}
+ {{ if and (ne .Name "description") (ne .Name "summary") }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
+ {{ end }}
|
@@ -979,13 +961,9 @@
|
-
- {{ range $line := (splitList "\n" .Annotations.description) }}
-
+ {{ range $line := (splitList "\n" .Annotations.description) }}
{{ $line }}
-
- {{ end }}
-
+ {{ end }}
|
@@ -1042,12 +1020,8 @@
|
-
- {{ range $refID, $value := .Values }}
-
- {{ $refID }}={{ $value }}
- {{ end }}
-
+ {{ range $refID, $value := .Values }}
+ {{ $refID }}={{ $value }} {{ end }}
|
@@ -1085,24 +1059,18 @@
-
- {{ range .Labels.SortedPairs }}
-
+ {{ range .Labels.SortedPairs }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
|
- {{ end }}{{ if .Annotations.SortedPairs }}
+ {{ end }}{{ if (without .Annotations.SortedPairs.Names "description" "summary") }}
|
Annotations
@@ -1111,20 +1079,16 @@
|
-
- {{ range .Annotations.SortedPairs }}
-
+ {{ range .Annotations.SortedPairs }}
+ {{ if and (ne .Name "description") (ne .Name "summary") }}
|
{{ .Name }}
|
-
- {{ .Value }}
- |
+ {{ .Value }} |
-
- {{ end }}
-
+ {{ end }}
+ {{ end }}
|