Fix: Alert email variable name typo fixed (#16232)

This commit is contained in:
Navaneesh Kumar 2019-03-27 14:12:20 +05:30 committed by Torkel Ödegaard
parent 3146500de5
commit 5ea823a65a
4 changed files with 20 additions and 20 deletions

View File

@ -91,8 +91,8 @@
[[if ne .ImageLink "" ]] [[if ne .ImageLink "" ]]
<img src="[[.ImageLink]]" alt="Alerting Panel"/> <img src="[[.ImageLink]]" alt="Alerting Panel"/>
[[end]] [[end]]
[[if ne .EmbededImage "" ]] [[if ne .EmbeddedImage "" ]]
<img src="cid:[[.EmbededImage]]" alt="Alerting Panel"/> <img src="cid:[[.EmbeddedImage]]" alt="Alerting Panel"/>
[[end]] [[end]]
</td> </td>
</tr> </tr>

View File

@ -76,17 +76,17 @@ func (this *EmailNotifier) Notify(evalContext *alerting.EvalContext) error {
SendEmailCommand: m.SendEmailCommand{ SendEmailCommand: m.SendEmailCommand{
Subject: evalContext.GetNotificationTitle(), Subject: evalContext.GetNotificationTitle(),
Data: map[string]interface{}{ Data: map[string]interface{}{
"Title": evalContext.GetNotificationTitle(), "Title": evalContext.GetNotificationTitle(),
"State": evalContext.Rule.State, "State": evalContext.Rule.State,
"Name": evalContext.Rule.Name, "Name": evalContext.Rule.Name,
"StateModel": evalContext.GetStateModel(), "StateModel": evalContext.GetStateModel(),
"Message": evalContext.Rule.Message, "Message": evalContext.Rule.Message,
"Error": error, "Error": error,
"RuleUrl": ruleUrl, "RuleUrl": ruleUrl,
"ImageLink": "", "ImageLink": "",
"EmbededImage": "", "EmbeddedImage": "",
"AlertPageUrl": setting.AppUrl + "alerting", "AlertPageUrl": setting.AppUrl + "alerting",
"EvalMatches": evalContext.EvalMatches, "EvalMatches": evalContext.EvalMatches,
}, },
To: this.Addresses, To: this.Addresses,
Template: "alert_notification.html", Template: "alert_notification.html",
@ -100,7 +100,7 @@ func (this *EmailNotifier) Notify(evalContext *alerting.EvalContext) error {
file, err := os.Stat(evalContext.ImageOnDiskPath) file, err := os.Stat(evalContext.ImageOnDiskPath)
if err == nil { if err == nil {
cmd.EmbededFiles = []string{evalContext.ImageOnDiskPath} cmd.EmbededFiles = []string{evalContext.ImageOnDiskPath}
cmd.Data["EmbededImage"] = file.Name() cmd.Data["EmbeddedImage"] = file.Name()
} }
} }

View File

@ -39,7 +39,7 @@ func TestEmailIntegrationTest(t *testing.T) {
"RuleUrl": "http://localhost:3000/dashboard/db/graphite-dashboard", "RuleUrl": "http://localhost:3000/dashboard/db/graphite-dashboard",
"ImageLink": "http://localhost:3000/render/dashboard-solo/db/graphite-dashboard?panelId=1&from=1471008499616&to=1471012099617&width=1000&height=500", "ImageLink": "http://localhost:3000/render/dashboard-solo/db/graphite-dashboard?panelId=1&from=1471008499616&to=1471012099617&width=1000&height=500",
"AlertPageUrl": "http://localhost:3000/alerting", "AlertPageUrl": "http://localhost:3000/alerting",
"EmbededImage": "test.png", "EmbeddedImage": "test.png",
"EvalMatches": []map[string]string{ "EvalMatches": []map[string]string{
{ {
"Metric": "desktop", "Metric": "desktop",

View File

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<style>body { <style>body {
width: 100% !important; min-width: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0; width: 100% !important; min-width: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; margin: 0; padding: 0;
} }
@ -297,8 +297,8 @@ text-decoration: underline;
{{if ne .ImageLink "" }} {{if ne .ImageLink "" }}
<img src="{{.ImageLink}}" alt="Alerting Panel" style="outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic; width: auto; clear: both; display: block; border: 0;" align="left" /> <img src="{{.ImageLink}}" alt="Alerting Panel" style="outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic; width: auto; clear: both; display: block; border: 0;" align="left" />
{{end}} {{end}}
{{if ne .EmbededImage "" }} {{if ne .EmbeddedImage "" }}
<img src="cid:{{.EmbededImage}}" alt="Alerting Panel" style="outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic; width: auto; clear: both; display: block; border: 0;" align="left" /> <img src="cid:{{.EmbeddedImage}}" alt="Alerting Panel" style="outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic; width: auto; clear: both; display: block; border: 0;" align="left" />
{{end}} {{end}}
</td> </td>
</tr> </tr>
@ -339,11 +339,11 @@ text-decoration: underline;
</td> </td>
</tr> </tr>
</table> </table>
<table class="footer center" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: center; color: #999999; margin-top: 20px; padding: 0;" bgcolor="#2e2e2e"> <table class="footer center" style="border-spacing: 0; border-collapse: collapse; vertical-align: top; text-align: center; color: #999999; margin-top: 20px; padding: 0;" bgcolor="#2e2e2e">
<tr style="vertical-align: top; padding: 0;" align="left"> <tr style="vertical-align: top; padding: 0;" align="left">
<td class="wrapper last" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; position: relative; color: #222222; font-family: 'Open Sans', 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; margin: 0; padding: 10px 20px 0px 0px;" align="left" valign="top"> <td class="wrapper last" style="word-break: break-word; -webkit-hyphens: auto; -moz-hyphens: auto; hyphens: auto; border-collapse: collapse !important; position: relative; color: #222222; font-family: 'Open Sans', 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; margin: 0; padding: 10px 20px 0px 0px;" align="left" valign="top">