Skip to content

Commit 5d4ee5c

Browse files
authored
Show only duplicated queries (#1394)
1 parent eb01216 commit 5d4ee5c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/Resources/sqlqueries/widget.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,24 @@
259259
if (duplicate) {
260260
t.append(", " + duplicate + " of which were duplicated");
261261
t.append(", " + (data.nb_statements - duplicate) + " unique");
262+
263+
// add toggler for displaying only duplicated queries
264+
var duplicatedText = "Show only duplicated";
265+
var allText = "Show All";
266+
var id = "phpdebugbar-show-duplicates";
267+
t.append(". <a id='" + id + "'>" + duplicatedText + "</a>");
268+
269+
$(".phpdebugbar #" + id).click(function () {
270+
var $this = $(this);
271+
$this.toggleClass("shown_duplicated");
272+
$this.text($this.hasClass("shown_duplicated") ? allText : duplicatedText);
273+
$(".phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-list-item")
274+
.not(".phpdebugbar-widgets-sql-duplicate")
275+
.toggle();
276+
277+
return false;
278+
});
279+
262280
}
263281
if (data.accumulated_duration_str) {
264282
this.$status.append($('<span title="Accumulated duration" />').addClass(csscls('duration')).text(data.accumulated_duration_str));

0 commit comments

Comments
 (0)