diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index 2748910a19ae..cada4ee6ca43 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -91,6 +91,10 @@ public function panelAction(Request $request, $token) $panel = $request->query->get('panel', 'request'); $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)) { return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html')); } diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig index aeffb2cf256b..9be617a3ecab 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig @@ -25,10 +25,17 @@ The token already exists in the database.

{% elseif about == 'no_token' %} -

Token not found

-

- Token "{{ token }}" was not found in the database. -

+ {% if token == 'latest' %} +

No profiles

+

+ No profiles found in the database. +

+ {% else %} +

Token not found

+

+ Token "{{ token }}" was not found in the database. +

+ {% endif %} {% endif %} {% endblock %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index 12728b964df0..6df82890c180 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -14,6 +14,7 @@ {% if profile %}
View last 10 + View latest Profile for: {{ profile.method|upper }} {% if profile.method|upper in ['GET', 'HEAD'] %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index 4d84a6931cce..fd3256534795 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -217,7 +217,7 @@ li { border-top-right-radius: 16px; line-height: 18px; } -a#resume-view-all { +a#resume-view-all, a#resume-view-latest { display: inline-block; padding: 0.2em 0.7em; margin-right: 0.5em;