Add structured headers to the PHP pages layer

Documents each tab's purpose, what it renders, and which endpoints it polls.
Pages that start with markup get the header in a <?php ?> block so it never
reaches the browser.

Also corrects the layer diagram in README-unraid.md: eight of eleven pages hold
no PHP logic and poll api/ for everything — only auth, monitor and scheduler
require an include/ file directly.
This commit is contained in:
Gmer4Lfe
2026-08-02 00:51:41 -04:00
parent 0b4ff27be4
commit ccc6c742ee
12 changed files with 414 additions and 5 deletions
+46
View File
@@ -1,4 +1,50 @@
<?php require_once dirname(__DIR__) . '/include/monitor.php'; ?>
// ═══════════════════════════════════════════════════════════════════════════════════════════════
// PURPOSE
// Monitor tab. The main dashboard — CPU per core, memory, GPUs, disks and pools, network,
// UPS, VMs, containers, transcodes, media sessions, and the watchdog health roll-up, for
// this host and every partner.
//
// DESIGN PRINCIPLES
// Two poll rates, deliberately split.
// api/monitor_fast.php carries the cheap, fast-moving values (12s); api/monitor.php
// carries the full payload on a slower cycle. Everything refreshing at the fast rate
// would put real load on the WebGUI this page exists to watch.
//
// Served from the tmpfs cache, not live calls.
// api_cache_writer.sh refreshes the payload every minute and the endpoint serves that.
// ?live=1 bypasses it. A missing cache always falls back to a live call, so the cache
// can never be why the dashboard fails to load.
//
// Missing subsystems simply do not render.
// No GPU, no UPS, no VMs — the corresponding card is absent rather than showing zeros
// or an error. The page is built to be correct on hardware lacking any given part.
//
// OPERATIONAL SAFEGUARDS
// The health roll-up must not default to healthy.
// vv_watchdog_summary() is conjunctive across every strike set, and it reads state from
// STATE_DIR. Six of those paths once pointed at /tmp, every read returned empty, and
// the page reported healthy unconditionally (fixed 2026-08-02). If this panel looks
// suspiciously green, verify the paths before believing it.
//
// Container actions are confirmed and routed through the action endpoint, which validates
// against real inventory.
//
// All remote and container-supplied strings render escaped.
//
// RENDERS
// System header, CPU per core, memory breakdown, GPU cards, storage pools and array disks,
// network, UPS, VMs, containers, transcode sessions, media now-playing, watchdog summary,
// partner node cards
//
// DEPENDS ON
// include/monitor.php required directly for initial render
// api/monitor.php full payload, slower cycle
// api/monitor_fast.php fast-moving values, 12s
// api/system.php system info
// api/media.php now-playing sessions
// api/docker_action.php container actions
// api/flag_toggle.php toggles
<style>
@keyframes vvRsPulse {
0%,100% { opacity:.5; transform:scaleX(.9); }