Skip to content

[WebProfilerBundle] Filter links in search results #16344

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

Merged
merged 1 commit into from
Oct 28, 2015
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ public function toolbarAction(Request $request, $token)
}

return new Response($this->twig->render('@WebProfiler/Profiler/toolbar.html.twig', array(
'request' => $request,
'position' => $position,
'profile' => $profile,
'templates' => $this->getTemplateManager()->getTemplates($profile),
Expand Down Expand Up @@ -242,13 +243,13 @@ public function searchBarAction(Request $request)
$limit =
$token = null;
} else {
$ip = $session->get('_profiler_search_ip');
$method = $session->get('_profiler_search_method');
$url = $session->get('_profiler_search_url');
$start = $session->get('_profiler_search_start');
$end = $session->get('_profiler_search_end');
$limit = $session->get('_profiler_search_limit');
$token = $session->get('_profiler_search_token');
$ip = $request->query->get('ip', $session->get('_profiler_search_ip'));
$method = $request->query->get('method', $session->get('_profiler_search_method'));
$url = $request->query->get('url', $session->get('_profiler_search_url'));
$start = $request->query->get('start', $session->get('_profiler_search_start'));
$end = $request->query->get('end', $session->get('_profiler_search_end'));
$limit = $request->query->get('limit', $session->get('_profiler_search_limit'));
$token = $request->query->get('token', $session->get('_profiler_search_token'));
}

return new Response(
Expand Down Expand Up @@ -295,6 +296,7 @@ public function searchResultsAction(Request $request, $token)
$limit = $request->query->get('limit');

return new Response($this->twig->render('@WebProfiler/Profiler/results.html.twig', array(
'request' => $request,
'token' => $token,
'profile' => $profile,
'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end),
Expand Down Expand Up @@ -351,6 +353,7 @@ public function searchAction(Request $request)
$tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end);

return new RedirectResponse($this->generator->generate('_profiler_search_results', array(
'request' => $request,
'token' => $tokens ? $tokens[0]['token'] : 'empty',
'ip' => $ip,
'method' => $method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
{{ include('@WebProfiler/Icon/search.svg') }} <span class="hidden-small">Search</span>
</a>

{{ render(path('_profiler_search_bar')) }}
{{ render(path('_profiler_search_bar', request.query.all)) }}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,32 @@ tr.status-warning td {
.highlight .number { color: #F5871F; font-weight: bold; }
.highlight .error { color: #C82829; }

{# Icons
========================================================================= #}
.sf-icon {
vertical-align: middle;
background-repeat: no-repeat;
background-size: contain;
width: 16px;
height: 16px;
display: inline-block;
}
.sf-icon svg {
width: 16px;
height: 16px;
}
.sf-icon.sf-medium,
.sf-icon.sf-medium svg {
width: 24px;
height: 24px;
}
.sf-icon.sf-large,
.sf-icon.sf-large svg {
width: 32px;
height: 32px;
}


{# Layout
========================================================================= #}
.container {
Expand Down Expand Up @@ -849,6 +875,14 @@ table.logs .metadata strong {
vertical-align: middle;
}

#search-results .sf-search {
visibility: hidden;
margin-left: 2px;
}
#search-results tr:hover .sf-search {
visibility: visible;
}

{# Small screens
========================================================================= #}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,30 @@
<td class="text-center">
<span class="label {{ css_class }}">{{ result.status_code|default('n/a') }}</span>
</td>
<td class="nowrap">{{ result.ip }}</td>
<td>{{ result.method }}</td>
<td class="break-long-words">{{ result.url }}</td>
<td>
<span class="nowrap">{{ result.ip }}</span>
{% if request.session is not null %}
<a href="{{ path('_profiler_search_results', request.query.all|merge({'ip': result.ip, 'token': result.token})) }}" title="Search">
Copy link
Member

Choose a reason for hiding this comment

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

The title attributes of the new links could be customized. Instead of Search we could use any of these alternatives:

Search by IP
Filter profiles by IP
View other profiles with this IP
Show only profiles for this IP
...

Same comment for the other links.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 which one do you propose? Currently we don't use "filter" anywhere, so I sticked with "search".

<span title="Search" class="sf-icon sf-search">{{ include('@WebProfiler/Icon/search.svg') }}</span>
</a>
{% endif %}
</td>
<td>
{{ result.method }}
{% if request.session is not null %}
<a href="{{ path('_profiler_search_results', request.query.all|merge({'method': result.method, 'token': result.token})) }}" title="Search">
<span title="Search" class="sf-icon sf-search">{{ include('@WebProfiler/Icon/search.svg') }}</span>
</a>
{% endif %}
</td>
<td class="break-long-words">
{{ result.url }}
{% if request.session is not null %}
<a href="{{ path('_profiler_search_results', request.query.all|merge({'url': result.url, 'token': result.token})) }}" title="Search">
<span title="Search" class="sf-icon sf-search">{{ include('@WebProfiler/Icon/search.svg') }}</span>
</a>
{% endif %}
</td>
<td class="text-small">
<span class="nowrap">{{ result.time|date('d-M-Y') }}</span>
<span class="nowrap newline">{{ result.time|date('H:i:s') }}</span>
Expand Down