<dtml-var manage_page_header>
<dtml-if debug_auto_reload>
<meta HTTP-EQUIV="Refresh"
  CONTENT="&dtml-debug_auto_reload;;URL=&dtml-URL;?debug_auto_reload=&dtml-debug_auto_reload;">
</dtml-if>
<dtml-with "_(management_view='Debug Information')">
  <dtml-var manage_tabs>
</dtml-with>

<dtml-if update_snapshot>
  <dtml-call rcsnapshot>
</dtml-if>

<main class="container-fluid">

  <p class="form-help mt-4">
    Reference count and database connection information
  </p>

  <h3>Top 100 reference counts</h3>
  <select name="foo" size="10" class="form-control">
    <dtml-in "refcount(100)">
      <option>&dtml-sequence-item;: &dtml-sequence-key;</option>
    </dtml-in>
  </select>

  <dtml-let delta_info="rcdeltas">
    <dtml-if delta_info>
      <h3 class="mt-4">Changes since last refresh</h3>

      <table class="table table-bordered table-sm mb-2">
      <dtml-in rcdeltas mapping>
      <dtml-if sequence-start>
      <tr>
      <th>Class</th>
      <th><dtml-var rcdate fmt="%Y/%m/%d - %H:%M:%S" null=""></th>
      <th><dtml-var ZopeTime fmt="%Y/%m/%d - %H:%M:%S"></th>
      <th>Delta</th>
      </tr>
      </dtml-if>
      <tr>
      <td>&dtml-name;</td>
      <td>&dtml-pc;</td>
      <td>&dtml-rc;</td>
      <td>+&dtml-delta;</td>
      </tr>
      </dtml-in>
      </table>
    </dtml-if>
  </dtml-let>
  
  <p class="form-help">
    <a href="../Database/cache_detail" class="mr-3" target="blank">
      <i class="fas fa-microchip" title="Cache detail"></i> 
      Cache detail
    </a>
    <a href="../Database/cache_extreme_detail" target="blank">
      <i class="fas fa-microchip" title="Cache extreme detail"></i> 
      Cache extreme detail
    </a>
  </p>

  <div class="zmi-controls row border-top border-bottom p-3 bg-light">
    <form action="&dtml-URL;" method="GET" class="form-group form-inline p-0 m-0">
      <button class="btn btn-primary mr-3" 
        onclick="window.location.href='&dtml-URL;?update_snapshot=1';"
      >Update Snapshot</button>
      <dtml-if debug_auto_reload>
        <button class="btn btn-primary mr-3"
          onclick="window.location.href='&dtml-URL;';"
        >Stop auto refresh</button>
      <dtml-else>
        <button class="btn btn-primary mr-3"
          onclick="window.location.href='&dtml-URL;';"
        >Refresh</button>
        <label for="debug_auto_reload" class="mx-3">Auto refresh interval (seconds):</label>
        <input class="form-control mr-3" type="text" id="debug_auto_reload" name="debug_auto_reload" size="3" value="10" />
        <input class="btn btn-primary" type="submit" value="Start auto refresh" />
      </dtml-if>
    </form>
  </div>
  
  <h3>ZODB database connections</h3>
  <table class="table table-sm table-bordered mb-5">
    <tr>
      <th>Opened</th>
      <th>Info</th>
    </tr>
    <dtml-in dbconnections mapping>
      <tr>
        <td class="text-nowrap">&dtml-opened;</td>
        <td><samp>&dtml-info;</samp></td>
      </tr>
    </dtml-in>
  </table>

</main>

<dtml-var manage_page_footer>
