Skip to content

Commit

Permalink
ConnectionPanel: Added performance colors (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek authored and dg committed Oct 6, 2020
1 parent 53fceda commit b0e102f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Bridges/DatabaseTracy/ConnectionPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class ConnectionPanel implements Tracy\IBarPanel
/** @var bool */
public $disabled = false;

/** @var float */
public $performanceScale = 0.25;

/** @var float logged time */
private $totalTime = 0;

Expand Down Expand Up @@ -137,6 +140,7 @@ public function getPanel(): ?string
$name = $this->name;
$count = $this->count;
$totalTime = $this->totalTime;
$performanceScale = $this->performanceScale;
require __DIR__ . '/templates/ConnectionPanel.panel.phtml';
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use Tracy\Helpers;
[$connection, $sql, $params, $source, $time, $rows, $error, $command, $explain] = $query;
?>
<tr>
<td>
<td style="background:rgba(255, 95, 23, <?= sprintf('%0.3f', log($time * 1000 + 1, 10) * $performanceScale) ?>)">
<?php if ($error): ?>
<span title="<?= Helpers::escapeHtml($error) ?>">ERROR</span>
<?php elseif ($time !== null): echo sprintf('%0.3f', $time * 1000); endif ?>
Expand Down

0 comments on commit b0e102f

Please sign in to comment.