Skip to content

Redesigned the web debug toolbar #15160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Jul 31, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c2fcadc
Redesigned the web debug toolbar
javiereguiluz Jul 1, 2015
b6f413f
First batch of fixes
javiereguiluz Jul 2, 2015
4eee931
Restored all the code removed by mistake
javiereguiluz Jul 2, 2015
64b8f38
A new batch of updates
javiereguiluz Jul 8, 2015
2735346
Fixed a minor markup error that broke the toolbar
javiereguiluz Jul 8, 2015
51a79c9
Reorder toolbar panels
javiereguiluz Jul 8, 2015
ef53850
More fixes and tweaks
javiereguiluz Jul 8, 2015
fac5391
Lots of minor improvements
javiereguiluz Jul 8, 2015
acee052
Finished the Ajax panel redesign
javiereguiluz Jul 8, 2015
af3dcb2
Minor Ajax tweaks
javiereguiluz Jul 8, 2015
041d424
Improved the Security toolbar panel
javiereguiluz Jul 9, 2015
77d522a
Tweaked the translation panel
javiereguiluz Jul 9, 2015
c0bee9b
Tweaked the Twig panel
javiereguiluz Jul 9, 2015
2bccdd4
Minor CSS fixes
javiereguiluz Jul 9, 2015
b25b6dd
Finished "dump" panel and other minor tweaks
javiereguiluz Jul 9, 2015
9d89841
Finished the toolbar redesign
javiereguiluz Jul 9, 2015
e14fb6d
Fixed a minor syntax issue
javiereguiluz Jul 9, 2015
7c35d25
Fixed another insignificant syntax issue
javiereguiluz Jul 9, 2015
23dc884
Fixed a potential issue in the request panel
javiereguiluz Jul 9, 2015
e28f895
A very high z-index value is required to avoid issues in the profiler…
javiereguiluz Jul 9, 2015
cd53210
Fixed another z-index issue
javiereguiluz Jul 10, 2015
0dfcb60
Fixed an issue with the Config panel in the Profiler view
javiereguiluz Jul 10, 2015
9e38a8a
Minor CSS tweaks and made font sizes bigger
javiereguiluz Jul 10, 2015
f087ac0
More vertical aligning fixes
javiereguiluz Jul 10, 2015
3ab2e20
fixed all vertical aligning issues and tweaked icons
javiereguiluz Jul 14, 2015
9b585b9
Made the close icon a bit smaller
javiereguiluz Jul 14, 2015
e94a6a0
Smaller font sizes for smartphones, fixed request status padding issue
javiereguiluz Jul 20, 2015
002dda5
Fixed toolbar issues when displaying it inside the profiler
javiereguiluz Jul 20, 2015
a0e03f6
Minor tweaks
javiereguiluz Jul 20, 2015
1847285
Pass the toolbar version number from the controller, to ease transiti…
javiereguiluz Jul 20, 2015
ebb44e4
Added some styles to make old panels look better in the new design
javiereguiluz Jul 20, 2015
972a92e
Misc. tweaks and improvements
javiereguiluz Jul 22, 2015
084cca6
Minor JavaScript optimizations
javiereguiluz Jul 22, 2015
7ec1cd4
Reverted the feature to display different toolbar versions
javiereguiluz Jul 27, 2015
2fb3319
Removed an unused import
javiereguiluz Jul 30, 2015
5070861
Added a new profiler_markup_version to improve BC of the new toolbar
javiereguiluz Jul 30, 2015
22f6bc5
Removed an useless CSS class and added styles for <hr>
javiereguiluz Jul 30, 2015
9df0f8b
Added some upgrade notes about the new toolbar design
javiereguiluz Jul 31, 2015
597637e
Tweaks and bug fixes
javiereguiluz Jul 31, 2015
7d92cb8
Restored the old behavior for toolbars with lots of elements
javiereguiluz Jul 31, 2015
b438ee5
Redesigned "abbr" elements
javiereguiluz Jul 31, 2015
b3ad83d
Removed an unused media query
javiereguiluz Jul 31, 2015
f237ff1
Increased the z-index of .sf-toolbar-info
javiereguiluz Jul 31, 2015
5a571b6
Reordered the toolbar elements via service priorities
javiereguiluz Jul 31, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finished "dump" panel and other minor tweaks
  • Loading branch information
