feat(gui): Add dashboard page to visualize sprite registry data from SQLite database

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Claude Code 2026-03-29 05:29:52 -07:00
parent e75d98e53d
commit 1b7999918c
4 changed files with 34 additions and 15 deletions

View file

@ -890,7 +890,7 @@ class SpriteRegistry:
scoring[name] = {
"scored": scored,
"passed": passed,
"pass_rate": round(passed / scored * 100, 1) if scored else 0.0,
"pass_rate": round(passed / scored, 4) if scored else 0.0,
"avg_confidence": round(row["avg_conf"] or 0.0, 3),
}

View file

@ -476,6 +476,38 @@ export function DashboardPage(): ReactNode {
})
}, [])
// Restore running state on mount by checking if server has an active pipeline process
const startStatusPoll = useCallback((): (() => void) => {
const poll = setInterval((): void => {
fetchPipelineStatus()
.then((st) => {
if (!st.running) {
clearInterval(poll)
setRunning(false)
load()
}
})
.catch(() => {
clearInterval(poll)
setRunning(false)
})
}, 3000)
return (): void => clearInterval(poll)
}, [load])
useEffect((): (() => void) => {
let cancel: (() => void) | null = null
fetchPipelineStatus()
.then((st) => {
if (st.running) {
setRunning(true)
cancel = startStatusPoll()
}
})
.catch(() => { /* server not yet reachable */ })
return (): void => { cancel?.() }
}, [startStatusPoll])
useEffect((): (() => void) => {
load()
const interval = setInterval(load, 5000)
@ -502,20 +534,7 @@ export function DashboardPage(): ReactNode {
setRunning(false)
return
}
const poll = setInterval((): void => {
fetchPipelineStatus()
.then((st) => {
if (!st.running) {
clearInterval(poll)
setRunning(false)
load()
}
})
.catch(() => {
clearInterval(poll)
setRunning(false)
})
}, 3000)
startStatusPoll()
} catch (e: unknown) {
alert(`Pipeline run failed: ${e instanceof Error ? e.message : String(e)}`)
setRunning(false)