Skip to content

Commit b0e102f

Browse files
janbarasekdg
authored andcommitted
ConnectionPanel: Added performance colors (#258)
1 parent 53fceda commit b0e102f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Bridges/DatabaseTracy/ConnectionPanel.php

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class ConnectionPanel implements Tracy\IBarPanel
3434
/** @var bool */
3535
public $disabled = false;
3636

37+
/** @var float */
38+
public $performanceScale = 0.25;
39+
3740
/** @var float logged time */
3841
private $totalTime = 0;
3942

@@ -137,6 +140,7 @@ public function getPanel(): ?string
137140
$name = $this->name;
138141
$count = $this->count;
139142
$totalTime = $this->totalTime;
143+
$performanceScale = $this->performanceScale;
140144
require __DIR__ . '/templates/ConnectionPanel.panel.phtml';
141145
});
142146
}

src/Bridges/DatabaseTracy/templates/ConnectionPanel.panel.phtml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use Tracy\Helpers;
2929
[$connection, $sql, $params, $source, $time, $rows, $error, $command, $explain] = $query;
3030
?>
3131
<tr>
32-
<td>
32+
<td style="background:rgba(255, 95, 23, <?= sprintf('%0.3f', log($time * 1000 + 1, 10) * $performanceScale) ?>)">
3333
<?php if ($error): ?>
3434
<span title="<?= Helpers::escapeHtml($error) ?>">ERROR</span>
3535
<?php elseif ($time !== null): echo sprintf('%0.3f', $time * 1000); endif ?>

0 commit comments

Comments
 (0)