-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle] Add HTTP return code in the Ajax request list table #17540
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
kucharovic
commented
Jan 26, 2016
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #17518 |
License | MIT |
Doc PR | - |
Q | A ---|--- Bug fix? | no New feature? | yes BC breaks? | no Deprecations? | no Tests pass? | yes Fixed tickets | symfony#17518 License | MIT Doc PR | -
@kucharovic I just tested your pull request and it works perfect! Thanks for working on this. However, to make errors stand out more prominently, what do you think of using the If you like the idea, the code would be something like this: var statusCodeCell = document.createElement('td');
var statusCode = document.createElement('span');
if (request.statusCode > 299) {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
} else {
statusCode.setAttribute('class', 'sf-toolbar-status');
}
statusCode.textContent = request.statusCode || '-';
statusCodeCell.appendChild(statusCode);
row.appendChild(statusCodeCell); |
@javiereguiluz it looks better. Are you sure, that redirects should be red? |
@kucharovic I trusted this comment from @Jean85 who said that in Ajax there are no redirections. We probably need more comments about this or some verification. |
IMO it should be: if (request.statusCode < 300) {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-green');
} else if (request.statusCode < 400) {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
} else {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
} |
@kucharovic anyway, to be completely safe, we could change |
@javiereguiluz he's right. A XMLHttpRequest should either get the resource or be told why not. |
Hmmm, then maybe: if (request.statusCode < 400) {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-green');
} else if (request.statusCode < 500) {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
} else {
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
} |
@stloyd I like your proposal ... except for the last comment. Showing 4xx errors in yellow is inconsistent with the current toolbar. 4xx and 5xx are treated as errors and showed in red. |
Yeah, I posted that comment because I stumbled on it.. I had an issue in my code, since I was trying to catch redirects with I agree with @javiereguiluz , consistency with the rest of the toolbar is better. |
👍 |
should we really put the 2xx in green or keep it in gray instead ? I think putting colors only on errors make them stand out more than if everything is colored |
+1 for gray instead of green |
👍 |
Thank you @kucharovic. |