Skip to content

Commit e9858e2

Browse files
javiereguiluzfabpot
authored andcommitted
Redesigned the Symfony Profiler
1 parent 4f6cfea commit e9858e2

File tree

2 files changed

+64
-44
lines changed

2 files changed

+64
-44
lines changed

Resources/views/Collector/icon.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 61 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
22

3+
{% block page_title 'Security' %}
4+
35
{% block toolbar %}
46
{% if collector.tokenClass %}
57
{% set is_authenticated = collector.enabled and collector.authenticated %}
@@ -9,9 +11,7 @@
911
{% endif %}
1012

1113
{% set icon %}
12-
<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">
13-
<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"/>
14-
</svg>
14+
{{ include('@Security/Collector/icon.svg') }}
1515
<span class="sf-toolbar-value">{{ collector.user|default('n/a') }}</span>
1616
{% endset %}
1717

@@ -21,10 +21,12 @@
2121
<b>Logged in as</b>
2222
<span>{{ collector.user }}</span>
2323
</div>
24+
2425
<div class="sf-toolbar-info-piece">
2526
<b>Authenticated</b>
2627
<span class="sf-toolbar-status sf-toolbar-status-{{ is_authenticated ? 'green' : 'red' }}">{{ is_authenticated ? 'Yes' : 'No' }}</span>
2728
</div>
29+
2830
{% if collector.tokenClass != null %}
2931
<div class="sf-toolbar-info-piece">
3032
<b>Token class</b>
@@ -46,54 +48,69 @@
4648
{% endblock %}
4749

4850
{% block menu %}
49-
<span class="label">
50-
<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 0.7-0.2 1.1 c0 0.5 0.1 0.9 0.4 1.2s0.5 0.4 0.8 0.4c0.2 0 0.4-0.1 0.7-0.2c0.2-0.1 0.5-0.3 0.7-0.6s0.4-0.6 0.5-1c0.1-0.4 0.2-0.8 0.2-1.2 c0-0.5-0.1-0.9-0.4-1.2C29 10.3 28.7 10.2 28.3 10.2z"/><path fill="#3F3F3F" d="M34 4H7C6.4 4 6 4.4 6 5v19c0 0.6 0.4 1 1 1h5v-1c-0.6 0-1-0.4-1-1c0-0.6 0.4-1 1-1h2c0.6 0 1 0.4 1 1 c0 0.6-0.4 1-1 1v1h13v-1c-0.6 0-1-0.4-1-1c0-0.6 0.4-1 1-1h2c0.6 0 1 0.4 1 1c0 0.6-0.4 1-1 1v1h5c0.6 0 1-0.4 1-1V5 C35 4.4 34.6 4 34 4z M21 19c0 0.6-0.4 1-1 1H9c-0.6 0-1-0.4-1-1V7c0-0.6 0.4-1 1-1h11c0.6 0 1 0.4 1 1V19z M32.9 16.6 c-0.5 0.4-1 0.7-1.7 1c-0.6 0.2-1.4 0.4-2.3 0.4c-0.8 0-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-
</span>
51+
<span class="label {{ not collector.enabled or not collector.tokenClass ? 'disabled' }}">
52+
<span class="icon">{{ include('@Security/Collector/icon.svg') }}</span>
53+
<strong>Security</strong>
54+
</span>
5355
{% endblock %}
5456

5557
{% block panel %}
56-
<h2>Security</h2>
58+
<h2>Security Token</h2>
59+
5760
{% if collector.tokenClass %}
61+
<div class="metrics">
62+
<div class="metric">
63+
<span class="value">{{ collector.user == 'anon.' ? 'Anonymous' : collector.user }}</span>
64+
<span class="label">Username</span>
65+
</div>
66+
67+
<div class="metric">
68+
<span class="value">{{ include('@WebProfiler/Icon/' ~ (collector.authenticated ? 'yes' : 'no') ~ '.svg') }}</span>
69+
<span class="label">Authenticated</span>
70+
</div>
71+
</div>
72+
5873
<table>
59-
<tr>
60-
<th>Username</th>
61-
<td>{{ collector.user }}</td>
62-
</tr>
63-
<tr>
64-
<th>Authenticated?</th>
65-
<td>
66-
{% if collector.authenticated %}
67-
yes
68-
{% else %}
69-
no {% if not collector.roles|length %}<em>(probably because the user has no roles)</em>{% endif %}
70-
{% endif %}
71-
</td>
72-
</tr>
73-
<tr>
74-
<th>Roles</th>
75-
<td>{{ collector.roles|yaml_encode }}</td>
76-
</tr>
77-
{% if collector.supportsRoleHierarchy %}
78-
<tr>
79-
<th>Inherited Roles</th>
80-
<td>{{ collector.inheritedRoles|yaml_encode }}</td>
81-
</tr>
82-
{% endif %}
83-
{% if collector.tokenClass != null %}
84-
<tr>
85-
<th>Token class</th>
86-
<td>{{ collector.tokenClass }}</td>
87-
</tr>
88-
{% endif %}
74+
<thead>
75+
<tr>
76+
<th scope="col" class="key">Property</th>
77+
<th scope="col">Value</th>
78+
</tr>
79+
</thead>
80+
<tbody>
81+
<tr>
82+
<th>Roles</th>
83+
<td>
84+
{{ collector.roles is empty ? 'none' : collector.roles|yaml_encode }}
85+
86+
{% if not collector.authenticated and collector.roles is empty %}
87+
<p class="help">User is not authenticated probably because they have no roles.</p>
88+
{% endif %}
89+
</td>
90+
</tr>
91+
92+
{% if collector.supportsRoleHierarchy %}
93+
<tr>
94+
<th>Inherited Roles</th>
95+
<td>{{ collector.inheritedRoles is empty ? 'none' : collector.inheritedRoles|yaml_encode }}</td>
96+
</tr>
97+
{% endif %}
98+
99+
{% if collector.tokenClass %}
100+
<tr>
101+
<th>Token class</th>
102+
<td>{{ collector.tokenClass }}</td>
103+
</tr>
104+
{% endif %}
105+
</tbody>
89106
</table>
90107
{% elseif collector.enabled %}
91-
<p>
92-
<em>No token</em>
93-
</p>
108+
<div class="empty">
109+
<p>There is no security token.</p>
110+
</div>
94111
{% else %}
95-
<p>
96-
<em>The security component is disabled</em>
97-
</p>
112+
<div class="empty">
113+
<p>The security component is disabled.</p>
114+
</div>
98115
{% endif %}
99116
{% endblock %}

0 commit comments

Comments
 (0)