lib/flapjack/gateways/email/alert.html.erb in flapjack-1.6.0 vs lib/flapjack/gateways/email/alert.html.erb in flapjack-2.0.0b1

- old
+ new

@@ -9,69 +9,70 @@ border: 1px solid #666; padding: 4px; } </style> -<p>Hi <%= @alert.contact_first_name%></p> +<p>Hi <%= @alert.medium.contact.name %></p> <p>Monitoring has detected the following:</p> +<% check = @alert.check -%> <table> <tbody> <tr> - <td><strong>Entity</strong></td> - <td><%= @alert.entity %></td> - </tr> - - <tr> <td><strong>Check</strong></td> - <td><%= @alert.check %></td> + <td><%= check.name %></td> </tr> <tr> <td><strong>State</strong></td> <td><%= @alert.state_title_case %></td> </tr> - <% if @alert.summary %> + <% summary = @alert.summary -%> + <% unless summary.nil? || summary.empty? -%> <tr> <td><strong>Summary</strong></td> - <td><%= @alert.summary %></td> + <td><%= summary %></td> </tr> <% end %> - <% if @alert.details %> + <% details = @alert.details -%> + <% unless details.nil? || details.empty? -%> <tr> <td><strong>Details</strong></td> - <td><%= @alert.details %></td> + <td><%= details %></td> </tr> <% end %> - <% if @alert.time %> + <% time = @alert.time -%> + <% unless time.nil? -%> <tr> <td><strong>Time</strong></td> - <td><%= Time.at(@alert.time.to_i).to_s %></td> + <td><%= Time.at(time.to_i).to_s %></td> </tr> <% end %> - <% if @alert.state_duration && @alert.state_duration > 40 %> + <% condition_duration = @alert.condition_duration -%> + <% unless condition_duration.nil? || (condition_duration <= 40.0) -%> <tr> <td><strong>Duration</strong></td> - <td><%= ChronicDuration.output(@alert.state_duration, :keep_zero => true) || '0 secs' %></td> + <td><%= ChronicDuration.output(condition_duration, :keep_zero => true) || '0 secs' %></td> </tr> <% end %> - <% if @alert.last_state %> + <% unless @alert.last_state.nil? -%> <tr> <td><strong>Previous State</strong></td> <td><%= @alert.last_state_title_case %></td> </tr> <% end %> - <% if @alert.last_summary %> + <% last_summary = @alert.last_summary -%> + <% unless last_summary.nil? || last_summary.empty? -%> <tr> <td><strong>Previous Summary</strong></td> - <td><%= @alert.last_summary %></td> + <td><%= last_summary %></td> </tr> <% end %> </tbody> </table>