lib/flapjack/gateways/email/alert.text.erb in flapjack-1.6.0 vs lib/flapjack/gateways/email/alert.text.erb in flapjack-2.0.0b1
- old
+ new
@@ -1,28 +1,34 @@
-Hi <%= @alert.contact_first_name %>
+Hi <%= @alert.medium.contact.name %>
Monitoring has detected the following:
-Entity: <%= @alert.entity %>
-Check: <%= @alert.check %>
+<% check = @alert.check -%>
+
+Check: <%= check.name %>
State: <%= @alert.state_title_case %>
-<% if @alert.summary -%>
-Summary: <%= @alert.summary %>
+<% summary = @alert.summary -%>
+<% unless summary.nil? || summary.empty? -%>
+Summary: <%= summary %>
<% end -%>
-<% if @alert.details -%>
-Details: <%= @alert.details %>
+<% details = @alert.details -%>
+<% unless details.nil? || details.empty? -%>
+Details: <%= details %>
<% end -%>
-<% if @alert.time -%>
-Time: <%= Time.at(@alert.time.to_i).to_s %>
+<% time = @alert.time -%>
+<% unless time.nil? -%>
+Time: <%= Time.at(time.to_i).to_s %>
<% end -%>
-<% if @alert.state_duration && @alert.state_duration > 40 -%>
-Duration: <%= ChronicDuration.output(@alert.state_duration, :keep_zero => true) || '0 secs' %>
+<% condition_duration = @alert.condition_duration -%>
+<% unless condition_duration.nil? || (condition_duration <= 40) -%>
+Duration: <%= ChronicDuration.output(condition_duration, :keep_zero => true) || '0 secs' %>
<% end -%>
-<% if @alert.last_state -%>
+<% unless @alert.last_state.nil? -%>
Previous State: <%= @alert.last_state_title_case %>
<% end -%>
-<% if @alert.last_summary -%>
-Previous Summary: <%= @alert.last_summary %>
+<% last_summary = @alert.last_summary -%>
+<% unless last_summary.nil? || last_summary.empty? -%>
+Previous Summary: <%= last_summary %>
<% end -%>
Cheers,
Flapjack