-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle] Added filters to search results #14110
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
Conversation
Can you add a screenshot here? |
<td>{{ elements.url }}</td> | ||
<td> | ||
{{ elements.ip }} | ||
<a href="{{ path('_profiler_search_results', app.request.query.all|merge({'ip': elements.ip, 'token': elements.token})) }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to include the token here? Wouldn't you usually want to filter just by the IP address (same below for the two other properties)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without that no search results will be shown at all. The filtering does not happen on the token, but the token is part of search result URI:
https://symfony.dev/_profiler/01d9c6/search/results?ip=&limit=10&url=https%3A//symfony.dev/filter-link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, you're right.
👍 looks nice |
<td> | ||
{{ elements.method }} | ||
<a href="{{ path('_profiler_search_results', app.request.query.all|merge({'method': elements.method, 'token': elements.token})) }}"> | ||
<img style="margin: 0 5px 0 0; vertical-align: middle;" width="16" height="16" alt="Search" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC2ElEQVR42u3XvUtbYRQG8JcggSxSiqlQoXUQUfEDnDoIEkK30ulKh0REFEOkitaIaBUU4gchQ8BBGyKGIC79B7rVxaGlm+JooYtQCq2U0oq9OX0eOBeCRXrf69DFwI9z73nPeTlJbrxXIyL/1e0AfyWueTVAEgrwGt5qLGge675e1gPUQaqxsfEgmUyerq6uft3e3v61v78vjDxnnuusYz3WTI0bDXAnHA6/Gh0d/bS7u+vu7e3JdbjOOtazDzmjAg9QF41Gy+vr6+eVSkX8Yj372I9zA8EGiEQi6bW1tfNyuSyK7/II0YEmMBodzYuHfezXmkADNAwNDX3c2dkRKpVKl4hZCIO5SvNZ1LleD/uxzz0c2w/Q0tLyAheYWywWRT0H4wPrhNjf1taWYd56gOHh4XdbW1tC+Xz+CNH4pfVCuo/9AAsLC182NzeFVlZWUojGL60X0n3sB8BFdFEoFISWlpYeIhq/tF5I97EfIJfLufgohZqbm+8jGr+0Xkj3sR9geXn5x8bGhlBHR8czROOX1gvpPvYDzM3NnWSzWaFYLPYG0fil9UK6j/0As7OzWVxMQul0+ht6nuDY/AvrWO/16j7WA/BCerC4uHiJKNTX13eid7wQzs1VzHOddV4P+n9zHwj0l5BfQ35+fl4Ix248Hj8NhUIlLPXDXeQNI8+Z5zrrvJ6BgYEzrMVxHGgAfg3hmZmZD4jiwd3ue3d393F9ff0hnwcYec4812tlMplqb2/vMepigW/H09PTUXgPEsTU1FS1p6dHhwj4QDI5ORmBHFyAXEfXK+DW5icmJqpdXV21Q9g/ko2Pj1MTvIQDOAPReKD5Jq1zwAVR/CVVOzs7OUR/oAFSqZQtB1wQz9jYWLW9vf0I2z2yHgAXWRAOuCCekZGRamtr66HtALw9B+WAC+JJJBI/rQfA081NOOCCEJ6gP1sPMDg4eFNP4Uw9vv3X7HaAq/4AszA5PJFqlwgAAAAASUVORK5CYII="> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We switched to inline svg for the icons. Should be used here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally fine with me, but copied the search icon directly from the search form. Can you point me to the place where the inline svg icons can be found? The search icon at the right top of the profiler, left of the 'search on symfony website' form also still is a png icon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then we dont have an svg for it yet i guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made one based on the current png, also did put it in the search form itself
Made a svg of the search icon, and refactored it to its own inline css class. Let me know when I'd rebase the commits. |
$end = $session->get('_profiler_search_end'); | ||
$limit = $session->get('_profiler_search_limit'); | ||
$token = $session->get('_profiler_search_token'); | ||
$ip = $request->get('ip', $session->get('_profiler_search_ip')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use $request->query->get()
. There is no need to read it from the POST params or the attributes as it can only be in the query string (same for others).
And using the query string should also work when the session is disabled (a few lines above).
thus, we should avoid reading from the session if we have the query string param IMO instead of always reading the session value just to compute the default value for the next call (methods calls are not lazy in PHP)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont use request->get
, see phpdoc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly (even though the implementation has been optimized a but to avoid relying on chaining defaults, making it OK when you actually need to allow the 3 sources)
👍 ping @symfony/deciders |
Don't think this PR still is valid on the profiler redesign? |
I do :) |
Let me at least squash all commits first then 👍 |
As this PR is based on 2.7, you will have to submit a new one based on the 2.8 branch. |
@rvanlaak I like this proposal. The only thing I don't fully like is the search icon. What if we use regular links like in the token link? If you think that it looks ugly because there are too many links, we could apply |
I can understand you don't like the search icon @javiereguiluz . But, is making it a link the right solution? What about showing an actual "filter" icon, and only showing it on Something like http://fontawesome.io/icon/filter/ |
Looks like something went wrong during the rebase. |
b0b49ac
to
31192c3
Compare
Was still busy rebasing, completed now. Did add the icon on |
@@ -53,8 +53,8 @@ | |||
</li> | |||
</ul> | |||
{% endif %} | |||
{{ render(path('_profiler_search_bar')) }} | |||
{% include '@WebProfiler/Profiler/admin.html.twig' with { 'token': token } only %} | |||
{{ render(path('_profiler_search_bar', app.request.query.all)) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never use app
in the profiler as it's not always available (in Silex for instance). request
should be available (at least that's the case in 2.8 where we are going to merge this PR).. which means that you should probably close this PR and open a new one on the 2.8 branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By which you mean app.request
can be request
on every profiler page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot for search results request
is not available, should the controller pass it to the view?
@rvanlaak please reopen this PR to the 2.8 branch as the profiler is totally redesigned in 2.8. We won't merge this in 2.7, and not having the diff with the right code makes the review painful |
So the target only is |
Yes, the PR should be based on the 2.8 branch as this is where it's going to be merged but more importantly because the profiler is quite different in 2.8. Thanks. |
@rvanlaak Closing this PR. Can you reopen a new one on 2.8? Thanks. |
…anlaak) This PR was merged into the 2.8 branch. Discussion ---------- [WebProfilerBundle] Filter links in search results | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14110 | License | MIT | Doc PR | Quite often I find myself copy/pasting the results from the search results in the profiler search form. Adding links for this allows developers to narrow down to the proper profiler result fast. Commits ------- 4bffacc [WebProfilerBundle] Filter links in search results
…lts (Rvanlaak) This PR was merged into the 2.8 branch. Discussion ---------- [WebProfilerBundle] Filter links in search results | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#14110 | License | MIT | Doc PR | Quite often I find myself copy/pasting the results from the search results in the profiler search form. Adding links for this allows developers to narrow down to the proper profiler result fast. Commits ------- 4bffacc [WebProfilerBundle] Filter links in search results
Quite often I find myself copy/pasting the results from the search results in the profiler search form. Adding links for this allows developers to narrow down to the proper profiler result fast.