fix(ui): step cards use the shared stage status words; new step areas reach the insert menu (#1956)
This commit is contained in:
2 files changed
+23
-16
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { stageStatusMeta } from "@/tasks/stage-rail";
|
||||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
|
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
|
||||||
import { Handle, Position } from "@vue-flow/core";
|
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";
|
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";
|
return STATE_CLASSES[props.data.run?.status ?? ""] ?? "border-border";
|
||||||
});
|
});
|
||||||
|
|
||||||
const STATUS = {
|
// The icon is drawn here; the words are the same ones the run panel uses.
|
||||||
ok: { icon: CircleCheck, class: "text-ok", label: "Done" },
|
const STATUS_ICONS = {
|
||||||
failed: { icon: CircleX, class: "text-danger", label: "Failed" },
|
ok: { icon: CircleCheck, class: "text-ok" },
|
||||||
interrupted: { icon: CircleAlert, class: "text-warn", label: "Interrupted" },
|
failed: { icon: CircleX, class: "text-danger" },
|
||||||
running: { icon: LoaderCircle, class: "text-info animate-spin", label: "Running" },
|
interrupted: { icon: CircleAlert, class: "text-warn" },
|
||||||
skipped: { icon: CircleMinus, class: "text-fg-subtle", label: "Skipped" },
|
running: { icon: LoaderCircle, class: "text-info animate-spin motion-reduce:animate-none" },
|
||||||
|
skipped: { icon: CircleMinus, class: "text-fg-subtle" },
|
||||||
} as const;
|
} as const;
|
||||||
const status = computed(() => {
|
const status = computed(() => {
|
||||||
const run = props.data.run?.status;
|
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.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;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,13 +28,16 @@ export function stepIcon(type: string): Component {
|
|||||||
return GROUP_ICONS[type.split(".")[0]] ?? Workflow;
|
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[] }[] {
|
export function stepGroups(types: string[]): { title: string; icon: Component; types: string[] }[] {
|
||||||
return Object.keys(GROUP_TITLES)
|
const known = Object.keys(GROUP_TITLES);
|
||||||
.map((group) => ({
|
const groups = known.map((group) => ({
|
||||||
title: GROUP_TITLES[group],
|
title: GROUP_TITLES[group],
|
||||||
icon: GROUP_ICONS[group],
|
icon: GROUP_ICONS[group],
|
||||||
types: types.filter((type) => type.split(".")[0] === group),
|
types: types.filter((type) => type.split(".")[0] === group),
|
||||||
}))
|
}));
|
||||||
.filter((group) => group.types.length);
|
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);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user