lib/flapjack/gateways/web/views/contact.html.erb in flapjack-0.7.28 vs lib/flapjack/gateways/web/views/contact.html.erb in flapjack-0.7.29
- old
+ new
@@ -13,55 +13,97 @@
<div class="page-header">
<%= nav %>
<h2><%= h @contact.name %></h2>
</div>
+ <% alerting = {} %>
+
<h3>Contact Media</h3>
<% if !@contact.media || @contact.media.empty? %>
<p>No media</p>
<% else %>
<table class="table table-bordered table-hover table-condensed">
<tr>
<th>Media</th>
<th>Address</th>
<th>Interval</th>
- <th>Rollup Threshold</th>
+ <th>Summary Mode</th>
+ <th>Summary Threshold</th>
</tr>
<% @contact.media.each_pair do |mk, mv| %>
+ <% alerting[mk] = @contact.alerting_checks_for_media(mk) %>
<tr>
<% if 'pagerduty'.eql?(mk) %>
<td>PagerDuty</td>
<td>
<% @pagerduty_credentials.each_pair do |pk, pv| %>
<p><%= 'password'.eql?(pk) ? h("#{pk}: ...") : h("#{pk}: #{pv}") %></p>
<% end %>
</td>
+ <td></td>
+ <td></td>
+ <td></td>
<% else %>
<td><%= h mk.capitalize %></td>
<td><%= h mv %></td>
+ <td>
+ <% if @contact.media_intervals[mk] %>
+ <%= h @contact.media_intervals[mk] %> seconds
+ <% else %>
+ no custom interval
+ <% end %>
+ </td>
+ <td>
+ <% if alerting[mk].length >= @contact.media_rollup_thresholds[mk].to_i %>
+ Yes -
+ <% else %>
+ No -
+ <% end %>
+ <%= alerting[mk].length %> alerting
+ </td>
+ <td>
+ <% if @contact.media_rollup_thresholds[mk] %>
+ <%= h @contact.media_rollup_thresholds[mk] %>
+ <% else %>
+ -
+ <% end %>
+ </td>
<% end %>
+ </tr>
+ <% end %>
+ </table>
+ <% end %>
+ <h3>Alerting Checks</h3>
+ <p>These failing checks are currently alerting because they are not acknowledged, not in scheduled maintenance, and currently allowed by this contact's notification rules.</p>
+
+ <table class="table table-bordered table-hover table-condensed">
+ <tr>
+ <th>Media</th>
+ <th>Alerting Checks</th>
+ </tr>
+ <% alerting.each_pair do |media, checks| %>
+ <% if checks.length > 0 %>
+ <tr>
+ <td><%= h media.capitalize %></td>
<td>
- <% if @contact.media_intervals[mk] %>
- <%= h @contact.media_intervals[mk] %> seconds
- <% else %>
- no custom interval
+ <% checks.each do |entity_check| %>
+ <% entity, check = entity_check.split(':', 2) %>
+ <% check_link = "<a href=\"/check?entity=#{u(entity)}&check=#{u(check)}\" title=\"check status\">" +
+ h(check) + "</a>"%>
+ <a href="/entity/<%= u(entity) %>" title="entity status"><%= h entity %></a> ::
+ <%= check_link %> <br />
<% end %>
</td>
- <td>
- <% if @contact.media_rollup_thresholds[mk] %>
- <%= h @contact.media_rollup_thresholds[mk] %> failing checks
- <% else %>
- -
- <% end %>
- </td>
</tr>
+ <% else %>
+ <tr><td colspan="2">No alerting checks, yay!</td></tr>
<% end %>
- </table>
- <% end %>
+ <% end %>
+ </table>
- <h3>Entities and Checks</h3>
+ <h3>All Entities and Checks</h3>
<% if !@entities_and_checks || @entities_and_checks.empty? %>
<p>No entities</p>
<% else %>
<table class="table table-bordered table-hover table-condensed">
<tr>
@@ -75,10 +117,10 @@
%>
<tr>
<td><a href="/entity/<%= u(entity.name) %>" title="entity status"><%= h entity.name %></a></td>
<td>
<% checks.each do |check| %>
- <a href="/check?entity=<%= u(entity.name) %>&check=<%= u(check) %>" title="check status"><%= h check %></a>
+ <%= "<a href=\"/check?entity=#{u(entity.name)}&check=#{u(check)}\" title=\"check status\">#{ h check }</a>" %>
<% end %>
</td>
</tr>
<% end %>
</table>