8000 [WebProfilerBundle] Improve AJAX toolbar panel by ro0NL · Pull Request #21007 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Improve AJAX toolbar panel #21007

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 5 commits into from
Closed

[WebProfilerBundle] Improve AJAX toolbar panel #21007

wants to merge 5 commits into from

Conversation

ro0NL
Copy link
Contributor
@ro0NL ro0NL commented Dec 21, 2016
Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #...
License MIT
Doc PR symfony/symfony-docs#...

Before

image

image

After

image

image

@javiereguiluz
Copy link
Member

A quick question: when there are no Ajax requests, the entire Ajax panel is hidden. Do you really see it when you have 0 requests?

@ro0NL
Copy link
Contributor Author
ro0NL commented Dec 21, 2016

Yes on hover.. and it's ugly ;-)

edit: not sure if that's actually intended though?

@javiereguiluz
Copy link
Member

@ro0NL that's a Symfony bug. There's no Ajax panel when there are no Ajax requests:

no-ajax-requests

@ro0NL
Copy link
Contributor Author
ro0NL commented Dec 21, 2016

Hmz interesting. I also noticed span.sf-toolbar-ajax-requests implicitly inherits styling from table.sf-toolbar-ajax-requests (hence the class rename) which feels buggy.

edit: @javiereguiluz it's a regression i guess; i cannot rebase this PR onto 3.2 in any way. Feel free to add a commit and re-fix it :)

@linaori
Copy link
Contributor
linaori commented Dec 21, 2016

Hmm maybe we need a new tag for this "improvement"?

@ro0NL
Copy link
Contributor Author
ro0NL commented Dec 21, 2016

Updated. Havent tracked back where this got broken, so im not sure how it was done before.

@ro0NL
Copy link
Contributor Author
ro0NL commented Dec 22, 2016

It seems to behave the same as latest 3.2 now, only difference i spotted 3.2 handles failures a bit different;

image

There's no red block in 3.3

@nicolas-grekas nicolas-grekas added this to the 3.x milestone Dec 26, 2016
@fabpot
Copy link
Member
fabpot commented Feb 16, 2017

@javiereguiluz What do we do with this one? Is it a bug that should be fixed in 3.2 as well? Do we have a regression in current master (or even several as noted in the latest @ro0NL's comment)?

@fabpot
Copy link
Member
fabpot commented Mar 1, 2017

@javiereguiluz Can you have a look at this one?

@javiereguiluz javiereguiluz self-assigned this Mar 1, 2017
@ro0NL
Copy link
Contributor Author
ro0NL commented Mar 1, 2017

@ro0NL
Copy link
Contributor Author
ro0NL commented Mar 4, 2017

Investigated it a bit further..

The display:none not being applied initially behaves really weird; after a few refreshes it works.

var requestCounter = document.querySelector('.sf-toolbar-ajax-requests');
if (!requestCounter) {
   return;
}

seems to false-positive sometimes. This is related to the window.load event concurring with the xhr load event.

The second issue with the red status block not working is because the JS promise gets rejected due CORS policy (same as in 3.2), however we dont reach finishAjaxRequest in that case (for 404 responses etc. it works as expected).

@ro0NL
Copy link
Contributor Author
ro0NL commented Mar 4, 2017

@fabpot @javiereguiluz we're all good 👍

Part of the regression was caused by a missing else case, which actually happened before (https://github.com/symfony/symfony/pull/20197/files#diff-de00cc2fe56e59a48a4d26e7a0dccca3L137)

@@ -498,7 +498,6 @@
Sfjs.addEventListener(window, 'load', function() {
Sfjs.createTabs();
Sfjs.createToggles();
Sfjs.renderAjaxRequests();
Copy link
Contributor Author
@ro0NL ro0NL Mar 4, 2017

Choose a reason for hiding this comment

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

This file is included in toolbar_js first.. so for being super fast window.load actually wins from the XHR response :))

@fabpot
Copy link
Member
fabpot commented Mar 22, 2017

Thank you @ro0NL.

@fabpot fabpot closed this in 6327b41 Mar 22, 2017
@ro0NL ro0NL deleted the wdt/ajax branch March 22, 2017 18:42
@nicolas-grekas nicolas-grekas modified the milestone: 3.x Mar 24, 2017
@patrick-mcdougle
8000 Copy link
Contributor

@ro0NL Can you explain to me what I broke so I know where I need to improve in the future? Was there a regression/problem caused by me in #20197 ?

@ro0NL
Copy link
Contributor Author
ro0NL commented Apr 10, 2017

@patrick-mcdougle
Copy link
Contributor

@ro0NL Thanks! I understand the race condition and the promise failure, but the else is right here: https://github.com/symfony/symfony/pull/20197/files#diff-de00cc2fe56e59a48a4d26e7a0dccca3R199

Is there another missing else?

@ro0NL
Copy link
Contributor Author
ro0NL commented Apr 10, 2017

The if from L193 had none ;-)

@fabpot fabpot mentioned this pull request May 1, 2017
ostrolucky pushed a commit to ostrolucky/symfony that referenced this pull request Mar 25, 2018
…(ro0NL)

This PR was squashed before being merged into the 3.3-dev branch (closes symfony#21007).

Discussion
----------

[WebProfilerBundle] Improve AJAX toolbar panel

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Before

![image](https://cloud.githubusercontent.com/assets/1047696/21394974/072b3570-c79b-11e6-8104-23e9be365b0b.png)

![image](https://cloud.githubusercontent.com/assets/1047696/21383263/1dc484fc-c765-11e6-84e8-7133d67da324.png)

After

![image](https://cloud.githubusercontent.com/assets/1047696/21394997/1a508cb8-c79b-11e6-87de-962ac41c9022.png)

![image](https://cloud.githubusercontent.com/assets/1047696/21383308/53b4f196-c765-11e6-8993-2645f342c7e9.png)

Commits
-------

afbcaa7 [WebProfilerBundle] Improve AJAX toolbar panel
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
0