<% th_style = "text-align: left; border-collapse: collapse;  background: #f5f5f5; background: linear-gradient(#f5f5f5, #e8e8e8); padding: 4px; border: 1px solid #cccccc;" %>
<% td_style = "text-align: left; border-collapse: collapse; background-color: #FFFFFF; padding: 4px; border: 1px solid #cccccc;" %>
<tr>
  <th style="<%= th_style %>">
    <%= _('Hostname') %>
  </th>
  <th style="<%= th_style %>">
    <%= _('Host group') %>
  </th>
  <th style="<%= th_style %>">
    <%= _('Environment') %>
  </th>
  <% list.first.last[:metrics].keys.each do |header| %>
    <th style="<%= th_style %>">
      <%= header %>
    </th>
  <% end %>
</tr>
<% list.each do |host,params| %>
  <tr>
    <% host_object = Host.find_by_name(host) %>
    <%= render 'link_to_host', :host => host %>
    <td style="<%= td_style %>">
      <%= host_object.hostgroup %>
    </td>
    <td style="<%= td_style %>">
      <%= host_object.environment %>
    </td>
    <% params[:metrics].each do |m,v| %>
      <% if m =~ /failed|failed_restart/ and v > 0 %>
        <td style="<%= td_style %>; color: red;">
      <% else %>
        <td style="<%= td_style %>">
      <% end %>
      <% if v > 0 %>
        <%= link_to v, reports_path(:search=>"host = #{host} and #{m} > 0", :host => @url.host, :port => @url.port, :protocol => @url.scheme, :only_path => false) %>
      <% else %>
        <%= v %>
      <% end %>
    </td>
    <% end %>
  </tr>
<% end %>
