<h1>Top Processes: <b><%= top.node %></b></h1>

<p>
  Node:
  <select id="top-node">
  <% for (var i = 0; i < nodes.length; i++) { %>
     <option name="#/top/<%= fmt_string(nodes[i].name) %>"<% if (nodes[i].name == top.node) { %>selected="selected"<% } %>><%= nodes[i].name %></option>
  <% } %>
  </select>

  Rows:
  <select id="row-count">
  <%
    var row_counts = [20, 50, 100, 150];
    for (var i = 0; i < row_counts.length; i++) {
  %>
    <option name="<%= row_counts[i] %>"
        <% if (row_counts[i] == top.row_count) { %>selected="selected"<% } %>>
    <%= row_counts[i] %></option>
  <% } %>
  </select>
</p>

<table class="list updatable">
 <thead>
  <tr>
    <th><%= fmt_sort('Process', 'pid') %></th>
    <th>Description</th>
    <th>Type</th>
    <th><%= fmt_sort('Memory', 'memory') %></th>
    <th><%= fmt_sort('Reductions / sec', 'reduction_delta') %></th>
    <th>Message queue</th>
    <th>Internal buffer <span class="help" id="process-internal-buffer"></span></th>
    <th>Status</th>
  </tr>
 </thead>
 <tbody>
<%
 for (var i = 0; i < top.processes.length; i++) {
    var process = top.processes[i];
%>
  <tr<%= alt_rows(i)%>>
    <td><%= link_pid(process.pid) %></td>
    <td><%= fmt_process_name(process) %></td>
    <td><%= fmt_remove_rabbit_prefix(process.name.type) %></td>
    <td><%= fmt_bytes(process.memory * 1.0) %></td>
    <td class="r"><%= fmt_reduction_delta(process.reduction_delta) %></td>
    <td class="r"><%= process.message_queue_len %></td>
    <td class="r"><%= process.buffer_len %></td>
    <td><%= process.status %></td>
  </tr>
<% } %>
 </tbody>
</table>
