|
1 <table id="sql-table" class="table table-striped table-condensed"> |
|
2 <thead> |
|
3 <tr> |
|
4 <th class="table-col-index">#</th> |
|
5 <th class="table-col-time">Time (ms)</th> |
|
6 <th class="table-col-sql">SQL</th> |
|
7 <th class="table-col-rollback">Rollback?</th> |
|
8 <th class="table-col-from-rql">From RQL</th> |
|
9 <th class="table-col-stack">Stack</th> |
|
10 </tr> |
|
11 </thead> |
|
12 <tbody> |
|
13 % for i, query in enumerate(sql_queries): |
|
14 <tr> |
|
15 <th class="table-col-index">${1 + i}</th> |
|
16 <td class="table-col-time">${'%.2f' % query["time"]}</td> |
|
17 <td class="table-col-sql">${highlight(query["sql"], "SQL") | n}<br>${highlight(query["args"], "python3") | n}</td> |
|
18 <td class="table-col-rollback">${query["rollback"]}</td> |
|
19 <td class="table-col-from-rql"> |
|
20 % if query["from_rql_query"]: |
|
21 ${highlight(query["from_rql_query"]["rql"], "rql") | n} |
|
22 % else: |
|
23 <i>standalone query</i> |
|
24 % endif |
|
25 </td> |
|
26 <td class="table-col-stack"> |
|
27 <button class="btn btn-default" id="sql-toggle-stack-${i}" onclick="javascript:toggle_sql_stack(${i})">show stack</a> |
|
28 </td> |
|
29 </tr> |
|
30 <tr style="display: none" id="sql-stack-${i}"> |
|
31 <td colspan="6"> |
|
32 <pre>${highlight(query["callstack"], "py3tb", linenos="inline") | n}</pre> |
|
33 </td> |
|
34 </tr> |
|
35 <tr style="display: none"></tr> <!-- css hack because of previous hidden tr for -stripped --> |
|
36 % endfor |
|
37 </tbody> |
|
38 </table> |
|
39 |
|
40 <script type="text/javascript" charset="utf-stack"> |
|
41 function toggle_sql_stack(stack_id) { |
|
42 var stack = document.getElementById("sql-stack-" + stack_id); |
|
43 var button = document.getElementById("sql-toggle-stack-" + stack_id); |
|
44 |
|
45 // stack is hidden, display it |
|
46 if (stack.style.getPropertyValue("display") == "none") { |
|
47 stack.style.setProperty("display", "table-row"); |
|
48 button.innerHTML = "hide stack" |
|
49 } else { |
|
50 stack.style.setProperty("display", "none"); |
|
51 button.innerHTML = "show stack" |
|
52 } |
|
53 } |
|
54 </script> |
|
55 |
|
56 <style> |
|
57 #sql-table { |
|
58 table-layout: fixed; |
|
59 } |
|
60 |
|
61 #sql-table .table-col-index { |
|
62 text-align: right; |
|
63 width: 30px; |
|
64 } |
|
65 |
|
66 #sql-table .table-col-time { |
|
67 white-space: nowrap; |
|
68 width: 73px; |
|
69 text-align: center; |
|
70 } |
|
71 |
|
72 #sql-table .table-col-rollback { |
|
73 white-space: nowrap; |
|
74 width: 73px; |
|
75 text-align: center; |
|
76 } |
|
77 |
|
78 #sql-table .table-col-stack { |
|
79 padding: 8px; |
|
80 width: 110px; |
|
81 text-align: center; |
|
82 } |
|
83 |
|
84 ${generate_css() | n} |
|
85 |
|
86 .highlight > pre { |
|
87 word-break: unset; |
|
88 border: none; |
|
89 margin: 0; |
|
90 padding: 0; |
|
91 background-color: unset; |
|
92 } |
|
93 </style> |