Fix: default uptime to 0 instead of 100 for inactive agents
This commit is contained in:
1 parent
f0d9a55a56
commit
6a23577b08
2 files changed
+3
-3
No files matched your search
@@ -103,7 +103,7 @@ export function getAgentColumns({
|
|||||||
className: "w-[10%] text-center",
|
className: "w-[10%] text-center",
|
||||||
accessor: (row) => {
|
accessor: (row) => {
|
||||||
const uuid = row.uuid || row.serial;
|
const uuid = row.uuid || row.serial;
|
||||||
const uptime = uptimeMap[uuid] ?? 100;
|
const uptime = uptimeMap[uuid] ?? 0;
|
||||||
let color = "text-emerald-400";
|
let color = "text-emerald-400";
|
||||||
if (uptime < 90) color = "text-red-400";
|
if (uptime < 90) color = "text-red-400";
|
||||||
else if (uptime < 98) color = "text-amber-400";
|
else if (uptime < 98) color = "text-amber-400";
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ export default function AgentsPage() {
|
|||||||
return hum === 'Online' || hum === 'Flows Detected' || (hum && hum.startsWith('Last seen:'));
|
return hum === 'Online' || hum === 'Flows Detected' || (hum && hum.startsWith('Last seen:'));
|
||||||
}).length;
|
}).length;
|
||||||
const offlineAgents = totalAgents - onlineAgents;
|
const offlineAgents = totalAgents - onlineAgents;
|
||||||
const uptimeValues = agents.map(a => uptimeMap[a.uuid || a.serial] ?? 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 : 100;
|
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
|
// External Accounts di halaman Agents = akun eksternal teknikal/operasional saja
|
||||||
// AGENT_VIEWER = akun network agent (sudah ada di tabel agents) → BUKAN akun eksternal
|
// AGENT_VIEWER = akun network agent (sudah ada di tabel agents) → BUKAN akun eksternal
|
||||||
|
|||||||
Reference in new issue
Block a user