Enhance resilience and UI in inventory and server detail pages:

- Add `Heartbeat` column to `/X/Inventory.php` with status-based row styling.
- Improve error handling and data validation for backup details in `Server-Detail.php`.
This commit is contained in:
2025-09-17 10:20:48 +02:00
parent 2c279320ce
commit 878106f83f
2 changed files with 28 additions and 8 deletions

View File

@@ -56,6 +56,7 @@
<thead> <!-- Header -->
<tr>
<th data-field="Name" data-sortable="true">Name</th>
<th data-field="Heartbeat" data-sortable="true" data-visible="false" >Heartbeat</th>
<th data-field="Host" data-sortable="true">Host</th>
<th data-field="OS" data-sortable="true">OS Type</th>
<th data-field="distrib" data-sortable="true">Distrib</th>
@@ -75,8 +76,24 @@
$total++;
echo "<tr>";
//name
$name = $s['hostname'];
echo "<td><a href='/inventory/server-detail.php?s=".$name."' target='_blank'>$name</a></td>";
$name = $s['hostname']; $heartbeat = $s['Heartbeat']; $statusClass = '';
$heartbeatDate = new DateTime($heartbeat);
$now = new DateTime();
$interval = $now->diff($heartbeatDate);
$diffInMinutes = ($interval->days * 24 * 60) + ($interval->h * 60) + $interval->i;
if ($diffInMinutes < 10) {
$statusClass = 'table-success';
} elseif ($diffInMinutes <= 30) {
$statusClass = 'table-warning';
} else {
$statusClass = 'table-danger';
}
echo "<td class='{$statusClass}'>";
echo " <a href='/inventory/server-detail.php?s={$name}' target='_blank'>{$name}</a>";
echo "</td>";
//heartbeat
echo "<td>".$s["Heartbeat"]."</td>";
//Host
echo "<td>".$s['Owner']."</td>";