<h1>Channel: <b><%= fmt_escape_html(channel.name) %></b><%= fmt_maybe_vhost(channel.vhost) %></h1>

<div class="section">
<h2>Overview</h2>
<div class="hider updatable">
<% if (rates_mode != 'none') { %>
    <%= message_rates('msg-rates-ch', channel.message_stats) %>
<% } %>

<h3>Details</h3>
<table class="facts facts-l">
  <tr>
    <th>Connection</th>
    <td><%= link_conn(channel.connection_details.name) %></td>
  </tr>
<% if (nodes_interesting) { %>
  <tr>
    <th>Node</th>
    <td><%= fmt_node(channel.node) %></td>
  </tr>
<% } %>
  <tr>
    <th>Username</th>
    <td><%= fmt_string(channel.user) %></td>
  </tr>
  <tr>
    <th>Mode <span class="help" id="channel-mode"></span></th>
    <td><%= fmt_channel_mode(channel) %></td>
  </tr>
</table>

<table class="facts facts-l">
  <tr>
    <th>State</th>
    <td><%= fmt_object_state(channel) %></td>
  </tr>
  <tr>
    <th>Prefetch count</th>
    <td><%= channel.prefetch_count %></td>
  </tr>
</table>

<table class="facts">
  <tr>
    <th>Messages unacknowledged</th>
    <td><%= channel.messages_unacknowledged %></td>
  </tr>
  <tr>
    <th>Messages unconfirmed</th>
    <td><%= channel.messages_unconfirmed %></td>
  </tr>
  <tr>
    <th>Messages uncommitted</th>
    <td><%= channel.messages_uncommitted %></td>
  </tr>
  <tr>
    <th>Acks uncommitted</th>
    <td><%= channel.acks_uncommitted %></td>
  </tr>
</table>

<table class="facts">
  <tr>
    <th>Pending Raft commands</th>
    <td><%= channel.pending_raft_commands %></td>
  </tr>
</table>

</div>
</div>

<div class="section">
  <h2 class="updatable" >Consumers (<%=(channel.consumer_details.length)%>) </h2>
  <div class="hider updatable">
<%= format('consumers', {'mode': 'channel', 'consumers': channel.consumer_details}) %>
  </div>
</div>

<% if (rates_mode == 'detailed') { %>
<div class="section">
<h2>Message rates breakdown</h2>
<div class="hider updatable">
<table class="two-col-layout">
  <tr>
    <td>
      <%= format('msg-detail-publishes',
                 {'mode':   'channel',
                  'object': channel.publishes,
                  'label':  'Publishes'}) %>
    </td>
    <td>
      <%= format('msg-detail-deliveries',
                 {'mode':   'channel',
                  'object': channel.deliveries}) %>
    </td>
  </tr>
</table>
</div>
</div>
<% } %>

<% if(channel.reductions || channel.garbage_collection) { %>
<div class="section-hidden">
<h2>Runtime Metrics (Advanced)</h2>
 <div class="hider updatable">
 <%= data_reductions('reductions-rates-conn', channel) %>
 <table class="facts">
    <% if (channel.garbage_collection.min_bin_vheap_size) { %>
        <tr>
        <th>Minimum binary virtual heap size in words (min_bin_vheap_size)</th>
        <td><%= channel.garbage_collection.min_bin_vheap_size %></td>
        </tr>
    <% } %>

    <% if (channel.garbage_collection.min_heap_size) { %>
        <tr>
        <th>Minimum heap size in words (min_heap_size)</th>
        <td><%= channel.garbage_collection.min_heap_size %></td>
        </tr>
    <% } %>

    <% if (channel.garbage_collection.fullsweep_after) { %>
        <tr>
        <th>Maximum generational collections before fullsweep (fullsweep_after)</th>
        <td><%= channel.garbage_collection.fullsweep_after %></td>
        </tr>
    <% } %>

    <% if (channel.garbage_collection.minor_gcs) { %>
        <tr>
        <th>Number of minor GCs (minor_gcs)</th>
        <td><%= channel.garbage_collection.minor_gcs %></td>
        </tr>
    <% } %>
 </table>
 </div>
</div>

<% } %>

