← back to AbramsEgo
build-queue/done/07-swap-metric.md
17 lines
# AbramsEgo build task 07 — add SWAP to the top metrics bar (panel 1)
SPEC.md panel 1 requires the top metrics bar to show **live CPU / RAM / swap / disk, color-coded
by threshold**. Right now the backend already collects swap (`SNAP.system.swap.usedMB`) but the
frontend metrics bar only renders CPU / RAM / DISK / NODE / UP — **swap is missing**. Add it.
1. In `public/index.html`, in the `// metrics bar` block (~line 272), add a `SWAP` metric between
RAM and DISK, e.g. `['SWAP', (s.swap && s.swap.usedMB!=null) ? (s.swap.usedMB>=1024 ? (s.swap.usedMB/1024).toFixed(1)+'G' : Math.round(s.swap.usedMB)+'M') : '—', cls(s.swap&&s.swap.usedMB, 2048, 8192)]`.
Reuse the existing `cls(val, warn, crit)` helper so it color-codes (warn ≈2GB, crit ≈8GB swap used).
Handle the `swap===null` case (non-mac / unavailable) → show `—`, no color.
2. Keep it read-only — no server changes needed (swap is already in the snapshot).
3. Verify: `pm2 restart abramsego`, then `curl -s -u admin:'DW2024!' http://localhost:9773/api/system`
confirms `swap.usedMB` is present, and the metrics bar HTML now includes a SWAP cell.
Commit `feat: show swap in top metrics bar (SPEC panel 1)`.
Do NOT deploy. Local only.