javiereguiluz committed Jul 30, 2015
commit b25b6dd608e0646b8e265c34a4af789d30f5859b
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@

{% if dumps_count %}
{% set icon %}
<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>
<span class="sf-toolbar-status sf-toolbar-status-yellow">{{ dumps_count }}</span>
<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>
<span class="sf-toolbar-value">{{ dumps_count }}</span>
{% endset %}

{% set text %}
<div class="sf-toolbar-info-piece">
<b>dump()</b>
</div>
{% for dump in collector.getDumps('html') %}
<div class="sf-toolbar-info-piece">
in
<span>
{% if dump.file %}
{% set link = dump.file|file_link(dump.line) %}
{% if link %}
Expand All @@ -26,14 +23,15 @@
{% else %}
{{ dump.name }}
{% endif %}
line {{ dump.line }}:
</span>
<span class="sf-toolbar-file-line">line {{ dump.line }}</span>
{{ dump.data|raw }}
</div>
{% endfor %}
<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]);};" />
{% endset %}

{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': true } %}
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
{% endif %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

{% block toolbar %}
{% if collector.data.nb_errors > 0 or collector.data.forms|length %}
{% set status_color = collector.data.nb_errors ? 'red' : '' %}
{% set icon %}
<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>
{{ include('@WebProfiler/Icon/form.svg.twig') }}
<span class="sf-toolbar-value">
{% if collector.data.nb_errors %}
{{ collector.data.nb_errors }}
Expand All @@ -15,7 +16,18 @@
</span>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: collector.data.nb_errors ? 'red' : '' }) }}
{% set text %}
<div class="sf-toolbar-info-piece">
<b>Number of forms</b>
<span class="sf-toolbar-status">{{ collector.data.forms|length }}</span>
</div>
<div class="sf-toolbar-info-piece">
<b>Number of errors</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.data.nb_errors > 0 ? 'red' }}">{{ collector.data.nb_errors }}</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should avoid putting a sf-toolbar-status- class when there is not error. The whole class should go in the conditional instead of putting only the suffix in it, given that you don't put any color anymore on valid forms

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to not make this change. It's not a bug and "fixing" it will complicate Twig templates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

complicate them ?

<span class="sf-toolbar-status sf-toolbar-status-{{ collector.data.nb_errors > 0 ? 'red' }}">
{# vs #}
<span class="sf-toolbar-status {{ collector.data.nb_errors > 0 ? 'sf-toolbar-status-red' }}">

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually have two different values in the ternary condition, so the templates would become more verbose:

<span class="sf-toolbar-status sf-toolbar-status-{{ collector.data.nb_errors > 0 ? 'red' : 'green' }}">
{# vs #}
<span class="sf-toolbar-status {{ collector.data.nb_errors > 0 ? 'sf-toolbar-status-red' : 'sf-toolbar-status-green' }}">

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz for panels, you removed all "green" statuses, so it doesn't apply to much cases anymore.

Btw, if this is so common, why not creating a symfony filter/function to handle this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz my comment was related to the case where the else clause displays nothing. When both cases are showing a color, the current way is perfectly fine (which is why it was used before btw)

</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
{% endif %}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,29 @@
{% block toolbar %}
{% if collector.counterrors or collector.countdeprecations or collector.countscreams %}
{% set icon %}
<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>
{% set status_color = collector.counterrors ? 'red' : collector.countdeprecations ? 'yellow' : '' %}
{% set error_count = collector.counterrors + collector.countdeprecations + collector.countscreams %}
{{ include('@WebProfiler/Icon/logger.svg.twig') }}
<span class="sf-toolbar-value">{{ error_count }}</span>
{% endset %}

{% set text %}
{% if collector.counterrors %}
<div class="sf-toolbar-info-piece">
<b>Errors</b>
<span class="sf-toolbar-status sf-toolbar-status-red">{{ collector.counterrors }}</span>
</div>
{% endif %}
{% if collector.countdeprecations %}
<div class="sf-toolbar-info-piece">
<b>Deprecated Calls</b>
<span class="sf-toolbar-status sf-toolbar-status-yellow">{{ collector.countdeprecations }}</span>
</div>
{% endif %}
{% if collector.countscreams %}
<div class="sf-toolbar-info-piece">
<b>Silenced Errors</b>
<span class="sf-toolbar-status sf-toolbar-status">{{ collector.countscreams }}</span>
</div>
{% endif %}
<div class="sf-toolbar-info-piece">
<b>Errors</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.counterrors ? 'red' }}">{{ collector.counterrors|default(0) }}</span>
</div>

