Skip to content

[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

Closed
wants to merge 1 commit into from

Conversation

rvanlaak
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
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.

@fabpot
Copy link
Member

fabpot commented Mar 30, 2015

Can you add a screenshot here?

@rvanlaak
Copy link
Contributor Author

snippet-sf-profiler

<td>{{ elements.url }}</td>
<td>
{{ elements.ip }}
<a href="{{ path('_profiler_search_results', app.request.query.all|merge({'ip': elements.ip, 'token': elements.token})) }}">
Copy link
Member

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)?

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, you're right.

@xabbuh
Copy link
Member

xabbuh commented Apr 1, 2015

👍 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=">
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Apr 2, 2015

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'));
Copy link
Member

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)

Copy link
Contributor

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

Copy link
Member

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)

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

👍 ping @symfony/deciders

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Oct 5, 2015

Don't think this PR still is valid on the profiler redesign?

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

I do :)

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Oct 5, 2015

Let me at least squash all commits first then 👍

@fabpot
Copy link
Member

fabpot commented Oct 5, 2015

As this PR is based on 2.7, you will have to submit a new one based on the 2.8 branch.

@javiereguiluz
Copy link
Member

@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 text-decoration: none by default and show the underline only when you :hover a table row.

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Oct 5, 2015

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 td:hover?

Something like http://fontawesome.io/icon/filter/

@xabbuh
Copy link
Member

xabbuh commented Oct 5, 2015

Looks like something went wrong during the rebase.

@rvanlaak rvanlaak force-pushed the 2.7 branch 2 times, most recently from b0b49ac to 31192c3 Compare October 6, 2015 08:27
@rvanlaak
Copy link
Contributor Author

rvanlaak commented Oct 6, 2015

Was still busy rebasing, completed now. Did add the icon on tr:hover to make visible what fields can get filtered.

@@ -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)) }}
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Contributor Author

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?

@stof
Copy link
Member

stof commented Oct 7, 2015

@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

@rvanlaak
Copy link
Contributor Author

rvanlaak commented Oct 7, 2015

So the target only is 2.8 and not 2.7, that wasn't clear to me up till now since the PR was from 30 March.

@fabpot
Copy link
Member

fabpot commented Oct 7, 2015

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.

@fabpot
Copy link
Member

fabpot commented Oct 19, 2015

@rvanlaak Closing this PR. Can you reopen a new one on 2.8? Thanks.

@rvanlaak
Copy link
Contributor Author

Done 👍 @fabpot see #16344

fabpot added a commit that referenced this pull request Oct 28, 2015
…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
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants