From 06cc9ff32d76bb59a6ce343944e0ef64772e1312 Mon Sep 17 00:00:00 2001 From: Juti Noppornpitak Date: Fri, 1 Jun 2012 14:12:35 -0400 Subject: [PATCH] Adjust the width of the timeline in the profiler dynamically when the (browser) window is resized. --- .../Resources/public/css/profiler.css | 18 +- .../Resources/views/Collector/time.html.twig | 490 ++++++++++++------ 2 files changed, 338 insertions(+), 170 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css b/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css index 98fedff4cb..5a48182faa 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css @@ -455,4 +455,20 @@ td.main, td.menu { background: transparent url(../images/profiler/spinner.gif) scroll no-repeat 50% 50%; height: 30px; display: none; -} \ No newline at end of file +} + +.sf-profiler-timeline .legends { + font-size: 12px; + line-height: 1.5em; +} + +.sf-profiler-timeline .legends span { + border-left-width: 10px; + border-left-style: solid; + padding: 0 10px 0 5px; +} + +.sf-profiler-timeline canvas { + border: 1px solid #999; + border-width: 1px 0; +} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig index f83dbb1519..cc7552fa62 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig @@ -37,10 +37,7 @@ {% block panel %}

Timeline

- {% set threshold = app.request.query.get('threshold', 1) %} - {% set width = app.request.query.get('width', 680) %} - -
+ @@ -53,15 +50,7 @@ - - - - - - - - - +
Threshold ms
Width px
  ms
@@ -71,174 +60,319 @@ - {{ collector.events.__section__.totaltime }} ms {% if profile.parent %} - - parent + - parent {% endif %} {% set max = collector.events.__section__.endtime %} - {{ _self.display_timeline('timeline_' ~ token, collector.events, threshold, colors, width) }} + {{ _self.display_timeline('timeline_' ~ token, collector.events, colors) }} {% if profile.children|length %} {% for child in profile.children %} {% set events = child.getcollector('time').events %}

- Sub-request "{{ child.getcollector('request').requestattributes.get('_controller') }}" + Sub-request "{{ child.getcollector('request').requestattributes.get('_controller') }}" - {{ events.__section__.totaltime }} ms

- {{ _self.display_timeline('timeline_' ~ child.token, events, threshold, colors, width) }} + {{ _self.display_timeline('timeline_' ~ child.token, events, colors) }} {% endfor %} {% endif %} {% endblock %} @@ -289,19 +447,13 @@ {% endfor %} {% endmacro %} -{% macro display_timeline(id, events, threshold, colors, width) %} - {% set height = 0 %} - {% for name, event in events if '__section__' != name and event.totaltime >= threshold %} - {% set height = height + 38 %} - {% endfor %} - -
- +{% macro display_timeline(id, events, colors) %} +
+
{% for category, color in colors %} -     {{ category }}   + {{ category }} {% endfor %} - +
+
- - {% endmacro %}