Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b25b6dd

Browse files
committed
Finished "dump" panel and other minor tweaks
1 parent 2bccdd4 commit b25b6dd

File tree

7 files changed

+72
-33
lines changed

7 files changed

+72
-33
lines changed

src/Symfony/Bundle/DebugBundle/Resources/views/Profiler/dump.html.twig

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55

66
{% if dumps_count %}
77
{% set icon %}
8-
<svg width="21" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 21 28" enable-background="new 0 0 21 28" xml:space="preserve"><path fill="#3F3F3F" d="M21 14h-1c-0.3-4.8-4.1-8.7-9-9V4h-1v1c-4.8 0.3-8.7 4.1-9 9H0v1h1c0.3 4.8 4.1 8.7 9 9v1h1v-1 c4.8-0.3 8.7-4.1 9-9h1V14z M11 22v-4h-1v4c-3.7-0.2-6.7-3.2-7-7h4v-1H3c0.2-3.7 3.2-6.7 7-7v4h1V7c3.7 0.2 6.7 3.2 7 7h-4v1h4 C17.7 18.7 14.7 21.7 11 22z"/></svg>
9-
<span class="sf-toolbar-status sf-toolbar-status-yellow">{{ dumps_count }}</span>
8+
<svg width="21" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 21 28" enable-background="new 0 0 21 28" xml:space="preserve"><path fill="#AAA" d="M21 14h-1c-0.3-4.8-4.1-8.7-9-9V4h-1v1c-4.8 0.3-8.7 4.1-9 9H0v1h1c0.3 4.8 4.1 8.7 9 9v1h1v-1 c4.8-0.3 8.7-4.1 9-9h1V14z M11 22v-4h-1v4c-3.7-0.2-6.7-3.2-7-7h4v-1H3c0.2-3.7 3.2-6.7 7-7v4h1V7c3.7 0.2 6.7 3.2 7 7h-4v1h4 C17.7 18.7 14.7 21.7 11 22z"/></svg>
9+
<span class="sf-toolbar-value">{{ dumps_count }}</span>
1010
{% endset %}
1111

1212
{% set text %}
13-
<div class="sf-toolbar-info-piece">
14-
<b>dump()</b>
15-
</div>
1613
{% for dump in collector.getDumps('html') %}
1714
<div class="sf-toolbar-info-piece">
18-
in
15+
<span>
1916
{% if dump.file %}
2017
{% set link = dump.file|file_link(dump.line) %}
2118
{% if link %}
@@ -26,14 +23,15 @@
2623
{% else %}
2724
{{ dump.name }}
2825
{% endif %}
29-
line {{ dump.line }}:
26+
</span>
27+
<span class="sf-toolbar-file-line">line {{ dump.line }}</span>
3028
{{ dump.data|raw }}
3129
</div>
3230
{% endfor %}
3331
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" onload="var h = this.parentNode.innerHTML, rx=/<script>(.*?)<\/script>/g, s; while (s = rx.exec(h)) {eval(s[1]);};" />
3432
{% endset %}
3533

36-
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %}
34+
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
3735
{% endif %}
3836
{% endblock %}
3937

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
{% block toolbar %}
66
{% if collector.data.nb_errors > 0 or collector.data.forms|length %}
7+
{% set status_color = collector.data.nb_errors ? 'red' : '' %}
78
{% set icon %}
8-
<svg width="20" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 20 28" enable-background="new 0 0 20 28" xml:space="preserve"><g><polygon fill="#AAA" points="16,5 13,5 13,3 7,3 7,5 4,5 4,9 16,9"></polygon><path fill="#AAA" d="M17 6v4H3V6H0v19h20V6H17z M8 22H3v-1h5V22z M17 20H3v-1h14V20z M17 18H3v-1h14V18z M17 16H3v-1h14V16z M17 14H4v-1h13V14z"></path></g></svg>
9+
{{ include('@WebProfiler/Icon/form.svg.twig') }}
910
<span class="sf-toolbar-value">
1011
{% if collector.data.nb_errors %}
1112
{{ collector.data.nb_errors }}
@@ -15,7 +16,18 @@
1516
</span>
1617
{% endset %}
1718

