Fixed broken sql log selecting in debug-panel

This commit is contained in:
Roman Kelesidis 2023-02-19 12:13:42 +07:00
commit a2bf059c35
2 changed files with 8 additions and 35 deletions

View file

@ -42,17 +42,6 @@ if (!defined('BB_ROOT')) {
cursor: pointer; cursor: pointer;
} }
.sqlLogHead {
text-align: right;
float: right;
width: 100%;
}
.sqlLogHead fieldset {
float: right;
margin-right: 4px;
}
.sqlLogWrapped { .sqlLogWrapped {
white-space: normal; white-space: normal;
overflow: visible; overflow: visible;
@ -74,7 +63,6 @@ if (!defined('BB_ROOT')) {
</style> </style>
<?php <?php
if (!empty($_COOKIE['explain'])) { if (!empty($_COOKIE['explain'])) {
foreach ($DBS->srv as $srv_name => $db_obj) { foreach ($DBS->srv as $srv_name => $db_obj) {
if (!empty($db_obj->do_explain)) { if (!empty($db_obj->do_explain)) {
@ -85,32 +73,17 @@ if (!empty($_COOKIE['explain'])) {
$sql_log = !empty($_COOKIE['sql_log']) ? \TorrentPier\Legacy\Dev::get_sql_log() : ''; $sql_log = !empty($_COOKIE['sql_log']) ? \TorrentPier\Legacy\Dev::get_sql_log() : '';
echo ' if ($sql_log) {
echo '<div class="sqlLog" id="sqlLog">' . ($sql_log ?: '') . '</div><!-- / sqlLog --><br clear="all" />';
}
?>
<script type="text/javascript"> <script type="text/javascript">
function fixSqlLog() { function fixSqlLog() {
if ($("#sqlLog").height() > 400) { if ($("#sqlLog").height() > 400) {
$("#sqlLog").height(400); $("#sqlLog").height(400);
} }
$("#sqlLog div.sqlLogRow")
.hover(
function(){ $(this).addClass("sqlHover"); },
function(){ $(this).removeClass("sqlHover"); }
)
.click(
function(){ $(this).toggleClass("sqlHighlight"); }
)
;
} }
</script>
<div class="sqlLogHead">
';
echo '</div><!-- / sqlLogHead -->';
if ($sql_log) {
echo '<div class="sqlLog" id="sqlLog">' . ($sql_log ?: '') . '</div><!-- / sqlLog --><br clear="all" />';
}
?>
<script type="text/javascript">
$(document).ready(fixSqlLog); $(document).ready(fixSqlLog);
</script> </script>

View file

@ -67,7 +67,7 @@ class Dev
$info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src']; $info = !empty($dbg['info']) ? $dbg['info'] . ' [' . $dbg['src'] . ']' : $dbg['src'];
$log .= '' $log .= ''
. '<div class="sqlLogRow" title="' . $info . '">' . '<div onmouseout="$(this).removeClass(\'sqlHover\');" onmouseover="$(this).addClass(\'sqlHover\');" onclick="$(this).toggleClass(\'sqlHighlight\');" class="sqlLogRow" title="' . $info . '">'
. '<span style="letter-spacing: -1px;">' . $time . ' </span>' . '<span style="letter-spacing: -1px;">' . $time . ' </span>'
. '<span title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#' . $id . '\').text() );" style="color: gray; letter-spacing: -1px;">' . $perc . '</span>' . '<span title="Copy to clipboard" onclick="$.copyToClipboard( $(\'#' . $id . '\').text() );" style="color: gray; letter-spacing: -1px;">' . $perc . '</span>'
. ' ' . ' '