mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 13:28:35 +01:00
Merge remote-tracking branch 'origin/pr/109'
Conflicts: src/DebugBar/Resources/widgets/sqlqueries/widget.css
This commit is contained in:
commit
ab02c692d2
@ -1,4 +1,3 @@
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries .phpdebugbar-widgets-status {
|
||||
font-family: monospace;
|
||||
padding: 6px 6px;
|
||||
@ -67,8 +66,17 @@ div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item span.phpdebu
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
code.phpdebugbar-widgets-sql {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: break-word;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate {
|
||||
background-color: #ffd;
|
||||
}
|
||||
|
||||
div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate:hover {
|
||||
background-color: #ffc;
|
||||
}
|
||||
|
@ -53,10 +53,33 @@
|
||||
this.$list.set('data', data.statements);
|
||||
this.$status.empty();
|
||||
|
||||
// Search for duplicate statements.
|
||||
for (var sql = {}, duplicate = 0, i = 0; i < data.statements.length; i++) {
|
||||
var stmt = data.statements[i].sql;
|
||||
if (data.statements[i].params && !$.isEmptyObject(data.statements[i].params)) {
|
||||
stmt += ' {' + $.param(data.statements[i].params, false) + '}';
|
||||
}
|
||||
sql[stmt] = sql[stmt] || { keys: [] };
|
||||
sql[stmt].keys.push(i);
|
||||
}
|
||||
// Add classes to all duplicate SQL statements.
|
||||
for (var stmt in sql) {
|
||||
if (sql[stmt].keys.length > 1) {
|
||||
duplicate++;
|
||||
for (var i = 0; i < sql[stmt].keys.length; i++) {
|
||||
this.$list.$el.find('.' + csscls('list-item')).eq(sql[stmt].keys[i])
|
||||
.addClass(csscls('sql-duplicate')).addClass(csscls('sql-duplicate-'+duplicate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var t = $('<span />').text(data.nb_statements + " statements were executed").appendTo(this.$status);
|
||||
if (data.nb_failed_statements) {
|
||||
t.append(", " + data.nb_failed_statements + " of which failed");
|
||||
}
|
||||
if (duplicate) {
|
||||
t.append(", " + duplicate + " of which were duplicated");
|
||||
}
|
||||
if (data.accumulated_duration_str) {
|
||||
this.$status.append($('<span title="Accumulated duration" />').addClass(csscls('duration')).text(data.accumulated_duration_str));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user