Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

refactor(frontend): one status->tone vocabulary in ds/status.js (plan 77 D3)

Juan Denisdc32ac6e8610
diff --git a/frontend/scripts/check-status-one-door.mjs b/frontend/scripts/check-status-one-door.mjs
new file mode 100644
index 00000000..e01a746e
--- /dev/null
+++ b/frontend/scripts/check-status-one-door.mjs
@@ -0,0 +1,60 @@
+#!/usr/bin/env node
+// Plan 77 D3 ratchet — ONE frontend status→tone vocabulary.
+//
+// Fails when a file outside src/components/ds/status.js defines its own
+// status→color/kind/variant object map. Run with: npm run check:status
+//
+// The allowlist below is the frozen 2026-08-19 population of files whose
+// matches are NOT status color maps (rank orders, label-only maps, icon
+// metadata, raw CSS-var renderers deferred to the D4 SCSS pass). Shrinking
+// it is progress; adding to it needs a reason that is not "my page wants
+// its own colors" — extend ds/status.js instead.
+
+import { readFileSync, readdirSync, statSync } from 'node:fs';
+import { join, relative } from 'node:path';
+
+const SRC = new URL('../src', import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1');
+
+const ALLOWED = new Set([
+ 'components/ds/status.js', // the one door
+ 'components/backups/BackupCalendar.jsx', // STATUS_RANK: severity ordering, not colors
+ 'components/databases/SourceTree.jsx', // STATUS_LABEL: labels only
+ 'pages/DeployConsole.jsx', // STATUS_META: labels+icons+css classes (D4 territory)
+ 'components/dashboard/widgets/renderers.jsx', // raw CSS-var renderer (D4 territory)
+ 'components/NotificationBell.jsx', // SEVERITY_DOT hex dots (D4 territory)
+ 'pages/Notifications.jsx', // SEVERITY_DOT hex dots (D4 territory)
+ 'components/LinkedAppsSection.jsx', // css-class map (D4 territory)
+ 'components/apps/AppWafPanel.jsx', // WAF mode map (block=green is domain-inverted) + ModSec severities
+ 'components/monitoring/MonitoringOverview.jsx', // metric-series colors (cpu/mem/disk), not statuses
+ 'components/security/FirewallTab.jsx', // firewall rule-TYPE tones, not statuses
+ 'pages/PublicStatusPage.jsx', // status-page meta bundle (labels+icons), public surface
+ 'pages/StatusPages.jsx', // status-page meta bundle (labels+icons+dots)
+]);
+
+// A "status map" smell: an object-literal or switch mapping status-ish keys
+// to Pill kinds / Badge variants.
+const DEF_RE = /(?:const|let|var)\s+\w*(?:STATUS|SEVERITY|TONE|PILL)\w*\s*=\s*\{[^}]*(?:'green'|'amber'|'red'|'cyan'|'violet'|'gray'|'success'|'destructive'|'warning'|'info'|'outline'|'secondary')/s;
+
+function* walk(dir) {
+ for (const name of readdirSync(dir)) {
+ const p = join(dir, name);
+ const st = statSync(p);
+ if (st.isDirectory()) yield* walk(p);
+ else if (/\.(jsx?|mjs)$/.test(name)) yield p;
+ }
+}
+
+const offenders = [];
+for (const file of walk(SRC)) {
+ const rel = relative(SRC, file).replaceAll('\\', '/');
+ if (ALLOWED.has(rel)) continue;
+ const text = readFileSync(file, 'utf8');
+ if (DEF_RE.test(text)) offenders.push(rel);
+}
+
+if (offenders.length) {
+ console.error('New local status→tone maps (extend src/components/ds/status.js instead):');
+ for (const f of offenders) console.error(' ' + f);
+ process.exit(1);
+}
+console.log('status one-door: OK');
diff --git a/frontend/src/components/ProcessTable.jsx b/frontend/src/components/ProcessTable.jsx
index 20bcbdd5..69b04499 100644
--- a/frontend/src/components/ProcessTable.jsx
+++ b/frontend/src/components/ProcessTable.jsx
@@ -1,4 +1,5 @@
import { useCallback, useMemo, useState } from 'react';
+import { processStateVariant } from '@/components/ds/status';
import { X, AlertTriangle } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
@@ -379,19 +380,7 @@ function defaultFormatMemory(bytes) {
}
function defaultGetStatusVariant(status) {
- switch (status?.toLowerCase()) {
- case 'running':
- case 'sleeping':
- return 'success';
- case 'stopped':
- case 'zombie':
- return 'destructive';
- case 'idle':
- case 'disk-sleep':
- return 'warning';
- default:
- return 'secondary';
- }
+ return processStateVariant(status);
}
export default ProcessTable;
diff --git a/frontend/src/components/ServiceCard.jsx b/frontend/src/components/ServiceCard.jsx
index 2b450dd3..9aa40e7f 100644
--- a/frontend/src/components/ServiceCard.jsx
+++ b/frontend/src/components/ServiceCard.jsx
@@ -1,4 +1,5 @@
import { Badge } from '@/components/ui/badge';
+import { serviceStatusVariant } from '@/components/ds/status';
export function ServicesGrid({ children, className = '' }) {
return <div className={`services-grid ${className}`.trim()}>{children}</div>;
@@ -46,18 +47,7 @@ export function ServiceCard({
}
function defaultStatusVariant(status) {
- switch (status?.toLowerCase()) {
- case 'running':
- case 'active':
- return 'success';
- case 'stopped':
- case 'failed':
- return 'destructive';
- case 'inactive':
- return 'secondary';
- default:
- return 'warning';
- }
+ return serviceStatusVariant(status);
}
export default ServiceCard;
diff --git a/frontend/src/components/StatusBadge.jsx b/frontend/src/components/StatusBadge.jsx
index 4ca4af27..ef1e8afe 100644
--- a/frontend/src/components/StatusBadge.jsx
+++ b/frontend/src/components/StatusBadge.jsx
@@ -1,39 +1,14 @@
import { Badge } from '@/components/ui/badge';
import { cn } from '@/lib/utils';
+import { serviceStatusVariant, serviceStatusDotClass, statusLabel } from '@/components/ds/status';
-const STATUS_VARIANT = {
- online: 'success', running: 'success', healthy: 'success',
- active: 'success', connected: 'success',
- offline: 'destructive', stopped: 'destructive', error: 'destructive',
- failed: 'destructive', disconnected: 'destructive',
- warning: 'warning', degraded: 'warning',
- pending: 'info', building: 'info', deploying: 'info',
- paused: 'secondary', unknown: 'secondary',
-};
-
-const DOT_COLOR = {
- success: 'bg-green-400',
- destructive: 'bg-red-400',
- warning: 'bg-yellow-400',
- info: 'bg-blue-400',
- secondary: 'bg-muted-foreground/60',
-};
-
-const STATUS_LABEL = {
- online: 'Online', running: 'Running', healthy: 'Healthy',
- active: 'Active', connected: 'Connected',
- offline: 'Offline', stopped: 'Stopped', error: 'Error',
- failed: 'Failed', disconnected: 'Disconnected',
- warning: 'Warning', degraded: 'Degraded',
- pending: 'Pending', building: 'Building', deploying: 'Deploying',
- paused: 'Paused', unknown: 'Unknown',
-};
+// One vocabulary (plan 77 D3): variant, dot color and label all derive from
+// ds/status.js — service-scoped, so "running" stays the healthy green.
export default function StatusBadge({ status, label, className = '' }) {
- const key = status?.toLowerCase();
- const variant = STATUS_VARIANT[key] || 'secondary';
- const dotColor = DOT_COLOR[variant] || DOT_COLOR.secondary;
- const displayLabel = label || STATUS_LABEL[key] || status;
+ const variant = serviceStatusVariant(status);
+ const dotColor = serviceStatusDotClass(status);
+ const displayLabel = label || (status ? statusLabel(status) : status);
return (
<Badge variant={variant} className={cn('status-badge-token', className)}>
diff --git a/frontend/src/components/appdetail/BuildTab.jsx b/frontend/src/components/appdetail/BuildTab.jsx
index 85243277..47d505fb 100644
--- a/frontend/src/components/appdetail/BuildTab.jsx
+++ b/frontend/src/components/appdetail/BuildTab.jsx
@@ -8,7 +8,7 @@ import { InfoList, InfoItem } from '../InfoList';
import BuildpackPreview from '../buildpack/BuildpackPreview';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import Modal from '@/components/Modal';
const BuildTab = ({ appId, appPath, app }) => {
@@ -174,18 +174,6 @@ const BuildTab = ({ appId, appPath, app }) => {
}
}
- function getStatusPillKind(status) {
- switch (status) {
- case 'live': return 'green';
- case 'building':
- case 'deploying':
- case 'pending': return 'amber';
- case 'failed': return 'red';
- case 'rolled_back': return 'gray';
- default: return 'gray';
- }
- }
-
function formatDuration(seconds) {
if (!seconds) return '-';
if (seconds < 60) return `${Math.round(seconds)}s`;
@@ -280,7 +268,7 @@ const BuildTab = ({ appId, appPath, app }) => {
<div key={dep.version} className={`deployment-item ${dep.status === 'live' ? 'current' : ''}`}>
<div className="deployment-info">
<span className="deployment-version">v{dep.version}</span>
- <Pill kind={getStatusPillKind(dep.status)}>{dep.status}</Pill>
+ <Pill kind={statusKind(dep.status)}>{dep.status}</Pill>
</div>
<div className="deployment-meta">
<span>{new Date(dep.created_at).toLocaleString()}</span>
diff --git a/frontend/src/components/appdetail/DeployTab.jsx b/frontend/src/components/appdetail/DeployTab.jsx
index 93657825..5ff5b5ec 100644
--- a/frontend/src/components/appdetail/DeployTab.jsx
+++ b/frontend/src/components/appdetail/DeployTab.jsx
@@ -9,7 +9,7 @@ import DeploymentTimeline from '../deployments/DeploymentTimeline';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import Modal from '@/components/Modal';
// `embedded` renders this inside the Settings → Git & Deploy section, where the
@@ -142,15 +142,6 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
}
}
- function getStatusPillKind(status) {
- switch (status) {
- case 'success': return 'green';
- case 'failed': return 'red';
- case 'in_progress': return 'amber';
- default: return 'gray';
- }
- }
-
if (loading) {
return <EmptyState loading loadingVariant="form" title="Loading deployment configuration..." />;
}
@@ -251,7 +242,7 @@ const DeployTab = ({ appId, appPath, embedded = false }) => {
<div className="deployments-list">
{history.slice(0, 5).map((dep, idx) => (
<div key={idx} className="deployment-item">
- <Pill kind={getStatusPillKind(dep.status)}>{dep.status}</Pill>
+ <Pill kind={statusKind(dep.status)}>{dep.status}</Pill>
<span className="deployment-date">{new Date(dep.timestamp).toLocaleString()}</span>
</div>
))}
diff --git a/frontend/src/components/appdetail/appDetailShared.jsx b/frontend/src/components/appdetail/appDetailShared.jsx
index 7979e319..a581f618 100644
--- a/frontend/src/components/appdetail/appDetailShared.jsx
+++ b/frontend/src/components/appdetail/appDetailShared.jsx
@@ -1,11 +1,5 @@
-// statusInfo.dotClass → ds Pill kind
-export const STATUS_PILL = {
- live: 'green',
- stopped: 'gray',
- deploying: 'amber',
- building: 'amber',
- failed: 'red',
-};
+// statusInfo.dotClass → ds Pill kind now comes from the ONE shared status
+// vocabulary — import { statusKind } from '@/components/ds/status'.
// Ingress plane → label + Pill kind. Host Nginx is the neutral default;
// a managed proxy stack reads as the accent (cyan) choice. NULL/undefined
diff --git a/frontend/src/components/apps/ContainerOpsPanel.jsx b/frontend/src/components/apps/ContainerOpsPanel.jsx
index 45eb36d4..b473f65f 100644
--- a/frontend/src/components/apps/ContainerOpsPanel.jsx
+++ b/frontend/src/components/apps/ContainerOpsPanel.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useCallback } from 'react';
+import { statusKind } from '@/components/ds/status';
import { RefreshCw, ArrowUpCircle, Moon, Sun, Gauge as GaugeIcon, Boxes } from 'lucide-react';
import { Link } from 'react-router-dom';
import api from '../../services/api';
@@ -17,13 +18,6 @@ function shortDigest(digest) {
return value.slice(0, 12);
}
-const IMAGE_STATUS_PILL = {
- up_to_date: 'green',
- update_available: 'amber',
- checking: 'amber',
- error: 'red',
- unknown: 'gray',
-};
function formatStatusLabel(status) {
if (!status) return 'Not checked';
@@ -109,7 +103,7 @@ const ImageUpdateSection = ({ app, onChanged }) => {
<span>Image Update</span>
<span className="app-panel-header-actions">
{status && (
- <Pill kind={IMAGE_STATUS_PILL[status] || 'gray'}>
+ <Pill kind={statusKind(status)}>
{formatStatusLabel(status)}
</Pill>
)}
diff --git a/frontend/src/components/backups/BackupHistoryList.jsx b/frontend/src/components/backups/BackupHistoryList.jsx
index 50f6337f..bb13533f 100644
--- a/frontend/src/components/backups/BackupHistoryList.jsx
+++ b/frontend/src/components/backups/BackupHistoryList.jsx
@@ -33,17 +33,8 @@ function storageIcon(run) {
);
}
-// Pill kind for a restore-drill outcome. skipped_no_space is a soft warning
-// (no disk headroom to drill), never a hard failure.
-function drillStatusKind(status) {
- switch (status) {
- case 'success': return 'green';
- case 'failed': return 'red';
- case 'skipped_no_space': return 'amber';
- default: return 'gray';
- }
-}
-
+// Drill outcomes read straight from the shared table (skipped_no_space is a
+// soft amber warning there — no disk headroom to drill, never a hard failure).
function drillStatusLabel(status) {
if (status === 'skipped_no_space') return 'skipped (no space)';
return status || 'unknown';
@@ -93,7 +84,7 @@ function RestoreDrills({ drills }) {
<span className="backup-drills__chev">
{isOpen ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
</span>
- <Pill kind={drillStatusKind(drill.status)}>{drillStatusLabel(drill.status)}</Pill>
+ <Pill kind={statusKind(drill.status)}>{drillStatusLabel(drill.status)}</Pill>
<span className="backup-drills__trigger">{drill.trigger || 'manual'}</span>
<span className="backup-drills__when">{formatWhen(drill.started_at)}</span>
{drill.duration_seconds != null && (
diff --git a/frontend/src/components/backups/ProtectionStatusCard.jsx b/frontend/src/components/backups/ProtectionStatusCard.jsx
index b794162d..d6f58df8 100644
--- a/frontend/src/components/backups/ProtectionStatusCard.jsx
+++ b/frontend/src/components/backups/ProtectionStatusCard.jsx
@@ -1,4 +1,4 @@
-import { Pill, MetricCard, KpiBand } from '@/components/ds';
+import { Pill, MetricCard, KpiBand, statusKind, statusLabel } from '@/components/ds';
import { Switch } from '@/components/ui/switch';
import { Button } from '@/components/ui/button';
import { Archive, Clock, DollarSign, HardDrive, Play, ExternalLink, Loader2 } from 'lucide-react';
@@ -10,14 +10,7 @@ import { humanSize, formatMoney, formatWhen, formatDateTime } from './format';
// All data is pre-shaped by the parent (policyView); this component holds no
// state and triggers behavior purely through the supplied callbacks.
-// Status kinds map to a Pill colour + the label shown both top-right and inline.
-const STATUS_PILL = {
- protected: { kind: 'green', label: 'Protected' },
- pending: { kind: 'amber', label: 'Pending' },
- failed: { kind: 'red', label: 'Failed' },
- running: { kind: 'cyan', label: 'Running' },
- off: { kind: 'gray', label: 'Off' },
-};
+// Pill colour + label come from the ONE shared status vocabulary (ds/status).
// Pick the status key from the policy snapshot. Failure wins over everything so
// a broken last run is never hidden behind an "enabled" badge.
@@ -58,8 +51,7 @@ const ProtectionStatusCard = ({
const nextRunAt = policyView.next_run_at;
const statusKey = resolveStatus(policy, isRunning);
- const { kind, label } = STATUS_PILL[statusKey];
- const statusPill = <Pill kind={kind}>{label}</Pill>;
+ const statusPill = <Pill kind={statusKind(statusKey)}>{statusLabel(statusKey)}</Pill>;
const subtitle = enabled
? 'Backups run on the configured schedule.'
diff --git a/frontend/src/components/backups/format.js b/frontend/src/components/backups/format.js
index 174ab1fa..44c9bb56 100644
--- a/frontend/src/components/backups/format.js
+++ b/frontend/src/components/backups/format.js
@@ -44,16 +44,8 @@ export function formatDateTime(iso) {
});
}
-// Pill kind ('green'|'amber'|'red'|'cyan'|'gray') for a run/policy status.
-export function statusKind(status) {
- switch (status) {
- case 'success': return 'green';
- case 'failed': return 'red';
- case 'running': return 'cyan';
- case 'verifying': return 'gray';
- default: return 'gray';
- }
-}
+// Pill kind for a run/policy status, from the ONE shared vocabulary (plan 77 D3).
+export { statusKind } from '../ds/status';
// Where a run is stored, from its size/remote fields.
export function storageLabel(run) {
diff --git a/frontend/src/components/dashboard/SetupHealthWidget.jsx b/frontend/src/components/dashboard/SetupHealthWidget.jsx
index 28e4a889..763586f1 100644
--- a/frontend/src/components/dashboard/SetupHealthWidget.jsx
+++ b/frontend/src/components/dashboard/SetupHealthWidget.jsx
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import api from '../../services/api';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import { ShieldCheck, AlertTriangle, Info, ChevronRight } from 'lucide-react';
// Compact "how set-up is this panel" card for the dashboard (admin-only).
@@ -10,7 +10,6 @@ import { ShieldCheck, AlertTriangle, Info, ChevronRight } from 'lucide-react';
// no dead card.
const TOP_N = 3;
-const STATUS_TONE = { fail: 'red', warn: 'amber', ok: 'green' };
// Critical (fail) first, then recommended (warn); ok items never show.
function openItems(items) {
@@ -99,7 +98,7 @@ const SetupHealthWidget = () => {
className="setup-health-widget__item"
onClick={() => item.fix?.to && navigate(item.fix.to)}
>
- <Pill kind={STATUS_TONE[item.status] || 'gray'}>{item.status}</Pill>
+ <Pill kind={statusKind(item.status)}>{item.status}</Pill>
<span className="setup-health-widget__itemtitle">{item.title}</span>
<ChevronRight size={14} />
</button>
diff --git a/frontend/src/components/docker/ContainersTab.jsx b/frontend/src/components/docker/ContainersTab.jsx
index 382dc126..83c382e1 100644
--- a/frontend/src/components/docker/ContainersTab.jsx
+++ b/frontend/src/components/docker/ContainersTab.jsx
@@ -1,4 +1,5 @@
import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';
+import { statusKind } from '@/components/ds/status';
import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { useConfirm } from '../../hooks/useConfirm';
@@ -77,7 +78,6 @@ export const RunContainerButton = () => {
// watching that container at all.
const HEALTH_LABELS = ['Unhealthy', 'Starting', 'None', 'Healthy'];
const HEALTH_RANK = { Unhealthy: 0, Starting: 1, None: 2, Healthy: 3 };
-const HEALTH_TONE = { Unhealthy: 'red', Starting: 'amber', None: 'gray', Healthy: 'green' };
const containerHealth = (container) => {
const status = getContainerStatus(container).toLowerCase();
@@ -557,7 +557,7 @@ const ContainersTab = ({ onStatsChange }) => {
// Spelled out rather than shown as 'None': the absence of a
// healthcheck is a fact about the image, not a missing reading.
if (health === 'None') return <span className="dx-muted-line">No healthcheck</span>;
- return <Pill kind={HEALTH_TONE[health]} dot={false}>{health}</Pill>;
+ return <Pill kind={statusKind(health)} dot={false}>{health}</Pill>;
},
},
{
diff --git a/frontend/src/components/ds/index.js b/frontend/src/components/ds/index.js
index 2122b3f5..7c98ab29 100644
--- a/frontend/src/components/ds/index.js
+++ b/frontend/src/components/ds/index.js
@@ -2,6 +2,11 @@
// Shared, reusable building blocks for the new "infra console" look. Styles
// live in styles/components/_design-system.scss (sk-* namespace).
export { Pill } from './Pill';
+export {
+ statusKind, statusVariant, statusDotClass, statusLabel,
+ alertStatusKind, processStateVariant, envActionKind,
+ serviceStatusKind, serviceStatusVariant, serviceStatusDotClass,
+} from './status';
export { EnvTag } from './EnvTag';
export { SegControl } from './SegControl';
export { MetricCard } from './MetricCard';
diff --git a/frontend/src/components/ds/status.js b/frontend/src/components/ds/status.js
new file mode 100644
index 00000000..2c7dbd85
--- /dev/null
+++ b/frontend/src/components/ds/status.js
@@ -0,0 +1,221 @@
+// ONE frontend status → tone vocabulary (plan 77 D3).
+//
+// Every page used to roll its own status→color map, so "running" rendered
+// cyan on some pages and green or amber on others. This module is the single
+// door: ONE table maps the union of backend statuses (see
+// backend/app/models/status.py) to a ds Pill kind, and a kind→variant map
+// derives the ui Badge variant from the same table, so both primitives agree.
+//
+// Pill kind: green | amber | red | cyan | violet | gray
+// Badge variant: success | warning | destructive | info | secondary | outline
+//
+// Do NOT add per-page status maps — extend STATUS_KIND (or one of the scoped
+// override tables below) instead. A ratchet test
+// (src/components/ds/__tests__/statusOneDoor.test.mjs) fails the suite when a
+// new local map appears outside this file.
+
+// The one table. Keys are lowercased statuses; values are Pill kinds.
+const STATUS_KIND = {
+ // green — healthy / succeeded / terminal-good
+ success: 'green',
+ succeeded: 'green',
+ completed: 'green',
+ done: 'green',
+ passed: 'green',
+ pass: 'green',
+ ok: 'green',
+ online: 'green',
+ healthy: 'green',
+ up: 'green',
+ published: 'green',
+ up_to_date: 'green',
+ active: 'green',
+ live: 'green',
+ connected: 'green',
+ protected: 'green',
+ resolved: 'green',
+ sleeping: 'green', // process S state is the normal resting state
+
+ // red — failed / terminal-bad
+ failed: 'red',
+ failure: 'red',
+ error: 'red',
+ fail: 'red',
+ dead: 'red',
+ dead_letter: 'red',
+ destroyed: 'red',
+ offline: 'red',
+ disconnected: 'red',
+ critical: 'red',
+ high: 'red',
+ major: 'red',
+ unhealthy: 'red',
+ down: 'red',
+ investigating: 'red',
+ zombie: 'red',
+
+ // cyan — in flight / making progress
+ running: 'cyan',
+ in_progress: 'cyan',
+ in_flight: 'cyan',
+ deploying: 'cyan',
+ building: 'cyan',
+ analyzing: 'cyan',
+ verifying: 'cyan',
+ restarting: 'cyan',
+ activating: 'cyan',
+ reloading: 'cyan',
+ connecting: 'cyan',
+ starting: 'cyan',
+ checking: 'cyan',
+ monitoring: 'cyan',
+ host: 'cyan', // fleet proxy "host default" plane
+ info: 'cyan',
+
+ // amber — warn-ish / needs attention
+ warn: 'amber',
+ warning: 'amber',
+ degraded: 'amber',
+ medium: 'amber',
+ minor: 'amber',
+ update_available: 'amber',
+ rolled_back: 'amber',
+ timeout: 'amber',
+ skipped_no_space: 'amber',
+ cancelled: 'amber',
+ canceled: 'amber',
+ identified: 'amber',
+ acknowledged: 'amber',
+ idle: 'amber',
+ 'disk-sleep': 'amber',
+
+ // gray — neutral / not started / switched off
+ pending: 'gray',
+ queued: 'gray',
+ scheduled: 'gray',
+ created: 'gray',
+ paused: 'gray',
+ stopped: 'gray',
+ inactive: 'gray',
+ skipped: 'gray',
+ unknown: 'gray',
+ low: 'gray',
+ none: 'gray',
+ debug: 'gray',
+ off: 'gray',
+
+ // violet — analyzed-but-not-applied and other "special" states
+ analyzed: 'violet',
+};
+
+// Pill kind → ui Badge variant. The ONE bridge between the two primitives.
+const KIND_VARIANT = {
+ green: 'success',
+ red: 'destructive',
+ cyan: 'info',
+ amber: 'warning',
+ violet: 'secondary',
+ gray: 'outline',
+};
+
+// Pill kind → StatusBadge dot color class (kept here so the dot always agrees
+// with the kind the same status resolves to).
+const KIND_DOT = {
+ green: 'bg-green-400',
+ red: 'bg-red-400',
+ amber: 'bg-yellow-400',
+ cyan: 'bg-blue-400',
+ violet: 'bg-muted-foreground/60',
+ gray: 'bg-muted-foreground/60',
+};
+
+// Labels pages already customize; everything else is humanized (underscores →
+// spaces, Title Case).
+const LABEL_OVERRIDES = {
+ host: 'Host default',
+ skipped_no_space: 'Skipped (no space)',
+};
+
+function normalize(status) {
+ return String(status ?? '').toLowerCase().trim();
+}
+
+/** Status → ds Pill kind. Unknown statuses read gray. */
+export function statusKind(status) {
+ return STATUS_KIND[normalize(status)] || 'gray';
+}
+
+/** Status → ui Badge variant, driven by the same table as statusKind(). */
+export function statusVariant(status) {
+ return KIND_VARIANT[statusKind(status)];
+}
+
+/** Status → StatusBadge dot color class, derived from the kind. */
+export function statusDotClass(status) {
+ return KIND_DOT[statusKind(status)];
+}
+
+/** Humanized label: underscores/hyphens → spaces, Title Case, with overrides. */
+export function statusLabel(status) {
+ const key = normalize(status);
+ if (!key) return 'Unknown';
+ if (LABEL_OVERRIDES[key]) return LABEL_OVERRIDES[key];
+ return key
+ .split(/[\s_-]+/)
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
+ .join(' ');
+}
+
+// ---------------------------------------------------------------------------
+// Scoped overrides. A handful of domains reuse a word the main table already
+// owns with a different meaning ("active" is healthy for a service but firing
+// for an alert; a "running"/"stopped" PROCESS is normal/killed, not in-flight/
+// neutral). They live HERE, not in the pages, so the vocabulary stays one file.
+// ---------------------------------------------------------------------------
+
+// Fleet alert lifecycle: an ACTIVE alert is the bad state.
+const ALERT_STATUS_OVERRIDES = { active: 'red' };
+
+/** Alert lifecycle status → Pill kind (active→red, acknowledged→amber, resolved→green). */
+export function alertStatusKind(status) {
+ return ALERT_STATUS_OVERRIDES[normalize(status)] || statusKind(status);
+}
+
+// OS process states: running/sleeping are the healthy norm, stopped/zombie are
+// the broken ones. sleeping/idle/disk-sleep/zombie live in the main table.
+const PROCESS_STATE_OVERRIDES = { running: 'green', stopped: 'red' };
+
+/** OS process state → ui Badge variant (running→success, stopped/zombie→destructive). */
+export function processStateVariant(state) {
+ const kind = PROCESS_STATE_OVERRIDES[normalize(state)] || statusKind(state);
+ return KIND_VARIANT[kind];
+}
+
+// Env-var change actions are verbs, not lifecycle states: "created" is an
+// addition (green), unlike a freshly-created run (gray).
+const ENV_ACTION_KIND = { created: 'green', updated: 'amber', deleted: 'red' };
+
+/** Env-var history action → Pill kind (created→green, updated→amber, deleted→red). */
+export function envActionKind(action) {
+ return ENV_ACTION_KIND[normalize(action)] || statusKind(action);
+}
+
+// Long-running services/units/previews: "running" IS the healthy steady
+// state (green), unlike a run-shaped job where running is an in-flight
+// phase (cyan). Same reasoning as processStateVariant above.
+const SERVICE_STATUS_OVERRIDES = { running: 'green' };
+
+/** Service/unit/preview status → Pill kind (running→green, else the shared table). */
+export function serviceStatusKind(status) {
+ return SERVICE_STATUS_OVERRIDES[normalize(status)] || statusKind(status);
+}
+
+/** Service/unit status → ui Badge variant, from the same scoped table. */
+export function serviceStatusVariant(status) {
+ return KIND_VARIANT[SERVICE_STATUS_OVERRIDES[normalize(status)] || statusKind(status)];
+}
+
+/** Service/unit status → StatusBadge dot color class, same scoped table. */
+export function serviceStatusDotClass(status) {
+ return KIND_DOT[SERVICE_STATUS_OVERRIDES[normalize(status)] || statusKind(status)];
+}
diff --git a/frontend/src/components/monitoring/DoctorPanel.jsx b/frontend/src/components/monitoring/DoctorPanel.jsx
index bd8da29b..64e6d2f6 100644
--- a/frontend/src/components/monitoring/DoctorPanel.jsx
+++ b/frontend/src/components/monitoring/DoctorPanel.jsx
@@ -4,12 +4,11 @@ import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import Modal from '@/components/Modal';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import EmptyState from '../EmptyState';
import { ChevronDown, ChevronRight, Server, Stethoscope, Wrench } from 'lucide-react';
import { usePolling } from '@/hooks/usePolling';
-const STATUS_TONE = { ok: 'green', warn: 'amber', fail: 'red', error: 'red' };
// The fleet sweep fans out across agents over the network, so it is a job
// (202 + job id) rather than a synchronous call — poll it to completion.
@@ -31,7 +30,7 @@ function DoctorCheck({ check, expanded, onToggleDiff, onRepair, disabled }) {
return (
<article className={`doctor-check doctor-check--${check.status}`}>
<div className="doctor-check__row">
- <Pill kind={STATUS_TONE[check.status] || 'gray'}>{check.status}</Pill>
+ <Pill kind={statusKind(check.status)}>{check.status}</Pill>
<div className="doctor-check__body">
<span className="doctor-check__title">{check.title}</span>
<span className="doctor-check__detail">{check.detail}</span>
diff --git a/frontend/src/components/monitoring/monitorShared.jsx b/frontend/src/components/monitoring/monitorShared.jsx
index 436b2f68..a745f9c7 100644
--- a/frontend/src/components/monitoring/monitorShared.jsx
+++ b/frontend/src/components/monitoring/monitorShared.jsx
@@ -2,6 +2,8 @@
// Keeping the status mapping in one place stops the list and the detail page
// disagreeing about what "degraded" looks like.
+import { statusKind } from '@/components/ds/status';
+
export const CHECK_TYPES = [
{ value: 'http', label: 'HTTP', hint: 'status code of a URL' },
{ value: 'keyword', label: 'Keyword', hint: 'URL must contain a phrase' },
@@ -42,9 +44,5 @@ export function monitorStateOf(monitor) {
export const INCIDENT_STATES = ['investigating', 'identified', 'monitoring', 'resolved'];
-export const IMPACT_TONE = {
- critical: 'red',
- major: 'red',
- minor: 'amber',
- none: 'gray',
-};
+// Impact levels ride the shared vocabulary (plan 77 D3).
+export const impactTone = (impact) => statusKind(impact);
diff --git a/frontend/src/components/previews/PreviewList.jsx b/frontend/src/components/previews/PreviewList.jsx
index 215203fc..d4be49f2 100644
--- a/frontend/src/components/previews/PreviewList.jsx
+++ b/frontend/src/components/previews/PreviewList.jsx
@@ -6,22 +6,12 @@ import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { useConfirm } from '../../hooks/useConfirm';
import EmptyState from '../EmptyState';
-import { Pill } from '../ds';
+import { Pill, serviceStatusKind } from '../ds';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
-// Preview status → ds Pill kind.
-const STATUS_PILL = {
- running: 'green',
- building: 'amber',
- queued: 'amber',
- stopped: 'gray',
- failed: 'red',
- destroyed: 'gray',
-};
-
const DEFAULT_TEMPLATE = 'pr-{pr_number}.{app_domain}';
const PreviewList = ({ appId }) => {
@@ -210,7 +200,7 @@ const PreviewList = ({ appId }) => {
<div className="preview-item__title">
<span className="preview-item__pr">PR #{p.pr_number}</span>
<span className="preview-item__name">{p.pr_title || '(untitled)'}</span>
- <Pill kind={STATUS_PILL[p.status] || 'gray'}>{p.status}</Pill>
+ <Pill kind={serviceStatusKind(p.status)}>{p.status}</Pill>
</div>
<div className="preview-item__meta">
{p.branch && <span className="preview-item__branch mono">{p.branch}</span>}
diff --git a/frontend/src/components/proxy/ProxyStackPanel.jsx b/frontend/src/components/proxy/ProxyStackPanel.jsx
index e0bde777..2eb03d46 100644
--- a/frontend/src/components/proxy/ProxyStackPanel.jsx
+++ b/frontend/src/components/proxy/ProxyStackPanel.jsx
@@ -4,7 +4,7 @@ import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import { Textarea } from '@/components/ui/textarea';
-import { Pill, SegControl } from '../ds';
+import { Pill, SegControl, serviceStatusKind } from '../ds';
import EmptyState from '../EmptyState';
import { AlertTriangle, CheckCircle2, Network } from 'lucide-react';
@@ -27,13 +27,6 @@ const PROXY_OPTIONS = [
{ value: 'caddy', label: 'Caddy', sub: 'Docker stack' },
];
-const STATUS_KIND = {
- running: 'green',
- stopped: 'gray',
- error: 'red',
- unknown: 'amber',
-};
-
const ProxyStackPanel = ({ serverId }) => {
const toast = useToast();
const [stack, setStack] = useState(null);
@@ -196,7 +189,7 @@ const ProxyStackPanel = ({ serverId }) => {
</div>
<div className="proxy-panel__status">
<span className="proxy-panel__status-label">Status</span>
- <Pill kind={STATUS_KIND[stack?.status] || 'gray'}>
+ <Pill kind={serviceStatusKind(stack?.status)}>
{savedIsNginx ? 'host nginx' : (stack?.status || 'unknown')}
</Pill>
</div>
diff --git a/frontend/src/components/security/AuditTab.jsx b/frontend/src/components/security/AuditTab.jsx
index e754bc5f..9105c309 100644
--- a/frontend/src/components/security/AuditTab.jsx
+++ b/frontend/src/components/security/AuditTab.jsx
@@ -1,16 +1,11 @@
import { useState } from 'react';
+import { statusKind } from '@/components/ds/status';
import { ClipboardCheck } from 'lucide-react';
import api from '../../services/api';
import EmptyState from '@/components/EmptyState';
import { Button } from '@/components/ui/button';
import { ScoreGauge } from '@/components/ds';
-const SEVERITY_TONES = {
- pass: 'green',
- critical: 'red',
- warning: 'amber',
- info: 'cyan',
-};
const scoreColor = (score) => {
if (score >= 80) return 'var(--green)';
@@ -82,7 +77,7 @@ const AuditTab = () => {
<div className="sec-finding-list">
{data.findings?.map((finding, idx) => (
<div key={idx} className="sec-finding">
- <span className={`sec-state sec-state--${SEVERITY_TONES[finding.severity] || 'gray'}`}>
+ <span className={`sec-state sec-state--${statusKind(finding.severity)}`}>
{finding.severity}
</span>
<span className="sec-finding__msg">{finding.message}</span>
diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsx
index 0d971df2..b9e86185 100644
--- a/frontend/src/components/security/OverviewTab.jsx
+++ b/frontend/src/components/security/OverviewTab.jsx
@@ -1,3 +1,4 @@
+import { statusKind } from '@/components/ds/status';
import { useState } from 'react';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
@@ -18,7 +19,6 @@ const capitalize = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : s);
// Status glyph per check state — paired with the label so state never relies on
// color alone (color-blind operators), per the product a11y bar.
const STATE_ICON = { pass: CheckCircle2, warn: AlertTriangle, unknown: Circle };
-const CHECK_PILL = { pass: 'green', warn: 'amber', unknown: 'gray' };
const OverviewTab = ({ status, clamavStatus, clamavLoading, onRefresh, onNavigateTab }) => {
// One action runs at a time; `busyKey` names it so only that row spins and
@@ -199,7 +199,7 @@ const OverviewTab = ({ status, clamavStatus, clamavLoading, onRefresh, onNavigat
{rowBusy ? 'Working…' : c.fix.label}
</Button>
) : (
- <Pill kind={CHECK_PILL[c.state]}>{c.state === 'unknown' ? 'pending' : c.state}</Pill>
+ <Pill kind={statusKind(c.state)}>{c.state === 'unknown' ? 'pending' : c.state}</Pill>
)}
</div>
);
diff --git a/frontend/src/components/security/ScannerTab.jsx b/frontend/src/components/security/ScannerTab.jsx
index 35423b4c..b52d88fc 100644
--- a/frontend/src/components/security/ScannerTab.jsx
+++ b/frontend/src/components/security/ScannerTab.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useRef } from 'react';
+import { statusKind } from '@/components/ds/status';
import api from '../../services/api';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -18,12 +19,6 @@ import { usePolling } from '@/hooks/usePolling';
const SCAN_STATUS_POLL_MS = 5000;
const SCAN_JOB_POLL_MS = 3000;
-const SEVERITY_TONE = {
- critical: 'red',
- high: 'red',
- medium: 'amber',
- low: 'gray',
-};
// Urgency order for the Severity column. The severity strings sort
// alphabetically — critical, high, low, medium — which files "low" above
@@ -377,7 +372,7 @@ const ScannerTab = () => {
sortValue: (f) => SEVERITY_RANK[f.severity] ?? 9,
enumOrder: ['critical', 'high', 'medium', 'low'],
render: (f) => (
- <span className={`sec-state sec-state--${SEVERITY_TONE[f.severity] || 'gray'}`}>
+ <span className={`sec-state sec-state--${statusKind(f.severity)}`}>
{f.severity}
</span>
),
diff --git a/frontend/src/components/serverdetail/ServerOverviewTab.jsx b/frontend/src/components/serverdetail/ServerOverviewTab.jsx
index a969222a..d3ae5f06 100644
--- a/frontend/src/components/serverdetail/ServerOverviewTab.jsx
+++ b/frontend/src/components/serverdetail/ServerOverviewTab.jsx
@@ -3,7 +3,7 @@ import OnboardingWizard from '../server/OnboardingWizard';
import SystemStatusCard from './SystemStatusCard';
import { formatBytes } from '@/utils/formatBytes';
import {
- STATUS_PILL_KIND,
+ serverStatusKind,
InfoRow,
KpiTile,
KpiGauge,
@@ -122,7 +122,7 @@ const ServerOverviewTab = ({ server, metrics, systemInfo, onRefreshServer }) =>
<h3><ServerIcon /> Server Information</h3>
<ul className="info-rows">
<InfoRow icon={<PulseIcon />} label="Status">
- <Pill kind={STATUS_PILL_KIND[server.status] || 'gray'}>{server.status}</Pill>
+ <Pill kind={serverStatusKind(server.status)}>{server.status}</Pill>
</InfoRow>
<InfoRow icon={<HostIcon />} label="Hostname" value={server.hostname || 'N/A'} mono />
<InfoRow icon={<NetworkIcon />} label="IP Address" value={server.ip_address || 'N/A'} mono />
diff --git a/frontend/src/components/serverdetail/ServicesTab.jsx b/frontend/src/components/serverdetail/ServicesTab.jsx
index 0b9ce7a4..bd5d7c55 100644
--- a/frontend/src/components/serverdetail/ServicesTab.jsx
+++ b/frontend/src/components/serverdetail/ServicesTab.jsx
@@ -3,7 +3,7 @@ import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { useConfirm } from '@/hooks/useConfirm';
import { Button } from '@/components/ui/button';
-import { Pill, Drawer, DataTable, DataTableFooter, ListToolbar, SearchField } from '../ds';
+import { Pill, Drawer, DataTable, DataTableFooter, ListToolbar, SearchField, serviceStatusKind } from '../ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -85,19 +85,8 @@ const SERVICE_VIEWS = [
},
];
-// systemd active/sub state → ds Pill kind
-const STATE_PILL = {
- active: 'green',
- running: 'green',
- activating: 'amber',
- reloading: 'amber',
- restarting: 'amber',
- failed: 'red',
- inactive: 'gray',
- dead: 'gray',
- stopped: 'gray',
-};
-
+// systemd active/sub state → ds Pill kind comes from the ONE shared
+// vocabulary (ds/status).
// The panel host and an agent answer the same question in different
// vocabularies: `/processes/services` probes a fixed list of well-known daemons
// and reports running/stopped, the agent runs `systemctl list-units --all` and
@@ -325,7 +314,7 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {
value: (u) => u.active || u.sub || 'unknown',
sortValue: (u) => u.active || u.sub || 'unknown',
render: (u) => (
- <Pill kind={STATE_PILL[u.active] || STATE_PILL[u.sub] || 'gray'}>
+ <Pill kind={serviceStatusKind(u.active || u.sub)}>
{u.active || u.sub || 'unknown'}
</Pill>
),
diff --git a/frontend/src/components/serverdetail/serverDetailShared.jsx b/frontend/src/components/serverdetail/serverDetailShared.jsx
index abeb716e..eb2e3173 100644
--- a/frontend/src/components/serverdetail/serverDetailShared.jsx
+++ b/frontend/src/components/serverdetail/serverDetailShared.jsx
@@ -2,15 +2,12 @@ import { useToast } from '../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
import { Gauge } from '../ds';
import { copyToClipboard } from '@/utils/clipboard';
+import { statusKind } from '@/components/ds/status';
// Server status → ds Pill tone (shared by the header pill and the
// Overview "Status" row).
-export const STATUS_PILL_KIND = {
- online: 'green',
- offline: 'red',
- connecting: 'amber',
- pending: 'gray',
-};
+// Server connection states ride the shared vocabulary (plan 77 D3).
+export const serverStatusKind = (status) => statusKind(status);
export const PRESET_LABELS = {
'* * * * *': 'Every minute',
diff --git a/frontend/src/components/service-detail/EventsTab.jsx b/frontend/src/components/service-detail/EventsTab.jsx
index d9377149..b5b8856c 100644
--- a/frontend/src/components/service-detail/EventsTab.jsx
+++ b/frontend/src/components/service-detail/EventsTab.jsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { History } from 'lucide-react';
import { Button } from '@/components/ui/button';
-import { DataTable, DataTableFooter, Drawer, Pill, SearchField } from '@/components/ds';
+import { DataTable, DataTableFooter, Drawer, Pill, SearchField, statusKind, envActionKind } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -15,18 +15,8 @@ import { useDeployments } from '../../hooks/useDeployments';
import { getDeployStatus, formatRelativeTime, formatDuration } from '../../utils/serviceTypes';
import EmptyState from '../EmptyState';
-// Deployment status → semantic tone (ds Pill kind / dot modifier)
-const DEPLOY_TONE = {
- success: 'green',
- failed: 'red',
- in_progress: 'amber',
- rolled_back: 'gray',
- pending: 'cyan',
-};
-
-// Env-var change action → tone (mirrors the history modal's Badge variants).
-const ENV_TONE = { created: 'green', updated: 'amber', deleted: 'red' };
-
+// Deployment status → tone and env-var change action → tone both come from
+// the ONE shared status vocabulary (ds/status).
// The three streams this timeline merges, in the order the Kind menu lists
// them. Declared rather than derived: an app that has never been deployed
// still has "Deploy" as a real kind, and a pick-list that hides it would
@@ -144,7 +134,7 @@ const EventsTab = ({ appId }) => {
// getDeployStatus already labels a successful deploy "Live"; there
// is no separate latest-success label to compute.
status: getDeployStatus(deploy.status).label,
- tone: DEPLOY_TONE[deploy.status] || 'cyan',
+ tone: statusKind(deploy.status),
actor: deploy.trigger || NONE,
text: deploy.commitMessage || deploy.version || `Deployment #${deployments.length - idx}`,
deploy,
@@ -155,7 +145,7 @@ const EventsTab = ({ appId }) => {
at: entry.changed_at,
ts: new Date(entry.changed_at).getTime() || 0,
status: titleCase(entry.action),
- tone: ENV_TONE[entry.action] || 'cyan',
+ tone: envActionKind(entry.action),
// The history row stores changed_by as a user id, never a name.
actor: NONE,
text: `${entry.key} ${entry.action}`,
diff --git a/frontend/src/components/service-detail/OverviewTab.jsx b/frontend/src/components/service-detail/OverviewTab.jsx
index e30ee6c7..e3fc1527 100644
--- a/frontend/src/components/service-detail/OverviewTab.jsx
+++ b/frontend/src/components/service-detail/OverviewTab.jsx
@@ -8,22 +8,14 @@ import { getDeployStatus, formatRelativeTime, formatDuration } from '../../utils
import { formatBytes } from '../../utils/formatBytes';
import BandwidthSparkline from '../BandwidthSparkline';
import ScheduledTasksCard from '../ScheduledTasksCard';
-import { KpiBand, MetricCard, Pill, Gauge, EnvTag } from '@/components/ds';
+import { KpiBand, MetricCard, Pill, Gauge, EnvTag, statusKind } from '@/components/ds';
import { usePolling } from '@/hooks/usePolling';
// Live metrics cadence.
const METRICS_REFRESH_MS = 10000;
-// Deployment status → semantic tone (ds Pill kind / dot modifier)
-const DEPLOY_TONE = {
- success: 'green',
- failed: 'red',
- in_progress: 'amber',
- rolled_back: 'gray',
- pending: 'cyan',
-};
-
+// Deployment status → tone comes from the ONE shared vocabulary (ds/status).
// environment_type → short EnvTag label
const ENV_LABEL = {
production: 'PROD',
@@ -362,7 +354,7 @@ const OverviewTab = ({ app, deployConfig }) => {
<div className="overview-tab__deploy-list">
{deployments.slice(0, 5).map((deploy, idx) => {
const statusInfo = getDeployStatus(deploy.status);
- const tone = DEPLOY_TONE[deploy.status] || 'cyan';
+ const tone = statusKind(deploy.status);
const isLatest = idx === 0 && deploy.status === 'success';
return (
<div key={deploy.id} className="overview-tab__deploy-row">
diff --git a/frontend/src/components/workspaces/WorkspaceServersTab.jsx b/frontend/src/components/workspaces/WorkspaceServersTab.jsx
index 45e4e1b8..3c7cff91 100644
--- a/frontend/src/components/workspaces/WorkspaceServersTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceServersTab.jsx
@@ -9,8 +9,8 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Button } from '@/components/ui/button';
import EmptyState from '../EmptyState';
+import { statusKind } from '@/components/ds/status';
-const SERVER_PILL = { online: 'green', pending: 'amber', offline: 'red' };
// What the Status cell shows when the row carries none. A real word, not '':
// `ruleIsArmed` drops any rule whose value is empty, so a rule on '' would
@@ -83,7 +83,7 @@ const WorkspaceServersTab = ({ wsId, srvIn, srvOut, onMoveServer }) => {
enumOrder: ['online', 'pending', 'offline', UNKNOWN],
value: (s) => s.status || UNKNOWN,
sortValue: (s) => s.status || UNKNOWN,
- render: (s) => <Pill kind={SERVER_PILL[s.status] || 'gray'}>{s.status || UNKNOWN}</Pill>,
+ render: (s) => <Pill kind={statusKind(s.status)}>{s.status || UNKNOWN}</Pill>,
},
{
key: 'actions',
diff --git a/frontend/src/components/workspaces/WorkspaceServicesTab.jsx b/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
index 7566fadc..7bb9cf62 100644
--- a/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceServicesTab.jsx
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';
import { Box, Plus } from 'lucide-react';
-import { ServiceTile, Pill, DataTable, DataTableFooter } from '@/components/ds';
+import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -10,8 +10,6 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Button } from '@/components/ui/button';
import EmptyState from '../EmptyState';
-const APP_PILL = { running: 'green', stopped: 'gray', failed: 'red' };
-
// What the Status cell shows when the row carries none. A real word, not '':
// `ruleIsArmed` drops any rule whose value is empty.
const UNKNOWN = 'unknown';
@@ -81,7 +79,7 @@ const WorkspaceServicesTab = ({ wsId, services, appsOut, onMoveApp, onShare }) =
type: 'enum',
value: (a) => a.status || UNKNOWN,
sortValue: (a) => a.status || UNKNOWN,
- render: (a) => <Pill kind={APP_PILL[a.status] || 'amber'}>{a.status || UNKNOWN}</Pill>,
+ render: (a) => <Pill kind={serviceStatusKind(a.status)}>{a.status || UNKNOWN}</Pill>,
},
{
key: 'actions',
diff --git a/frontend/src/components/workspaces/WorkspaceSitesTab.jsx b/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
index 07f0fe57..ce082b6b 100644
--- a/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
+++ b/frontend/src/components/workspaces/WorkspaceSitesTab.jsx
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';
import { Globe, Plus } from 'lucide-react';
-import { ServiceTile, Pill, DataTable, DataTableFooter } from '@/components/ds';
+import { ServiceTile, Pill, DataTable, DataTableFooter, serviceStatusKind } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -10,8 +10,6 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Button } from '@/components/ui/button';
import EmptyState from '../EmptyState';
-const APP_PILL = { running: 'green', stopped: 'gray', failed: 'red' };
-
// What the Status cell shows when the row carries none. A real word, not '':
// `ruleIsArmed` drops any rule whose value is empty.
const UNKNOWN = 'unknown';
@@ -81,7 +79,7 @@ const WorkspaceSitesTab = ({ wsId, sites, appsOut, onMoveApp, onShare }) => {
type: 'enum',
value: (a) => a.status || UNKNOWN,
sortValue: (a) => a.status || UNKNOWN,
- render: (a) => <Pill kind={APP_PILL[a.status] || 'amber'}>{a.status || UNKNOWN}</Pill>,
+ render: (a) => <Pill kind={serviceStatusKind(a.status)}>{a.status || UNKNOWN}</Pill>,
},
{
key: 'actions',
diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsx
index 6e7194da..fc0e2caa 100644
--- a/frontend/src/pages/AgentFleet.jsx
+++ b/frontend/src/pages/AgentFleet.jsx
@@ -29,7 +29,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
-import { MetricCard, KpiBand, Pill, Gauge, DataTable, DataTableFooter } from '@/components/ds';
+import { MetricCard, KpiBand, Pill, Gauge, DataTable, DataTableFooter, statusKind } from '@/components/ds';
const AgentFleet = () => {
const [activeTab, setActiveTab] = useState('dashboard');
@@ -192,17 +192,6 @@ const AgentFleet = () => {
}
};
- const rolloutPillKind = (status) => {
- const map = {
- running: 'cyan',
- completed: 'green',
- failed: 'red',
- cancelled: 'amber',
- pending: 'gray'
- };
- return map[status] || 'gray';
- };
-
// Columns for the shared DataTable. Cell markup and classNames are
// identical to the hand-rolled tables they replace. No in-page toolbar
// rows on this page (Refresh lives in the shared top bar), so each table
@@ -295,7 +284,7 @@ const AgentFleet = () => {
sortable: true,
sortValue: (r) => r.status || '',
render: (r) => (
- <Pill kind={rolloutPillKind(r.status)}>{r.status}</Pill>
+ <Pill kind={statusKind(r.status)}>{r.status}</Pill>
),
},
{
diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsx
index 7fc7b842..09a95d97 100644
--- a/frontend/src/pages/Deployments.jsx
+++ b/frontend/src/pages/Deployments.jsx
@@ -5,7 +5,7 @@ import api from '../services/api';
import Modal from '../components/Modal';
import EmptyState from '../components/EmptyState';
import { Button } from '@/components/ui/button';
-import { DataTable, DataTableFooter, Pill, SearchField } from '@/components/ds';
+import { DataTable, DataTableFooter, Pill, SearchField, statusKind } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -32,13 +32,6 @@ import {
activityGroup,
} from '../utils/deployActivity';
-const STATUS_KIND = {
- succeeded: 'green',
- failed: 'red',
- running: 'cyan',
- pending: 'gray',
-};
-
// Built-in saved views. These replace the segmented All/Running/Succeeded/Failed
// strip: the strip was a status rule wearing a button, could not combine with
// anything (you could not ask for "failed, on that server"), and reported counts
@@ -198,7 +191,7 @@ const Deployments = () => {
// only the former is a real global rule, so `spin` never rotated
// anything it was put on.
render: (job) => (
- <Pill kind={STATUS_KIND[job.status] || 'gray'} dot={job.status !== 'running'}>
+ <Pill kind={statusKind(job.status)} dot={job.status !== 'running'}>
{job.status === 'running' && <Loader2 size={11} className="animate-spin" />}
{job.status}
</Pill>
diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsx
index a7fb1ec0..1ad93173 100644
--- a/frontend/src/pages/FleetProxy.jsx
+++ b/frontend/src/pages/FleetProxy.jsx
@@ -7,7 +7,7 @@ import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Button } from '@/components/ui/button';
-import { DataTable, Pill } from '@/components/ds';
+import { DataTable, Pill, serviceStatusKind, statusLabel as dsStatusLabel } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -29,24 +29,6 @@ const PROXY_TYPE_META = {
caddy: { label: 'Caddy', kind: 'violet' },
};
-// Status → Pill kind. 'host' means "host nginx, no managed stack" — a healthy
-// default, not a fault, so it reads green-ish (cyan) rather than amber.
-const STATUS_KIND = {
- running: 'green',
- host: 'cyan',
- stopped: 'gray',
- error: 'red',
- unknown: 'amber',
-};
-
-const STATUS_LABEL = {
- running: 'Running',
- host: 'Host default',
- stopped: 'Stopped',
- error: 'Error',
- unknown: 'Unknown',
-};
-
// Recommendation level → Pill kind. 'ok' reads green (aligned), 'info' is a
// neutral note, 'warn' is amber so the operator can spot what needs action.
const RECOMMENDATION_KIND = {
@@ -71,7 +53,7 @@ function typeMeta(type) {
return PROXY_TYPE_META[type] || { label: type || 'Unknown', kind: 'gray' };
}
-const statusLabel = (row) => STATUS_LABEL[row.status] || row.status || 'Unknown';
+const statusLabel = (row) => dsStatusLabel(row.status);
// Columns for the shared DataTable. Two accessors per column on purpose:
// `value` is what the column MENU, the filter rules and the export read
@@ -121,7 +103,7 @@ const FLEET_COLUMNS = [
groupValue: statusLabel,
sortValue: statusLabel,
render: (row) => (
- <Pill kind={STATUS_KIND[row.status] || 'gray'}>{statusLabel(row)}</Pill>
+ <Pill kind={serviceStatusKind(row.status)}>{statusLabel(row)}</Pill>
),
},
{
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index 7d6aaa05..dd6be576 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -8,7 +8,7 @@ import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
import {
Pill, MetricCard, KpiBand, SegControl, Drawer, DataTable, DataTableFooter,
- ListToolbar,
+ ListToolbar, statusKind,
} from '../components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -32,15 +32,6 @@ const VALID_TABS = ['overview', 'repositories', 'access', 'webhooks', 'deploymen
const SOURCE_INITIALS = { github: 'GH', gitlab: 'GL', bitbucket: 'BB' };
-const getStatusColor = (status) => {
- switch (status) {
- case 'success': return 'green';
- case 'failed': return 'red';
- case 'running': return 'amber';
- default: return 'gray';
- }
-};
-
const formatDate = (dateString) => {
if (!dateString) return 'Unknown';
const date = new Date(dateString);
@@ -441,7 +432,7 @@ const HOOK_DEPLOY_COLUMNS = [
header: 'Status',
sortable: true,
sortValue: (d) => d.status || '',
- render: (d) => <Pill kind={getStatusColor(d.status)}>{d.status}</Pill>,
+ render: (d) => <Pill kind={statusKind(d.status)}>{d.status}</Pill>,
},
{
key: 'when',
@@ -1281,11 +1272,11 @@ function Git({ basePath = '/git' }) {
<div className="dom-card">
{filteredDeployments.map(deployment => (
<div key={deployment.id} className="git-deploy-row is-clickable" onClick={() => setDrawerDeployment(deployment)}>
- <span className={`git-deploy-dot git-deploy-dot--${getStatusColor(deployment.status)}`} />
+ <span className={`git-deploy-dot git-deploy-dot--${statusKind(deployment.status)}`} />
<div className="git-deploy-body">
<div className="git-deploy-top">
<span className="git-deploy-version">v{deployment.version}</span>
- <Pill kind={getStatusColor(deployment.status)}>{deployment.status}</Pill>
+ <Pill kind={statusKind(deployment.status)}>{deployment.status}</Pill>
{deployment.is_rollback && <span className="git-chip git-chip--cyan">rollback</span>}
{deployment.commit_sha && <code className="git-hash">{deployment.commit_sha.slice(0, 7)}</code>}
</div>
@@ -1720,7 +1711,7 @@ function Git({ basePath = '/git' }) {
<div className="dom-specs">
<div className="sk-spec-card">
<div className="sk-spec-card__label">Status</div>
- <div style={{ marginTop: 8 }}><Pill kind={getStatusColor(drawerDeployment.status)}>{drawerDeployment.status}</Pill></div>
+ <div style={{ marginTop: 8 }}><Pill kind={statusKind(drawerDeployment.status)}>{drawerDeployment.status}</Pill></div>
{drawerDeployment.duration_seconds != null && <div className="sk-spec-card__sub">{drawerDeployment.duration_seconds}s</div>}
</div>
<div className="sk-spec-card">
@@ -1893,7 +1884,7 @@ function Git({ basePath = '/git' }) {
>
{selectedDeployment && (<>
<div className="deployment-summary">
- <div className="summary-item"><span className="label">Status:</span><Pill kind={getStatusColor(selectedDeployment.status)}>{selectedDeployment.status}</Pill></div>
+ <div className="summary-item"><span className="label">Status:</span><Pill kind={statusKind(selectedDeployment.status)}>{selectedDeployment.status}</Pill></div>
{selectedDeployment.commit_sha && <div className="summary-item"><span className="label">Commit:</span><code className="git-hash">{selectedDeployment.commit_sha.slice(0, 7)}</code></div>}
<div className="summary-item"><span className="label">Branch:</span><span>{selectedDeployment.branch}</span></div>
<div className="summary-item"><span className="label">Triggered by:</span><span>{selectedDeployment.triggered_by}</span></div>
diff --git a/frontend/src/pages/ImportWizard.jsx b/frontend/src/pages/ImportWizard.jsx
index 639e22dd..e1b5cdfa 100644
--- a/frontend/src/pages/ImportWizard.jsx
+++ b/frontend/src/pages/ImportWizard.jsx
@@ -9,7 +9,7 @@ import api from '../services/api';
import HtaccessConverter from '../components/apps/HtaccessConverter';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import PageLayout from '../layouts/PageLayout';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -39,18 +39,10 @@ const SOURCE_TYPES = [
const STEPS = ['Source', 'Backup', 'Analyse', 'Review', 'Run'];
-// Import status -> Pill colour, shared by the run pane and the history list.
-const PILL_KIND = {
- created: 'gray',
- analyzing: 'cyan',
- analyzed: 'violet',
- running: 'cyan',
- completed: 'green',
- failed: 'red',
-};
-
+// Import status -> Pill colour comes from the ONE shared vocabulary
+// (ds/status), shared by the run pane and the history list.
function StatusPill({ status }) {
- return <Pill kind={PILL_KIND[status] || 'gray'}>{status}</Pill>;
+ return <Pill kind={statusKind(status)}>{status}</Pill>;
}
function formatSize(bytes) {
diff --git a/frontend/src/pages/Incidents.jsx b/frontend/src/pages/Incidents.jsx
index 4f1f7252..b39e0dd7 100644
--- a/frontend/src/pages/Incidents.jsx
+++ b/frontend/src/pages/Incidents.jsx
@@ -8,6 +8,7 @@
// question a third time. All three are rows here, told apart by the Source
// column, and every bucket the segment offered is a saved view below.
import { useCallback, useEffect, useMemo, useState } from 'react';
+import { statusKind, alertStatusKind } from '@/components/ds/status';
import { Link } from 'react-router-dom';
import {
AlertTriangle, CheckCircle2, ChevronRight, Eye, Radar, RefreshCw, Siren,
@@ -26,7 +27,7 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { METRIC_LABELS } from '../components/monitoring/fleetMetrics';
-import { IMPACT_TONE, INCIDENT_STATES } from '../components/monitoring/monitorShared';
+import { impactTone, INCIDENT_STATES } from '../components/monitoring/monitorShared';
// Built-in views. This page used to carry THREE old affordances at once — a KPI
// band whose tiles set a filter, an Active/Resolved/All segment row, and the
@@ -109,17 +110,7 @@ const BUILTIN_VIEWS = [
},
];
-const STATE_TONE = {
- investigating: 'red',
- identified: 'amber',
- monitoring: 'cyan',
- resolved: 'green',
-};
-const SEVERITY_TONE = { critical: 'red', warning: 'amber', info: 'cyan' };
-
-// The fleet alert lifecycle, tinted exactly as the deleted panel tinted it.
-const ALERT_STATUS_TONE = { active: 'red', acknowledged: 'amber', resolved: 'green' };
function formatWhen(iso) {
if (!iso) return 'unknown';
@@ -229,7 +220,7 @@ export default function Incidents() {
subject,
detail: subject,
state: incident.status,
- tone: STATE_TONE[incident.status] || 'gray',
+ tone: statusKind(incident.status),
impact: incident.impact,
when: incident.created_at,
resolved: incident.status === 'resolved',
@@ -265,7 +256,7 @@ export default function Incidents() {
subject: 'This server',
detail: hostDetail(alert),
state: alert.severity,
- tone: SEVERITY_TONE[alert.severity] || 'gray',
+ tone: statusKind(alert.severity),
impact: alert.severity,
metric: alert.type,
value: alert.value,
@@ -292,7 +283,7 @@ export default function Incidents() {
subject,
detail: `${metric} ${formatValue(alert.value)} / ${alert.threshold}`,
state: alert.status,
- tone: ALERT_STATUS_TONE[alert.status] || 'gray',
+ tone: alertStatusKind(alert.status),
impact: alert.severity,
metric,
value: alert.value,
@@ -553,8 +544,8 @@ export default function Incidents() {
{selected?.kind === 'incident' && (
<div className="incident-detail">
<div className="incident-detail__pills">
- <Pill kind={STATE_TONE[selected.raw.status] || 'gray'}>{selected.raw.status}</Pill>
- <Pill kind={IMPACT_TONE[selected.raw.impact] || 'gray'}>{selected.raw.impact} impact</Pill>
+ <Pill kind={statusKind(selected.raw.status)}>{selected.raw.status}</Pill>
+ <Pill kind={impactTone(selected.raw.impact)}>{selected.raw.impact} impact</Pill>
</div>
{selected.raw.body && <p className="incident-detail__body">{selected.raw.body}</p>}
@@ -570,10 +561,10 @@ export default function Incidents() {
<ol className="incident-timeline">
{selected.raw.updates.map((update) => (
<li key={update.id} className="incident-timeline__item">
- <span className={`incident-timeline__dot is-${STATE_TONE[update.status] || 'gray'}`} />
+ <span className={`incident-timeline__dot is-${statusKind(update.status)}`} />
<div>
<div className="incident-timeline__head">
- <Pill kind={STATE_TONE[update.status] || 'gray'}>{update.status}</Pill>
+ <Pill kind={statusKind(update.status)}>{update.status}</Pill>
<span>{formatWhen(update.created_at)}</span>
</div>
<p>{update.body}</p>
@@ -614,7 +605,7 @@ export default function Incidents() {
<div className="incident-detail">
<div className="incident-detail__pills">
<Pill kind={selected.tone}>{selected.state}</Pill>
- <Pill kind={SEVERITY_TONE[selected.raw.severity] || 'gray'}>
+ <Pill kind={statusKind(selected.raw.severity)}>
{selected.raw.severity}
</Pill>
</div>
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index 205007d6..35aa1d2a 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -17,6 +17,7 @@ import api from '../services/api';
import {
Pill, DataTable, DataTableFooter, SegControl,
SearchField, FilterDrawer, FilterButton, countActiveFilters,
+ statusKind,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridToolsMenu,
@@ -136,24 +137,6 @@ const BUILTIN_VIEWS = [
];
// Map a job status to a DS Pill colour.
-const STATUS_KIND = {
- queued: 'gray',
- pending: 'gray',
- scheduled: 'gray',
- running: 'cyan',
- succeeded: 'green',
- success: 'green',
- completed: 'green',
- failed: 'red',
- error: 'red',
- cancelled: 'amber',
- canceled: 'amber',
-};
-
-function statusKind(status) {
- return STATUS_KIND[String(status || '').toLowerCase()] || 'gray';
-}
-
function ownerLabel(job) {
if (!job.owner_type) return '—';
return `${job.owner_type}${job.owner_id ? ` #${job.owner_id}` : ''}`;
diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsx
index 0f001130..66d11f6c 100644
--- a/frontend/src/pages/Marketplace.jsx
+++ b/frontend/src/pages/Marketplace.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect, useCallback } from 'react';
+import { statusVariant } from '@/components/ds/status';
import { useLocation, useSearchParams, useNavigate } from 'react-router-dom';
import {
Activity,
@@ -439,11 +440,7 @@ const Marketplace = () => {
setFilters({ ownership: '', category: [] });
};
- const pluginStatusVariant = (status) => {
- if (status === 'active') return 'success';
- if (status === 'error') return 'destructive';
- return 'outline';
- };
+ const pluginStatusVariant = (status) => statusVariant(status);
const activeFilterCount = countActiveFilters(filters);
diff --git a/frontend/src/pages/QueueDetail.jsx b/frontend/src/pages/QueueDetail.jsx
index 9668637c..04ac1292 100644
--- a/frontend/src/pages/QueueDetail.jsx
+++ b/frontend/src/pages/QueueDetail.jsx
@@ -20,6 +20,7 @@ import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import {
DataTable, DataTableFooter, MetricCard, KpiBand, Pill, SortChipBar,
+ statusKind, statusLabel,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -29,22 +30,6 @@ import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { usePolling } from '@/hooks/usePolling';
-const STATUS_KINDS = {
- pending: 'blue',
- in_flight: 'yellow',
- completed: 'green',
- failed: 'red',
- dead_letter: 'gray',
-};
-
-const STATUS_LABELS = {
- pending: 'Pending',
- in_flight: 'In Flight',
- completed: 'Completed',
- failed: 'Failed',
- dead_letter: 'Dead Letter',
-};
-
const STATUS_ORDER = ['pending', 'in_flight', 'completed', 'failed', 'dead_letter'];
const POLL_INTERVAL = 3000;
@@ -258,7 +243,7 @@ const QueueDetail = () => {
enumOrder: STATUS_ORDER,
// Lifecycle order, not alphabet.
sortValue: (msg) => STATUS_ORDER.indexOf(msg.status),
- render: (msg) => <Pill kind={STATUS_KINDS[msg.status] || 'gray'}>{msg.status}</Pill>,
+ render: (msg) => <Pill kind={statusKind(msg.status)}>{msg.status}</Pill>,
},
{
key: 'payload',
@@ -378,7 +363,7 @@ const QueueDetail = () => {
{STATUS_ORDER.map(s => (
<MetricCard
key={s}
- label={STATUS_LABELS[s]}
+ label={statusLabel(s)}
value={stats[s] || 0}
kind={s === 'failed' || s === 'dead_letter' ? 'danger' : undefined}
/>
@@ -419,7 +404,7 @@ const QueueDetail = () => {
onChange={(e) => setStatusFilter(e.target.value)}
>
<option value="all">All statuses</option>
- {STATUS_ORDER.map(s => <option key={s} value={s}>{STATUS_LABELS[s]}</option>)}
+ {STATUS_ORDER.map(s => <option key={s} value={s}>{statusLabel(s)}</option>)}
</select>
</div>
</div>
@@ -469,7 +454,7 @@ const QueueDetail = () => {
</div>
<div className="queue-message-detail">
<div><strong>ID:</strong> <code>{selectedMessage.id}</code></div>
- <div><strong>Status:</strong> <Pill kind={STATUS_KINDS[selectedMessage.status] || 'gray'}>{selectedMessage.status}</Pill></div>
+ <div><strong>Status:</strong> <Pill kind={statusKind(selectedMessage.status)}>{selectedMessage.status}</Pill></div>
<div><strong>Attempts:</strong> {selectedMessage.attempts} / {selectedMessage.max_attempts}</div>
<div><strong>Created:</strong> {new Date(selectedMessage.created_at).toLocaleString()}</div>
{selectedMessage.error_message && (
diff --git a/frontend/src/pages/QueueOperations.jsx b/frontend/src/pages/QueueOperations.jsx
index 2f687f89..49700c81 100644
--- a/frontend/src/pages/QueueOperations.jsx
+++ b/frontend/src/pages/QueueOperations.jsx
@@ -23,6 +23,7 @@ import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import {
DataTable, DataTableFooter, MetricCard, Pill, SearchField, SortChipBar,
+ statusKind, statusLabel,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -33,22 +34,6 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { formatCompact, formatFull } from '../utils/formatNumber';
import { usePolling } from '@/hooks/usePolling';
-const STATUS_KINDS = {
- pending: 'blue',
- in_flight: 'yellow',
- completed: 'green',
- failed: 'red',
- dead_letter: 'gray',
-};
-
-const STATUS_LABELS = {
- pending: 'Pending',
- in_flight: 'In Flight',
- completed: 'Completed',
- failed: 'Failed',
- dead_letter: 'Dead Letter',
-};
-
const STATUS_ORDER = ['pending', 'in_flight', 'completed', 'failed', 'dead_letter'];
const POLL_INTERVAL = 3000;
@@ -332,7 +317,7 @@ const QueueOperations = () => {
const activeStatusLabel = messageFilter === 'all'
? 'All queues'
- : `${STATUS_LABELS[messageFilter]} queues`;
+ : `${statusLabel(messageFilter)} queues`;
const activeGroupLabel = activeGroup ? activeGroup.name : 'All groups';
// DataTable columns. Cell markup and classNames are identical to the
@@ -379,8 +364,8 @@ const QueueOperations = () => {
render: (queue) => (
<div className="queue-row-counts" onClick={e => e.stopPropagation()}>
{STATUS_ORDER.filter(s => (queue.stats?.[s] || 0) > 0).map(status => (
- <Pill key={status} kind={STATUS_KINDS[status]}>
- {STATUS_LABELS[status]} {queue.stats[status]}
+ <Pill key={status} kind={statusKind(status)}>
+ {statusLabel(status)} {queue.stats[status]}
</Pill>
))}
{(queue.stats?.total || 0) === 0 && (
@@ -529,7 +514,7 @@ const QueueOperations = () => {
onClick={() => setMessageFilter(status)}
>
<span>
- <strong>{STATUS_LABELS[status]}</strong>
+ <strong>{statusLabel(status)}</strong>
<small>{status}</small>
</span>
<b title={String(formatFull(statusCounts[status] || 0))}>{formatCompact(statusCounts[status] || 0)}</b>
diff --git a/frontend/src/pages/RemoteAccess.jsx b/frontend/src/pages/RemoteAccess.jsx
index 672a3841..fcceddd2 100644
--- a/frontend/src/pages/RemoteAccess.jsx
+++ b/frontend/src/pages/RemoteAccess.jsx
@@ -1,3 +1,4 @@
+import { statusKind } from '@/components/ds/status';
import { useState, useEffect, useCallback, useMemo } from 'react';
import { Link } from 'react-router-dom';
import {
@@ -23,15 +24,7 @@ import {
} from '@/components/ui/select';
// Tunnel / service status → status-pill tone.
-const PILL_KIND = {
- up: 'green',
- published: 'green',
- pending: 'amber',
- degraded: 'amber',
- down: 'red',
- error: 'red',
-};
-const pillKind = (status) => PILL_KIND[status] || 'gray';
+const pillKind = (status) => statusKind(status);
const EMPTY_FORM = {
privateServerId: '',
diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsx
index 4232dc9c..d4390819 100644
--- a/frontend/src/pages/ServerDetail.jsx
+++ b/frontend/src/pages/ServerDetail.jsx
@@ -19,7 +19,7 @@ import ServerMetricsTab from '../components/serverdetail/ServerMetricsTab';
import SurveyTab from '../components/serverdetail/SurveyTab';
import ServerSettingsTab, { TokenModal } from '../components/serverdetail/ServerSettingsTab';
import {
- STATUS_PILL_KIND,
+ serverStatusKind,
CopyChip,
FolderTinyIcon,
RefreshIcon,
@@ -262,7 +262,7 @@ const ServerDetail = () => {
<div className="server-detail-header__title-row">
<h1>{server.name}</h1>
<FavoriteStar type="server" id={server.id} path={`/servers/${server.id}`} label={server.name} />
- <Pill kind={STATUS_PILL_KIND[server.status] || 'gray'}>
+ <Pill kind={serverStatusKind(server.status)}>
{server.status || 'pending'}
</Pill>
<CopyChip
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 844fdf71..0435b4c6 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -8,7 +8,7 @@ import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import {
- DataTable, DataTableFooter, Drawer, Gauge, Pill, SearchField,
+ DataTable, DataTableFooter, Drawer, Gauge, Pill, SearchField, statusKind,
} from '@/components/ds';
import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
@@ -25,13 +25,6 @@ import LinkPanelForm from '../components/servers/LinkPanelForm';
// Status -> Pill tone. `connecting` and `pending` both mean "not reporting
// yet" but for different reasons (handshake in flight vs agent never
// installed), so they stay distinct rather than folding into one bucket.
-const STATUS_KIND = {
- online: 'green',
- offline: 'red',
- connecting: 'amber',
- pending: 'gray',
-};
-
// Built-in saved views. States only use real column keys (SERVER_COLUMNS) —
// there is no separate status segment or group select any more; the Status and
// Group columns' own menus are the one place the fleet is narrowed, and they
@@ -220,7 +213,7 @@ const SERVER_COLUMNS = [
groupLabel: (value) => (value ? value.charAt(0).toUpperCase() + value.slice(1) : 'None'),
render: (server) => {
const status = server.status || 'pending';
- return <Pill kind={STATUS_KIND[status] || 'gray'}>{status}</Pill>;
+ return <Pill kind={statusKind(status)}>{status}</Pill>;
},
},
meterColumn('cpu', 'CPU', 'cpu_percent'),
diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index 713eb3a9..8286a7f8 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -25,19 +25,10 @@ import EmptyState from '../components/EmptyState';
import PluginSlot from '../components/PluginSlot';
import { Layers, FileArchive, RotateCcw, LayoutDashboard, History, ScrollText, Variable, Terminal, Activity, Package, Server, SquareTerminal, Settings, Eye, ExternalLink } from 'lucide-react';
import { Button } from '@/components/ui/button';
-import { Pill, ServiceTile, PageTopbar } from '@/components/ds';
+import { Pill, ServiceTile, PageTopbar, statusKind } from '@/components/ds';
import FavoriteStar from '@/components/FavoriteStar';
import { useRecordVisit } from '@/hooks/useRecordVisit';
-// statusInfo.dotClass → ds Pill kind
-const STATUS_PILL = {
- live: 'green',
- stopped: 'gray',
- deploying: 'amber',
- building: 'amber',
- failed: 'red',
-};
-
const TAB_LABELS = {
overview: 'Overview',
events: 'Events',
@@ -424,7 +415,7 @@ const ServiceDetail = () => {
<ExternalLink size={15} />
</a>
)}
- <Pill kind={STATUS_PILL[service.statusInfo.dotClass] || 'gray'}>
+ <Pill kind={statusKind(service.statusInfo.dotClass)}>
{service.statusInfo.label}
</Pill>
<span
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 3b40b2a5..8b5108eb 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -7,7 +7,7 @@ import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/se
import ResourceListPage from '../components/layouts/ResourceListPage';
import BandwidthSparkline from '../components/BandwidthSparkline';
import { formatBytes } from '../utils/formatBytes';
-import { Pill, ServiceTile, EnvTag, SearchField } from '@/components/ds';
+import { Pill, ServiceTile, EnvTag, SearchField, serviceStatusKind } from '@/components/ds';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { Button } from '@/components/ui/button';
import { Label } from '@/components/ui/label';
@@ -21,8 +21,6 @@ import {
import Modal from '@/components/Modal';
import RequiresDocker from '../components/RequiresDocker';
-const STATUS_PILL = { running: 'green', stopped: 'gray', deploying: 'amber', building: 'amber', failed: 'red' };
-
// Severity order for status sorting — also the page's default row order.
const STATUS_SORT_ORDER = { running: 0, deploying: 1, building: 2, stopped: 3, failed: 4 };
@@ -332,7 +330,7 @@ const Services = () => {
groupable: true,
groupValue: (app) => app.status,
groupLabel: (value) => (value ? value.charAt(0).toUpperCase() + value.slice(1) : 'None'),
- render: (app) => <Pill kind={STATUS_PILL[app.status] || 'gray'}>{getStatusConfig(app.status).label}</Pill>,
+ render: (app) => <Pill kind={serviceStatusKind(app.status)}>{getStatusConfig(app.status).label}</Pill>,
},
{
key: 'last_deploy',
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index c762429c..2ee9d2b3 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -40,6 +40,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useAuth } from '../contexts/AuthContext';
import { useToast } from '../contexts/ToastContext';
import EmptyState from '../components/EmptyState';
+import { statusKind } from '@/components/ds/status';
const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info', 'debug'];
@@ -47,12 +48,10 @@ const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info', 'debug'];
// knows, or the badge silently renders without its background. `label` is the
// one spelling of a severity the whole page uses: the pill, the filter drawer's
// option list and the built-in view names all read from here.
-const SEVERITY_CONFIG = {
- critical: { pill: 'red', label: 'Critical' },
- error: { pill: 'red', label: 'Error' },
- warning: { pill: 'amber', label: 'Warning' },
- info: { pill: 'cyan', label: 'Info' },
- debug: { pill: 'gray', label: 'Debug' },
+// Severity tones ride the shared vocabulary (plan 77 D3); labels are local.
+const SEVERITY_LABEL = {
+ critical: 'Critical', error: 'Error', warning: 'Warning',
+ info: 'Info', debug: 'Debug',
};
const PAGE_SIZE = 50;
@@ -253,7 +252,7 @@ export default function Telemetry() {
key: 'severity',
label: 'Severity',
type: 'single',
- options: SEVERITY_ORDER.map((s) => ({ value: s, label: SEVERITY_CONFIG[s].label })),
+ options: SEVERITY_ORDER.map((s) => ({ value: s, label: SEVERITY_LABEL[s] })),
},
]), [sources, eventTypes]);
@@ -280,8 +279,8 @@ export default function Telemetry() {
// contain, alphabetically. Pin the full ladder in rank order.
enumOrder: SEVERITY_ORDER,
render: (event) => {
- const config = SEVERITY_CONFIG[event.severity] || SEVERITY_CONFIG.info;
- return <Pill kind={config.pill}>{config.label}</Pill>;
+ const severity = event.severity in SEVERITY_LABEL ? event.severity : 'info';
+ return <Pill kind={statusKind(severity)}>{SEVERITY_LABEL[severity]}</Pill>;
},
},
{
@@ -520,7 +519,7 @@ export default function Telemetry() {
<div>
<dt>Severity</dt>
<dd>
- <Pill kind={(SEVERITY_CONFIG[selectedEvent.severity] || SEVERITY_CONFIG.info).pill}>
+ <Pill kind={statusKind(selectedEvent.severity in SEVERITY_LABEL ? selectedEvent.severity : 'info')}>
{selectedEvent.severity}
</Pill>
</dd>
diff --git a/frontend/src/pages/TestSandbox.jsx b/frontend/src/pages/TestSandbox.jsx
index 6e53a49c..959ba70f 100644
--- a/frontend/src/pages/TestSandbox.jsx
+++ b/frontend/src/pages/TestSandbox.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import EmptyState from '../components/EmptyState';
-import { Pill } from '@/components/ds';
+import { Pill, statusKind } from '@/components/ds';
import PageLayout from '../layouts/PageLayout';
import { Button } from '@/components/ui/button';
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card';
@@ -22,20 +22,6 @@ const FAMILY_META = {
suse: { label: 'SUSE', kind: 'violet' },
};
-const RESULT_PILL = {
- queued: 'gray',
- running: 'cyan',
- passed: 'green',
- failed: 'red',
-};
-
-const RUN_PILL = {
- running: 'cyan',
- done: 'green',
- cancelled: 'amber',
- error: 'red',
-};
-
const MODES = [
{
value: 'quick',
@@ -96,7 +82,7 @@ function RunResults({ run, distroMeta, logs, openLogs, onToggleLog }) {
<span className="ts-result__duration">{formatDuration(result.duration_s)}</span>
)}
{result.status === 'running' && <span className="spinner-inline" />}
- <Pill kind={RESULT_PILL[result.status] || 'gray'}>{result.status}</Pill>
+ <Pill kind={statusKind(result.status)}>{result.status}</Pill>
</Button>
{result.detail && (
<div className="ts-result__detail">{result.detail}</div>
@@ -466,7 +452,7 @@ const TestSandbox = () => {
<CardHeader className="ts-active__head">
<CardTitle>Run #{activeRun.id}</CardTitle>
<Pill kind="gray" dot={false}>{activeRun.mode}</Pill>
- <Pill kind={RUN_PILL[activeRun.status] || 'gray'}>{activeRun.status}</Pill>
+ <Pill kind={statusKind(activeRun.status)}>{activeRun.status}</Pill>
{isRunning && (
<Button
variant="destructive"
@@ -572,7 +558,7 @@ function FragmentRow({ run, expanded, passed, failed, total, onToggle, detail })
</span>
</td>
<td>{timeAgo(run.created_at)}</td>
- <td><Pill kind={RUN_PILL[run.status] || 'gray'}>{run.status}</Pill></td>
+ <td><Pill kind={statusKind(run.status)}>{run.status}</Pill></td>
</tr>
{expanded && (
<tr className="ts-detail-row">