Astra: PO/GL actions, usage coverage, assisted sign-in, self-healing, recorder, new top navigation and theme (172a4e22a2bf)
fb62a97 verified Download web/src/components/shell/StatusDot.tsx from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/components/shell/StatusDot.tsx
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/web/src/components/shell/StatusDot.tsx
-
curl -L -o StatusDot.tsx https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/components/shell/StatusDot.tsx
1.8 kB
| import type { Schemas } from '../../api/client'; | |
| type RunSummary = Schemas['RunSummary']; | |
| export type RunState = 'queued' | 'running' | 'waiting' | 'done-ready' | 'done-notready' | 'done-held' | 'done' | 'failed' | 'stopped' | 'paused' | 'idle'; | |
| /** One state per test run, for dots, chips and sidebar rows. Pure. */ | |
| export function runState(r: Pick<RunSummary, 'status' | 'pending_gate' | 'decision' | 'decisions'>): RunState { | |
| switch (r.status) { | |
| case 'completed': { | |
| const ds = Object.values(r.decisions ?? {}); | |
| const all = ds.length ? ds : r.decision ? [r.decision] : []; | |
| if (!all.length) return 'done'; | |
| if (all.includes('NO-GO')) return 'done-notready'; | |
| if (all.includes('HELD')) return 'done-held'; | |
| return all.every((d) => d === 'GO') ? 'done-ready' : 'done'; | |
| } | |
| case 'failed': case 'killed': return 'failed'; | |
| case 'cancelled': return 'stopped'; | |
| case 'interrupted': return 'paused'; | |
| case 'waiting_approval': case 'waiting_sign_in': case 'waiting_review': return 'waiting'; | |
| case 'running': return r.pending_gate ? 'waiting' : 'running'; | |
| case 'queued': return r.pending_gate ? 'waiting' : 'queued'; | |
| default: return 'idle'; | |
| } | |
| } | |
| /** A small coloured dot. Never the only signal: it carries an aria-label/title, and callers show words beside it. */ | |
| export function StatusDot({ state, pulse, size = 10, label, decorative = false }: { state: RunState; pulse?: boolean; size?: 8 | 10; label: string; decorative?: boolean }) { | |
| return ( | |
| <span className="fpt-sdot" data-state={state} data-pulse={pulse || state === 'running' ? 'true' : undefined} | |
| {...(decorative ? { 'aria-hidden': true } : { role: 'img', 'aria-label': label })} title={label} | |
| style={{ width: size, height: size, flexBasis: size }} /> | |
| ); | |
| } | |