Global refresh rate in Settings drives every live view and each machine's sampler; per-page pickers removed

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-18 13:27:13 -07:00
co-authored by Claude Fable 5.1
parent a4f39859b6
commit bbf0f2580f
11 changed files with 92 additions and 32 deletions
+4 -2
View File
@@ -3,6 +3,7 @@ import { api, Sample, SmartInfo, StorageDevice, ZFSInfo, ZFSSnapshot } from './a
import { fmtBytes, fmtRate } from './Dashboard'
import TaskOutput from './TaskOutput'
import { Btn, Loading, Spinner, toast } from './ui'
import { useRefreshMs } from './prefs'
const pct = (v: number) => `${Math.round(v)}%`
const KIND: Record<string, string> = { nvme: 'NVMe', ssd: 'SSD', hdd: 'HDD', usb: 'USB', other: 'disk' }
@@ -178,6 +179,7 @@ export default function Disks() {
const [live, setLive] = useState<Sample | null>(null)
const [err, setErr] = useState('')
const [task, setTask] = useState<string | null>(null)
const rate = useRefreshMs()
const load = useCallback(async () => {
try {
@@ -190,9 +192,9 @@ export default function Disks() {
let stop = false
const tick = async () => { if (!stop && document.visibilityState === 'visible') { try { setLive(await api.metrics()) } catch { /* ignore */ } } }
tick()
const t = setInterval(tick, 2000)
const t = setInterval(tick, rate)
return () => { stop = true; clearInterval(t) }
}, [])
}, [rate])
if (!devs) return <div className="dash">{err ? <div className="error">{err}</div> : <Loading label="Scanning disks…" />}</div>
const liveFor = (n: string) => live?.disks.find((d) => d.name === n)