Add the staff stats dashboard

Backend: GET /api/stats/ (staff only) gathers psutil CPU/memory counters,
nvidia-smi GPU stats, the cached disk numbers and the running/finished
download + match jobs. Root logging now also writes a rotating file
(backend/logs/j621.log) so the dashboard can tail it, and psutil joins the
requirements. The storage payload computation is shared with the existing
storage endpoint.

Frontend: a /stats route + Stats nav entry for staff, polling every 2 s —
per-core CPU bars, memory and swap, GPUs (utilization, VRAM, temperature),
disk with the media/temp breakdown, active jobs with progress bars,
recently finished jobs with summaries, and the log tail with level colours
and an auto-scroll toggle. Section 4 of the roadmap is complete.
This commit is contained in:
2026-09-17 21:36:33 -05:00
parent 0fcc4e518a
commit b024fc52d7
11 changed files with 808 additions and 62 deletions
+7 -4
View File
@@ -113,10 +113,13 @@ Files now stage first and are resolved before entering the library.
- [x] Apply overwrites the same J-ID: `POST /api/files/J-x/optimize/` replaces
the file(s) and recomputes MD5/size/perceptual hashes (409 when the
result matches another item, 400 when it is identical)
- [ ] **Stats dashboard**
- [ ] CPU / RAM / GPU / disk usage
- [ ] Active jobs list (this is what makes the footer "Active Workers" real)
- [ ] Live log tail
- [x] **Stats dashboard** (`/stats`, staff)
- [x] CPU / RAM / GPU / disk usage (`psutil` + `nvidia-smi`; capacity bars
follow the design system's 80% / 95% colour thresholds)
- [x] Active jobs list (downloads + match scans with progress) plus the
recently finished ones
- [x] Live log tail with level highlighting and an auto-scroll toggle
(root logging now also writes a rotating `backend/logs/j621.log`)
## 5. Shell & polish