Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Redesigned the Symfony Profiler #15523

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

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b267347
Redesigned most of the Symfony Profiler panels
javiereguiluz Aug 12, 2015
4e66c45
Added some missing SVG icons
javiereguiluz Aug 12, 2015
b7f604c
Highlight the line of code which caused the exception
javiereguiluz Aug 12, 2015
3cdf546
CSS tweaks to fix some reported issues
javiereguiluz Aug 12, 2015
0a58431
A new round of tweaks and fixes
javiereguiluz Aug 13, 2015
9dc561c
Redesigned the "debug/dump" panel and other minor tweaks
javiereguiluz Aug 13, 2015
10f1fbb
Replaced the CSS-based tabs by proper JavaScript-based tabs
javiereguiluz Aug 14, 2015
a5f367c
First version of the redesigned Form panel
javiereguiluz Aug 17, 2015
6ca6b2f
Added the new icons, made the sidebar narrower, added badges in the
javiereguiluz Aug 19, 2015
22841fc
More design tweaks
javiereguiluz Aug 21, 2015
7cbced0
Refactored the "summary" section and redesigned all the profiler erro…
javiereguiluz Aug 21, 2015
50a60d5
Refactored the JavaScript code that creates the tabs
javiereguiluz Aug 21, 2015
656739e
Added a "toggle" utility
javiereguiluz Aug 21, 2015
b3aa953
Refactored the JavaScript code, used toggles in the Dump panel and
javiereguiluz Aug 23, 2015
376f1be
Finished the redesign of the Symfony Profiler
javiereguiluz Aug 24, 2015
3f6f747
Tweaks as per Stof's review and comments
javiereguiluz Aug 25, 2015
ab133e1
Minor tweaks for the Form panel
javiereguiluz Aug 25, 2015
904c618
Allow a toggle to define if its related content is displayed by default
javiereguiluz Aug 25, 2015
8a2a7cd
Replaced a randomly-generated ID by the real log index
javiereguiluz Aug 25, 2015
4e81feb
Lots of minor tweaks
javiereguiluz Aug 25, 2015
688e3f7
Minor JavaScript changes
javiereguiluz Aug 25, 2015
e47339b
Fixed the title of all panels and fixed some JavaScript issues
javiereguiluz Aug 26, 2015
3ac9100
Refactored some JavaScript code
javiereguiluz Aug 26, 2015
edb5e5e
Improved the vertical spacing of tabbed navigation
javiereguiluz Aug 26, 2015
4139c6b
Minor JavaScript change
javiereguiluz Aug 26, 2015
14b7cf5
More CSS tweaks to polish profiler panels
javiereguiluz Aug 26, 2015
a1d2e24
Redesigned the search results page
javiereguiluz Aug 27, 2015
489fbd6
Improved the timeline graphics and allowed panels to define their pag…
javiereguiluz Aug 27, 2015
437a67b
Simplified the management of the profiler panel titles
javiereguiluz Aug 28, 2015
72a64e3
Added some metrics about sub-requests in the performance panel
javiereguiluz Aug 28, 2015
f79894f
Fixed some CSS issues in Firefox
javiereguiluz Sep 1, 2015
2b55b9b
Allow to disable tabs, tweaked tables layout and other minor tweaks
javiereguiluz Sep 1, 2015
79f7297
Display the listener priority in the events panel
javiereguiluz Sep 3, 2015
50d5f59
Add a check to avoid errors for special pages (exceptions for example)
javiereguiluz Sep 3, 2015
14e725f
Fixed some test for the TraceableEventDispatcher changes
javiereguiluz Sep 3, 2015
b254b69
Sort uncalled events by priority
javiereguiluz Sep 3, 2015
67ef234
Grouped listeners by event in the events panel
javiereguiluz Sep 3, 2015
f971509
Fixed an HTML markup issue for the new events panel
javiereguiluz Sep 3, 2015
ac6f79a
Adjusted the logger panel after the grouping of related deprecations
javiereguiluz Sep 7, 2015
ac63334
Tweaked the logger panel stack trace contents
javiereguiluz Sep 7, 2015
a808fa5
Tweaked the toolbar for Silex 2
javiereguiluz Sep 7, 2015
73809a8
Removed the app.request... call to make it compatible with Silex
javiereguiluz Sep 7, 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
16 changes: 14 additions & 2 deletions 16 src/Symfony/Bridge/Twig/DataCollector/TwigDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,20 @@ public function getMacroCount()
public function getHtmlCallGraph()
{
$dumper = new \Twig_Profiler_Dumper_Html();

return new \Twig_Markup($dumper->dump($this->getProfile()), 'UTF-8');
$dump = $dumper->dump($this->getProfile());

// needed to remove the hardcoded CSS styles
$dump = str_replace(array(
'<span style="background-color: #ffd">',
'<span style="color: #d44">',
'<span style="background-color: #dfd">',
), array(
'<span class="status-warning">',
'<span class="status-error">',
'<span class="status-success">',
), $dump);

return new \Twig_Markup($dump, 'UTF-8');
}

