|
1 | 1 | {% load i18n l10n %} |
2 | 2 | <ul> |
3 | | - {% for alias, info in databases %} |
4 | | - <li> |
5 | | - <strong><span class="djdt-color" data-djdt-styles="backgroundColor:rgb({{ info.rgb_color|join:', ' }})"></span> {{ alias }}</strong> |
6 | | - {{ info.time_spent|floatformat:"2" }} ms ({% blocktrans count info.num_queries as num %}{{ num }} query{% plural %}{{ num }} queries{% endblocktrans %} |
7 | | - {% if info.similar_count %} |
8 | | - {% blocktrans with count=info.similar_count trimmed %} |
9 | | - including <abbr title="Similar queries are queries with the same SQL, but potentially different parameters.">{{ count }} similar</abbr> |
10 | | - {% endblocktrans %} |
11 | | - {% if info.duplicate_count %} |
12 | | - {% blocktrans with dupes=info.duplicate_count trimmed %} |
13 | | - and <abbr title="Duplicate queries are identical to each other: they execute exactly the same SQL and parameters.">{{ dupes }} duplicates</abbr> |
14 | | - {% endblocktrans %} |
15 | | - {% endif %} |
16 | | - {% endif %}) |
17 | | - </li> |
18 | | - {% endfor %} |
| 3 | + {% for alias, info in databases %} |
| 4 | + <li> |
| 5 | + <strong><span class="djdt-color" |
| 6 | + data-djdt-styles="backgroundColor:rgb({{ info.rgb_color|join:', ' }})"></span> {{ alias }}</strong> |
| 7 | + {{ info.time_spent|floatformat:"2" }} ms ({% blocktrans count info.num_queries as num %}{{ num }} query{% plural %}{{ num }} queries{% endblocktrans %} |
| 8 | + {% if info.similar_count %} |
| 9 | + {% blocktrans with count=info.similar_count trimmed %} |
| 10 | + including <abbr title="Similar queries are queries with the same SQL, but potentially different parameters.">{{ count }} similar</abbr> |
| 11 | + {% endblocktrans %} |
| 12 | + {% if info.duplicate_count %} |
| 13 | + {% blocktrans with dupes=info.duplicate_count trimmed %} |
| 14 | + and <abbr title="Duplicate queries are identical to each other: they execute exactly the same SQL and parameters.">{{ dupes }} duplicates</abbr> |
| 15 | + {% endblocktrans %} |
| 16 | + {% endif %} |
| 17 | + {% endif %} |
| 18 | + ) |
| 19 | + </li> |
| 20 | + {% endfor %} |
19 | 21 | </ul> |
20 | | - |
21 | 22 | {% if queries %} |
22 | | - <table> |
23 | | - <colgroup> |
24 | | - <col> |
25 | | - <col> |
26 | | - <col> |
27 | | - <col class="djdt-width-30"> |
28 | | - <col> |
29 | | - <col> |
30 | | - </colgroup> |
31 | | - <thead> |
32 | | - <tr> |
33 | | - <th></th> |
34 | | - <th colspan="2">{% trans "Query" %}</th> |
35 | | - <th>{% trans "Timeline" %}</th> |
36 | | - <th>{% trans "Time (ms)" %}</th> |
37 | | - <th>{% trans "Action" %}</th> |
38 | | - </tr> |
39 | | - </thead> |
40 | | - <tbody> |
41 | | - {% for query in queries %} |
42 | | - <tr class="{% if query.is_slow %} djDebugRowWarning{% endif %}" id="sqlMain_{{ forloop.counter }}"> |
43 | | - <td><span class="djdt-color" data-djdt-styles="backgroundColor:rgb({{ query.rgb_color|join:', '}})"></span></td> |
44 | | - <td class="djdt-toggle"> |
45 | | - <button type="button" class="djToggleSwitch" data-toggle-name="sqlMain" data-toggle-id="{{ forloop.counter }}">+</button> |
46 | | - </td> |
47 | | - <td> |
48 | | - <div class="djDebugSql">{{ query.sql|safe }}</div> |
49 | | - {% if query.similar_count %} |
50 | | - <strong> |
51 | | - <span class="djdt-color" data-djdt-styles="backgroundColor:{{ query.similar_color }}"></span> |
52 | | - {% blocktrans with count=query.similar_count %}{{ count }} similar queries.{% endblocktrans %} |
53 | | - </strong> |
54 | | - {% endif %} |
55 | | - {% if query.duplicate_count %} |
56 | | - <strong> |
57 | | - <span class="djdt-color" data-djdt-styles="backgroundColor:{{ query.duplicate_color }}"></span> |
58 | | - {% blocktrans with dupes=query.duplicate_count %}Duplicated {{ dupes }} times.{% endblocktrans %} |
59 | | - </strong> |
60 | | - {% endif %} |
61 | | - </td> |
62 | | - <td> |
63 | | - <svg class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}{% if query.in_trans %} djDebugLineChartInTransaction{% endif %}" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none" aria-label="{{ query.width_ratio }}%"> |
64 | | - <rect x="{{ query.start_offset|unlocalize }}" y="0" height="5" width="{{ query.width_ratio|unlocalize }}" fill="{{ query.trace_color }}" /> |
65 | | - {% if query.starts_trans %} |
66 | | - <line x1="{{ query.start_offset|unlocalize }}" y1="0" x2="{{ query.start_offset|unlocalize }}" y2="5" /> |
67 | | - {% endif %} |
68 | | - {% if query.ends_trans %} |
69 | | - <line x1="{{ query.end_offset|unlocalize }}" y1="0" x2="{{ query.end_offset|unlocalize }}" y2="5" /> |
70 | | - {% endif %} |
71 | | - </svg> |
72 | | - </td> |
73 | | - <td class="djdt-time"> |
74 | | - {{ query.duration|floatformat:"2" }} |
75 | | - </td> |
76 | | - <td class="djdt-actions"> |
77 | | - {% if query.params %} |
78 | | - {% if query.is_select %} |
79 | | - <form method="post"> |
80 | | - {{ query.form.as_div }} |
81 | | - <button formaction="{% url 'djdt:sql_select' %}" class="remoteCall">Sel</button> |
82 | | - <button formaction="{% url 'djdt:sql_explain' %}" class="remoteCall">Expl</button> |
83 | | - {% if query.vendor == 'mysql' %} |
84 | | - <button formaction="{% url 'djdt:sql_profile' %}" class="remoteCall">Prof</button> |
85 | | - {% endif %} |
86 | | - </form> |
87 | | - {% endif %} |
88 | | - {% endif %} |
89 | | - </td> |
90 | | - </tr> |
91 | | - <tr class="djUnselected {% if query.is_slow %} djDebugRowWarning{% endif %} djToggleDetails_{{ forloop.counter }}" id="sqlDetails_{{ forloop.counter }}"> |
92 | | - <td colspan="2"></td> |
93 | | - <td colspan="4"> |
94 | | - <div class="djSQLDetailsDiv"> |
95 | | - <p><strong>{% trans "Connection:" %}</strong> {{ query.alias }}</p> |
96 | | - {% if query.iso_level %} |
97 | | - <p><strong>{% trans "Isolation level:" %}</strong> {{ query.iso_level }}</p> |
98 | | - {% endif %} |
99 | | - {% if query.trans_status %} |
100 | | - <p><strong>{% trans "Transaction status:" %}</strong> {{ query.trans_status }}</p> |
101 | | - {% endif %} |
102 | | - {% if query.stacktrace %} |
103 | | - <pre class="djdt-stack">{{ query.stacktrace }}</pre> |
104 | | - {% endif %} |
105 | | - {% if query.template_info %} |
106 | | - <table> |
107 | | - {% for line in query.template_info.context %} |
108 | | - <tr> |
109 | | - <td>{{ line.num }}</td> |
110 | | - <td><code {% if line.highlight %}class="djdt-highlighted"{% endif %}>{{ line.content }}</code></td> |
111 | | - </tr> |
112 | | - {% endfor %} |
113 | | - </table> |
114 | | - <p><strong>{{ query.template_info.name|default:_("(unknown)") }}</strong></p> |
115 | | - {% endif %} |
116 | | - </div> |
117 | | - </td> |
118 | | - </tr> |
119 | | - {% endfor %} |
120 | | - </tbody> |
121 | | - </table> |
| 23 | + <table> |
| 24 | + <colgroup> |
| 25 | + <col> |
| 26 | + <col> |
| 27 | + <col> |
| 28 | + </colgroup> |
| 29 | + <thead> |
| 30 | + <tr> |
| 31 | + <th></th> |
| 32 | + <th colspan="2">{% trans "Query" %}</th> |
| 33 | + <th>{% trans "Time (ms)" %}</th> |
| 34 | + </tr> |
| 35 | + </thead> |
| 36 | + <tbody> |
| 37 | + {% for query in queries %} |
| 38 | + <tr class="{% if query.is_slow %} djDebugRowWarning{% endif %}" |
| 39 | + id="sqlMain_{{ forloop.counter }}"> |
| 40 | + <td> |
| 41 | + <span class="djdt-color" |
| 42 | + data-djdt-styles="backgroundColor:rgb({{ query.rgb_color|join:', ' }})"></span> |
| 43 | + </td> |
| 44 | + <td class="djdt-toggle"> |
| 45 | + <button type="button" |
| 46 | + class="djToggleSwitch" |
| 47 | + data-toggle-name="sqlMain" |
| 48 | + data-toggle-id="{{ forloop.counter }}">+</button> |
| 49 | + </td> |
| 50 | + <td> |
| 51 | + <div class="djDebugSql">{{ query.sql|safe }}</div> |
| 52 | + {% if query.similar_count %} |
| 53 | + <strong> |
| 54 | + <span class="djdt-color" |
| 55 | + data-djdt-styles="backgroundColor:{{ query.similar_color }}"></span> |
| 56 | + {% blocktrans with count=query.similar_count %}{{ count }} similar queries.{% endblocktrans %} |
| 57 | + </strong> |
| 58 | + {% endif %} |
| 59 | + {% if query.duplicate_count %} |
| 60 | + <strong> |
| 61 | + <span class="djdt-color" |
| 62 | + data-djdt-styles="backgroundColor:{{ query.duplicate_color }}"></span> |
| 63 | + {% blocktrans with dupes=query.duplicate_count %}Duplicated {{ dupes }} times.{% endblocktrans %} |
| 64 | + </strong> |
| 65 | + {% endif %} |
| 66 | + </td> |
| 67 | + <td class="djdt-time">{{ query.time|floatformat:"2" }}</td> |
| 68 | + </tr> |
| 69 | + <tr class="djUnselected {% if query.is_slow %}djDebugRowWarning{% endif %} djToggleDetails_{{ forloop.counter }}" |
| 70 | + id="sqlDetails_{{ forloop.counter }}"> |
| 71 | + <td colspan="2"></td> |
| 72 | + <td colspan="4"> |
| 73 | + <div class="djSQLDetailsDiv"> |
| 74 | + <p> |
| 75 | + <strong>{% trans "Connection:" %}</strong> {{ query.alias }} |
| 76 | + </p> |
| 77 | + {% if query.iso_level %} |
| 78 | + <p> |
| 79 | + <strong>{% trans "Isolation level:" %}</strong> {{ query.iso_level }} |
| 80 | + </p> |
| 81 | + {% endif %} |
| 82 | + {% if query.trans_status %} |
| 83 | + <p> |
| 84 | + <strong>{% trans "Transaction status:" %}</strong> {{ query.trans_status }} |
| 85 | + </p> |
| 86 | + {% endif %} |
| 87 | + {% if query.stacktrace %}<pre class="djdt-stack">{{ query.stacktrace }}</pre>{% endif %} |
| 88 | + {% if query.template_info %} |
| 89 | + <table> |
| 90 | + {% for line in query.template_info.context %} |
| 91 | + <tr> |
| 92 | + <td>{{ line.num }}</td> |
| 93 | + <td> |
| 94 | + <code {% if line.highlight %}class="djdt-highlighted"{% endif %}>{{ line.content }}</code> |
| 95 | + </td> |
| 96 | + </tr> |
| 97 | + {% endfor %} |
| 98 | + </table> |
| 99 | + <p> |
| 100 | + <strong>{{ query.template_info.name|default:_("(unknown)") }}</strong> |
| 101 | + </p> |
| 102 | + {% endif %} |
| 103 | + </div> |
| 104 | + </td> |
| 105 | + </tr> |
| 106 | + {% endfor %} |
| 107 | + </tbody> |
| 108 | + </table> |
122 | 109 | {% else %} |
123 | | - <p>{% trans "No MQL queries were recorded during this request." %}</p> |
| 110 | + <p>{% trans "No MQL queries were recorded during this request." %}</p> |
124 | 111 | {% endif %} |
0 commit comments