fix(ui): one workflows toolbar row, one menu, no repeat step type

The step editor's More disclosure no longer fills when open, so only the
chevron moves. A step card keeps its type chip only when its title does not
already say it.

The editor header is one toolbar at every width: view tabs left, the run
selector and actions right, and a single menu holding the sections that do
not fit, the run's own actions and the draft's change list. Publish is the
one primary action. Restore replaces Discard draft and the per-workflow
Restore default, which settings owns.

The page header no longer wraps, and run rows on a phone no longer squeeze
the run title.
This commit is contained in:
sam committed 2026-10-18 22:29:25 +11:00
1 parent 66ec3437fc
commit 14ea688920
6 files changed
+97 -93

No files matched your search

+6 -3
View File
@@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue";
import { FlaskConical, Play } from "@lucide/vue"; import { FlaskConical, Play } from "@lucide/vue";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
@@ -13,7 +12,9 @@ defineProps<{
draft?: string; draft?: string;
}>(); }>();
const emit = defineEmits<{ started: [taskId: number] }>(); const emit = defineEmits<{ started: [taskId: number] }>();
const open = ref(false); // A controlled open lets the toolbar's one menu run this when its own button
// does not fit.
const open = defineModel<boolean>("open", { default: false });
function started(taskId: number): void { function started(taskId: number): void {
open.value = false; open.value = false;
@@ -28,10 +29,12 @@ function started(taskId: number): void {
type="button" type="button"
size="sm" size="sm"
variant="outline" variant="outline"
class="max-sm:w-7 max-sm:px-0"
:aria-label="`${draft !== undefined ? 'Test' : 'Run'} ${workflow}`"
:disabled="disabled" :disabled="disabled"
:title="draft !== undefined ? 'Runs this draft once. Forge writes and pushes are skipped, including in called workflows; commands and tools still run' : disabled ? 'Save first' : undefined" :title="draft !== undefined ? 'Runs this draft once. Forge writes and pushes are skipped, including in called workflows; commands and tools still run' : disabled ? 'Save first' : undefined"
> >
<component :is="draft !== undefined ? FlaskConical : Play" data-icon="inline-start" /> {{ draft !== undefined ? "Test" : "Run" }}</Button> <component :is="draft !== undefined ? FlaskConical : Play" data-icon="inline-start" /> <span class="max-sm:hidden">{{ draft !== undefined ? "Test" : "Run" }}</span></Button>
</DialogTrigger> </DialogTrigger>
<DialogContent class="sm:max-w-[640px]"> <DialogContent class="sm:max-w-[640px]">
<DialogHeader> <DialogHeader>
+3 -1
View File
@@ -203,7 +203,9 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
</div> </div>
</section> </section>
<Button type="button" variant="ghost" size="xs" class="-ml-2 text-fg-muted" :aria-expanded="more" @click="more = !more"> <!-- Only the chevron moves: a filled trigger changed the row's weight and
read as a different control once open. -->
<Button type="button" variant="ghost" size="xs" class="-ml-2 text-fg-muted aria-expanded:bg-transparent" :aria-expanded="more" @click="more = !more">
<ChevronDown data-icon="inline-start" class="transition-transform" :class="!more && '-rotate-90'" />More <ChevronDown data-icon="inline-start" class="transition-transform" :class="!more && '-rotate-90'" />More
</Button> </Button>
+5 -1
View File
@@ -63,6 +63,9 @@ const badge = computed(() => {
return { icon: stepIcon(props.data.type), label: stepTitle(props.data.type) }; return { icon: stepIcon(props.data.type), label: stepTitle(props.data.type) };
}); });
const number = computed(() => (props.data.step ? `${Number(props.data.step)}.` : "")); const number = computed(() => (props.data.step ? `${Number(props.data.step)}.` : ""));
// A step with no id of its own is titled by its type, so the chip would repeat
// the line below it; the icon alone still names the type there.
const typeNamed = computed(() => props.data.title !== badge.value.label);
function duration(ms?: number): string { function duration(ms?: number): string {
if (ms === undefined) return ""; if (ms === undefined) return "";
@@ -104,7 +107,7 @@ function commitRename(event: Event): void {
<Handle id="data-in" type="target" :position="Position.Right" class="!opacity-0" /> <Handle id="data-in" type="target" :position="Position.Right" class="!opacity-0" />
<div class="px-3 py-2.5" @click="data.onToggle?.()"> <div class="px-3 py-2.5" @click="data.onToggle?.()">
<div class="flex items-center gap-1.5"> <div class="flex items-center gap-1.5">
<Badge variant="outline" class="max-w-40 gap-1 bg-background"> <Badge v-if="typeNamed" variant="outline" class="max-w-40 gap-1 bg-background">
<component :is="badge.icon" class="text-primary" aria-hidden="true" /><span class="truncate">{{ badge.label }}</span> <component :is="badge.icon" class="text-primary" aria-hidden="true" /><span class="truncate">{{ badge.label }}</span>
</Badge> </Badge>
<span v-if="data.run?.duration_ms !== undefined" class="ml-auto font-mono text-[11px] text-fg-subtle">{{ duration(data.run.duration_ms) }}</span> <span v-if="data.run?.duration_ms !== undefined" class="ml-auto font-mono text-[11px] text-fg-subtle">{{ duration(data.run.duration_ms) }}</span>
@@ -123,6 +126,7 @@ function commitRename(event: Event): void {
</DropdownMenu> </DropdownMenu>
</div> </div>
<div class="mt-1.5 flex min-w-0 items-baseline gap-1 text-sm font-medium"> <div class="mt-1.5 flex min-w-0 items-baseline gap-1 text-sm font-medium">
<component :is="badge.icon" v-if="!typeNamed" class="size-3.5 shrink-0 self-center text-primary" aria-hidden="true" />
<span v-if="number" class="shrink-0">{{ number }}</span> <span v-if="number" class="shrink-0">{{ number }}</span>
<Input <Input
v-if="renaming" v-if="renaming"
+74 -79
View File
@@ -9,14 +9,13 @@ import {
AlertDialogTitle, AlertDialogTitle,
} from "@/components/ui/alert-dialog"; } from "@/components/ui/alert-dialog";
import { computed, onBeforeUnmount, ref, watch } from "vue"; import { computed, onBeforeUnmount, ref, watch } from "vue";
import { ChevronDown, Ellipsis, RotateCcw, Trash2 } from "@lucide/vue"; import { CircleAlert, Ellipsis, RotateCcw, Trash2 } from "@lucide/vue";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { import {
DropdownMenu, DropdownMenu,
DropdownMenuContent, DropdownMenuContent,
DropdownMenuItem, DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger, DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"; } from "@/components/ui/dropdown-menu";
import { Spinner } from "@/components/ui/spinner"; import { Spinner } from "@/components/ui/spinner";
@@ -38,10 +37,10 @@ import { revisionOfRun, type WorkflowRevision } from "./workflow-revisions";
import { deleteStep, duplicateStep, insertStep, moveStep, replaceStep, revertWorkflowChange, stepAt, workflowChanges, workflowField, type StepPath } from "./workflow-edit"; import { deleteStep, duplicateStep, insertStep, moveStep, replaceStep, revertWorkflowChange, stepAt, workflowChanges, workflowField, type StepPath } from "./workflow-edit";
import ChangeList from "@/components/ChangeList.vue"; import ChangeList from "@/components/ChangeList.vue";
import CoBuilder from "./CoBuilder.vue"; import CoBuilder from "./CoBuilder.vue";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { useWorkflowRuns } from "./workflow-runs"; import { useWorkflowRuns } from "./workflow-runs";
import { useWorkflowTriggers } from "./workflow-triggers"; import { useWorkflowTriggers } from "./workflow-triggers";
import { cloneControlPlaneValue, useSettingsStore } from "@/stores/settings"; import { useSettingsStore } from "@/stores/settings";
import { import {
removeWorkflowDefinition, removeWorkflowDefinition,
upsertWorkflowDefinition, upsertWorkflowDefinition,
@@ -67,7 +66,6 @@ const modelAliases = computed(() =>
.sort(), .sort(),
); );
const collection = computed(() => workflows.collection); const collection = computed(() => workflows.collection);
const shipped = computed(() => workflows.shipped);
// Which definition is open belongs to the page, which also lists them. // Which definition is open belongs to the page, which also lists them.
const selected = defineModel<string>("selected", { required: true }); const selected = defineModel<string>("selected", { required: true });
defineProps<{ runsCount?: number }>(); defineProps<{ runsCount?: number }>();
@@ -159,10 +157,6 @@ function renameAt(path: StepPath, name: string): void {
yaml.value = replaceStep(yaml.value, path, { id: name || undefined, type, ...rest }); yaml.value = replaceStep(yaml.value, path, { id: name || undefined, type, ...rest });
} }
const shippedEntry = computed(() =>
shipped.value.definitions.find((entry) => entry.id === id.value),
);
function load(value: string): void { function load(value: string): void {
const entry = collection.value.definitions.find( const entry = collection.value.definitions.find(
(candidate) => candidate.id === value, (candidate) => candidate.id === value,
@@ -240,7 +234,8 @@ async function takeProposal(): Promise<void> {
unsaved = undefined; unsaved = undefined;
load(selected.value); load(selected.value);
} }
async function discard(): Promise<void> { // Back to the published definition: the draft is dropped, not merged.
async function restorePublished(): Promise<void> {
await dropDraft(selected.value); await dropDraft(selected.value);
load(selected.value); load(selected.value);
} }
@@ -274,6 +269,10 @@ async function publish(): Promise<void> {
} }
} }
// The run and draft dialogs are opened from the one toolbar menu when the row
// has no button for them; each block and its menu item drive one flag.
const runOpen = ref(false);
const draftOpen = ref(false);
const confirmDelete = ref(false); const confirmDelete = ref(false);
async function remove(): Promise<void> { async function remove(): Promise<void> {
if (!selected.value) return; if (!selected.value) return;
@@ -287,22 +286,6 @@ async function remove(): Promise<void> {
yaml.value = ""; yaml.value = "";
} }
async function restoreOne(): Promise<void> {
if (!shippedEntry.value) return;
// The restored definition replaces whatever draft was open.
if (
await save(
upsertWorkflowDefinition(
collection.value,
cloneControlPlaneValue(shippedEntry.value),
),
)
) {
await dropDraft(selected.value);
load(selected.value);
}
}
// What is typed, read against the served step vocabulary (workflow-yaml.ts). // What is typed, read against the served step vocabulary (workflow-yaml.ts).
// The Steps preview, the gutter and the validity indicator are three readings // The Steps preview, the gutter and the validity indicator are three readings
// of one parse, so they cannot disagree about the same text. Step settings are // of one parse, so they cannot disagree about the same text. Step settings are
@@ -339,9 +322,10 @@ const runOptions = computed(() => [
})), })),
]); ]);
const lines = computed(() => yamlLines(yaml.value)); const lines = computed(() => yamlLines(yaml.value));
// Below md the section tabs that do not fit beside Canvas and YAML are picked // The sections that sit beside Canvas and YAML once the editor has the width
// from one menu, which also names the section in view. // for them (the workflow list takes 24rem of it), and otherwise the one menu,
const OVERFLOW: Record<string, string> = { history: "History", performance: "Performance", runs: "Runs" }; // which names the section in view beside the tabs.
const SECTIONS: Record<string, string> = { history: "History", performance: "Performance", runs: "Runs" };
// The highlight layer sits behind the textarea and never scrolls by itself, so // The highlight layer sits behind the textarea and never scrolls by itself, so
// it follows the textarea's own scroll on both axes. // it follows the textarea's own scroll on both axes.
@@ -356,79 +340,80 @@ function syncScroll(event: Event): void {
<template> <template>
<form class="space-y-4" @submit.prevent="publish"> <form class="space-y-4" @submit.prevent="publish">
<Tabs v-model="view" class="space-y-1.5"> <Tabs v-model="view" class="space-y-1.5">
<div class="flex flex-wrap items-center gap-2"> <!--
<TabsList class="max-w-full justify-start"> Two rows at every width: the page header above names the workflow, and
this row is one toolbar. The tabs hold the views that fit, the run
selector and the actions share the right end, and everything else is in
the single menu beside Publish. Nothing wraps: the run selector gives up
width first.
-->
<div class="flex items-center gap-2">
<TabsList class="shrink-0 justify-start">
<TabsTrigger value="canvas">Canvas</TabsTrigger> <TabsTrigger value="canvas">Canvas</TabsTrigger>
<TabsTrigger value="yaml">YAML</TabsTrigger> <TabsTrigger value="yaml">YAML</TabsTrigger>
<TabsTrigger v-if="stored !== undefined" value="history" class="max-md:hidden">History</TabsTrigger> <TabsTrigger v-if="stored !== undefined" value="history" class="max-xl:hidden">History</TabsTrigger>
<TabsTrigger v-if="$slots.performance" value="performance" class="max-md:hidden">Performance</TabsTrigger> <TabsTrigger v-if="$slots.performance" value="performance" class="max-xl:hidden">Performance</TabsTrigger>
<TabsTrigger v-if="$slots.runs" value="runs" class="max-md:hidden">Runs <span class="ml-1 font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></TabsTrigger> <TabsTrigger v-if="$slots.runs" value="runs" class="max-xl:hidden">Runs <span class="ml-1 font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></TabsTrigger>
</TabsList> </TabsList>
<DropdownMenu> <span v-if="SECTIONS[view]" class="shrink-0 text-xs font-medium text-fg-muted xl:hidden">{{ SECTIONS[view] }}</span>
<DropdownMenuTrigger as-child> <div class="ml-auto flex min-w-0 items-center gap-1">
<Button type="button" variant="outline" size="sm" class="md:hidden" aria-label="More sections"> <div v-if="runs.length && view === 'canvas'" class="flex min-w-0 items-center gap-1">
{{ OVERFLOW[view] ?? "More" }}<ChevronDown data-icon="inline-end" /> <OptionSelect :model-value="watched" :options="runOptions" aria-label="Run shown on the canvas" class="min-w-0 max-w-24 sm:max-w-56" @update:model-value="pick" />
</Button> <template v-if="watchedRun">
</DropdownMenuTrigger> <Button as-child variant="ghost" size="sm" class="max-md:hidden"><RouterLink :to="`/tasks/${watchedRun.id}`">Open</RouterLink></Button>
<DropdownMenuContent align="start" class="w-40"> <Button v-if="watchedRevision" type="button" variant="ghost" size="sm" class="max-md:hidden font-mono text-xs" title="Open the version this run used" @click="openRevision(watchedRevision.version)">v{{ watchedRevision.version }}</Button>
<DropdownMenuItem v-if="stored !== undefined" @select="view = 'history'">History</DropdownMenuItem> <!-- One run control keeps the row short; the run's other actions
<DropdownMenuItem v-if="$slots.performance" @select="view = 'performance'">Performance</DropdownMenuItem> are on the run, one Open away. -->
<DropdownMenuItem v-if="$slots.runs" @select="view = 'runs'">Runs <span class="ml-auto font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></DropdownMenuItem> <TaskRowActions :task="watchedRun" :only="watchedRun.actions?.slice(0, 1)" class="max-md:hidden" @done="refresh" />
</DropdownMenuContent> </template>
</DropdownMenu> </div>
<div v-if="runs.length && view === 'canvas'" class="flex min-w-0 items-center gap-1"> <span v-if="!parsed.ok" class="hidden max-w-md truncate text-xs text-danger sm:block" role="status" :title="validationLabel(parsed)">{{ validationLabel(parsed) }}</span>
<OptionSelect :model-value="watched" :options="runOptions" aria-label="Run shown on the canvas" class="min-w-0 max-w-64" @update:model-value="pick" /> <span v-if="!parsed.ok" class="sm:hidden" role="status" :title="validationLabel(parsed)">
<template v-if="watchedRun"> <CircleAlert class="size-4 text-danger" aria-hidden="true" /><span class="sr-only">{{ validationLabel(parsed) }}</span>
<RouterLink :to="`/tasks/${watchedRun.id}`" class="shrink-0 px-1 text-xs text-fg-muted hover:text-foreground hover:underline">Open</RouterLink>
<button v-if="watchedRevision" type="button" class="shrink-0 px-1 font-mono text-xs text-fg-muted hover:text-foreground hover:underline" title="Open the version this run used" @click="openRevision(watchedRevision.version)">v{{ watchedRevision.version }}</button>
<TaskRowActions :task="watchedRun" class="shrink-0" @done="refresh" />
</template>
</div>
<template v-if="view === 'canvas' || view === 'yaml'">
<div class="ml-auto flex flex-wrap items-center justify-end gap-2">
<span v-if="!parsed.ok" class="max-w-md truncate text-xs text-danger" role="status" :title="validationLabel(parsed)">
{{ validationLabel(parsed) }}
</span> </span>
<Popover v-else-if="dirty"> <!-- The dialog is teleported, so hiding this wrapper below sm hides the
<PopoverTrigger as-child> trigger only and leaves the one dialog reachable from the menu. -->
<Button type="button" variant="ghost" size="sm" class="text-xs text-fg-subtle"> <div v-if="stored !== undefined && (view === 'canvas' || view === 'yaml')" class="max-sm:hidden">
Draft · {{ changes.length }} {{ changes.length === 1 ? "change" : "changes" }}</Button> <RunWorkflowButton
</PopoverTrigger> v-model:open="runOpen"
<PopoverContent align="end" class="max-h-96 w-96 overflow-y-auto p-0"> :workflow="selected"
<ChangeList :changes="changes" @revert="(change) => (yaml = revertWorkflowChange(yaml, change))" /> :draft="dirty ? yaml : undefined"
</PopoverContent> :disabled="!parsed.ok"
</Popover> @started="(id) => { view = 'canvas'; void follow(id); }"
/>
</div>
<DropdownMenu> <DropdownMenu>
<DropdownMenuTrigger as-child> <DropdownMenuTrigger as-child>
<Button type="button" variant="ghost" size="icon-sm" aria-label="More"><Ellipsis /></Button> <Button type="button" variant="ghost" size="icon-sm" aria-label="More"><Ellipsis /></Button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent align="end" class="w-48"> <DropdownMenuContent align="end" class="w-48">
<DropdownMenuItem v-if="dirty" :disabled="archieWorking" @select="discard"><RotateCcw />Discard draft</DropdownMenuItem> <DropdownMenuItem v-if="stored !== undefined" class="xl:hidden" @select="view = 'history'">History</DropdownMenuItem>
<DropdownMenuItem v-if="shippedEntry" @select="restoreOne"><RotateCcw />Restore default</DropdownMenuItem> <DropdownMenuItem v-if="$slots.performance" class="xl:hidden" @select="view = 'performance'">Performance</DropdownMenuItem>
<DropdownMenuSeparator v-if="dirty || shippedEntry" /> <DropdownMenuItem v-if="$slots.runs" class="xl:hidden" @select="view = 'runs'">Runs <span class="ml-auto font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></DropdownMenuItem>
<DropdownMenuItem variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem> <DropdownMenuItem v-if="watchedRun" as-child class="md:hidden"><RouterLink :to="`/tasks/${watchedRun.id}`">Open run</RouterLink></DropdownMenuItem>
<DropdownMenuItem v-if="watchedRevision" class="md:hidden" @select="openRevision(watchedRevision.version)">Version {{ watchedRevision.version }}</DropdownMenuItem>
<DropdownMenuItem v-if="stored !== undefined && (view === 'canvas' || view === 'yaml')" class="sm:hidden" :disabled="!parsed.ok" @select="runOpen = true">{{ dirty ? "Test" : "Run" }}</DropdownMenuItem>
<DropdownMenuItem v-if="dirty" @select="draftOpen = true">Draft changes <span class="ml-auto font-mono text-xs text-fg-subtle">{{ changes.length }}</span></DropdownMenuItem>
<DropdownMenuItem v-if="dirty" :disabled="archieWorking" @select="restorePublished"><RotateCcw />Restore</DropdownMenuItem>
<DropdownMenuItem v-if="view === 'canvas' || view === 'yaml'" variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem>
</DropdownMenuContent> </DropdownMenuContent>
</DropdownMenu> </DropdownMenu>
<RunWorkflowButton v-if="stored !== undefined" :workflow="selected" :draft="yaml" :disabled="!parsed.ok" @started="(id) => { view = 'canvas'; void follow(id); }" /> <Button v-if="view === 'canvas' || view === 'yaml'" type="submit" size="sm" :disabled="state.saving || !parsed.ok || !dirty || archieWorking">
<RunWorkflowButton v-if="stored !== undefined" :workflow="selected" :disabled="dirty" @started="(id) => { view = 'canvas'; void follow(id); }" />
<Button type="submit" size="sm" :disabled="state.saving || !parsed.ok || !dirty || archieWorking">
<Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button> <Spinner v-if="state.saving" data-icon="inline-start" />Publish</Button>
</div> </div>
</template>
</div> </div>
<p v-if="runsLoading && !runs.length" class="text-xs text-fg-muted" role="status">Loading recent runs…</p> <p v-if="runsLoading && !runs.length" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>
<div v-else-if="runsError" class="text-sm text-danger" role="alert"> <div v-else-if="runsError" class="text-sm text-danger" role="alert">
<p>Could not load recent runs: {{ runsError }}</p> <p>Could not load recent runs: {{ runsError }}</p>
<Button type="button" variant="outline" size="sm" @click="refresh">Retry runs</Button> <Button type="button" variant="outline" size="sm" @click="refresh">Retry runs</Button>
</div> </div>
<p v-if="watchedRun && !watchedRun.workflow_definition_yaml" class="text-xs text-fg-muted" role="status">No workflow snapshot was recorded for this run.</p> <p v-if="view === 'canvas' && watchedRun && !watchedRun.workflow_definition_yaml" class="text-xs text-fg-muted" role="status">No workflow snapshot was recorded for this run.</p>
<!-- Kept mounted so an Archie turn started here still finishes, unlocks the <!-- Kept mounted so an Archie turn started here still finishes, unlocks the
editor and loads its draft when the operator switches tabs. --> editor and loads its draft when the operator switches tabs. -->
<TabsContent value="canvas" force-mount class="space-y-2 data-[state=inactive]:hidden"> <TabsContent value="canvas" force-mount class="space-y-2 data-[state=inactive]:hidden">
<!-- The canvas takes the height the viewport has left, so the page <!-- The canvas takes the height the viewport has left, so the page
itself does not scroll; the canvas pans. A phone stacks more chrome itself does not scroll; the canvas pans. A phone stacks the run
above it (the workflow list, a two-row toolbar and the run picker), selector over the step tooling, hence the larger offset below md. -->
hence the larger offset below md. -->
<div class="relative flex h-[calc(100dvh-17rem)] min-h-[26rem] flex-col max-md:h-[calc(100dvh-22rem)] max-md:min-h-[23rem]"> <div class="relative flex h-[calc(100dvh-17rem)] min-h-[26rem] flex-col max-md:h-[calc(100dvh-22rem)] max-md:min-h-[23rem]">
<p v-if="restartError" role="alert" class="absolute bottom-16 left-14 z-10 max-w-xl rounded-md border border-danger/40 bg-card px-3 py-2 text-sm text-danger shadow-lg">{{ restartError }}</p> <p v-if="restartError" role="alert" class="absolute bottom-16 left-14 z-10 max-w-xl rounded-md border border-danger/40 bg-card px-3 py-2 text-sm text-danger shadow-lg">{{ restartError }}</p>
<WorkflowCanvas <WorkflowCanvas
@@ -552,6 +537,16 @@ function syncScroll(event: Event): void {
<p v-if="localError || state.error" class="text-sm text-danger" role="alert"> <p v-if="localError || state.error" class="text-sm text-danger" role="alert">
{{ localError || state.error }} {{ localError || state.error }}
</p> </p>
<Dialog v-model:open="draftOpen">
<DialogContent class="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Draft changes</DialogTitle>
</DialogHeader>
<div class="max-h-96 overflow-y-auto rounded-md border border-border">
<ChangeList :changes="changes" @revert="(change) => (yaml = revertWorkflowChange(yaml, change))" />
</div>
</DialogContent>
</Dialog>
<AlertDialog v-model:open="confirmDelete"> <AlertDialog v-model:open="confirmDelete">
<AlertDialogContent> <AlertDialogContent>
<AlertDialogHeader> <AlertDialogHeader>
+2 -2
View File
@@ -1,13 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
defineProps<{ value: string; workflows: { id: string }[]; label: string }>(); defineProps<{ value: string; workflows: { id: string }[]; label: string; class?: string }>();
const emit = defineEmits<{ pick: [string] }>(); const emit = defineEmits<{ pick: [string] }>();
</script> </script>
<template> <template>
<Select :model-value="value || undefined" @update:model-value="emit('pick', String($event))"> <Select :model-value="value || undefined" @update:model-value="emit('pick', String($event))">
<SelectTrigger :aria-label="label"><SelectValue placeholder="Choose workflow" /></SelectTrigger> <SelectTrigger :aria-label="label" :class="$props.class"><SelectValue placeholder="Choose workflow" /></SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem v-if="value && !workflows.some((entry) => entry.id === value)" :value="value" disabled>{{ value }} (unavailable)</SelectItem> <SelectItem v-if="value && !workflows.some((entry) => entry.id === value)" :value="value" disabled>{{ value }} (unavailable)</SelectItem>
<SelectItem v-for="entry in workflows" :key="entry.id" :value="entry.id">{{ entry.id }}</SelectItem> <SelectItem v-for="entry in workflows" :key="entry.id" :value="entry.id">{{ entry.id }}</SelectItem>
+7 -7
View File
@@ -212,13 +212,13 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
</Empty> </Empty>
</section> </section>
<section v-else-if="selected && store.state.resource" class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5" aria-label="Workflow"> <section v-else-if="selected && store.state.resource" class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5" aria-label="Workflow">
<header class="mb-2 flex flex-wrap items-center gap-2"> <header class="mb-2 flex items-center gap-2">
<!-- Below lg the list is gone: this picks the workflow instead. --> <!-- Below lg the list is gone: this picks the workflow instead. -->
<div class="lg:hidden"><WorkflowPicker :value="selected" :workflows="rows" label="Workflow" @pick="selected = $event" /></div> <div class="min-w-0 flex-1 lg:hidden"><WorkflowPicker class="w-full" :value="selected" :workflows="rows" label="Workflow" @pick="selected = $event" /></div>
<h2 class="font-mono text-[15px] font-medium max-lg:hidden">{{ selected }}</h2> <h2 class="min-w-0 truncate font-mono text-[15px] font-medium max-lg:hidden">{{ selected }}</h2>
<Badge v-if="provenance" variant="outline">{{ provenance }}</Badge> <Badge v-if="provenance" variant="outline" class="shrink-0">{{ provenance }}</Badge>
<Badge v-if="drafted" variant="outline" class="lg:hidden">Draft</Badge> <Badge v-if="drafted" variant="outline" class="shrink-0 lg:hidden">Draft</Badge>
<div class="ml-auto flex items-center gap-3"> <div class="ml-auto flex shrink-0 items-center gap-3">
<ApplyStatusRows kind="workflow-definitions" compact /> <ApplyStatusRows kind="workflow-definitions" compact />
<Switch v-if="enabled !== undefined" :model-value="enabled" aria-label="Workflow enabled" @update:model-value="setEnabled" /> <Switch v-if="enabled !== undefined" :model-value="enabled" aria-label="Workflow enabled" @update:model-value="setEnabled" />
</div> </div>
@@ -249,7 +249,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
<ul v-else class="divide-y divide-border"> <ul v-else class="divide-y divide-border">
<li v-for="t in workflowRuns" :key="t.id" class="flex items-center gap-3 py-2 text-sm"> <li v-for="t in workflowRuns" :key="t.id" class="flex items-center gap-3 py-2 text-sm">
<RouterLink :to="`/tasks/${t.id}`" class="min-w-0 flex-1 truncate hover:underline">{{ t.title || `Task ${t.id}` }}</RouterLink> <RouterLink :to="`/tasks/${t.id}`" class="min-w-0 flex-1 truncate hover:underline">{{ t.title || `Task ${t.id}` }}</RouterLink>
<span class="font-mono text-xs text-fg-subtle">{{ t.owner && t.repo ? `${t.owner}/${t.repo} #${t.issue_number}` : "" }}</span> <span class="hidden font-mono text-xs text-fg-subtle sm:block">{{ t.owner && t.repo ? `${t.owner}/${t.repo} #${t.issue_number}` : "" }}</span>
<Badge :variant="statusKind(t.status ?? '')">{{ statusLabel(t.status ?? "") }}</Badge> <Badge :variant="statusKind(t.status ?? '')">{{ statusLabel(t.status ?? "") }}</Badge>
</li> </li>
</ul> </ul>