| import { Badge } from "../ui"; | |
| /** | |
| * Maps the real WorkflowStatus enum (app/models/workflow_run.py) to a tone. | |
| * WAITING_FOR_REVIEW is deliberately "warning" (attention-needed), never | |
| * "danger" — it is a legitimate in-progress state, not a failure. | |
| */ | |
| const TONE_BY_STATUS = { | |
| PENDING: "default", | |
| RUNNING: "accent", | |
| WAITING_FOR_REVIEW: "warning", | |
| COMPLETED: "success", | |
| FAILED: "danger", | |
| CANCELLED: "default", | |
| }; | |
| const LABEL_BY_STATUS = { | |
| PENDING: "Pending", | |
| RUNNING: "Processing", | |
| WAITING_FOR_REVIEW: "Waiting for review", | |
| COMPLETED: "Completed", | |
| FAILED: "Failed", | |
| CANCELLED: "Cancelled", | |
| }; | |
| export function WorkflowStatusBadge({ status }) { | |
| return ( | |
| <Badge tone={TONE_BY_STATUS[status] || "default"} dot> | |
| {LABEL_BY_STATUS[status] || status} | |
| </Badge> | |
| ); | |
| } | |