Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
+50
-16
@@ -8,28 +8,62 @@ export interface StatusPresentation {
|
||||
|
||||
/** A second visual cue keeps state readable without relying on color. */
|
||||
export const statusShapes: Record<StatusTone, StatusShape> = {
|
||||
neutral: 'hollow', online: 'circle', warning: 'triangle', danger: 'square', info: 'ring'
|
||||
neutral: 'hollow',
|
||||
online: 'circle',
|
||||
warning: 'triangle',
|
||||
danger: 'square',
|
||||
info: 'ring'
|
||||
};
|
||||
|
||||
const states: Record<string, [string, StatusTone]> = {
|
||||
provisioning: ['Provisioning', 'info'],
|
||||
online: ['Online', 'online'], offline: ['Offline', 'danger'], stale: ['Not responding', 'warning'], starting: ['Starting', 'info'],
|
||||
'host-offline': ['Host offline', 'danger'], 'not-responding': ['Not responding', 'warning'], stopped: ['Stopped', 'neutral'], unknown: ['Unknown', 'neutral'],
|
||||
queued: ['Queued', 'neutral'], pending: ['Queued for restart', 'neutral'], running: ['In progress', 'info'], active: ['In progress', 'info'],
|
||||
deploying: ['Installing files', 'info'], restarting: ['Restarting', 'info'],
|
||||
observing: ['Collecting test evidence', 'info'], 'rolling-back': ['Rolling back', 'info'],
|
||||
'awaiting-empty': ['Waiting for empty lobby', 'neutral'], waiting: ['Waiting', 'neutral'],
|
||||
'awaiting-health': ['Verifying health', 'info'], 'awaiting-match': ['Waiting for a match', 'neutral'],
|
||||
ready: ['Ready', 'online'], 'ready-promote': ['Ready to promote', 'online'],
|
||||
done: ['Completed', 'online'], passed: ['Test passed', 'online'], tested: ['Test passed', 'online'],
|
||||
promoted: ['Promoted', 'online'], 'rolled-back': ['Rolled back', 'neutral'], cancelled: ['Cancelled', 'neutral'],
|
||||
failed: ['Failed', 'danger'], 'test-failed': ['Test failed', 'danger'], interrupted: ['Interrupted', 'danger'],
|
||||
warning: ['Completed with warnings', 'warning'], held: ['On hold', 'neutral'], skipped: ['Withdrawn', 'neutral'],
|
||||
manual: ['Manual action needed', 'warning'], paused: ['Paused', 'warning'], inconclusive: ['Missing evidence', 'warning'],
|
||||
untested: ['Needs testing', 'neutral'], testing: ['Beta active', 'info'], empty: ['No versions', 'neutral'], attention: ['Needs attention', 'warning']
|
||||
online: ['Online', 'online'],
|
||||
offline: ['Offline', 'danger'],
|
||||
stale: ['Not responding', 'warning'],
|
||||
starting: ['Starting', 'info'],
|
||||
'host-offline': ['Host offline', 'danger'],
|
||||
'not-responding': ['Not responding', 'warning'],
|
||||
stopped: ['Stopped', 'neutral'],
|
||||
unknown: ['Unknown', 'neutral'],
|
||||
queued: ['Queued', 'neutral'],
|
||||
pending: ['Queued for restart', 'neutral'],
|
||||
running: ['In progress', 'info'],
|
||||
active: ['In progress', 'info'],
|
||||
deploying: ['Installing files', 'info'],
|
||||
restarting: ['Restarting', 'info'],
|
||||
observing: ['Collecting test evidence', 'info'],
|
||||
'rolling-back': ['Rolling back', 'info'],
|
||||
'awaiting-empty': ['Waiting for empty lobby', 'neutral'],
|
||||
waiting: ['Waiting', 'neutral'],
|
||||
'awaiting-health': ['Verifying health', 'info'],
|
||||
'awaiting-match': ['Waiting for a match', 'neutral'],
|
||||
ready: ['Ready', 'online'],
|
||||
'ready-promote': ['Ready to promote', 'online'],
|
||||
done: ['Completed', 'online'],
|
||||
passed: ['Test passed', 'online'],
|
||||
tested: ['Test passed', 'online'],
|
||||
promoted: ['Promoted', 'online'],
|
||||
'rolled-back': ['Rolled back', 'neutral'],
|
||||
cancelled: ['Cancelled', 'neutral'],
|
||||
failed: ['Failed', 'danger'],
|
||||
'test-failed': ['Test failed', 'danger'],
|
||||
interrupted: ['Interrupted', 'danger'],
|
||||
warning: ['Completed with warnings', 'warning'],
|
||||
held: ['On hold', 'neutral'],
|
||||
skipped: ['Withdrawn', 'neutral'],
|
||||
manual: ['Manual action needed', 'warning'],
|
||||
paused: ['Paused', 'warning'],
|
||||
inconclusive: ['Missing evidence', 'warning'],
|
||||
untested: ['Needs testing', 'neutral'],
|
||||
testing: ['Beta active', 'info'],
|
||||
empty: ['No versions', 'neutral'],
|
||||
attention: ['Needs attention', 'warning']
|
||||
};
|
||||
export function statusPresentation(state: string): StatusPresentation {
|
||||
const result = states[state];
|
||||
const [label, tone] = result ?? [(state.charAt(0).toUpperCase() + state.slice(1)).replaceAll('-', ' ') || 'Unknown', 'neutral'];
|
||||
const [label, tone] = result ?? [
|
||||
(state.charAt(0).toUpperCase() + state.slice(1)).replaceAll('-', ' ') || 'Unknown',
|
||||
'neutral'
|
||||
];
|
||||
return { label, tone, shape: statusShapes[tone] };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user