public function getProfile()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
{% set dumps_count = collector.dumpsCount %}

{% if dumps_count %}
{% if collector.dumpsCount %}
{% set icon %}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<path fill="#AAAAAA" d="M12,22.6c-5.8,0-10.5-4.7-10.5-10.5C1.5,6.3,6.2,1.5,12,1.5s10.5,4.7,10.5,10.5C22.5,17.9,17.8,22.6,12,22.6z M12,4.5c-4.2,0-7.5,3.4-7.5,7.5c0,4.2,3.4,7.5,7.5,7.5s7.5-3.4,7.5-7.5C19.5,7.9,16.2,4.5,12,4.5z"/>
<path fill="#AAAAAA" d="M12,9.1c-0.8,0-1.5-0.7-1.5-1.5v-6c0-0.8,0.7-1.5,1.5-1.5s1.5,0.7,1.5,1.5v6C13.5,8.4,12.8,9.1,12,9.1zM13.5,22.4v-6c0-0.8-0.7-1.5-1.5-1.5s-1.5,0.7-1.5,1.5v6c0,0.8,0.7,1.5,1.5,1.5S13.5,23.2,13.5,22.4z M23.9,12c0-0.8-0.7-1.5-1.5-1.5h-6c-0.8,0-1.5,0.7-1.5,1.5s0.7,1.5,1.5,1.5h6C23.2,13.5,23.9,12.8,23.9,12z M9.1,12c0-0.8-0.7-1.5-1.5-1.5h-6c-0.8,0-1.5,0.7-1.5,1.5s0.7,1.5,1.5,1.5h6C8.4,13.5,9.1,12.8,9.1,12z"/>
</svg>
<span class="sf-toolbar-value">{{ dumps_count }}</span>
{{ include('@Debug/Profiler/icon.svg') }}
<span class="sf-toolbar-value">{{ collector.dumpsCount }}</span>
{% endset %}

{% set text %}
Expand All @@ -28,6 +23,7 @@
{% endif %}
</span>
<span class="sf-toolbar-file-line">line {{ dump.line }}</span>

{{ dump.data|raw }}
</div>
{% endfor %}
Expand All @@ -39,42 +35,18 @@
{% endblock %}

{% block menu %}
<span class="label">
<span class="icon">
{{- "" -}}
<svg width="28" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 28 28" enable-background="new 0 0 28 28" xml:space="preserve"><path fill="#3F3F3F" d="M28 13h-1.1C26.5 6.6 21.4 1.5 15 1.1V0h-2v1.1C6.6 1.5 1.5 6.6 1.1 13H0v2h1.1C1.5 21.4 6.6 26.5 13 26.9 V28h2v-1.1c6.4-0.5 11.5-5.6 11.9-11.9H28V13z M15 24.9V19h-2v5.9c-5.3-0.5-9.5-4.7-9.9-9.9H9v-2H3.1C3.5 7.7 7.7 3.5 13 3.1V9h2 V3.1c5.3 0.5 9.5 4.7 9.9 9.9H19v2h5.9C24.5 20.3 20.3 24.5 15 24.9z"/></svg>
{{- "" -}}
</span>
<strong>dump()</strong>
<span class="count">
<span>{{ collector.dumpsCount }}</span>
</span>
<span class="label {{ collector.dumpsCount == 0 ? 'disabled' }}">
<span class="icon">{{ include('@Debug/Profiler/icon.svg') }}</span>
<strong>Debug</strong>
</span>
{% endblock %}

{% block panel %}
<h2>dump()</h2>
<h2>Dumped Contents</h2>

<style>
li.sf-dump {
list-style-type: disc;
}
.sf-dump ol>li {
padding: 0;
}
.sf-dump a {
cursor: pointer;
}
.sf-dump-compact {
display: none;
}
</style>

