Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1525cce

Browse files
committed
feature #17540 [WebProfilerBundle] Add HTTP return code in the Ajax request list table (kucharovic)
This PR was submitted for the 2.8 branch but it was merged into the 3.1-dev branch instead (closes #17540). Discussion ---------- [WebProfilerBundle] Add HTTP return code in the Ajax request list table Q | A ---|--- Bug fix? | no New feature? | yes BC breaks? | no Deprecations? | no Tests pass? | yes Fixed tickets | #17518 License | MIT Doc PR | - Commits ------- 9192e1b [WebProfilerBundle] Add HTTP return code in the Ajax request list table
2 parents cb16bff + 9192e1b commit 1525cce

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<thead>
1616
<tr>
1717
<th>Method</th>
18+
<th>Status</th>
1819
<th>URL</th>
1920
<th>Time</th>
2021
<th>Profile</th>

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,19 @@
110110
methodCell.textContent = request.method;
111111
row.appendChild(methodCell);
112112
113+
var statusCodeCell = document.createElement('td');
114+
var statusCode = document.createElement('span');
115+
if (request.statusCode < 300) {
116+
statusCode.setAttribute('class', 'sf-toolbar-status');
117+
} else if (request.statusCode < 400) {
118+
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-yellow');
119+
} else {
120+
statusCode.setAttribute('class', 'sf-toolbar-status sf-toolbar-status-red');
121+
}
122+
statusCode.textContent = request.statusCode || '-';
123+
statusCodeCell.appendChild(statusCode);
124+
row.appendChild(statusCodeCell);
125+
113126
var pathCell = document.createElement('td');
114127
pathCell.className = 'sf-ajax-request-url';
115128
if ('GET' === request.method) {
@@ -241,6 +254,7 @@
241254
stackElement.duration = new Date() - stackElement.start;
242255
stackElement.loading = false;
243256
stackElement.error = self.status < 200 || self.status >= 400;
257+
stackElement.statusCode = self.status;
244258
stackElement.profile = self.getResponseHeader("X-Debug-Token");
245259
stackElement.profilerUrl = self.getResponseHeader("X-Debug-Token-Link");
246260

0 commit comments

Comments
 (0)