Skip to content

Commit

Permalink
Treat GeneratorURL as optional in Alerts page.
Browse files Browse the repository at this point in the history
This fixes #21

Otherwise, sending an alert with a missing `GeneratorURL` payload
property would cause the template rendering to crash:

    Error executing template: template: alerts.html:51:76: executing "content" at <.Alert.Payload.Gener...>: invalid value; expected string
  • Loading branch information
juliusv committed Jan 10, 2015
1 parent d2ce4fa commit 4196341
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/templates/alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ <h2>Alerts</h2>
</td>
<td>{{timeSince .Created}} ago</td>
<td>{{timeSince .LastRefreshed}} ago</td>
<td><a href="{{.Alert.Payload.GeneratorURL}}">{{(truncate .Alert.Payload.GeneratorURL 40)}}</a></td>
<td>
{{if .Alert.Payload.GeneratorURL}}
<a href="{{.Alert.Payload.GeneratorURL}}">{{(truncate .Alert.Payload.GeneratorURL 40)}}</a>
{{end}}
</td>
<td>{{.Alert.Payload.AlertingRule}}</td>
<td>
{{$silence := call $silenceForAlert .Alert}}
Expand Down

0 comments on commit 4196341

Please sign in to comment.