Skip to content

Commit 8fd9721

Browse files
committed
bug #20294 Improved the design of the metrics in the profiler (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #20294). Discussion ---------- Improved the design of the metrics in the profiler | Q | A | | --- | --- | | Branch? | 2.8 | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | - | | License | MIT | | Doc PR | | - Performance panel now displays Sub-Requests a bit separated from the normal metrics - Singular/plural: when there is 1 sub-request, we don't display "sub-request**s**" anymore ### Before ![before_subrequests](https://cloud.githubusercontent.com/assets/73419/19680261/5289fd26-9aa5-11e6-8702-1ac50997da78.png) ### After ![after_subrequests](https://cloud.githubusercontent.com/assets/73419/19680272/57324b44-9aa5-11e6-8d85-44cc089bd9f4.png) - Add bottom margin to metrics so they are correctly displayed when the screen is very small. ### Before & After ![metrics-small-screens](https://cloud.githubusercontent.com/assets/73419/19680259/4f826654-9aa5-11e6-9ed8-1ffe9a3db8bf.png) Commits ------- d030a9d Improved the design of the metrics in the profiler
2 parents 8d5c563 + d030a9d commit 8fd9721

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,19 @@
6060
<span class="label">Symfony initialization</span>
6161
</div>
6262

63+
{% if profile.collectors.memory %}
64+
<div class="metric">
65+
<span class="value">{{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} <span class="unit">MB</span></span>
66+
<span class="label">Peak memory usage</span>
67+
</div>
68+
{% endif %}
69+
6370
{% if profile.children|length > 0 %}
71+
<div class="metric-divider"></div>
72+
6473
<div class="metric">
6574
<span class="value">{{ profile.children|length }}</span>
66-
<span class="label">Sub-Requests</span>
75+
<span class="label">Sub-Request{{ profile.children|length > 1 ? 's' }}</span>
6776
</div>
6877

6978
{% set subrequests_time = 0 %}
@@ -73,14 +82,7 @@
7382

7483
<div class="metric">
7584
<span class="value">{{ subrequests_time }} <span class="unit">ms</span></span>
76-
<span class="label">Sub-Requests time</span>
77-
</div>
78-
{% endif %}
79-
80-
{% if profile.collectors.memory %}
81-
<div class="metric">
82-
<span class="value">{{ '%.2f'|format(profile.collectors.memory.memory / 1024 / 1024) }} <span class="unit">MB</span></span>
83-
<span class="label">Peak memory usage</span>
85+
<span class="label">Sub-Request{{ profile.children|length > 1 ? 's' }} time</span>
8486
</div>
8587
{% endif %}
8688
</div>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ table tbody ul {
250250
{# Metrics
251251
------------------------------------------------------------------------- #}
252252
.metrics {
253-
margin: 1em 0;
253+
margin: 1em 0 0;
254254
overflow: auto;
255255
}
256256
.metrics .metric {
257257
float: left;
258-
margin-right: 1em;
258+
margin: 0 1em 1em 0;
259259
}
260260

261261
.metric {
@@ -310,6 +310,12 @@ table tbody ul {
310310
vertical-align: middle;
311311
}
312312

313+
.metric-divider {
314+
float: left;
315+
margin: 0 1em;
316+
min-height: 1px; {# required to apply 'margin' to an empty 'div' #}
317+
}
318+
313319
{# Cards
314320
------------------------------------------------------------------------- #}
315321
.card {

0 commit comments

Comments
 (0)