File tree Expand file tree Collapse file tree 5 files changed +27
-41
lines changed
templates/debug_toolbar/panels Expand file tree Collapse file tree 5 files changed +27
-41
lines changed Original file line number Diff line number Diff line change @@ -215,12 +215,8 @@ def duplicate_key(query):
215215 query ["rgb_color" ] = self ._databases [alias ]["rgb_color" ]
216216 try :
217217 query ["width_ratio" ] = (query ["duration" ] / self ._sql_time ) * 100
218- query ["width_ratio_relative" ] = (
219- 100.0 * query ["width_ratio" ] / (100.0 - width_ratio_tally )
220- )
221218 except ZeroDivisionError :
222219 query ["width_ratio" ] = 0
223- query ["width_ratio_relative" ] = 0
224220 query ["start_offset" ] = width_ratio_tally
225221 query ["end_offset" ] = query ["width_ratio" ] + query ["start_offset" ]
226222 width_ratio_tally += query ["width_ratio" ]
Original file line number Diff line number Diff line change 421421# djDebug .djdt-timeline {
422422 width : 30% ;
423423}
424- # djDebug .djDebugTimeline {
425- position : relative;
426- height : 100% ;
427- min-height : 100% ;
428- }
429- # djDebug div .djDebugLineChart {
430- position : absolute;
431- left : 0 ;
432- right : 0 ;
433- top : 0 ;
434- bottom : 0 ;
435- vertical-align : middle;
436- }
437- # djDebug div .djDebugLineChart strong {
438- text-indent : -10000em ;
439- display : block;
440- font-weight : normal;
441- vertical-align : middle;
442- background-color : # ccc ;
443- }
444424
445- # djDebug div .djDebugLineChartWarning strong {
446- background-color : # 900 ;
425+ # djDebug svg .djDebugLineChart {
426+ width : 100% ;
427+ height : 1.5em ;
447428}
448429
449- # djDebug . djDebugInTransaction div . djDebugLineChart strong {
450- background-color : # d3ff82 ;
430+ # djDebug svg . djDebugLineChartWarning rect {
431+ fill : # 900 ;
451432}
452- # djDebug .djDebugStartTransaction div .djDebugLineChart strong {
453- border-left : 1px solid # 94b24d ;
433+
434+ # djDebug svg .djDebugLineChartInTransaction rect {
435+ fill : # d3ff82 ;
454436}
455- # djDebug . djDebugEndTransaction div . djDebugLineChart strong {
456- border-right : 1 px solid # 94b24d ;
437+ # djDebug svg . djDebugLineChart line {
438+ stroke : # 94b24d ;
457439}
458440
459441# djDebug .djdt-panelContent ul .djdt-stats {
Original file line number Diff line number Diff line change @@ -15,17 +15,17 @@ function addRow(stat, endStat) {
1515 if ( endStat ) {
1616 // Render a start through end bar
1717 row . innerHTML = '<td>' + stat . replace ( 'Start' , '' ) + '</td>' +
18- '<td class="djdt-timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong ></div></div ></td>' +
18+ '<td class="djdt-timeline"><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" / ></svg ></td>' +
1919 '<td>' + ( performance . timing [ stat ] - timingOffset ) + ' (+' + ( performance . timing [ endStat ] - performance . timing [ stat ] ) + ')</td>' ;
20- row . querySelector ( 'strong ' ) . style . width = getCSSWidth ( stat , endStat ) ;
20+ row . querySelector ( 'rect ' ) . setAttribute ( ' width' , getCSSWidth ( stat , endStat ) ) ;
2121 } else {
2222 // Render a point in time
2323 row . innerHTML = '<td>' + stat + '</td>' +
24- '<td class="djdt-timeline"><div class="djDebugTimeline"><div class="djDebugLineChart"><strong> </strong ></div></div ></td>' +
24+ '<td class="djdt-timeline"><svg class="djDebugLineChart" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 5" preserveAspectRatio="none"><rect y="0" height="5" fill="#ccc" / ></svg ></td>' +
2525 '<td>' + ( performance . timing [ stat ] - timingOffset ) + '</td>' ;
26- row . querySelector ( 'strong ' ) . style . width = '2px' ;
26+ row . querySelector ( 'rect ' ) . setAttribute ( ' width' , 2 ) ;
2727 }
28- row . querySelector ( '.djDebugLineChart ' ) . style . left = getLeft ( stat ) + '%' ;
28+ row . querySelector ( 'rect ' ) . setAttribute ( 'x' , getLeft ( stat ) ) ;
2929 document . querySelector ( '#djDebugBrowserTimingTableBody' ) . appendChild ( row ) ;
3030}
3131
Original file line number Diff line number Diff line change 3434 </ thead >
3535 < tbody >
3636 {% for query in queries %}
37- < tr class ="{% 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 }} ">
37+ < tr class ="{% if query.is_slow %} djDebugRowWarning{% endif %} " id ="sqlMain_{{ forloop.counter }} ">
3838 < td class ="djdt-color "> < span style ="background-color:rgb({{ query.rgb_color|join:', '}}) ">  </ span > </ td >
3939 < td class ="djdt-toggle ">
4040 < a class ="djToggleSwitch " data-toggle-name ="sqlMain " data-toggle-id ="{{ forloop.counter }} " data-toggle-open ="+ " data-toggle-close ="- " href =""> +</ a >
5757 {% endif %}
5858 </ td >
5959 < td class ="djdt-timeline ">
60- < div class ="djDebugTimeline "> < div class ="djDebugLineChart{% if query.is_slow %} djDebugLineChartWarning{% endif %} " style ="left:{{ query.start_offset|unlocalize }}% "> < strong style ="width:{{ query.width_ratio_relative|unlocalize }}%;background-color:{{ query.trace_color }} "> {{ query.width_ratio }}%</ strong > </ div > </ div >
60+ < 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 }}% ">
61+ < rect x ="{{ query.start_offset|unlocalize }} " y ="0 " height ="5 " width ="{{ query.width_ratio|unlocalize }} " fill ="{{ query.trace_color }} " />
62+ {% if query.starts_trans %}
63+ < line x1 ="{{ query.start_offset|unlocalize }} " y1 ="0 " x2 ="{{ query.start_offset|unlocalize }} " y2 ="5 " />
64+ {% endif %}
65+ {% if query.ends_trans %}
66+ < line x1 ="{{ query.end_offset|unlocalize }} " y1 ="0 " x2 ="{{ query.end_offset|unlocalize }} " y2 ="5 " />
67+ {% endif %}
68+ </ svg >
6169 </ td >
6270 < td class ="djdt-time ">
6371 {{ query.duration|floatformat:"2" }}
Original file line number Diff line number Diff line change 11{% load i18n %}
22< table >
33 < colgroup >
4- < col style =" width:15% ">
5- < col style =" width:15% ">
4+ < col class =" djdt- width-20 ">
5+ < col class =" djdt- width-20 ">
66 < col >
77 </ colgroup >
88 < thead >
You can’t perform that action at this time.
0 commit comments