Optimize database queries, add resilience with is_countable, refine UI for progress bars and tables, update scripts for dynamic resizing, and correct navbar link case sensitivity.

This commit is contained in:
2025-08-20 20:38:01 +02:00
parent 70af042b7b
commit a17bb63889
6 changed files with 96 additions and 51 deletions

View File

@@ -63,16 +63,29 @@
</div>
<!-- TABLE -->
<div>
<?php // DATA
$answers = Invoke_infra("SELECT distinct(cmd),max(ts) from x_stdout group by cmd order by max(ts) desc");
echo "<div class='row'>";
foreach($answers as $cmd){
$ts = Invoke_infra("SELECT max(ts) as fin, min(ts) as debut FROM x_stdout where cmd = '".$cmd['cmd']."'");
echo "<div class='col-3 mb-3'><a href='StdOut-detail.php?s=".$cmd['cmd']."&AIX=1&linux=1&DUN=1' class='btn btn-primary btn-lg' role='button'>";
echo "<b>".$cmd['cmd']."</b><br><small>".$ts[0]['debut']." --> ".$ts[0]['fin']."</small>";
echo "</a></div> ";
<?php // DATA OPTIMIZED
// The one and only query to get everything we need
$sql = "SELECT cmd, MIN(ts) AS debut, MAX(ts) AS fin FROM x_stdout GROUP BY cmd ORDER BY fin DESC";
$results = Invoke_infra($sql);
echo "<div class='row'>";
// Loop through the results (now very fast, no more queries inside)
if (is_array($results)) {
foreach ($results as $script) {
$scriptName = $script['cmd'];
$startTime = $script['debut'];
$endTime = $script['fin'];
echo "<div class='col-3 mb-3'>";
echo "<a href='StdOut-detail.php?s={$scriptName}&AIX=1&linux=1&DUN=1' class='btn btn-primary btn-lg' role='button'>";
echo "<b>{$scriptName}</b><br><small>{$startTime} --> {$endTime}</small>";
echo "</a>";
echo "</div>";
}
}
echo "</div>";
?>
</div>