8000 [WebProfilerBundle] Add link to show profile of latest request by xelaris · Pull Request #14264 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Add link to show profile of latest request #14264

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 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
[WebProfilerBundle] Add link to show profile of latest request
  • Loading branch information
xelaris committed May 16, 2015
commit 85f1c1c50674f78a6c73fd6e9c2692cbb67a406c
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Copy link
Member

Choose a reason for hiding this comment

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

I would simplify the code to:

        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'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@
<em>The token already exists in the database.</em>
</p>
{% elseif about == 'no_token' %}
<h2>Token not found</h2>
<p>
<em>Token "{{ token }}" was not found in the database.</em>
</p>
{% if token == 'latest' %}
<h2>No profiles</h2>
<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 %}
{% endblock %}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{% if profile %}
<div id="resume">
<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>
{{ profile.method|upper }}
{% if profile.method|upper in ['GET', 'HEAD'] %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
0