{% if collector.dumpsCount %}
<ul class="alt">
{% for dump in collector.getDumps('html') %}
<li class="sf-dump sf-reset">
in
{% for dump in collector.getDumps('html') %}
<div class="sf-dump sf-reset">
<h3>In
{% if dump.line %}
{% set link = dump.file|file_link(dump.line) %}
{% if link %}
Expand All @@ -85,19 +57,22 @@
{% else %}
{{ dump.name }}
{% endif %}
line {{ dump.line }}:
<a onclick="var s = this.nextElementSibling; if ('sf-dump-compact' == s.className) {this.innerHTML = '&#9660;'; s.className = 'sf-dump-expanded';} else {this.innerHTML = '&#9654;'; s.className = 'sf-dump-compact';}">&#9654;</a>
<span class="sf-dump-compact">
{% if dump.fileExcerpt %}{{ dump.fileExcerpt|raw }}{% else %}{{ dump.file|file_excerpt(dump.line) }}{% endif %}
</span>
<small>line {{ dump.line }}</small>

{{ dump.data|raw }}
</li>
{% endfor %}
</ul>
<a class="text-small sf-toggle" data-toggle-selector="#sf-trace-{{ loop.index0 }}" data-toggle-alt-content="Hide code">Show code</a>
</h3>

<div class="sf-dump-compact hidden" id="sf-trace-{{ loop.index0 }}">
<div class="trace">
{{ dump.fileExcerpt ? dump.fileExcerpt|raw : dump.file|file_excerpt(dump.line) }}
</div>
</div>

{{ dump.data|raw }}
</div>
{% else %}
<p>
<em>No dumped variable</em>
</p>
{% endif %}
<div class="empty">
<p>No content was dumped.</p>
</div>
{% endfor %}
{% endblock %}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block page_title 'Security' %}

{% block toolbar %}
{% if collector.tokenClass %}
{% set is_authenticated = collector.enabled and collector.authenticated %}
Expand All @@ -9,9 +11,7 @@
{% endif %}

{% set icon %}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" height="24" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<path fill="#AAAAAA" d="M21,20.4V22H3v-1.6c0-3.7,2.4-6.9,5.8-8c-1.7-1.1-2.9-3-2.9-5.2c0-3.4,2.7-6.1,6.1-6.1s6.1,2.7,6.1,6.1c0,2.2-1.2,4.1-2.9,5.2C18.6,13.5,21,16.7,21,20.4z"/>
</svg>
{{ include('@Security/Collector/icon.svg') }}
<span class="sf-toolbar-value">{{ collector.user|default('n/a') }}</span>
{% endset %}

Expand All @@ -21,10 +21,12 @@
<b>Logged in as</b>
<span>{{ collector.user }}</span>
</div>

<div class="sf-toolbar-info-piece">
<b>Authenticated</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ is_authenticated ? 'green' : 'red' }}">{{ is_authenticated ? 'Yes' : 'No' }}</span>
</div>

{% if collector.tokenClass != null %}
<div class="sf-toolbar-info-piece">
<b>Token class</b>
Expand All @@ -46,54 +48,69 @@
{% endblock %}

