No nodes found.
No nodes found.
: NODES.slice(0, 4).map(n => {
const nodeId = n.id || n.hostname || n.name || 'node';
const isOnline = n.status === 'online' || n.online === true;
const cpuPct = n.cpu_percent ?? n.cpu ?? n.cpu_usage ?? null;
const memRaw = n.memory_used_gb ?? n.mem ?? (n.mem_used_mb != null ? n.mem_used_mb / 1024 : null);
const memGb = memRaw != null ? Number(memRaw) : null;
+ const memTotal = n.memory_total_gb ?? n.mem_total_gb ?? null;
+ const memPct = memGb && memTotal ? Math.round((memGb / memTotal) * 100) : null;
return (
-
+
- {nodeId}
-
- {cpuPct != null && CPU {Math.round(cpuPct)}%}
- {memGb != null && {memGb < 1 ? Math.round(memGb * 1024) + 'MB' : memGb.toFixed(1) + 'GB'} RAM}
+ {nodeId}
+
+ {cpuPct != null && (
+
+ CPU
+
+ 80 ? 'var(--warning)' : 'var(--text-3)' }} />
+
+ {Math.round(cpuPct)}%
+
+ )}
+ {memGb != null && (
+
+ MEM
+
+ 85 ? 'var(--warning)' : 'var(--text-3)' }} />
+
+ {memGb < 1 ? Math.round(memGb * 1024) + 'MB' : memGb.toFixed(1) + 'GB'}
+
+ )}
);
})}
@@ -323,6 +355,26 @@ function Dashboard({ navigate }) {
);
}
+function DashSparkline({ data, color }) {
+ if (!data || data.length < 2) return
;
+ const max = Math.max(...data, 1);
+ const min = Math.min(...data, 0);
+ const range = max - min || 1;
+ const h = 24;
+ const w = 80;
+ const step = w / (data.length - 1);
+ const pts = data.map((d, i) => (i * step) + ',' + (h - ((d - min) / range) * h)).join(' ');
+ const area = '0,' + h + ' ' + pts + ' ' + w + ',' + h;
+ return (
+
+ );
+}
+
function SectionHead({ title, onMore, moreLabel = 'View all' }) {
return (
@@ -338,23 +390,25 @@ function SectionHead({ title, onMore, moreLabel = 'View all' }) {
function MiniJobRow({ job }) {
return (
-
+
-
-
-
{job.kind}
-
·
-
{job.asset}
+
+
+ {job.kind}
+ ·
+ {job.asset}
+ {job.node && on {job.node}}
{job.status === 'running' && (
-
-
+
)}
- {job.status === 'failed' &&
{job.error}
}
+ {job.status === 'failed' &&
{job.error}
}
-
- {job.status === 'running' ? job.eta : job.status}
+
+ {job.status === 'running' && job.eta ? job.eta : {job.status}}
);