Skip to content

Commit

Permalink
use xdebug links similar in views/sql (#1510)
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh authored Feb 11, 2024
1 parent a3bf4d0 commit fa8a757
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/DataCollector/ViewCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public function addView(View $view)
}

$template = [
'name' => $shortPath ? sprintf('%s (%s)', $name, $shortPath) : $name,
'param_count' => count($params),
'name' => $name,
'param_count' => $this->collect_data ? count($params) : null,
'params' => $params,
'start' => microtime(true),
'type' => $type,
Expand Down
5 changes: 5 additions & 0 deletions src/Resources/laravel-debugbar-dark-mode.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ div.phpdebugbar-openhandler .phpdebugbar-text-muted
color: var(--color-gray-600);
}

li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-filename,
li.phpdebugbar-widgets-list-item span.phpdebugbar-widgets-filename a.phpdebugbar-widgets-editor-link
{
color: #ddd;
}
div.phpdebugbar div.phpdebugbar-widgets-sqlqueries li.phpdebugbar-widgets-list-item.phpdebugbar-widgets-sql-duplicate {
background-color: #6f6200;
}
Expand Down
27 changes: 14 additions & 13 deletions src/Resources/sqlqueries/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,21 @@
if (typeof(stmt.row_count) != 'undefined') {
$('<span title="Row count" />').addClass(csscls('row-count')).text(stmt.row_count).appendTo(li);
}
if (typeof(stmt.filename) != 'undefined' && stmt.filename) {
$('<span title="Source file" />').addClass(csscls('source-file'))
.append(! stmt.xdebug_link ? $('<i/>').text(stmt.filename).html() : $('<a />')
.attr('href', stmt.xdebug_link.url).text(stmt.filename)
.attr('title', stmt.source)
.on('click', function (event) {
event.stopPropagation();
if (stmt.xdebug_link.ajax) {
event.preventDefault();
$.ajax(stmt.xdebug_link.url);
}
})
).appendTo(li);

if (typeof stmt.xdebug_link !== 'undefined' && stmt.xdebug_link !== null) {
var header = $('<span />').addClass(csscls('filename')).text(stmt.xdebug_link.filename + ( stmt.xdebug_link.line ? "#" + stmt.xdebug_link.line : ''));
if (stmt.xdebug_link) {
if (stmt.xdebug_link.ajax) {
$('<a title="' + stmt.xdebug_link.url + '"></a>').on('click', function () {
$.ajax(stmt.xdebug_link.url);
}).addClass(csscls('editor-link')).appendTo(header);
} else {
$('<a href="' + stmt.xdebug_link.url + '"></a>').addClass(csscls('editor-link')).appendTo(header);
}
}
header.appendTo(li);
}

if (stmt.connection) {
$('<span title="Connection" />').addClass(csscls('database')).text(stmt.connection).appendTo(li);
li.attr("connection",stmt.connection);
Expand Down

0 comments on commit fa8a757

Please sign in to comment.