Skip to content

Commit 1e6b29b

Browse files
committed
make timeline breakup space height adaptable on it's content
1 parent 6951ba8 commit 1e6b29b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

template_profiler_panel/panels/template.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def _calc_timeline(self, start, end, processing_timeline):
202202
result['relative_end'] = (end - self.t_min) * 1000.0
203203

204204
result['processing_timeline'] = []
205+
max_level = 0
205206
for time_item in processing_timeline:
206207
if 'node' in time_item:
207208
class_name = time_item['node'].__class__.__name__
@@ -214,6 +215,9 @@ def _calc_timeline(self, start, end, processing_timeline):
214215
position = time_item['node'].token.position
215216
else:
216217
False
218+
level = time_item['level'] if 'level' in time_item else 0
219+
if level > max_level:
220+
max_level = level
217221
result['processing_timeline'].append({
218222
'name': time_item['name'],
219223
'position': position,
@@ -227,8 +231,9 @@ def _calc_timeline(self, start, end, processing_timeline):
227231
time_item['start']-self.t_min,
228232
self.t_max - self.t_min),
229233
'bg_color': bg_color,
230-
'level': time_item['level'] if 'level' in time_item else 0,
234+
'level': level,
231235
})
236+
result['max_level'] = max_level
232237

233238
return result
234239

template_profiler_panel/templates/template_profiler_panel/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h4>{{ templates|length }} {% trans 'calls to Template.render()' %}</h4>
4343
<td></td>
4444
<td></td>
4545
<td>
46-
<div style="height: 200px; position:relative;" class="timeline_toggle_{{ forloop.counter }} djToggleDetails_{{ forloop.counter }} djSelected" id="sqlDetails_{{ forloop.counter }}">
46+
<div style="height: calc({{ template.max_level|add:1 }}px * 18); position:relative;" class="timeline_toggle_{{ forloop.counter }} djToggleDetails_{{ forloop.counter }} djSelected" id="sqlDetails_{{ forloop.counter }}">
4747
{% for time_item in template.processing_timeline %}
4848
<span title="{{ time_item.name }}
4949
Runtime {{ time_item.relative_start|floatformat:2 }} - {{ time_item.relative_end|floatformat:2 }} ms

0 commit comments

Comments
 (0)