{% block menu %}
<span class="label">
<span class="icon"><svg width="42" height="30" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 42 30" enable-background="new 0 0 42 30" xml:space="preserve"><g><path fill="#3F3F3F" d="M16.1 15.3c0-0.5 0-0.8 0-1.2c0.2-0.1 0.6-0.8 0.7-1.4c0.2 0 0.4-0.2 0.5-0.8c0-0.4-0.1-0.5-0.2-0.6 c0.3-0.8 0.8-3.4-1.1-3.7C15.7 7.2 15.2 7 14.6 7c-2.6 0-2.9 2-2.4 4.2c-0.1 0.1-0.3 0.3-0.2 0.6c0.1 0.7 0.3 0.8 0.5 0.8 c0.1 0.6 0.5 1.3 0.7 1.4c0 0.4 0 0.8 0 1.2c-0.5 1.4-4 1-4.2 3.7h11.2C20.1 16.3 16.6 16.7 16.1 15.3z"/><path fill="#3F3F3F" d="M28.3 10.2c-0.2 0-0.5 0.1-0.7 0.2c-0.2 0.1-0.4 0.3-0.6 0.6c-0.2 0.3-0.4 0.6-0.5 1s-0.2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c0-0.6 0.2-1.2 0.5-1.8c0.3-0.6 0.7-1.1 1.2-1.4c0.5-0.3 0.9-0.5 1.3-0.5 c0.3 0 0.6 0.1 0.9 0.3c0.3 0.2 0.6 0.4 0.8 0.8l0.2-0.9h1l-0.8 3.8c-0.1 0.5-0.2 0.8-0.2 0.9c0 0.1 0 0.2 0.1 0.3 c0.1 0.1 0.2 0.1 0.3 0.1c0.2 0 0.5-0.1 0.8-0.3c0.4-0.3 0.8-0.7 1-1.2c0.3-0.5 0.4-1 0.4-1.6c0-0.6-0.2-1.2-0.5-1.8 c-0.3-0.6-0.8-1-1.5-1.3s-1.4-0.5-2.1-0.5c-0.9 0-1.7 0.2-2.4 0.6c-0.7 0.4-1.3 1-1.7 1.8C24.2 11 24 11.9 24 12.7 c0 0.9 0.2 1.7 0.6 2.4c0.4 0.7 1 1.2 1.8 1.5c0.8 0.3 1.6 0.5 2.5 0.5c1 0 1.8-0.2 2.5-0.5c0.7-0.3 1.2-0.7 1.5-1.2h1 C33.7 15.8 33.4 16.2 32.9 16.6z"/></g></svg></span>
<strong>Security</strong>
</span>
<span class="label {{ not collector.enabled or not collector.tokenClass ? 'disabled' }}">
<span class="icon">{{ include('@Security/Collector/icon.svg') }}</span>
<strong>Security</strong>
</span>
{% endblock %}

{% block panel %}
<h2>Security</h2>
<h2>Security Token</h2>

{% if collector.tokenClass %}
<div class="metrics">
<div class="metric">
<span class="value">{{ collector.user == 'anon.' ? 'Anonymous' : collector.user }}</span>
<span class="label">Username</span>
</div>

<div class="metric">
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.authenticated ? 'yes' : 'no') ~ '.svg') }}</span>
<span class="label">Authenticated</span>
</div>
</div>

<table>
<tr>
<th>Username</th>
<td>{{ collector.user }}</td>
</tr>
<tr>
<th>Authenticated?</th>
<td>
{% if collector.authenticated %}
yes
{% else %}
no {% if not collector.roles|length %}<em>(probably because the user has no roles)</em>{% endif %}
{% endif %}
</td>
</tr>
<tr>
<th>Roles</th>
<td>{{ collector.roles|yaml_encode }}</td>
</tr>
{% if collector.supportsRoleHierarchy %}
<tr>
<th>Inherited Roles</th>
<td>{{ collector.inheritedRoles|yaml_encode }}</td>
</tr>
{% endif %}
{% if collector.tokenClass != null %}
<tr>
<th>Token class</th>
<td>{{ collector.tokenClass }}</td>
</tr>
{% endif %}
<thead>
<tr>
<th scope="col" class="key">Property</th>
<th scope="col">Value</th>
</tr>
</thead>
<tbody>
<tr>
<th>Roles</th>
<td>
{{ collector.roles is empty ? 'none' : collector.roles|yaml_encode }}

{% if not collector.authenticated and collector.roles is empty %}
<p class="help">User is not authenticated probably because they have no roles.</p>
{% endif %}
</td>
</tr>

{% if collector.supportsRoleHierarchy %}
<tr>
<th>Inherited Roles</th>
<td>{{ collector.inheritedRoles is empty ? 'none' : collector.inheritedRoles|yaml_encode }}</td>
</tr>
{% endif %}

{% if collector.tokenClass %}
<tr>
<th>Token class</th>
<td>{{ collector.tokenClass }}</td>
</tr>
{% endif %}
</tbody>
</table>
{% elseif collector.enabled %}
<p>
<em>No token</em>
</p>
<div class="empty">
<p>There is no security token.</p>
</div>
{% else %}
<p>
<em>The security component is disabled</em>
</p>
<div class="empty">
<p>The security component is disabled.</p>
</div>
{% endif %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function panelAction(Request $request, $token)
'request' => $request,
'templates' => $this->getTemplateManager()->getTemplates($profile),
'is_ajax' => $request->isXmlHttpRequest(),
'profiler_markup_version' => 2, // 1 = original profiler, 2 = Symfony 2.8+ profiler
)), 200, array('Content-Type' => 'text/html'));
}

Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.