Fix unwanted newlines in plain text email (#70141)

This commit is contained in:
George Robinson
2023-06-15 15:04:10 +01:00
committed by GitHub
parent 2675f90eaa
commit a3845c9e2e
2 changed files with 26 additions and 26 deletions

View File

@ -18,8 +18,8 @@ Go to the Alerts page: [[ .AlertPageUrl ]]
[[- define "__default_alerts_summarize" -]]
[[- range . ]]
[[ template "__default_alert_labels" . ]]
[[ template "__default_alert_annotations" . ]]
[[- end ]]
[[- template "__default_alert_annotations" . ]]
[[ end ]]
[[- end -]]
[[- define "__default_alert_labels" -]]
@ -32,21 +32,21 @@ Labels: [[ .Labels.SortedPairs ]]
[[- define "__default_alert_annotations" -]]
[[- $annotations := .Annotations -]]
[[- if index $annotations "summary" -]]
Summary: [[ index .Annotations "summary" ]]
[[- if index $annotations "summary" ]]
Summary: [[ index .Annotations "summary" -]]
[[- $annotations = $annotations.Remove (toStrings (list "summary")) ]]
[[ end -]]
[[- if index $annotations "description" -]]
Description: [[ index $annotations "description" ]]
[[- end -]]
[[- if index $annotations "description" ]]
Description: [[ index $annotations "description" -]]
[[- $annotations = $annotations.Remove (toStrings (list "description")) ]]
[[ end -]]
[[- if index $annotations "runbook_url" -]]
Runbook: [[ index $annotations "runbook_url" ]]
[[- end -]]
[[- if index $annotations "runbook_url" ]]
Runbook: [[ index $annotations "runbook_url" -]]
[[- $annotations = $annotations.Remove (toStrings (list "runbook_url")) ]]
[[ end -]]
[[- if $annotations -]]
[[- end -]]
[[- if $annotations ]]
Annotations: [[ template "__default_sorted_pairs" $annotations ]]
[[ end -]]
[[- end -]]
[[- end -]]
[[- define "__default_sorted_pairs" -]]

View File

@ -18,8 +18,8 @@ Go to the Alerts page: {{ .AlertPageUrl }}
{{- define "__default_alerts_summarize" -}}
{{- range . }}
{{ template "__default_alert_labels" . }}
{{ template "__default_alert_annotations" . }}
{{- end }}
{{- template "__default_alert_annotations" . }}
{{ end }}
{{- end -}}
{{- define "__default_alert_labels" -}}
@ -32,21 +32,21 @@ Labels: {{ .Labels.SortedPairs }}
{{- define "__default_alert_annotations" -}}
{{- $annotations := .Annotations -}}
{{- if index $annotations "summary" -}}
Summary: {{ index .Annotations "summary" }}
{{- if index $annotations "summary" }}
Summary: {{ index .Annotations "summary" -}}
{{- $annotations = $annotations.Remove (toStrings (list "summary")) }}
{{ end -}}
{{- if index $annotations "description" -}}
Description: {{ index $annotations "description" }}
{{- end -}}
{{- if index $annotations "description" }}
Description: {{ index $annotations "description" -}}
{{- $annotations = $annotations.Remove (toStrings (list "description")) }}
{{ end -}}
{{- if index $annotations "runbook_url" -}}
Runbook: {{ index $annotations "runbook_url" }}
{{- end -}}
{{- if index $annotations "runbook_url" }}
Runbook: {{ index $annotations "runbook_url" -}}
{{- $annotations = $annotations.Remove (toStrings (list "runbook_url")) }}
{{ end -}}
{{- if $annotations -}}
{{- end -}}
{{- if $annotations }}
Annotations: {{ template "__default_sorted_pairs" $annotations }}
{{ end -}}
{{- end -}}
{{- end -}}
{{- define "__default_sorted_pairs" -}}