|
| 1 | +{% load i18n l10n %} |
| 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 %} |
| 19 | +</ul> |
| 20 | + |
| 21 | +{% 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> |
| 122 | +{% else %} |
| 123 | + <p>{% trans "No MQL queries were recorded during this request." %}</p> |
| 124 | +{% endif %} |
0 commit comments