pboling/rack-insight

View on GitHub
lib/rack/insight/views/panels/sphinx.html.erb

Summary

Maintainability
Test Coverage
<h3>Sphinx Usage</h3>
<table id="Sphinx_usage">
<tr>
  <th>Total Calls</th>
  <td><%= stats.calls %></td>

  <th>Total Time</th>
  <td><%= stats.display_time %></td>
</tr>
</table>

<% if stats.queries.any? %>
  <h3>Breakdown</h3>
  <table id="Sphinx_breakdown">
    <thead>
      <tr>
        <th>Time&nbsp;(ms)</th>
        <th>Command</th>
        <th class="backtrace"></th>
      </tr>
    </thead>
    <tbody>
      <% i = 1 %>
      <% stats.queries.each do |query| %>
        <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
          <td><%= query.display_time %></td>
          <td><%= query.command %></td>
          <td><%= "<a href='#' class='reveal_backtrace'>Show Backtrace</a>" if query.has_backtrace? %></td>
        </tr>
        <% if query.has_backtrace? %>
          <tr style="display:none">
            <td></td>
            <td colspan="2">
              <ul>
                <% query.filtered_backtrace.each do |line| %>
                  <li><%=h line %></li>
                <% end %>
              </ul>
            </td>
          </tr>
        <% end %>
        <% i += 1 %>
      <% end %>
    </tbody>
  </table>
<% end %>