18-
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: collector.data.nb_errors ? 'red' : '' }) }}
19+
{% set text %}
20+
<div class="sf-toolbar-info-piece">
21+
<b>Number of forms</b>
22+
<span class="sf-toolbar-status">{{ collector.data.forms|length }}</span>
23+
</div>
24+
<div class="sf-toolbar-info-piece">
25+
<b>Number of errors</b>
26+
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.data.nb_errors > 0 ? 'red' }}">{{ collector.data.nb_errors }}</span>
27+
</div>
28+
{% endset %}
29+
30+
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
1931
{% endif %}
2032
{% endblock %}
2133

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,29 @@
55
{% block toolbar %}
66
{% if collector.counterrors or collector.countdeprecations or collector.countscreams %}
77
{% set icon %}
8-
<svg width="16" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 16 28" enable-background="new 0 0 16 28" xml:space="preserve"><g><path fill="#AAA" d="M15 6h-1V5c0-0.5-0.5-1-1-1H2C1.4 4 1 4.4 1 5v2v13c0 1.6 1.3 3 3 3h11c0.5 0 1-0.5 1-1V7 C16 6.5 15.5 6 15 6z M6 15h3v3H6V15z M6 13V7h3v6H6z M15 21c0 0.6-0.4 1-1 1H5c-0.9 0-1.7-0.4-2.2-1H13c0.6 0 1-0.4 1-1V7 c0.5 0 1 0.5 1 1V21z"/></g></svg>
98
{% set status_color = collector.counterrors ? 'red' : collector.countdeprecations ? 'yellow' : '' %}
109
{% set error_count = collector.counterrors + collector.countdeprecations + collector.countscreams %}
10+
{{ include('@WebProfiler/Icon/logger.svg.twig') }}
1111
<span class="sf-toolbar-value">{{ error_count }}</span>
1212
{% endset %}
13+
1314
{% set text %}
14-
{% if collector.counterrors %}
15-
<div class="sf-toolbar-info-piece">
16-
<b>Errors</b>
17-
<span class="sf-toolbar-status sf-toolbar-status-red">{{ collector.counterrors }}</span>
18-
</div>
19-
{% endif %}
20-
{% if collector.countdeprecations %}
21-
<div class="sf-toolbar-info-piece">
22-
<b>Deprecated Calls</b>
23-
<span class="sf-toolbar-status sf-toolbar-status-yellow">{{ collector.countdeprecations }}</span>
24-
</div>
25-
{% endif %}
26-
{% if collector.countscreams %}
27-
<div class="sf-toolbar-info-piece">
28-
<b>Silenced Errors</b>
29-
<span class="sf-toolbar-status sf-toolbar-status">{{ collector.countscreams }}</span>
30-
</div>
31-
{% endif %}
15+
<div class="sf-toolbar-info-piece">
16+
<b>Errors</b>
17+
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.counterrors ? 'red' }}">{{ collector.counterrors|default(0) }}</span>
18+
</div>
19+
20+
<div class="sf-toolbar-info-piece">
21+
<b>Deprecated Calls</b>
22+
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.countdeprecations ? 'yellow' }}">{{ collector.countdeprecations|default(0) }}</span>
23+
</div>
24+
25+
<div class="sf-toolbar-info-piece">
26+
<b>Silenced Errors</b>
27+
<span class="sf-toolbar-status">{{ collector.countscreams|default(0) }}</span>
28+
</div>
3229
{% endset %}
30+
3331
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
3432
{% endif %}
3533
{% endblock %}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<span class="sf-toolbar-label">MB</span>
99
</span>
1010
{% endset %}
11+
1112
{% set text %}
1213
<div class="sf-toolbar-info-piece">
1314
<b>Peak memory usage</b>
@@ -16,8 +17,9 @@
1617

1718
<div class="sf-toolbar-info-piece">
1819
<b>PHP memory limit</b>
19-
<span>{{ collector.memoryLimit == -1 ? '&infin;' : '%.1f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB</span>
20+
<span>{{ collector.memoryLimit == -1 ? '&infin;' : '%.0f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB</span>
2021
</div>
2122
{% endset %}
23+
2224
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false, status: status_color }) }}
2325
{% endblock %}

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,26 @@
1616
{% endif %}
1717

1818
{% block toolbar %}
19-
{% set duration = collector.events|length ? '%.0f'|format(collector.duration) : 'n/a' %}
19+
{% set total_time = collector.events|length ? '%.0f'|format(collector.duration) : 'n/a' %}
20+
{% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %}
2021
{% set status_color = collector.events|length ? collector.duration > 1000 ? 'yellow' : '' %}
22+
2123
{% set icon %}
22-
<span class="sf-toolbar-value">{{ duration }}</span>
24+
<span class="sf-toolbar-value">{{ total_time }}</span>
2325
<span class="sf-toolbar-label">ms</span>
2426
{% endset %}
27+
2528
{% set text %}
2629
<div class="sf-toolbar-info-piece">
2730
<b>Total time</b>
28-
<span>{{ duration }} ms</span>
31+
<span>{{ total_time }} ms</span>
32+
</div>
33+
<div class="sf-toolbar-info-piece">
34+
<b>Initialization time</b>
35+
<span>{{ initialization_time }} ms</span>
2936
</div>
3037
{% endset %}
38+
3139
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
3240
{% endblock %}
3341

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<span class="sf-toolbar-label">ms</span>
1010
</span>
1111
{% endset %}
12+
1213
{% set text %}
1314
<div class="sf-toolbar-info-piece">
1415
<b>Render Time</b>
@@ -27,6 +28,7 @@
2728
<span class="sf-toolbar-status">{{ collector.macrocount }}</span>
2829
</div>
2930
{% endset %}
31+
3032
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }}
3133
{% endblock %}
3234

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
margin-right: 0px;
8282
white-space: nowrap;
8383
}
84+
.sf-toolbar-block a,
8485
.sf-toolbar-block a:hover {
8586
text-decoration: none;
8687
}
@@ -371,6 +372,24 @@
371372
100% { color: black; }
372373
}
373374

375+
.sf-toolbar-block-dump pre.sf-dump {
376+
background-color: #222;
377+
border-color: #777;
378+
border-radius: 0;
379+
margin: 6px 0 12px 0;
380+
width: 200px;
381+
}
382+
.sf-toolbar-block-dump pre.sf-dump:last-child {
383+
margin-bottom: 0;
384+
}
385+
.sf-toolbar-block-dump .sf-toolbar-info-piece .sf-toolbar-file-line {
386+
color: #AAA;
387+
margin-left: 4px;
388+
}
389+
.sf-toolbar-block-dump .sf-toolbar-info img {
390+
display: none;
391+
}
392+
374393
/***** Override the setting when the toolbar is on the top *****/
375394
{% if position == 'top' %}
376395
.sf-minitoolbar {

0 commit comments

Comments
 (0)