diff options
Diffstat (limited to 'debug_toolbar/templates')
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/base.html | 13 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/sql.html | 144 | 
2 files changed, 86 insertions, 71 deletions
diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index 7f7a535..d039ade 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -1,10 +1,9 @@  {% load i18n %} -<script type="text/javascript"> -// <![CDATA[ -var DEBUG_TOOLBAR_MEDIA_URL = "{{ DEBUG_TOOLBAR_MEDIA_URL }}"; -// ]]> -</script> -<script type="text/javascript" src="{{ DEBUG_TOOLBAR_MEDIA_URL }}js/toolbar.min.js"></script> +<style type="text/css"> +@media print { #djDebug {display:none;}} +{{ css }} +</style> +<script type="text/javascript">{{ js }}</script>  <div id="djDebug" style="display:none;">  	<div style="display:none;" id="djDebugToolbar">  		<ul id="djDebugPanelList"> @@ -14,7 +13,7 @@ var DEBUG_TOOLBAR_MEDIA_URL = "{{ DEBUG_TOOLBAR_MEDIA_URL }}";  			<li id="djDebugButton">DEBUG</li>  			{% endif %}  			{% for panel in panels %} -				<li> +				<li class="djDebugPanelButton">  					{% if panel.has_content %}  						<a href="{{ panel.url|default:"#" }}" title="{{ panel.title }}" class="{{ panel.dom_id }}">  					{% else %} diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html index 626ec5c..50acd6e 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html @@ -1,71 +1,87 @@  {% load i18n %} -<table> -	<thead> -		<tr> -			<th>{% trans "Time" %} (ms)</th> -			<th>{% trans "Action" %}</th> -			<th>{% trans 'Stacktrace' %}</th> -			<th>{% trans 'Alias' %}</th> -			<th>{% trans 'Query' %}</th> -		</tr> -	</thead> -	<tbody> -		{% for query in queries %} -			<tr class="{% cycle 'djDebugOdd' 'djDebugEven' %}"> -				<td>{{ query.duration|floatformat:"2" }}</td> -				<td> -				{% if query.params %} -					{% if query.is_select %} -						<a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">SELECT</a><br /> -						<a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">EXPLAIN</a><br /> -						{% if is_mysql %} -							<a class="remoteCall" href="/__debug__/sql_profile/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">PROFILE</a><br /> +<div class="clearfix"> +	<ul class="stats"> +		{% for alias, info in databases %} +			<li> +				<strong class="label"><span style="background-color: rgb({{ info.rgb_color|join:", " }})" class="color"> </span> {{ alias }}</strong> +				<span class="info">{{ info.time_spent|floatformat:"2" }} ms ({% blocktrans count info.num_queries as num %}{{ num }} query{% plural %}{{ num }} queries{% endblocktrans %})</span> +			</li> +		{% endfor %} +	</ul> +</div> + +{% if queries %} +	<table> +		<thead> +			<tr> +				<th class="color"> </th> +				<th class="query" colspan="2">{% trans 'Query' %}</th> +				<th class="timeline">{% trans 'Timeline' %}</th> +				<th class="time">{% trans 'Time (ms)' %}</th> +				<th class="actions">{% trans "Action" %}</th> +			</tr> +		</thead> +		<tbody> +			{% for query in queries %} +				<tr class="djDebugHoverable {% cycle 'djDebugOdd' 'djDebugEven' %}{% if query.is_slow %} djDebugRowWarning{% endif %}{% if query.starts_trans %} djDebugStartTransaction{% endif %}{% if query.ends_trans %} djDebugEndTransaction{% endif %}{% if query.in_trans %} djDebugInTransaction{% endif %}" id="sqlMain_{{ forloop.counter }}"> +					<td class="color"><span style="background-color: rgb({{ query.rgb_color|join:", " }});"> </span></td> +					<td class="toggle"> +						<a class="djSQLToggleDetails" data-queryid="{{ forloop.counter }}" href="javascript:void(0)">+</a> +					</td> +					<td class="query"> +						<div class="djDebugSqlWrap"> +							<div class="djDebugSql">{{ query.sql|safe }}</div> +						</div> +					</td> +					<td class="timeline"> +						<div class="djDebugTimeline"><div class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}" style="left:{{ query.start_offset }}%;"><strong style="width:{{ query.width_ratio }}%;">{{ query.width_ratio }}%</strong></div></div> +					</td> +					<td class="time"> +						{{ query.duration|floatformat:"2" }} +					</td> +					<td class="actions"> +					{% if query.params %} +						{% if query.is_select %} +							<a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">Sel</a> +							<a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">Expl</a> +							{% ifequal query.engine 'mysql' %} +								<a class="remoteCall" href="/__debug__/sql_profile/?sql={{ query.raw_sql|urlencode }}&params={{ query.params|urlencode }}&duration={{ query.duration|floatformat:"2"|urlencode }}&hash={{ query.hash }}">Prof</a> +							{% endifequal %}  						{% endif %}  					{% endif %} -				{% endif %} -				</td> -				<td> -					{% if query.stacktrace %} -					<div class="djSQLShowStacktraceDiv"><a class="djSQLShowStacktrace" href="#">Toggle Stacktrace</a></div> -					{% endif %} -				</td> -				<td>{{ query.alias }}</td> -				<td class="syntax"> -					<div class="djDebugSqlWrap"> -						<div class="djDebugSql">{{ query.sql|safe }}</div> -						{% if query.stacktrace %} -						<div class="djSQLHideStacktraceDiv" style="display:none;"> -							<table> -								<tr> -									<th>{% trans "Line" %}</th> -									<th>{% trans "Method" %}</th> -									<th>{% trans "File" %}</th> -								</tr> -								{% for file, line, method in query.stacktrace %} +					</td> +				</tr> +				<tr class="djHiddenByDefault djDebugHoverable {% cycle 'djDebugOdd' 'djDebugEven' %}{% if query.is_slow %} djDebugRowWarning{% endif %}" id="sqlDetails_{{ forloop.counter }}"> +					<td colspan="2"></td> +					<td colspan="4"> +						<div class="djSQLDetailsDiv"> +							<p><strong>Connection:</strong> {{ query.alias }}</p> +							{% if query.iso_level %} +								<p><strong>Isolation Level:</strong> {{ query.iso_level }}</p> +							{% endif %} +							{% if query.trans_status %} +								<p><strong>Transaction Status:</strong> {{ query.trans_status }}</p> +							{% endif %} +							{% if query.stacktrace %} +								<pre>{{ query.stacktrace }}</pre> +							{% endif %} +							{% if query.template_info %} +								<table> +									{% for line in query.template_info.context %}  									<tr> -										<td>{{ line }}</td> -										<td><code>{{ method|escape }}</code></td> -										<td><code>{{ file|escape }}</code></td> +										<td>{{ line.num }}</td> +										<td><code style="font-family: monospace;{% if line.highlight %}background-color: lightgrey{% endif %}">{{ line.content }}</code></td>  									</tr> -								{% endfor %} -							</table> -							{% if query.template_info %} -							<table> -								{% for line in query.template_info.context %} -								<tr> -									<td>{{ line.num }}</td> -									<td><code style="font-family: monospace;{% if line.highlight %}background-color: lightgrey{% endif %}">{{ line.content }}</code></td> -								</tr> -								{% endfor %} -							</table> -							<p><strong>{{ query.template_info.name|default:"(unknown)" }}</strong></p> +									{% endfor %} +								</table> +								<p><strong>{{ query.template_info.name|default:"(unknown)" }}</strong></p>  							{% endif %}  						</div> -						{% endif %} -            <span class="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %}" style="width:{{ query.width_ratio }}%; left:{{ query.start_offset }}%;"></span> -					</div> -				</td> -			</tr> -		{% endfor %} -	</tbody> -</table> +					</td> +				</tr> +			{% endfor %} +		</tbody> +	</table> +{% else %} +	<p>No SQL queries were recorded during this request.</p> +{% endif %}  | 
