From 6a17951a3a2ca43590c93ce54ede529a31639cb6 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 13 Nov 2026 14:32:46 +1100 Subject: [PATCH] fix(ui): workflow list menus sit in their row, a new workflow is listed at once, moving a step opens nothing (#1952) --- ui/src/workflows/WorkflowEditor.vue | 7 ++++++- ui/src/workflows/WorkflowsPage.vue | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ui/src/workflows/WorkflowEditor.vue b/ui/src/workflows/WorkflowEditor.vue index 69fdb8d5a..0993f2ff1 100644 --- a/ui/src/workflows/WorkflowEditor.vue +++ b/ui/src/workflows/WorkflowEditor.vue @@ -164,7 +164,12 @@ function duplicateAt(path: StepPath): void { function moveAt(path: StepPath, delta: -1 | 1): void { const moved = moveStep(yaml.value, path, delta); yaml.value = moved.source; - if (openPath.value) openStepAt(moved.path); + // An open card follows its step: the moved one to its new place, the + // neighbour it swapped with to the old one. Nothing else opens. + const source = JSON.stringify(path); + const target = JSON.stringify(moved.path); + if (open.value === source) open.value = target; + else if (open.value === target) open.value = source; } function removeAt(path: StepPath): void { yaml.value = deleteStep(yaml.value, path); diff --git a/ui/src/workflows/WorkflowsPage.vue b/ui/src/workflows/WorkflowsPage.vue index b008e1c80..96752ff3e 100644 --- a/ui/src/workflows/WorkflowsPage.vue +++ b/ui/src/workflows/WorkflowsPage.vue @@ -33,7 +33,7 @@ import ApplyStatusRows from "@/settings/ApplyStatusRows.vue"; import type { StageStats } from "./WorkflowRuns.vue"; import WorkflowEditor from "./WorkflowEditor.vue"; import WorkflowPicker from "./WorkflowPicker.vue"; -import { setWorkflowField } from "./workflow-edit"; +import { SEEDED_AGENT_ID, setWorkflowField } from "./workflow-edit"; import { workflowRows, type WorkflowDefinition, type WorkflowStats } from "./workflow-rows"; interface WorkflowsResponse { @@ -186,10 +186,15 @@ function rowActions(id: string): RowAction[] { const stages = computed(() => (data.value.stages ?? []).filter((s) => s.workflow === selected.value)); -function create() { +// A new workflow starts as a draft, so it is in the list straight away and +// nothing runs it until Publish. +async function create() { let n = 1; - while (stored.value.some((d) => d.id === `workflow-${n}`)) n++; - selected.value = `workflow-${n}`; + const taken = (id: string) => rows.value.some((row) => row.id === id); + while (taken(`workflow-${n}`)) n++; + const id = `workflow-${n}`; + if (await store.putDraft(id, `id: ${id}\nidentity: ${SEEDED_AGENT_ID}\nsteps: []\n`)) selected.value = id; + else toast.error(store.draftState.error || errors.workflows.editor.draftNotSaved); } // The share of a workflow's runs whose work is finished: merged, or ended // with nothing to merge (a no-change build, a no-code triage -- `completed`). @@ -217,7 +222,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :