Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6327b41

Browse filesBrowse files
committed
feature #21007 [WebProfilerBundle] Improve AJAX toolbar panel (ro0NL)
This PR was squashed before being merged into the 3.3-dev branch (closes #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
2 parents d378947 + afbcaa7 commit 6327b41
Copy full SHA for 6327b41

File tree

Expand file treeCollapse file tree

3 files changed

+10
-8
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-8
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/ajax.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/ajax.html.twig
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block toolbar %}
44
{% set icon %}
55
{{ include('@WebProfiler/Icon/ajax.svg') }}
6-
<span class="sf-toolbar-value sf-toolbar-ajax-requests">0</span>
6+
<span class="sf-toolbar-value sf-toolbar-ajax-request-counter">0</span>
77
{% endset %}
88

99
{% set text %}

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@
8888
var successStreak = 4;
8989
var pendingRequests = 0;
9090
var renderAjaxRequests = function() {
91-
var requestCounter = document.querySelector('.sf-toolbar-ajax-requests');
91+
var requestCounter = document.querySelector('.sf-toolbar-ajax-request-counter');
9292
if (!requestCounter) {
9393
return;
9494
}
9595
requestCounter.textContent = requestStack.length;
96-
requestCounter.className = 'sf-toolbar-ajax-requests sf-toolbar-value';
9796
9897
var infoSpan = document.querySelector(".sf-toolbar-ajax-info");
9998
if (infoSpan) {
100-
infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length > 1 ? 's' : '');
99+
infoSpan.textContent = requestStack.length + ' AJAX request' + (requestStack.length !== 1 ? 's' : '');
101100
}
102101
103102
var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
@@ -138,7 +137,7 @@
138137
139138
var statusCodeCell = document.createElement('td');
140139
var statusCode = document.createElement('span');
141-
statusCode.textContent = '-';
140+
statusCode.textContent = 'n/a';
142141
statusCodeCell.appendChild(statusCode);
143142
row.appendChild(statusCodeCell);
144143
@@ -157,7 +156,7 @@
157156
158157
var durationCell = document.createElement('td');
159158
durationCell.className = 'sf-ajax-request-duration';
160-
durationCell.textContent = '-';
159+
durationCell.textContent = 'n/a';
161160
row.appendChild(durationCell);
162161
163162
var profilerCell = document.createElement('td');
@@ -199,6 +198,8 @@
199198
statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
200199
}
201200
statusCodeElem.textContent = request.statusCode;
201+
} else {
202+
statusCodeElem.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
202203
}
203204
204205
if (request.duration) {
@@ -271,6 +272,7 @@
271272
finishAjaxRequest(idx);
272273
}, function (e){
273274
stackElement.error = true;
275+
finishAjaxRequest(idx);
274276
});
275277
startAjaxRequest(idx);
276278
}
@@ -498,7 +500,6 @@
498500
Sfjs.addEventListener(window, 'load', function() {
499501
Sfjs.createTabs();
500502
Sfjs.createToggles();
501-
Sfjs.renderAjaxRequests();
502503
});
503504
504505
/*]]>*/</script>

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
}
9292
9393
Sfjs.setPreference('toolbar/displayState', 'block');
94-
})
94+
});
95+
Sfjs.renderAjaxRequests();
9596
},
9697
function(xhr) {
9798
if (xhr.status !== 0) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.