Dashboard: stop flex children shrinking (bar text overflowed), wrap the bar, gate saves on loaded layout, fix double v in footer
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
1751afc974
commit
cd3979efce
@@ -260,6 +260,7 @@ export default function Dashboard() {
|
||||
const [err, setErr] = useState('')
|
||||
const [layout, setLayout] = useState<Layout>(() => normalize({}))
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [loaded, setLoaded] = useState(false)
|
||||
const hist = useRef<Series | null>(null)
|
||||
const saveTimer = useRef<number | undefined>(undefined)
|
||||
const intervalRef = useRef(DEFAULT_INTERVAL)
|
||||
@@ -278,7 +279,7 @@ export default function Dashboard() {
|
||||
useEffect(() => {
|
||||
let stop = false
|
||||
let timer: number | undefined
|
||||
api.dashPrefs().then((p) => { if (!stop) setLayout(normalize(p)) }).catch(() => { /* defaults */ })
|
||||
api.dashPrefs().then((p) => { if (!stop) { setLayout(normalize(p)); setLoaded(true) } }).catch(() => setErr('could not load layout'))
|
||||
const seed = async () => {
|
||||
try { hist.current = await api.metricsHistory(); setLatest(await api.metrics()); setErr('') }
|
||||
catch (e) { setErr(e instanceof Error ? e.message : 'failed') }
|
||||
@@ -364,12 +365,12 @@ export default function Dashboard() {
|
||||
<select className="btn" value={layout.intervalMs} onChange={(e) => update((l) => ({ ...l, intervalMs: Number(e.target.value) }))}>
|
||||
{INTERVALS.map((ms) => <option key={ms} value={ms}>{fmtMs(ms)}</option>)}
|
||||
</select>
|
||||
· charts show the last {fmtWindow(layout.intervalMs)} · ▲▼ reorder, ✕ hides a module or row
|
||||
· last {fmtWindow(layout.intervalMs)} · ▲▼ reorder · ✕ hide
|
||||
</label>
|
||||
) : <span className="hint">last {fmtWindow(latest.interval_ms || layout.intervalMs)} · {fmtMs(latest.interval_ms || layout.intervalMs)}</span>}
|
||||
<span className="spacer" />
|
||||
{editing && <button className="btn" onClick={reset}>Reset</button>}
|
||||
<button className={'btn' + (editing ? ' on' : '')} onClick={() => setEditing(!editing)}>{editing ? 'Done' : 'Customize'}</button>
|
||||
<button className={'btn' + (editing ? ' on' : '')} disabled={!loaded} title={loaded ? '' : 'layout not loaded'} onClick={() => setEditing(!editing)}>{editing ? 'Done' : 'Customize'}</button>
|
||||
</div>
|
||||
|
||||
{visible('tile').length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user