Skip to content

Commit 6198223

Browse files
committed
feature symfony#27763 [WebProfilerBundle] Append new ajax request to the end of the list (BoShurik)
This PR was squashed before being merged into the 4.2-dev branch (closes symfony#27763). Discussion ---------- [WebProfilerBundle] Append new ajax request to the end of the list Append new ajax request to the end of the list instead of adding it to the beginning | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes/no | BC breaks? | no/yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Didn't find why this behavior was changed with web profiler design. In current version it is hard to click to the latest ajax request. Commits ------- 45d4559 [WebProfilerBundle] Append new ajax request to the end of the list
2 parents 924f7f9 + 45d4559 commit 6198223

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
129129
var nbOfAjaxRequest = tbody.rows.length;
130130
if (nbOfAjaxRequest >= 100) {
131-
tbody.deleteRow(nbOfAjaxRequest - 1);
131+
tbody.deleteRow(0);
132132
}
133133
134134
var request = requestStack[index];
@@ -177,7 +177,10 @@
177177
}, 100);
178178
179179
row.className = 'sf-ajax-request sf-ajax-request-loading';
180-
tbody.insertBefore(row, tbody.firstChild);
180+
tbody.insertBefore(row, null);
181+
182+
var toolbarInfo = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
183+
toolbarInfo.scrollTop = toolbarInfo.scrollHeight;
181184
182185
renderAjaxRequests();
183186
};
@@ -492,6 +495,10 @@
492495
setPreference('toolbar/displayState', 'block');
493496
});
494497
renderAjaxRequests();
498+
addEventListener(document.querySelector('.sf-toolbar-block-ajax'), 'mouseenter', function (event) {
499+
var elem = document.querySelector('.sf-toolbar-block-ajax .sf-toolbar-info');
500+
elem.scrollTop = elem.scrollHeight;
501+
});
495502
addEventListener(document.querySelector('.sf-toolbar-block-ajax > .sf-toolbar-icon'), 'click', function (event) {
496503
event.preventDefault();
497504

0 commit comments

Comments
 (0)