<tr>
  <th style="border: 1px solid #FF9933;
    border-collapse: collapse;
    padding: 4px;
    text-align:center;
    background-color: #FF9933;">Hostname
  </th>
  <th style="border: 1px solid #FF9933;
    border-collapse: collapse;
    padding: 4px;
    text-align:center;
    background-color: #FF9933;">Host group
  </th>
  <th style="border: 1px solid #FF9933;
    border-collapse: collapse;
    padding: 4px;
    text-align:center;
    background-color: #FF9933;">Environment
  </th>
  <% list.first.last[:metrics].keys.each do |header| %>
    <th style="border: 1px solid #FF9933;
      border-collapse: collapse;
      padding: 4px;
      text-align:center;
      background-color: #FF9933;"><%= 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="border:1px solid #FF9933;border-collapse:collapse;padding:4px;background-color:#FFFFFF;">
      <%= host_object.hostgroup %>
    </td>
    <td style="border:1px solid #FF9933;border-collapse:collapse;padding:4px;background-color:#FFFFFF;">
      <%= host_object.environment %>
    </td>
    <% params[:metrics].each do |m,v| %>
      <% if m =~ /failed|failed_restart/ and v > 0 %>
        <td style="color:red;font-weight:bold;border:1px solid #FF9933;border-collapse:collapse;padding:4px;background-color:#FFFFFF;">
      <% else %>
        <td style="border:1px solid #FF9933;border-collapse:collapse;padding:4px;background-color:#FFFFFF;">
      <% 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 %>
