File size: 850 Bytes
fcacf10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 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>
);
}
|