Integração Pangolin Proxy
This commit is contained in:
@@ -23,8 +23,21 @@
|
||||
<?php foreach ($servers as $server): ?>
|
||||
<?php
|
||||
$lastSeen = !empty($server['last_seen']) ? strtotime($server['last_seen']) : 0;
|
||||
$isOnline = $lastSeen && (time() - $lastSeen < 300); // 5 minutes
|
||||
// Servidor só está online se está ATIVO e foi visto nos últimos 5 minutos
|
||||
$isOnline = $server['status'] === 'active' && $lastSeen && (time() - $lastSeen < 300);
|
||||
$lastSeenText = $lastSeen ? date('d/m/Y H:i', $lastSeen) : 'Nunca';
|
||||
|
||||
// Define a cor do badge do agente
|
||||
if ($server['status'] !== 'active') {
|
||||
$agentClass = 'bg-gray-100 text-gray-600';
|
||||
$agentText = 'Inativo';
|
||||
} elseif ($isOnline) {
|
||||
$agentClass = 'bg-green-100 text-green-800';
|
||||
$agentText = 'Online';
|
||||
} else {
|
||||
$agentClass = 'bg-red-100 text-red-800';
|
||||
$agentText = 'Offline';
|
||||
}
|
||||
?>
|
||||
<tr class="hover:bg-gray-50 transition-colors">
|
||||
<td class="px-6 py-4 text-sm font-medium text-gray-900"><?= htmlspecialchars($server['name']) ?>
|
||||
@@ -52,8 +65,8 @@
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm">
|
||||
<span title="Visto por último: <?= $lastSeenText ?>"
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full <?= $isOnline ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' ?>">
|
||||
<?= $isOnline ? 'Online' : 'Offline' ?>
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full <?= $agentClass ?>">
|
||||
<?= $agentText ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user