<h1>Shovel Status</h1>
<%
  var extra_width = 0;
  if (vhosts_interesting) extra_width++;
  if (nodes_interesting)  extra_width++;
%>
<div class="updatable">
<% if (shovels.length > 0) { %>
<table class="list">
 <thead>
  <tr>
    <th>Name</th>
<% if (nodes_interesting) { %>
    <th>Node</th>
<% } %>
<% if (vhosts_interesting) { %>
    <th>Virtual Host</th>
<% } %>
    <th>State</th>
    <th colspan="2">Source</th>
    <th colspan="2">Destination</th>
    <th>Last changed</th>
  </tr>
 </thead>
 <tbody>
<%
 for (var i = 0; i < shovels.length; i++) {
    var shovel = shovels[i];
%>
  <tr<%= alt_rows(i)%>>
    <td>
      <%= fmt_string(shovel.name) %>
      <sub><%= fmt_string(shovel.type) %></sub>
    </td>
<% if (nodes_interesting) { %>
    <td><%= fmt_node(shovel.node) %></td>
<% } %>
<% if (vhosts_interesting) { %>
    <td><%= fmt_string(shovel.vhost, '') %></td>
<% } %>
<% if (shovel.state == 'terminated') { %>
    <td colspan="5"><%= fmt_state('red', shovel.state) %></td>
    <td><%= shovel.timestamp %></td>
  </tr>
  <tr>
    <td colspan="<%= 8 + extra_width %>">
      <pre><%= fmt_string(shovel.reason) %></pre>
    </td>
  </tr>
<% } else { %>
    <td><%= fmt_state('green', shovel.state) %></td>
    <% if (shovel.definition == undefined) { %>
      <td colspan="2"><%= fmt_string(shovel.src_uri) %></td>
      <td colspan="2"><%= fmt_string(shovel.dest_uri) %></td>
    <% } else { %>
      <td><%= fmt_string(shovel.src_uri) %></td>
      <td><%= fmt_shovel_endpoint('src', shovel.definition) %></td>
      <td><%= fmt_string(shovel.dest_uri) %></td>
      <td><%= fmt_shovel_endpoint('dest', shovel.definition) %></td>
    <% } %>
    <td><%= shovel.timestamp %></td>
  </tr>
<% } %>
  <% } %>
 </tbody>
</table>
<% } else { %>
  <p>... no shovels ...</p>
<% } %>
</div>
