mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-10-07 16:19:05 +08:00
fix(automations): render CANCELLED and SKIPPED run statuses (#16198)
This commit is contained in:
@@ -10,6 +10,8 @@ describe("RunStatusBadge", () => {
|
||||
[AutomationRunStatus.FAILED, I18nKey.AUTOMATIONS$DETAIL$FAILED],
|
||||
[AutomationRunStatus.PENDING, I18nKey.AUTOMATIONS$DETAIL$PENDING],
|
||||
[AutomationRunStatus.RUNNING, I18nKey.AUTOMATIONS$DETAIL$RUNNING],
|
||||
[AutomationRunStatus.CANCELLED, I18nKey.AUTOMATIONS$DETAIL$CANCELLED],
|
||||
[AutomationRunStatus.SKIPPED, I18nKey.AUTOMATIONS$DETAIL$SKIPPED],
|
||||
])("renders the %s label for the matching status", (status, labelKey) => {
|
||||
render(<RunStatusBadge status={status} />);
|
||||
|
||||
@@ -21,6 +23,8 @@ describe("RunStatusBadge", () => {
|
||||
[AutomationRunStatus.FAILED, "run-status-icon-failed"],
|
||||
[AutomationRunStatus.PENDING, "run-status-icon-pending"],
|
||||
[AutomationRunStatus.RUNNING, "run-status-icon-pending"],
|
||||
[AutomationRunStatus.CANCELLED, "run-status-icon-pending"],
|
||||
[AutomationRunStatus.SKIPPED, "run-status-icon-pending"],
|
||||
])(
|
||||
"renders the %s icon variant for the matching status",
|
||||
(status, testId) => {
|
||||
@@ -29,4 +33,12 @@ describe("RunStatusBadge", () => {
|
||||
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
||||
},
|
||||
);
|
||||
|
||||
it("renders a neutral badge for a status the backend added later", () => {
|
||||
const unknownStatus = "ARCHIVED" as AutomationRunStatus;
|
||||
|
||||
render(<RunStatusBadge status={unknownStatus} />);
|
||||
|
||||
expect(screen.getByTestId("run-status-icon-pending")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,6 +31,14 @@ const statusConfig: Record<
|
||||
label: I18nKey.AUTOMATIONS$DETAIL$RUNNING,
|
||||
style: "border-[var(--oh-border)] bg-surface-raised text-muted",
|
||||
},
|
||||
[AutomationRunStatus.CANCELLED]: {
|
||||
label: I18nKey.AUTOMATIONS$DETAIL$CANCELLED,
|
||||
style: "border-[var(--oh-border)] bg-surface-raised text-muted",
|
||||
},
|
||||
[AutomationRunStatus.SKIPPED]: {
|
||||
label: I18nKey.AUTOMATIONS$DETAIL$SKIPPED,
|
||||
style: "border-[var(--oh-border)] bg-surface-raised text-muted",
|
||||
},
|
||||
};
|
||||
|
||||
function StatusIcon({ status }: { status: AutomationRunStatus }) {
|
||||
@@ -58,7 +66,9 @@ function StatusIcon({ status }: { status: AutomationRunStatus }) {
|
||||
|
||||
export function RunStatusBadge({ status }: RunStatusBadgeProps) {
|
||||
const { t } = useTranslation("openhands");
|
||||
const config = statusConfig[status];
|
||||
// Degrade instead of crashing on a status the backend added after this enum.
|
||||
const config =
|
||||
statusConfig[status] ?? statusConfig[AutomationRunStatus.PENDING];
|
||||
|
||||
return (
|
||||
<span
|
||||
|
||||
@@ -14160,6 +14160,40 @@
|
||||
"uk": "Виконується",
|
||||
"ca": "En execució"
|
||||
},
|
||||
"AUTOMATIONS$DETAIL$CANCELLED": {
|
||||
"en": "Cancelled",
|
||||
"ja": "キャンセル済み",
|
||||
"zh-CN": "已取消",
|
||||
"zh-TW": "已取消",
|
||||
"ko-KR": "취소됨",
|
||||
"no": "Avbrutt",
|
||||
"it": "Annullato",
|
||||
"pt": "Cancelado",
|
||||
"es": "Cancelado",
|
||||
"ar": "أُلغي",
|
||||
"fr": "Annulé",
|
||||
"tr": "İptal edildi",
|
||||
"de": "Abgebrochen",
|
||||
"uk": "Скасовано",
|
||||
"ca": "Cancel·lat"
|
||||
},
|
||||
"AUTOMATIONS$DETAIL$SKIPPED": {
|
||||
"en": "Skipped",
|
||||
"ja": "スキップ済み",
|
||||
"zh-CN": "已跳过",
|
||||
"zh-TW": "已略過",
|
||||
"ko-KR": "건너뜀",
|
||||
"no": "Hoppet over",
|
||||
"it": "Saltato",
|
||||
"pt": "Ignorado",
|
||||
"es": "Omitido",
|
||||
"ar": "تم التخطي",
|
||||
"fr": "Ignoré",
|
||||
"tr": "Atlandı",
|
||||
"de": "Übersprungen",
|
||||
"uk": "Пропущено",
|
||||
"ca": "Omès"
|
||||
},
|
||||
"AUTOMATIONS$DETAIL$INACTIVE": {
|
||||
"en": "Inactive",
|
||||
"ja": "非アクティブ",
|
||||
|
||||
@@ -53,8 +53,9 @@ export const MOCK_AUTOMATION_RUNS: Record<string, AutomationRun[]> = {
|
||||
],
|
||||
"a1000000-0000-0000-0000-000000000003": [
|
||||
makeRun("r3-01", AutomationRunStatus.COMPLETED, 1),
|
||||
makeRun("r3-02", AutomationRunStatus.COMPLETED, 2),
|
||||
makeRun("r3-03", AutomationRunStatus.COMPLETED, 3),
|
||||
// Terminal statuses the backend emits besides COMPLETED/FAILED.
|
||||
makeRun("r3-02", AutomationRunStatus.CANCELLED, 2),
|
||||
makeRun("r3-03", AutomationRunStatus.SKIPPED, 3, 9, false),
|
||||
],
|
||||
"a1000000-0000-0000-0000-000000000004": [
|
||||
makeRun("r4-01", AutomationRunStatus.FAILED, 14, 11, false), // Failed before sandbox creation
|
||||
|
||||
@@ -61,11 +61,14 @@ export interface AutomationsResponse {
|
||||
total: number;
|
||||
}
|
||||
|
||||
/** Mirrors `RunStatus` in the automation service's OpenAPI schema. */
|
||||
export enum AutomationRunStatus {
|
||||
PENDING = "PENDING",
|
||||
RUNNING = "RUNNING",
|
||||
COMPLETED = "COMPLETED",
|
||||
FAILED = "FAILED",
|
||||
CANCELLED = "CANCELLED",
|
||||
SKIPPED = "SKIPPED",
|
||||
}
|
||||
|
||||
export interface AutomationRun {
|
||||
|
||||
Reference in New Issue
Block a user