symfony/symfony — pull request #8896 by Burgov (2013-08-30 19:06:47+00:00)
Title: Show AJAX requests in the symfony profiler toolbar

| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -

Applications make more and more use of AJAX calls to get partials or JSON data, and whenever something goes wrong or I wish to know more about DB queries executed, I have to find the profile in the profiler, which is rather anoying and sometimes can even be somewhat difficult. This PR adds a section to the debugger toolbar which shows the amount of AJAX calls executed during the current page show, and if you hover over it, gives more information on the calls, like the method, the URI, the time it took, the status, and a link to the profile of that specific request.

Todo:
- [ ] create an actual icon for this, instead of using a copy of the "memory" icon and fix the layout of the data
- [ ] now only JQuery and AngularJS calls are logged, perhaps more libraries should be added
- [ ] refactor the JS (my pure JS skills are a little rusty since the Netscape era...
- [ ] either prevent the icon from linking (is that possible?) or actually show some information in the profiler itself (that means actually registering the calls in the profiler server side)
- [ ] Generate the url to the profiler instead of the way it is done now (`url = "/_profile/"+token`)

You can clone https://github.com/Burgov/profile_ajax_requests to see a working example