fix(ui): step cards use the shared stage status words; new step areas reach the insert menu (#1956)

This commit is contained in:
sam committed 2026-11-13 17:48:48 +11:00
1 parent 3653376221
commit 9d8e4f68ab
2 files changed
+23 -16

No files matched your search

+12 -8
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { stageStatusMeta } from "@/tasks/stage-rail";
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { Handle, Position } from "@vue-flow/core";
import { CircleAlert, CircleCheck, CircleMinus, CircleX, Copy, EllipsisVertical, Flag, LoaderCircle, Pencil, Play, Repeat, Settings2, SkipForward, Tag, Trash2, Workflow, Zap, BookOpen, CalendarClock } from "@lucide/vue";
@@ -51,18 +52,21 @@ const stateClass = computed(() => {
return STATE_CLASSES[props.data.run?.status ?? ""] ?? "border-border";
});
const STATUS = {
ok: { icon: CircleCheck, class: "text-ok", label: "Done" },
failed: { icon: CircleX, class: "text-danger", label: "Failed" },
interrupted: { icon: CircleAlert, class: "text-warn", label: "Interrupted" },
running: { icon: LoaderCircle, class: "text-info animate-spin", label: "Running" },
skipped: { icon: CircleMinus, class: "text-fg-subtle", label: "Skipped" },
// The icon is drawn here; the words are the same ones the run panel uses.
const STATUS_ICONS = {
ok: { icon: CircleCheck, class: "text-ok" },
failed: { icon: CircleX, class: "text-danger" },
interrupted: { icon: CircleAlert, class: "text-warn" },
running: { icon: LoaderCircle, class: "text-info animate-spin motion-reduce:animate-none" },
skipped: { icon: CircleMinus, class: "text-fg-subtle" },
} as const;
const status = computed(() => {
const run = props.data.run?.status;
if (run) return STATUS[run as keyof typeof STATUS] ?? null;
if (run) {
const look = STATUS_ICONS[run as keyof typeof STATUS_ICONS];
return look ? { ...look, label: stageStatusMeta(run).label } : null;
}
if (props.data.problem) return { icon: CircleAlert, class: "text-danger", label: props.data.problem };
if (props.data.editable && props.data.kind === "step") return { icon: CircleCheck, class: "text-ok/70", label: "Ready" };
return null;
});
+11 -8
View File
@@ -28,13 +28,16 @@ export function stepIcon(type: string): Component {
return GROUP_ICONS[type.split(".")[0]] ?? Workflow;
}
/** Step type names grouped by area, in a fixed reading order. */
/** Step type names grouped by area, in a fixed reading order. A type from an
* area not listed here still appears, under Other, so a new server step type
* is never missing from the menu. */
export function stepGroups(types: string[]): { title: string; icon: Component; types: string[] }[] {
return Object.keys(GROUP_TITLES)
.map((group) => ({
title: GROUP_TITLES[group],
icon: GROUP_ICONS[group],
types: types.filter((type) => type.split(".")[0] === group),
}))
.filter((group) => group.types.length);
const known = Object.keys(GROUP_TITLES);
const groups = known.map((group) => ({
title: GROUP_TITLES[group],
icon: GROUP_ICONS[group],
types: types.filter((type) => type.split(".")[0] === group),
}));
groups.push({ title: "Other", icon: Workflow, types: types.filter((type) => !known.includes(type.split(".")[0]) && type !== "parallel" && type !== "switch") });
return groups.filter((group) => group.types.length);
}