<div class="sf-toolbar-info-piece">
<b>Deprecated Calls</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.countdeprecations ? 'yellow' }}">{{ collector.countdeprecations|default(0) }}</span>
</div>

<div class="sf-toolbar-info-piece">
<b>Silenced Errors</b>
<span class="sf-toolbar-status">{{ collector.countscreams|default(0) }}</span>
</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
{% endif %}
{% endblock %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<span class="sf-toolbar-label">MB</span>
</span>
{% endset %}

{% set text %}
<div class="sf-toolbar-info-piece">
<b>Peak memory usage</b>
Expand All @@ -16,8 +17,9 @@

<div class="sf-toolbar-info-piece">
<b>PHP memory limit</b>
<span>{{ collector.memoryLimit == -1 ? '&infin;' : '%.1f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB</span>
<span>{{ collector.memoryLimit == -1 ? '&infin;' : '%.0f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB</span>
</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false, status: status_color }) }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@
{% endif %}

{% block toolbar %}
{% set duration = collector.events|length ? '%.0f'|format(collector.duration) : 'n/a' %}
{% set total_time = collector.events|length ? '%.0f'|format(collector.duration) : 'n/a' %}
{% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %}
{% set status_color = collector.events|length ? collector.duration > 1000 ? 'yellow' : '' %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest using and rather than nested ternary operators


{% set icon %}
<span class="sf-toolbar-value">{{ duration }}</span>
<span class="sf-toolbar-value">{{ total_time }}</span>
<span class="sf-toolbar-label">ms</span>
{% endset %}

{% set text %}
<div class="sf-toolbar-info-piece">
<b>Total time</b>
<span>{{ duration }} ms</span>
<span>{{ total_time }} ms</span>
</div>
<div class="sf-toolbar-info-piece">
<b>Initialization time</b>
<span>{{ initialization_time }} ms</span>
</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<span class="sf-toolbar-label">ms</span>
</span>
{% endset %}

{% set text %}
<div class="sf-toolbar-info-piece">
<b>Render Time</b>
Expand All @@ -27,6 +28,7 @@
<span class="sf-toolbar-status">{{ collector.macrocount }}</span>
</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }}
{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
margin-right: 0px;
white-space: nowrap;
}
.sf-toolbar-block a,
.sf-toolbar-block a:hover {
text-decoration: none;
}
Expand Down Expand Up @@ -371,6 +372,24 @@
100% { color: black; }
}

.sf-toolbar-block-dump pre.sf-dump {
background-color: #222;
border-color: #777;
border-radius: 0;
margin: 6px 0 12px 0;
width: 200px;
}
.sf-toolbar-block-dump pre.sf-dump:last-child {
margin-bottom: 0;
}
.sf-toolbar-block-dump .sf-toolbar-info-piece .sf-toolbar-file-line {
color: #AAA;
margin-left: 4px;
}
.sf-toolbar-block-dump .sf-toolbar-info img {
display: none;
}

/***** Override the setting when the toolbar is on the top *****/
{% if position == 'top' %}
.sf-minitoolbar {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy