fix(ui/topbar): replace Jump to with a command palette, drop filler chrome (#1650)

* fix(ui/topbar): replace Jump to with a command palette, drop filler chrome

Jump to opens a shadcn-vue Command dialog that finds pages, tasks and
workflows by name. The connection indicator shows only when the stream is
lost, the dead documentation link is gone, and the profile menu label has
no stray whitespace.

* fix(ui): trim stray whitespace from template text and drop em dashes from copy

Element text that started or ended with a line break rendered with leading
and trailing spaces. Also removes the unused 'soon' nav state and the nav
group components no route reaches.

* fix(ui): drop the space a hidden spinner left before button text

* fix(ui/status): one dense Status page, full-width settings, problems-only apply status

Status drops its tabs and the duplicate health card; services list only
what is wrong. Settings pages use the full width, the resizable sidebar
handle is gone, and apply status shows only processes that have not
applied a change. PageHeader puts the title and actions on one line.

* refactor(ui): use shadcn ToggleGroup and Badge, drop SegmentedControl and StatusPill

Status badges show only when a state needs attention: no Running, Enabled,
Active, Listening or live pills next to healthy rows. Removes the unused
pagination, radio-group and scroll-area components.

* fix(ui/history): use the shadcn Table with fixed columns so nothing is clipped

* fix(ui/workflows): apply ?workflow= only once the workflow is listed

Selecting it before the definitions loaded opened an empty canvas.

* refactor(ui/workflows): use shadcn Input, NativeSelect, Checkbox and Button in editors

Replaces hand-rolled inputs, selects, the repository mode switch and icon
buttons in the workflow editor, bind dialog, harness page, sources panel
and review gate. Adds the upstream shadcn-vue NativeSelect.

* style(ui): rounded-rectangle controls instead of pills

Halves the radius scale so inputs, selects and buttons stop reading as
pills, and badges and chips lose their full rounding.

* fix(ui/alerts): centre the bell's failed state and stop it contradicting Needs you

* fix(ui/tasks): one header line, aligned columns, no placeholder issue numbers

Tasks puts its filters beside the title and drops the stat tiles the
dashboard already shows. Sort headers align with their cells, chat tasks
no longer show their synthetic issue number, and Logs and the task
not-found page use the shared header.

* fix(ui/dashboard): shared header and cards, empty cards stay silent

Needs you uses the shadcn Card and drops its duplicate Open button; quality
gates and token outlook render only when there is something to show; the
throughput strip moves into the dashboard, its only user.

* refactor(ui/stores): one Pinia store per feature

Splits the site-wide control-plane store and the module-level refs into
settings, workflows, tasks, events, org and session stores. Identity
requests move into lib/api. Drops store fields nothing read: per-resource
stream state, the states map and loadApplyStatus.

* fix(ui/org): one header for the org area, sections drop their repeated titles

The org name is the page title with the admin's org switcher and New org
beside it; Members and Workspaces tables sit in cards like other pages.

* fix(ui/events): shadcn Tabs for the capture, map and bind steps

Replaces the numbered step strip with line tabs that carry each step's
count; the Listening pill is gone and Capture off shows only when it is.

* fix(ui/workflows): confirm a workflow delete in an AlertDialog, not window.confirm

* style(ui/settings): denser setting rows
This commit is contained in:
sam authored and GitHub committed 2026-10-12 04:40:21 +11:00
1 parent 94d2f98cc0
commit 3bf64933b0
209 files changed
+2158 -3175

No files matched your search

+7 -5
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { Plus } from "@lucide/vue";
import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
@@ -11,14 +12,15 @@ const emit = defineEmits<{ pick: [string] }>();
<template>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<button
type="button"
class="nodrag nopan flex size-6 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm transition-colors hover:border-primary hover:text-primary"
<Button
variant="outline"
size="icon-xs"
class="nodrag nopan bg-card"
:aria-label="label ?? 'Add a step here'"
:title="label ?? 'Add a step here'"
>
<Plus class="size-3.5" />
</button>
<Plus />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent class="w-52" align="center">
<DropdownMenuLabel>{{ label ?? "Add a step here" }}</DropdownMenuLabel>
+25 -21
View File
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { Input } from "@/components/ui/input";
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
import { computed, onMounted, ref, watch } from "vue";
import { ArrowLeft, Braces, Type } from "@lucide/vue";
@@ -6,7 +8,7 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api";
import { useLiveResource } from "@/stores/live-updates";
import { useLiveResource } from "@/stores/session";
import { statusKind, statusLabel, takesRepository, type Binding } from "@/bindings/binding-draft";
import type { Capture } from "@/captures/state";
import SourceSecret from "@/sources/SourceSecret.vue";
@@ -236,17 +238,17 @@ const resume = () => transition(api.bindingResume, "pending_approval");
<form v-else class="flex-1 space-y-5 overflow-y-auto px-4 py-4" @submit.prevent="save">
<section class="space-y-1.5">
<label for="bind-source" class="text-xs font-medium text-muted-foreground">Source</label>
<select id="bind-source" v-model="source" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]" :disabled="!!binding">
<option value="" disabled>Pick a source</option>
<option v-for="path in sources" :key="path" :value="path">{{ sourceNames[path] ? `${sourceNames[path]} (${path})` : path }}</option>
<option :value="NEW_SOURCE">New source…</option>
</select>
<input
<NativeSelect size="sm" id="bind-source" v-model="source" class="w-full" :disabled="!!binding">
<NativeSelectOption value="" disabled>Pick a source</NativeSelectOption>
<NativeSelectOption v-for="path in sources" :key="path" :value="path">{{ sourceNames[path] ? `${sourceNames[path]} (${path})` : path }}</NativeSelectOption>
<NativeSelectOption :value="NEW_SOURCE">New source…</NativeSelectOption>
</NativeSelect>
<Input
v-if="source === NEW_SOURCE"
v-model="newSource"
aria-label="New source path"
placeholder="path, e.g. alertmanager"
class="h-8 w-full rounded-md border border-input bg-background px-2 font-mono text-[13px]"
class="h-8 w-full font-mono text-[13px]"
/>
<Button v-if="source === NEW_SOURCE" type="button" size="sm" :disabled="creatingSource || !sourcePath" @click="createSource"><Spinner v-if="creatingSource" />Create source</Button>
</section>
@@ -255,9 +257,9 @@ const resume = () => transition(api.bindingResume, "pending_approval");
<section v-if="sourcePath" class="space-y-1.5">
<label for="bind-capture" class="text-xs font-medium text-muted-foreground">Example event</label>
<select v-if="sourceCaptures.length" id="bind-capture" v-model="captureId" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]">
<option v-for="c in sourceCaptures" :key="c.id" :value="c.id">#{{ c.id }} · {{ when(c.received_at) }}{{ c.event_type ? "" : " · unidentified" }}</option>
</select>
<NativeSelect size="sm" v-if="sourceCaptures.length" id="bind-capture" v-model="captureId" class="w-full">
<NativeSelectOption v-for="c in sourceCaptures" :key="c.id" :value="c.id">#{{ c.id }} · {{ when(c.received_at) }}{{ c.event_type ? "" : " · unidentified" }}</NativeSelectOption>
</NativeSelect>
<p v-else class="text-xs text-fg-subtle" :title="`Send an event to ${hookURL} and it appears here`">Waiting for the first event</p>
</section>
@@ -270,42 +272,44 @@ const resume = () => transition(api.bindingResume, "pending_approval");
<span class="font-mono">{{ name }}</span>
<span class="text-fg-subtle">{{ spec.type ?? "string" }}</span>
<span v-if="spec.required" class="text-danger" title="Required">*</span>
<button
<Button
type="button"
class="ml-auto text-muted-foreground hover:text-foreground"
variant="ghost"
size="icon-xs"
class="ml-auto"
:title="rows[name]!.from === 'path' ? 'Use a fixed value' : 'Read from the event'"
:aria-label="`${name}: ${rows[name]!.from === 'path' ? 'use a fixed value' : 'read from the event'}`"
@click="rows[name]!.from = rows[name]!.from === 'path' ? 'value' : 'path'"
>
<Type v-if="rows[name]!.from === 'path'" class="size-3.5" /><Braces v-else class="size-3.5" />
</button>
<Type v-if="rows[name]!.from === 'path'" /><Braces v-else />
</Button>
</div>
<input
<Input
v-if="rows[name]!.from === 'path'"
v-model="rows[name]!.path"
list="bind-paths"
:aria-label="`${name} payload path`"
placeholder="payload path"
class="h-7 w-full rounded-md border border-input bg-background px-2 font-mono text-xs"
class="h-7 w-full font-mono text-xs"
/>
<input
<Input
v-else
v-model="rows[name]!.value"
:aria-label="`${name} fixed value`"
placeholder="fixed value"
class="h-7 w-full rounded-md border border-input bg-background px-2 font-mono text-xs"
class="h-7 w-full font-mono text-xs"
/>
<p v-if="rows[name]!.from === 'path' && resolved(name).failure" class="text-xs text-danger">{{ resolved(name).failure }}</p>
<p v-else-if="rows[name]!.from === 'path' && resolved(name).value !== undefined" class="truncate font-mono text-xs text-success" :title="resolved(name).value">{{ resolved(name).value }}</p>
</div>
<div v-if="repository" class="space-y-1 px-3 py-2">
<div class="text-xs" title="Optional: owner/name of a configured repository; blank uses the configured one">Repository</div>
<input
<Input
v-model="repositoryPath"
list="bind-paths"
aria-label="Repository payload path"
placeholder="payload path"
class="h-7 w-full rounded-md border border-input bg-background px-2 font-mono text-xs"
class="h-7 w-full font-mono text-xs"
/>
<p v-if="resolved(REPOSITORY_FIELD).failure" class="text-xs text-danger">{{ resolved(REPOSITORY_FIELD).failure }}</p>
<p v-else-if="resolved(REPOSITORY_FIELD).value !== undefined" class="truncate font-mono text-xs text-success">{{ resolved(REPOSITORY_FIELD).value }}</p>
+1 -2
View File
@@ -20,8 +20,7 @@ function started(taskId: number): void {
<Dialog v-model:open="open">
<DialogTrigger as-child>
<Button type="button" size="sm" variant="outline" :disabled="disabled" :title="disabled ? 'Save your changes first' : undefined">
<Play data-icon="inline-start" /> Run
</Button>
<Play data-icon="inline-start" /> Run</Button>
</DialogTrigger>
<DialogContent class="sm:max-w-[640px]">
<DialogHeader>
+62 -61
View File
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
import { computed, ref } from "vue";
import { CircleHelp, Plus, Trash2, X } from "@lucide/vue";
import { parse, stringify } from "yaml";
@@ -10,7 +11,7 @@ import { Switch } from "@/components/ui/switch";
import { Textarea } from "@/components/ui/textarea";
import { stepIcon } from "./step-icons";
import { addBranch, branchingOf, deleteBranch, renameBranch, earlierStepIDs, replaceStep, stepAt, workflowField, type StepPath, type StepRecord } from "./workflow-edit";
import type { WorkflowDefinitionEntry } from "@/stores/control-plane";
import type { WorkflowDefinitionEntry } from "@/stores/workflows";
import type { InputSpec } from "./bind-event";
import { inputValue } from "./work-request";
import WorkflowPicker from "./WorkflowPicker.vue";
@@ -151,12 +152,12 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<component :is="stepIcon(type)" class="size-4" />
</span>
<div class="min-w-0 flex-1">
<input
:value="(step.id as string) ?? ''"
class="w-full truncate bg-transparent text-sm font-medium outline-none placeholder:text-fg-subtle focus:underline"
<Input
:model-value="(step.id as string) ?? ''"
class="h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent"
:placeholder="stepTitle(type)"
aria-label="Step id"
@input="setField('id', ($event.target as HTMLInputElement).value)"
@update:model-value="(value) => setField('id', String(value))"
/>
<div class="truncate font-mono text-[11px] text-fg-subtle">{{ type }}</div>
</div>
@@ -192,15 +193,15 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<CircleHelp v-if="fields.lead.schema.description" class="size-3 text-fg-subtle" />
</div>
<WorkflowPicker v-if="fields.lead.kind === 'workflow'" :value="text(fields.lead.key)" :workflows="workflows" :label="label(fields.lead.key, fields.lead.schema)" @pick="setTarget(fields.lead.key, $event)" />
<select
v-else-if="fields.lead.kind === 'select'"
class="h-9 w-full rounded-md border border-input bg-background px-2"
:value="text(fields.lead.key)"
@change="setSetting(fields.lead.key, ($event.target as HTMLSelectElement).value || undefined)"
<NativeSelect
size="sm"
v-else-if="fields.lead.kind === 'select'" class="w-full"
:model-value="text(fields.lead.key)"
@update:model-value="(value) => setSetting(fields.lead.key, String(value) || undefined)"
>
<option value="">Default</option>
<option v-for="option in fields.lead.options" :key="option" :value="option">{{ option }}</option>
</select>
<NativeSelectOption value="">Default</NativeSelectOption>
<NativeSelectOption v-for="option in fields.lead.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
</NativeSelect>
<Textarea
v-else-if="fields.lead.kind === 'text'"
:model-value="text(fields.lead.key)"
@@ -217,8 +218,8 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
<span class="text-[11px] text-fg-subtle">Insert</span>
<template v-for="id in earlier" :key="id">
<button type="button" class="rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary" @click="reference(id, 'summary')">{{ id }}</button>
<button type="button" class="rounded-full border border-border px-2 py-0.5 font-mono text-[11px] hover:border-primary hover:text-primary" @click="reference(id, 'result')">{{ id }}.result</button>
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
</template>
</div>
</section>
@@ -235,28 +236,28 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
:model-value="settings[field.key] === true"
@update:model-value="setSetting(field.key, $event || undefined)"
/>
<select
v-else-if="field.kind === 'select'"
class="h-7 max-w-40 rounded-md border border-input bg-background px-1.5 text-[13px]"
:value="text(field.key)"
@change="setSetting(field.key, ($event.target as HTMLSelectElement).value || undefined)"
<NativeSelect
size="sm"
v-else-if="field.kind === 'select'" class="max-w-40"
:model-value="text(field.key)"
@update:model-value="(value) => setSetting(field.key, String(value) || undefined)"
>
<option value="">Default</option>
<option v-for="option in field.options" :key="option" :value="option">{{ option }}</option>
</select>
<input
<NativeSelectOption value="">Default</NativeSelectOption>
<NativeSelectOption v-for="option in field.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
</NativeSelect>
<Input
v-else-if="field.kind === 'number'"
type="number"
class="h-7 w-24 rounded-md border border-input bg-background px-2 text-right text-[13px]"
:value="settings[field.key] ?? ''"
@input="setSetting(field.key, ($event.target as HTMLInputElement).value === '' ? undefined : Number(($event.target as HTMLInputElement).value))"
class="h-7 w-24 text-right text-[13px]"
:model-value="(settings[field.key] as number | undefined) ?? ''"
@update:model-value="(value) => setSetting(field.key, String(value) === '' ? undefined : Number(String(value)))"
/>
<input
<Input
v-else
class="h-7 w-40 rounded-md border border-input bg-background px-2 text-[13px]"
:value="text(field.key)"
class="h-7 w-40 text-[13px]"
:model-value="text(field.key)"
@focus="focused = field.key"
@input="setSetting(field.key, ($event.target as HTMLInputElement).value)"
@update:model-value="(value) => setSetting(field.key, String(value))"
/>
</div>
</section>
@@ -266,17 +267,17 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<div class="text-xs font-medium text-muted-foreground">Inputs</div>
<div v-for="[name, spec] in callInputs" :key="name" class="space-y-1.5">
<div class="text-[13px]">{{ name }}<span v-if="spec.required" class="text-danger"> *</span><span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<select :aria-label="`${name} source`" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]" :value="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '') ? 'input' : 'value'" @change="setCallInput(name, ($event.target as HTMLSelectElement).value === 'input' ? 'inputs.' : '')">
<option v-if="!['object', 'array'].includes(spec.type ?? '')" value="value">Value</option>
<option value="input">Caller input</option>
</select>
<select v-if="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '')" :aria-label="name" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]" :value="inputText(name)" @change="setCallInput(name, ($event.target as HTMLSelectElement).value)">
<option value="">Choose input</option>
<option v-for="[key] in callerInputs.filter(([, input]) => input.type === spec.type || input.type === 'any' || spec.type === 'any')" :key="key" :value="`inputs.${key}`">{{ key }}</option>
</select>
<select v-else-if="spec.type === 'bool'" :aria-label="name" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]" :value="inputText(name)" @change="setCallInput(name, ($event.target as HTMLSelectElement).value, spec.type)">
<option value="">Unset</option><option value="true">True</option><option value="false">False</option>
</select>
<NativeSelect size="sm" :aria-label="`${name} source`" class="w-full" :model-value="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '') ? 'input' : 'value'" @update:model-value="(value) => setCallInput(name, String(value) === 'input' ? 'inputs.' : '')">
<NativeSelectOption v-if="!['object', 'array'].includes(spec.type ?? '')" value="value">Value</NativeSelectOption>
<NativeSelectOption value="input">Caller input</NativeSelectOption>
</NativeSelect>
<NativeSelect size="sm" v-if="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '')" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value))">
<NativeSelectOption value="">Choose input</NativeSelectOption>
<NativeSelectOption v-for="[key] in callerInputs.filter(([, input]) => input.type === spec.type || input.type === 'any' || spec.type === 'any')" :key="key" :value="`inputs.${key}`">{{ key }}</NativeSelectOption>
</NativeSelect>
<NativeSelect size="sm" v-else-if="spec.type === 'bool'" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value), spec.type)">
<NativeSelectOption value="">Unset</NativeSelectOption><NativeSelectOption value="true">True</NativeSelectOption><NativeSelectOption value="false">False</NativeSelectOption>
</NativeSelect>
<Input v-else :aria-label="name" :type="spec.type === 'number' ? 'number' : 'text'" step="any" :model-value="inputText(name)" @update:model-value="setCallInput(name, String($event), spec.type)" />
</div>
</section>
@@ -284,10 +285,10 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<div class="text-xs font-medium text-muted-foreground">Outputs</div>
<div v-for="[name, spec] in callOutputs" :key="name" class="space-y-1.5">
<div class="text-[13px]">{{ name }}<span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
<select :aria-label="`${name} output`" :disabled="settings.wait !== true" class="h-8 w-full rounded-md border border-input bg-background px-2 text-[13px]" :value="outputMap[name] ?? ''" @change="setSetting('outputs', { ...outputMap, [name]: ($event.target as HTMLSelectElement).value || undefined })">
<option value="">Do not publish</option>
<option v-for="[key] in callerOutputs.filter(([, output]) => output.type === spec.type || spec.type === 'any' || output.type === 'any')" :key="key" :value="`outputs.${key}`">{{ key }}</option>
</select>
<NativeSelect size="sm" :aria-label="`${name} output`" :disabled="settings.wait !== true" class="w-full" :model-value="outputMap[name] ?? ''" @update:model-value="(value) => setSetting('outputs', { ...outputMap, [name]: String(value) || undefined })">
<NativeSelectOption value="">Do not publish</NativeSelectOption>
<NativeSelectOption v-for="[key] in callerOutputs.filter(([, output]) => output.type === spec.type || spec.type === 'any' || output.type === 'any')" :key="key" :value="`outputs.${key}`">{{ key }}</NativeSelectOption>
</NativeSelect>
</div>
</section>
</template>
@@ -327,34 +328,34 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<div class="divide-y divide-border rounded-md border border-border">
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Run only when</span>
<input
class="h-7 w-48 rounded-md border border-input bg-background px-2 font-mono text-xs"
<Input
class="h-7 w-48 font-mono text-xs"
placeholder="always"
:value="(step.when as string) ?? ''"
@input="setField('when', ($event.target as HTMLInputElement).value)"
:model-value="(step.when as string) ?? ''"
@update:model-value="(value) => setField('when', String(value))"
/>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">If it fails</span>
<select
class="h-7 rounded-md border border-input bg-background px-1.5 text-[13px]"
:value="(step.on_failure as string) ?? ''"
@change="setField('on_failure', ($event.target as HTMLSelectElement).value || undefined)"
<NativeSelect
size="sm"
:model-value="(step.on_failure as string) ?? ''"
@update:model-value="(value) => setField('on_failure', String(value) || undefined)"
>
<option value="">Park the task</option>
<option value="continue">Continue</option>
</select>
<NativeSelectOption value="">Park the task</NativeSelectOption>
<NativeSelectOption value="continue">Continue</NativeSelectOption>
</NativeSelect>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Attempts</span>
<input
<Input
type="number"
min="1"
max="10"
placeholder="1"
class="h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]"
:value="(step.retry as { attempts?: number } | undefined)?.attempts ?? ''"
@input="setRetry({ attempts: ($event.target as HTMLInputElement).value === '' ? undefined : Number(($event.target as HTMLInputElement).value) })"
class="h-7 w-20 text-right text-[13px]"
:model-value="(step.retry as { attempts?: number } | undefined)?.attempts ?? ''"
@update:model-value="(value) => setRetry({ attempts: String(value) === '' ? undefined : Number(String(value)) })"
/>
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
+1 -2
View File
@@ -77,8 +77,7 @@ function duration(ms?: number): string {
<Repeat class="size-3" aria-hidden="true" />×{{ data.retry }}
</span>
<span v-if="data.continues" class="flex items-center gap-0.5 rounded bg-secondary px-1" title="A failure does not stop the run">
<SkipForward class="size-3" aria-hidden="true" />continues
</span>
<SkipForward class="size-3" aria-hidden="true" />continues</span>
</div>
<div
v-if="data.run"
+3 -2
View File
@@ -1,7 +1,8 @@
<script setup lang="ts">
import { Button } from "@/components/ui/button";
import { computed, onUnmounted, ref, watch } from "vue";
import { api } from "@/lib/api";
import { useLiveResource } from "@/stores/live-updates";
import { useLiveResource } from "@/stores/session";
import { Badge } from "@/components/ui/badge";
import ChangeCapture from "@/tasks/ChangeCapture.vue";
import TaskLogs from "@/tasks/TaskLogs.vue";
@@ -122,7 +123,7 @@ const scopedLogs = computed(() => logs.value ? { ...logs.value, entries: (logs.v
<p v-if="tool.detail" class="mt-1 break-words whitespace-pre-wrap text-xs text-muted-foreground">{{ tool.detail }}</p>
</li>
</ol>
<button v-if="group.tools.length > 12" type="button" class="text-xs text-primary hover:underline" @click="expanded = !expanded">{{ expanded ? 'Show first 12' : `Show all ${group.tools.length}` }}</button>
<Button v-if="group.tools.length > 12" type="button" variant="link" size="xs" class="px-0" @click="expanded = !expanded">{{ expanded ? 'Show first 12' : `Show all ${group.tools.length}` }}</Button>
</div>
<p v-if="group.reports.length" class="text-xs text-muted-foreground">{{ group.reports.map((report) => describeTimelineEvent(report).detail).filter(Boolean).join(' · ') }}</p>
<p v-else-if="group.agents.length" class="text-xs text-muted-foreground">{{ group.agents.reduce((sum, agent) => sum + agent.tokens_used, 0).toLocaleString() }} tokens recorded</p>
+54 -35
View File
@@ -1,4 +1,15 @@
<script setup lang="ts">
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
import { computed, ref, watch } from "vue";
import { Ellipsis, RotateCcw, Trash2, X } from "@lucide/vue";
@@ -24,13 +35,13 @@ import WorkflowCanvas from "./WorkflowCanvas.vue";
import { deleteStep, duplicateStep, insertStep, moveStep, type StepPath } from "./workflow-edit";
import { useWorkflowRuns } from "./workflow-runs";
import { useWorkflowTriggers } from "./workflow-triggers";
import { cloneControlPlaneValue, useSettingsStore } from "@/stores/settings";
import {
cloneControlPlaneValue,
removeWorkflowDefinition,
upsertWorkflowDefinition,
useControlPlaneStore,
useWorkflowsStore,
type WorkflowDefinitionCollection,
} from "@/stores/control-plane";
} from "@/stores/workflows";
import {
parseWorkflowYaml,
validationLabel,
@@ -38,22 +49,17 @@ import {
yamlTokenClass,
} from "./workflow-yaml";
const store = useControlPlaneStore();
const state = computed(() => store.stateFor("workflow-definitions"));
const store = useSettingsStore();
const workflows = useWorkflowsStore();
const state = computed(() => workflows.state);
// Chat and agent aliases: embedding and transcription have their own purposes.
const modelAliases = computed(() =>
Object.keys((store.stateFor("model-aliases").resource?.value ?? {}) as Record<string, string>)
.filter((alias) => alias !== "embedding" && alias !== "transcription")
.sort(),
);
const collection = computed(
() =>
(state.value.resource?.value as
WorkflowDefinitionCollection | undefined) ?? { definitions: [] },
);
const shipped = computed<WorkflowDefinitionCollection>(() =>
store.shippedWorkflows(),
);
const collection = computed(() => workflows.collection);
const shipped = computed(() => workflows.shipped);
// Which definition is open belongs to the page, which also lists them.
const selected = defineModel<string>("selected", { required: true });
defineProps<{ runsCount?: number }>();
@@ -143,7 +149,7 @@ watch(collection, () => {
async function save(next: WorkflowDefinitionCollection): Promise<boolean> {
localError.value = "";
return store.replace("workflow-definitions", next);
return workflows.save(next);
}
async function saveDraft(): Promise<void> {
@@ -166,8 +172,9 @@ async function saveDraft(): Promise<void> {
selected.value = nextID;
}
const confirmDelete = ref(false);
async function remove(): Promise<void> {
if (!selected.value || !window.confirm(`Delete the ${selected.value} workflow?`)) return;
if (!selected.value) return;
if (
!(await save(removeWorkflowDefinition(collection.value, selected.value)))
)
@@ -195,7 +202,7 @@ async function restoreOne(): Promise<void> {
// 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
// not served, so a save the server refuses still reports its own reason below.
const vocabulary = computed(() => store.stepTypes());
const vocabulary = computed(() => workflows.stepTypes);
const parsed = computed(() => parseWorkflowYaml(yaml.value, vocabulary.value));
const stored = computed(() => collection.value.definitions.find((entry) => entry.id === selected.value)?.yaml);
const dirty = computed(() => yaml.value !== (stored.value ?? ""));
@@ -221,22 +228,23 @@ function syncScroll(event: Event): void {
<TabsTrigger v-if="$slots.performance" value="performance">Performance</TabsTrigger>
<TabsTrigger v-if="$slots.runs" value="runs">Runs <span class="ml-1 font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></TabsTrigger>
</TabsList>
<div v-if="runs.length && view === 'canvas'" class="flex h-8 min-w-0 items-center gap-1 rounded-md border border-input pr-1">
<select
:value="watched"
aria-label="Run shown on the canvas"
class="h-full min-w-0 max-w-64 truncate rounded-md bg-transparent px-2 text-[13px] outline-none"
@change="pick(($event.target as HTMLSelectElement).value)"
>
<option value="">Definition only</option>
<option v-for="run in runs" :key="run.id" :value="String(run.id)">
Run #{{ run.id }} {{ run.title || "" }}{{ run.status ? ` · ${run.status}` : "" }}
</option>
</select>
<template v-if="watchedRun">
<RouterLink :to="`/tasks/${watchedRun.id}`" class="shrink-0 px-1 text-xs text-muted-foreground hover:text-foreground hover:underline">Open</RouterLink>
<TaskRowActions :task="watchedRun" class="shrink-0" @done="refresh" />
</template>
<div v-if="runs.length && view === 'canvas'" class="flex min-w-0 items-center gap-1">
<NativeSelect
size="sm"
:model-value="watched"
aria-label="Run shown on the canvas"
class="min-w-0 max-w-64"
@update:model-value="(value) => pick(String(value))"
>
<NativeSelectOption value="">Definition only</NativeSelectOption>
<NativeSelectOption v-for="run in runs" :key="run.id" :value="String(run.id)">{{
[`Run #${run.id}`, run.title, run.status].filter(Boolean).join(" · ")
}}</NativeSelectOption>
</NativeSelect>
<template v-if="watchedRun">
<RouterLink :to="`/tasks/${watchedRun.id}`" class="shrink-0 px-1 text-xs text-muted-foreground hover:text-foreground hover:underline">Open</RouterLink>
<TaskRowActions :task="watchedRun" class="shrink-0" @done="refresh" />
</template>
</div>
<template v-if="view === 'canvas' || view === 'yaml'">
<span v-if="!parsed.ok" class="ml-auto max-w-md truncate text-xs text-danger" role="status" :title="validationLabel(parsed)">
@@ -252,13 +260,12 @@ function syncScroll(event: Event): void {
<DropdownMenuItem v-if="dirty" @select="load(selected)"><RotateCcw />Discard changes</DropdownMenuItem>
<DropdownMenuItem v-if="shippedEntry" @select="restoreOne"><RotateCcw />Restore Defaults</DropdownMenuItem>
<DropdownMenuSeparator v-if="dirty || shippedEntry" />
<DropdownMenuItem variant="destructive" @select="remove"><Trash2 />Delete workflow</DropdownMenuItem>
<DropdownMenuItem variant="destructive" @select="confirmDelete = true"><Trash2 />Delete workflow</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<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">
<Spinner v-if="state.saving" data-icon="inline-start" /> Save
</Button>
<Spinner v-if="state.saving" data-icon="inline-start" />Save</Button>
</template>
</div>
<TabsContent value="canvas" class="space-y-2">
@@ -382,5 +389,17 @@ function syncScroll(event: Event): void {
<p v-if="localError || state.error" class="text-sm text-danger" role="alert">
{{ localError || state.error }}
</p>
<AlertDialog v-model:open="confirmDelete">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete the {{ selected }} workflow?</AlertDialogTitle>
<AlertDialogDescription>This removes its stored definition.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction variant="destructive" @click="remove">Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</form>
</template>
+42 -44
View File
@@ -1,4 +1,7 @@
<script setup lang="ts">
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { Input } from "@/components/ui/input";
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
import { computed, ref } from "vue";
import { Plus, Trash2, X } from "@lucide/vue";
@@ -7,7 +10,7 @@ import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { cn } from "@/lib/utils";
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
import { useIdentitiesStore } from "@/stores/identities";
import { useOrgStore } from "@/stores/org";
import BindEvent from "./BindEvent.vue";
import { setWorkflowField, workflowField } from "./workflow-edit";
import type { WorkflowTrigger } from "./workflow-triggers";
@@ -57,8 +60,8 @@ function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
// The identity a run acts as must be an agent, never a person; a workflow
// naming none is refused when it runs.
const identities = useIdentitiesStore();
identities.watch();
const identities = useOrgStore();
identities.watchIdentities();
const agents = computed(() => identities.identities.filter((i) => i.kind !== "user" && i.lifecycle === "active"));
const MODES = [
@@ -94,51 +97,47 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
<div class="flex-1 space-y-5 overflow-y-auto px-4 py-4">
<section class="space-y-1.5">
<div class="text-xs font-medium text-muted-foreground">Works on</div>
<div class="grid grid-cols-3 gap-1 rounded-md bg-secondary p-1">
<button
v-for="mode in MODES"
:key="mode.value"
type="button"
class="rounded px-2 py-1.5 text-[13px] transition-colors"
:class="repository === mode.value ? 'bg-card shadow-sm' : 'text-muted-foreground hover:text-foreground'"
:title="mode.hint"
@click="set('repository', mode.value === 'required' ? undefined : mode.value)"
>
{{ mode.label }}
</button>
</div>
<ToggleGroup
type="single"
variant="outline"
size="sm"
class="w-full"
:model-value="repository"
aria-label="Works on"
@update:model-value="(value) => { if (value) set('repository', value === 'required' ? undefined : String(value)); }"
>
<ToggleGroupItem v-for="mode in MODES" :key="mode.value" :value="mode.value" :title="mode.hint" class="flex-1">{{ mode.label }}</ToggleGroupItem>
</ToggleGroup>
</section>
<section v-for="[key, list] in [['inputs', inputs], ['outputs', outputs]] as const" :key="key" class="space-y-1.5">
<div class="flex items-center text-xs font-medium text-muted-foreground">
{{ key === "inputs" ? "Inputs" : "Outputs" }}
<button type="button" class="ml-auto flex items-center gap-0.5 hover:text-foreground" @click="addSpec(key, list)">
<Plus class="size-3" /> Add
</button>
<Button type="button" variant="ghost" size="xs" class="ml-auto" @click="addSpec(key, list)"><Plus data-icon="inline-start" />Add</Button>
</div>
<div v-if="list.length" class="divide-y divide-border rounded-md border border-border">
<div v-for="([name, spec], i) in list" :key="i" class="flex items-center gap-2 px-2 py-1.5">
<input
:value="name"
class="h-7 min-w-0 flex-1 rounded-md border border-input bg-background px-2 font-mono text-xs"
<Input
:model-value="name"
class="h-7 min-w-0 flex-1 font-mono text-xs"
:aria-label="`${key} name`"
@change="editSpec(key, list, i, ($event.target as HTMLInputElement).value.trim(), spec)"
/>
<select
:value="spec.type ?? 'string'"
class="h-7 rounded-md border border-input bg-background px-1 text-xs"
@change="editSpec(key, list, i, name, { ...spec, type: ($event.target as HTMLSelectElement).value })"
<NativeSelect
size="sm"
:model-value="spec.type ?? 'string'"
@update:model-value="(value) => editSpec(key, list, i, name, { ...spec, type: String(value) })"
>
<option v-for="type in TYPES" :key="type" :value="type">{{ type }}</option>
</select>
<NativeSelectOption v-for="type in TYPES" :key="type" :value="type">{{ type }}</NativeSelectOption>
</NativeSelect>
<Switch
:model-value="spec.required === true"
:title="spec.required ? 'Required' : 'Optional'"
@update:model-value="editSpec(key, list, i, name, { ...spec, required: $event || undefined })"
/>
<button type="button" class="text-muted-foreground hover:text-danger" :aria-label="`Remove ${name}`" @click="setSpec(key, list.filter((_: unknown, j: number) => j !== i))">
<Trash2 class="size-3.5" />
</button>
<Button type="button" variant="ghost" size="icon-xs" :aria-label="`Remove ${name}`" @click="setSpec(key, list.filter((_: unknown, j: number) => j !== i))">
<Trash2 />
</Button>
</div>
</div>
<p v-else class="text-xs text-fg-subtle">
@@ -151,12 +150,12 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
<div class="divide-y divide-border rounded-md border border-border">
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Identity</span>
<input
:value="text('identity')"
<Input
:model-value="text('identity')"
list="workflow-identities"
placeholder="required"
title="Every run acts as this identity; a workflow naming none is refused."
:class="cn('h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]', !text('identity') && 'border-danger/60')"
:class="cn('h-7 w-44 text-[13px]', !text('identity') && 'border-danger/60')"
@change="set('identity', ($event.target as HTMLInputElement).value.trim())"
/>
<datalist id="workflow-identities">
@@ -165,10 +164,10 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Container profile</span>
<input
:value="text('profile')"
<Input
:model-value="text('profile')"
placeholder="default"
class="h-7 w-44 rounded-md border border-input bg-background px-2 text-[13px]"
class="h-7 w-44 text-[13px]"
@change="set('profile', ($event.target as HTMLInputElement).value.trim())"
/>
</label>
@@ -184,22 +183,21 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
</label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]" title="The largest gate-retry budget any stage declares.">Gate retries</span>
<input
<Input
type="number"
min="0"
placeholder="0"
class="h-7 w-20 rounded-md border border-input bg-background px-2 text-right text-[13px]"
:value="needs.gate_retries ?? ''"
@input="setNeeds({ ...needs, gate_retries: ($event.target as HTMLInputElement).value === '' ? undefined : Number(($event.target as HTMLInputElement).value) })"
class="h-7 w-20 text-right text-[13px]"
:model-value="needs.gate_retries ?? ''"
@update:model-value="(value) => setNeeds({ ...needs, gate_retries: String(value) === '' ? undefined : Number(String(value)) })"
/>
</label>
</div>
</section>
<section class="space-y-1.5">
<div class="flex items-center text-xs font-medium text-muted-foreground">
Starts when
<button type="button" class="ml-auto flex items-center gap-0.5 hover:text-foreground" @click="binding = null"><Plus class="size-3" />Bind an event</button>
<div class="flex items-center text-xs font-medium text-muted-foreground">Starts when
<Button type="button" variant="ghost" size="xs" class="ml-auto" @click="binding = null"><Plus data-icon="inline-start" />Bind an event</Button>
</div>
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-[13px]">
+32 -24
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch, watchEffect } from "vue";
import { computed, onMounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { Ellipsis, Plus, RotateCcw } from "@lucide/vue";
import {
@@ -21,15 +22,16 @@ import {
EmptyHeader,
EmptyTitle,
} from "@/components/ui/empty";
import { StatusPill } from "@/components/ui/status-pill";
import { Badge } from "@/components/ui/badge";
import { Switch } from "@/components/ui/switch";
import { api } from "@/lib/api";
import { delivered } from "@/lib/delivered";
import { compact } from "@/lib/format";
import { cn } from "@/lib/utils";
import { statusLabel } from "@/lib/task-meta";
import { cloneControlPlaneValue, restoreShippedDefinitions, useControlPlaneStore, type WorkflowDefinitionCollection } from "@/stores/control-plane";
import { useLiveResource } from "@/stores/live-updates";
import { statusKind, statusLabel } from "@/lib/task-meta";
import { cloneControlPlaneValue } from "@/stores/settings";
import { restoreShippedDefinitions, useWorkflowsStore } from "@/stores/workflows";
import { useLiveResource } from "@/stores/session";
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
import SlowestStagesCard from "./SlowestStagesCard.vue";
import StageFailuresCard from "./StageFailuresCard.vue";
@@ -52,7 +54,7 @@ interface RunTask {
issue_number?: number;
}
const store = useControlPlaneStore();
const store = useWorkflowsStore();
const data = ref<WorkflowsResponse>({});
const runs = ref<RunTask[]>([]);
const error = ref<string | null>(null);
@@ -73,9 +75,7 @@ onMounted(() => Promise.all([load(), store.load()]));
// Stored definitions are the source of truth for the list; statistics join
// them by id, and a workflow seen only in statistics still gets a row.
const stored = computed(
() => (store.stateFor("workflow-definitions").resource?.value as WorkflowDefinitionCollection | undefined)?.definitions ?? [],
);
const stored = computed(() => store.collection.definitions);
const rows = computed(() =>
workflowRows(
data.value.workflows,
@@ -99,16 +99,26 @@ const live = computed(() => {
}
return byWorkflow;
});
// ?workflow= names the selection, so Jump to can open a workflow directly. It
// applies once the workflow is listed: selecting it before the definitions load
// would open an empty editor.
const route = useRoute();
const selected = ref("");
watchEffect(() => {
if (!selected.value && rows.value.length) selected.value = rows.value[0]!.id;
});
let applied = "";
watch(
[() => route.query.workflow, rows],
([wanted]) => {
if (typeof wanted === "string" && wanted !== applied && rows.value.some((row) => row.id === wanted)) {
selected.value = applied = wanted;
} else if (!selected.value && rows.value.length) selected.value = rows.value[0]!.id;
},
{ immediate: true },
);
// Whether this workflow is still the one archie ships: "Edited" when it has
// been changed, "Custom" when archie ships nothing by that name.
const provenance = computed(() => {
const shippedYAML = store.shippedWorkflows().definitions.find((d) => d.id === selected.value)?.yaml;
const storedYAML = (store.stateFor("workflow-definitions").resource?.value as WorkflowDefinitionCollection | undefined)
?.definitions.find((d) => d.id === selected.value)?.yaml;
const shippedYAML = store.shipped.definitions.find((d) => d.id === selected.value)?.yaml;
const storedYAML = stored.value.find((d) => d.id === selected.value)?.yaml;
if (storedYAML === undefined) return "";
if (shippedYAML === undefined) return "Custom";
return shippedYAML === storedYAML ? "" : "Edited";
@@ -142,9 +152,9 @@ function create() {
}
const confirmRestore = ref(false);
async function restoreShipped() {
const shipped = store.shippedWorkflows();
const shipped = store.shipped;
const restored = restoreShippedDefinitions({ definitions: stored.value }, shipped);
if (await store.replace("workflow-definitions", cloneControlPlaneValue(restored)))
if (await store.save(cloneControlPlaneValue(restored)))
selected.value = shipped.definitions[0]?.id ?? "";
}
// The share of a workflow's runs whose work is finished: merged, or ended
@@ -160,9 +170,8 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
<Button variant="ghost" size="icon-sm" aria-label="More"><Ellipsis /></Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem :disabled="!store.shippedWorkflows().definitions.length" @select="confirmRestore = true">
<RotateCcw />Restore shipped workflows
</DropdownMenuItem>
<DropdownMenuItem :disabled="!store.shipped.definitions.length" @select="confirmRestore = true">
<RotateCcw />Restore shipped workflows</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
<Button size="sm" @click="create"><Plus data-icon="inline-start" />New workflow</Button>
@@ -221,11 +230,10 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
<section v-else class="min-w-0 rounded-lg border border-border bg-card px-5 py-4" aria-label="Workflow">
<header class="mb-2 flex flex-wrap items-center gap-2">
<h2 class="font-mono text-[15px] font-medium">{{ selected }}</h2>
<StatusPill v-if="provenance">{{ provenance }}</StatusPill>
<Badge v-if="provenance" variant="outline">{{ provenance }}</Badge>
<div class="ml-auto flex items-center gap-3">
<ApplyStatusRows kind="workflow-definitions" compact />
<label v-if="enabled !== undefined" class="flex items-center gap-2 text-xs text-fg-muted">
Enabled
<label v-if="enabled !== undefined" class="flex items-center gap-2 text-xs text-fg-muted">Enabled
<Switch :model-value="enabled" aria-label="Workflow enabled" @update:model-value="setEnabled" />
</label>
</div>
@@ -252,7 +260,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
<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>
<span class="font-mono text-xs text-fg-subtle">{{ t.owner && t.repo ? `${t.owner}/${t.repo} #${t.issue_number}` : "" }}</span>
<StatusPill>{{ statusLabel(t.status ?? "") }}</StatusPill>
<Badge :variant="statusKind(t.status ?? '')">{{ statusLabel(t.status ?? "") }}</Badge>
</li>
</ul>
</template>
+1 -1
View File
@@ -1,7 +1,7 @@
import { computed, ref, watch, type Ref } from "vue";
import { api } from "@/lib/api";
import { useLiveResource } from "@/stores/live-updates";
import { useLiveResource } from "@/stores/session";
import type { StageRun } from "./workflow-graph";
import type { Task } from "@/tasks/TaskRow.vue";
+6 -4
View File
@@ -3,7 +3,8 @@ import { parse } from "yaml";
import { api } from "@/lib/api";
import { branchingOf } from "./workflow-edit.ts";
import { useControlPlaneStore } from "@/stores/control-plane";
import { useSettingsStore } from "@/stores/settings";
import { useWorkflowsStore } from "@/stores/workflows";
import type { Binding } from "@/bindings/binding-draft";
/** One way a workflow gets started. */
@@ -107,7 +108,8 @@ function resultChoices(steps: unknown[], reference: unknown): string[] {
/** The triggers of the workflow named id, from the routes and definitions the
* control plane serves, the stored playbooks, and the event bindings. */
export function useWorkflowTriggers(id: Ref<string>) {
const store = useControlPlaneStore();
const store = useSettingsStore();
const workflows = useWorkflowsStore();
const bindings = ref<TriggerSources["bindings"]>([]);
async function reload(): Promise<void> {
const response = await api.bindings<{ bindings?: Binding[] }>().catch(() => null);
@@ -116,10 +118,10 @@ export function useWorkflowTriggers(id: Ref<string>) {
onMounted(reload);
const triggers = computed(() =>
triggersFor(id.value, {
routes: store.intakeRoutes(),
routes: workflows.intakeRoutes,
bindings: bindings.value,
playbooks: (store.stateFor("eda-playbooks").resource?.value as { playbooks?: TriggerSources["playbooks"] } | undefined)?.playbooks ?? [],
definitions: (store.stateFor("workflow-definitions").resource?.value as { definitions?: TriggerSources["definitions"] } | undefined)?.definitions ?? [],
definitions: workflows.collection.definitions,
}),
);
return { triggers, reload };