<h1>Queue <b><%= fmt_string(highlight_extra_whitespace(queue.name)) %></b><%= fmt_maybe_vhost(queue.vhost) %></h1>

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

    <h3>Details</h3>
    <table class="facts facts-l" id="details-queue-table">
      <tr>
        <th>Features</th>
        <td id="details-queue-features"><%= fmt_features(queue) %></td>
      </tr>
<% if(!disable_stats) { %>
      <tr>
        <th>Policy</th>
        <td><%= link_policy(queue.vhost, queue.policy) %></td>
      </tr>
      <tr>
        <th>Operator policy</th>
        <td><%= fmt_string(queue.operator_policy, '') %></td>
      </tr>
      <% if (queue.owner_pid_details != undefined) { %>
        <tr>
          <th>Exclusive owner</th>
          <td><%= link_conn(queue.owner_pid_details.name) %></td>
        </tr>
      <% } %>
      <tr>
        <th>Effective policy definition</th>
        <td><%= fmt_table_short(queue.effective_policy_definition) %></td>
      </tr>
<% } %>
<% if (nodes_interesting) { %>
   <%= format(QUEUE_TYPE(queue).tmpl.node_details, {queue: queue}) %>
<% } %>
    </table>

    <% if(!disable_stats) { %>
        <%= format(QUEUE_TYPE(queue).tmpl.stats, {queue: queue}) %>
    <% } %>
  </div>
</div>

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

    </td>
    <td>
      <%= format('msg-detail-deliveries',
                 {'mode':   'queue',
                  'object': queue.deliveries}) %>
    </td>
  </tr>
</table>
</div>
</div>

<% } %>

<% if(!disable_stats) { %>
<%= maybe_format_extra_queue_content(queue, extra_content) %>
<% } %>

<% if(!disable_stats) { %>
<div class="section-hidden" id="queue-consumers-section">
  <h2 class="updatable">Consumers (<%=(queue.consumer_details.length)%>) </h2>
  <div class="hider updatable">
<%= format('consumers', {'mode': 'queue', 'consumers': queue.consumer_details}) %>
  </div>
</div>
<% } %>

<div class="section-hidden">
  <h2 class="updatable">Bindings (<%=(bindings.length)%>) </h2>
  <div class="hider">
    <div class="bindings-wrapper">
      <%= format('bindings', {'mode': 'queue', 'bindings': bindings}) %>
      <p class="arrow">&dArr;</p>
      <p><span class="queue">This queue</span></p>

      <%= format('add-binding', {'mode': 'queue', 'parent': queue}) %>
    </div>
  </div>
</div>

<%= format('publish', {'mode': 'queue', 'queue': queue}) %>

<% if (QUEUE_TYPE(queue).actions.get_message) { %>
  <%= format((QUEUE_TYPE(queue).tmpl && QUEUE_TYPE(queue).tmpl.get_message) || "classic-queue-get-message", {queue: queue}) %>
<% } %>

<% if (is_user_policymaker) { %>
<div class="section-hidden">
  <h2>Move messages</h2>
  <div class="hider">
  <% if (NAVIGATION['Admin'][0]['Shovel Management'] == undefined) { %>
    <p>To move messages, the shovel plugin must be enabled, try:</p>
    <pre>$ rabbitmq-plugins enable rabbitmq_shovel rabbitmq_shovel_management</pre>
  <% } else { %>
    <p>
      The shovel plugin can be used to move messages from this queue
      to another one. The form below will create a temporary shovel to
      move messages to another queue on the same virtual host, with
      default settings.
    </p>
    <p>
      For more options <a href="#/dynamic-shovels">see the shovel
      interface</a>.
    </p>
    <form action="#/shovel-parameters-move-messages" method="put">
      <input type="hidden" name="component" value="shovel"/>
      <input type="hidden" name="vhost" value="<%= fmt_string(queue.vhost) %>"/>
      <input type="hidden" name="name" value="Move from <%= fmt_string(queue.name) %>"/>
      <input type="hidden" name="src-uri" value="amqp:///<%= esc(queue.vhost) %>"/>
      <input type="hidden" name="src-queue" value="<%= fmt_string(queue.name) %>"/>
      <input type="hidden" name="src-protocol" value="amqp091"/>
      <input type="hidden" name="src-prefetch-count" value="1000"/>
      <input type="hidden" name="src-delete-after" value="queue-length"/>
      <input type="hidden" name="dest-protocol" value="amqp091"/>
      <input type="hidden" name="dest-uri" value="amqp:///<%= esc(queue.vhost) %>"/>
      <input type="hidden" name="dest-add-forward-headers" value="false"/>
      <input type="hidden" name="ack-mode" value="on-confirm"/>
      <% if (is_stream(queue)) { %>
        <input type="hidden" name="src-consumer-args-stream-offset" value="first"/>
      <% } %>
      <input type="hidden" name="redirect" value="#/queues"/>

      <table class="form">
        <tr>
          <th>Destination queue:</th>
          <td><input type="text" name="dest-queue"/></td>
        </tr>
      </table>
      <input type="submit" value="Move messages"/>
    </form>
  <% } %>
  </div>
</div>
<% } %>

<% if (!is_internal(queue)) { %>
<div class="section-hidden" id="delete">
  <h2>Delete</h2>
  <div class="hider">
    <form action="#/queues" method="delete" class="confirm-queue inline-form">
      <input type="hidden" name="vhost" value="<%= fmt_string(queue.vhost) %>"/>
      <input type="hidden" name="name" value="<%= fmt_string(queue.name) %>"/>
      <input type="hidden" name="mode" value="delete"/>
      <input type="submit" value="Delete Queue" />
    </form>
  </div>
</div>
<% } %>

<% if (QUEUE_TYPE(queue).actions.purge) { %>
<div class="section-hidden">
  <h2>Purge</h2>
  <div class="hider">
    <form action="#/queues" method="delete" class="confirm-purge-queue inline-form">
      <input type="hidden" name="vhost" value="<%= fmt_string(queue.vhost) %>"/>
      <input type="hidden" name="name" value="<%= fmt_string(queue.name) %>"/>
      <input type="hidden" name="mode" value="purge"/>
      <input type="submit" value="Purge Messages" />
    </form>
  </div>
</div>
<% } %>

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

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

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

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

<% } %>
