Fix: default uptime to 0 instead of 100 for inactive agents

This commit is contained in:
ypratama committed 2026-09-07 10:52:34 +07:00
1 parent f0d9a55a56
commit 6a23577b08
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -103,7 +103,7 @@ export function getAgentColumns({
className: "w-[10%] text-center",
accessor: (row) => {
const uuid = row.uuid || row.serial;
const uptime = uptimeMap[uuid] ?? 100;
const uptime = uptimeMap[uuid] ?? 0;
let color = "text-emerald-400";
if (uptime < 90) color = "text-red-400";
else if (uptime < 98) color = "text-amber-400";
+2 -2
View File
@@ -99,8 +99,8 @@ export default function AgentsPage() {
return hum === 'Online' || hum === 'Flows Detected' || (hum && hum.startsWith('Last seen:'));
}).length;
const offlineAgents = totalAgents - onlineAgents;
const uptimeValues = agents.map(a => uptimeMap[a.uuid || a.serial] ?? 100);
const avgUptime = uptimeValues.length > 0 ? uptimeValues.reduce((s, v) => s + v, 0) / uptimeValues.length : 100;
const uptimeValues = agents.map(a => uptimeMap[a.uuid || a.serial] ?? 0);
const avgUptime = uptimeValues.length > 0 ? uptimeValues.reduce((s, v) => s + v, 0) / uptimeValues.length : 0;
// External Accounts di halaman Agents = akun eksternal teknikal/operasional saja
// AGENT_VIEWER = akun network agent (sudah ada di tabel agents) → BUKAN akun eksternal