8000 feature #54423 [WebProfilerBundle] Update the search links in the pro… · symfony/symfony@9ece00c · GitHub
[go: up one dir, main page]

Skip to content

Commit 9ece00c

Browse files
committed
feature #54423 [WebProfilerBundle] Update the search links in the profiler layout (javiereguiluz)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [WebProfilerBundle] Update the search links in the profiler layout | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT While working on #54421, I noticed that the page jump is mostly caused by the "profile search form" that we embed in the page via Ajax. This is how it looks expanded: ![image](https://github.com/symfony/symfony/assets/73419/090febc8-65e6-4ede-8c21-8b3fb0d738d2) However, thew workflow is as follows: 1. Click on `Search` link 2. The embedded search form expands 3. Input the search criteria 4. Click on `Search` button 5. You are redirected to the Search page to see the results ----- In this PR, I propose to NOT embed the search form in any pages and change the workflow as follows: 1. Click on `Search` link 2. You are redirected to the Search page to see the results 3. Input the search criteria (in the already expanded search form) 4. Click on `Search` button to see the results This fixes some of the perceived performance slowdown and looks like a better workflow to me. ----- Also, the current sidebar shows these shortcut links: ![image](https://github.com/symfony/symfony/assets/73419/1ef165fe-1ac1-42ff-8d01-1514c2b2320f) * "Last 10" shows the 10 most recent profiles * "Latest" shows the most recent profile available * "Search" expands the search form This PR changes it to only show 2 shortcuts: * "Search profiles" shows the last 10 profiles and also the search form expanded * "Latest" shows the most recent profile aaailable It looks like this: ![search-links](https://github.com/symfony/symfony/assets/73419/8f2ba944-c9a3-4f56-9a12-4818c79bfdcb) Commits ------- 7baa29e [WebProfilerBundle] Update the search links in the profiler layout
2 parents 8e06742 + 7baa29e commit 9ece00c

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ public function searchBarAction(Request $request): Response
195195
'end' => $request->query->get('end', $session?->get('_profiler_search_end')),
196196
'limit' => $request->query->get('limit', $session?->get('_profiler_search_limit')),
197197
'request' => $request,
198-
'render_hidden_by_default' => false,
199198
'profile_type' => $request->query->get('type', $session?->get('_profiler_search_type', 'request')),
200199
]),
201200
200,

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,10 @@
2828
<div id="sidebar-shortcuts">
2929
{% block sidebar_shortcuts_links %}
3030
<div class="shortcuts">
31-
<a class="btn btn-link" href="{{ path('_profiler_search', { limit: 10, type: profile_type }) }}">Last 10</a>
31+
<a class="btn btn-link" href="{{ path('_profiler_search', { limit: 10, type: profile_type }) }}">{{ source('@WebProfiler/Icon/search.svg') }} Search profiles</a>
3232
<a class="btn btn-link" href="{{ path('_profiler', { token: 'latest', type: profile_type }|merge(request.query.all)) }}">Latest</a>
33-
34-
<a class="sf-toggle btn btn-link" data-toggle-selector="#sidebar-search" {% if tokens is defined or about is defined %}data-toggle-initial="display"{% endif %}>
35-
{{ source('@WebProfiler/Icon/search.svg') }} <span class="hidden-small">Search</span>
36-
</a>
3733
</div>
3834
{% endblock sidebar_shortcuts_links %}
39-
40-
{{ render(controller('web_profiler.controller.profiler::searchBarAction', query={type: profile_type }|merge(request.query.all))) }}
4135
</div>
4236

4337
{% if templates is defined %}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,7 @@ tr.status-warning td {
14171417
------------------------------------------------------------------------- #}
14181418
#sidebar #sidebar-shortcuts {
14191419
color: var(--gray-500);
1420-
padding: 10px 15px;
1420+
padding: 5px 8px;
14211421
}
14221422
#sidebar #sidebar-shortcuts .sf-tabs .tab-navigation {
14231423
margin: 5px 0 15px;
@@ -1432,15 +1432,21 @@ tr.status-warning td {
14321432
display: flex;
14331433
align-items: center;
14341434
font-size: 13px;
1435+
padding: 5px 7px;
14351436
}
1436-
#sidebar #sidebar-shortcuts:hover .btn-link {
1437-
color: var(--menu-color);
1437+
#sidebar #sidebar-shortcuts .btn-link:hover {
1438+
background: var(--menu-active-background);
1439+
color: var(--menu-active-color);
1440+
text-decoration: none;
14381441
}
14391442
#sidebar-shortcuts .shortcuts svg {
14401443
height: 16px;
14411444
width: 16px;
14421445
margin-right: 4px;
14431446
}
1447+
#sidebar #sidebar-shortcuts form {
1448+
padding: 5px 7px;
1449+
}
14441450

14451451
{# Sidebar Search (the colors of this element don't change based on the selected theme)
14461452
------------------------------------------------------------------------- #}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/results.html.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
{% endblock %}
3636

3737
{% block sidebar_search_css_class %}{% endblock %}
38-
{% block sidebar_shortcuts_links %}{% endblock %}
38+
{% block sidebar_shortcuts_links %}
39+
{{ render(controller('web_profiler.controller.profiler::searchBarAction', query={type: profile_type }|merge(request.query.all))) }}
40+
{% endblock %}
3941

4042
{% block panel %}
4143
<div class="sf-tabs" data-processed="true">

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/search.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div id="sidebar-search" class="{{ (render_hidden_by_default ?? true) ? 'hidden' }}">
1+
<div id="sidebar-search">
22
<form action="{{ path('_profiler_search') }}" method="get">
33
<div class="form-group">
44
<label for="ip">

0 commit comments

Comments
 (0)
163B
0