fix(ui): mark each trigger on the start node with its kind

This commit is contained in:
sam committed 2026-10-18 23:45:25 +11:00
1 parent f1323ebf73
commit 157627f830
1 file changed
+12 -2
+12 -2
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
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, Trash2 } from "@lucide/vue";
import { CircleAlert, CircleCheck, CircleMinus, CircleX, Copy, EllipsisVertical, Flag, LoaderCircle, Pencil, Play, Repeat, Settings2, SkipForward, Tag, Trash2, Workflow, Zap, BookOpen } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
@@ -23,6 +23,13 @@ export interface StepCardData extends StepNodeData {
const props = defineProps<{ data: StepCardData }>();
const TRIGGER_KINDS = {
issue: { icon: Tag, label: "Issue route" },
event: { icon: Zap, label: "Event binding" },
playbook: { icon: BookOpen, label: "Playbook" },
workflow: { icon: Workflow, label: "Workflow" },
} as const;
const STATE_CLASSES: Record<string, string> = {
ok: "border-ok/70",
failed: "border-danger/80",
@@ -145,7 +152,10 @@ function commitRename(event: Event): void {
<div v-if="data.mark" class="text-[11px] font-medium" :class="{ 'text-ok': data.mark === 'added', 'text-danger': data.mark === 'removed', 'text-warn': data.mark === 'changed' }">{{ data.mark === "added" ? "Added" : data.mark === "removed" ? "Removed" : "Changed" }}</div>
<template v-if="!data.expanded">
<ul v-if="data.kind === 'start' && data.triggers?.length" class="mt-1 space-y-0.5">
<li v-for="trigger in data.triggers" :key="trigger.kind + trigger.label" class="truncate text-xs text-fg-muted" :title="trigger.detail">{{ trigger.label }}</li>
<li v-for="trigger in data.triggers" :key="trigger.kind + trigger.label" class="flex min-w-0 items-center gap-1 text-xs text-fg-muted" :title="[TRIGGER_KINDS[trigger.kind].label, trigger.detail].filter(Boolean).join(': ')">
<component :is="TRIGGER_KINDS[trigger.kind].icon" class="size-3 shrink-0" :aria-label="TRIGGER_KINDS[trigger.kind].label" />
<span class="truncate">{{ trigger.label }}</span>
</li>
</ul>
<div v-else-if="data.kind === 'start'" class="mt-0.5 text-xs text-fg-muted">Manual runs only</div>
<div v-else-if="data.summary || data.detail" class="mt-0.5 truncate text-xs text-fg-muted" :title="[data.detail, data.summary].filter(Boolean).join('\n')">{{ data.summary || data.detail }}</div>