pboling/rack-insight

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

Summary

Maintainability
Test Coverage
<h3>SQL Queries</h3>
<table class="sortable">
<thead>
  <tr>
    <th class="time">Time&nbsp;(ms)</th>
    <th class="query">Query</th>
    <th class="backtrace"></th>
    <th class="actions"></th>
  </tr>
</thead>
<tbody>
  <% i = 1 %>
  <% queries.each do |query| %>
    <tr class="<%= i % 2 == 0 ? "even" : "odd" %>">
      <td><%= query.human_time %></td>
      <td class="syntax"><%= query.sql %></td>
      <td>
        <% if query.has_backtrace? %>
          <a href="#" class="reveal_backtrace">Show Backtrace</a>
        <% end %>
      </td>
      <td>
        <% if query.inspectable? %>
          <a href="/__insight__/sql/execute?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">SELECT</a> |
          <a href="/__insight__/sql/explain?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">EXPLAIN</a> |
          <a href="/__insight__/sql/profile?<%= signed_params("query" => query.sql, "time" => query.time) %>" class="remote_call">Profile</a>
        <% end %>
      </td>
    </tr>
    <tr style="display:none">
      <td></td>
      <td colspan="3">
        <ul>
          <% query.filtered_backtrace.each do |line| %>
            <li><%=h line %></li>
          <% end %>
        </ul>
      </td>
    </tr>
    <% i += 1 %>
  <% end %>
</tbody>
</table>