[WebProfilerBundle] Add link to show profile of latest request
This commit is contained in:
parent
b7d003e9ab
commit
b65d0a26ea
@ -91,6 +91,10 @@ class ProfilerController
|
|||||||
$panel = $request->query->get('panel', 'request');
|
$panel = $request->query->get('panel', 'request');
|
||||||
$page = $request->query->get('page', 'home');
|
$page = $request->query->get('page', 'home');
|
||||||
|
|
||||||
|
if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) {
|
||||||
|
$token = $latest['token'];
|
||||||
|
}
|
||||||
|
|
||||||
if (!$profile = $this->profiler->loadProfile($token)) {
|
if (!$profile = $this->profiler->loadProfile($token)) {
|
||||||
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html'));
|
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html'));
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,17 @@
|
|||||||
<em>The token already exists in the database.</em>
|
<em>The token already exists in the database.</em>
|
||||||
</p>
|
</p>
|
||||||
{% elseif about == 'no_token' %}
|
{% elseif about == 'no_token' %}
|
||||||
<h2>Token not found</h2>
|
{% if token == 'latest' %}
|
||||||
<p>
|
<h2>No profiles</h2>
|
||||||
<em>Token "{{ token }}" was not found in the database.</em>
|
<p>
|
||||||
</p>
|
<em>No profiles found in the database.</em>
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
<h2>Token not found</h2>
|
||||||
|
<p>
|
||||||
|
<em>Token "{{ token }}" was not found in the database.</em>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
{% if profile %}
|
{% if profile %}
|
||||||
<div id="resume">
|
<div id="resume">
|
||||||
<a id="resume-view-all" href="{{ path('_profiler_search', {limit: 10}) }}">View last 10</a>
|
<a id="resume-view-all" href="{{ path('_profiler_search', {limit: 10}) }}">View last 10</a>
|
||||||
|
<a id="resume-view-latest" href="{{ path('_profiler', {token: 'latest', 'panel': panel}) }}">View latest</a>
|
||||||
<strong>Profile for:</strong>
|
<strong>Profile for:</strong>
|
||||||
{{ profile.method|upper }}
|
{{ profile.method|upper }}
|
||||||
{% if profile.method|upper in ['GET', 'HEAD'] %}
|
{% if profile.method|upper in ['GET', 'HEAD'] %}
|
||||||
|
@ -217,7 +217,7 @@ li {
|
|||||||
border-top-right-radius: 16px;
|
border-top-right-radius: 16px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
}
|
}
|
||||||
a#resume-view-all {
|
a#resume-view-all, a#resume-view-latest {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.2em 0.7em;
|
padding: 0.2em 0.7em;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
|
Reference in New Issue
Block a user