fix(ui): workflow list menus sit in their row, a new workflow is listed at once, moving a step opens nothing (#1952)

This commit is contained in:
sam committed 2026-11-13 14:32:46 +11:00
1 parent 0cfa701f5c
commit 6a17951a3a
2 files changed
+20 -7

No files matched your search

+6 -1
View File
@@ -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);
+14 -6
View File
@@ -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 :
<button
type="button"
:aria-current="row.id === selected ? 'true' : undefined"
:class="cn('w-full rounded-md px-3 py-2.5 text-left transition-colors hover:bg-secondary', row.id === selected && 'bg-secondary')"
:class="cn('w-full rounded-md py-2.5 pr-10 pl-3 text-left transition-colors hover:bg-secondary', row.id === selected && 'bg-secondary')"
@click="selected = row.id"
>
<span class="flex items-baseline gap-2">
@@ -242,9 +247,12 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
<ContextMenuItem v-for="action in rowActions(row.id)" :key="action.label" @select="action.run"><component :is="action.icon" />{{ action.label }}</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
<MoreMenu v-if="rowActions(row.id).length" :label="`${row.id} actions`" class="absolute top-1.5 right-1.5">
<!-- MoreMenu renders no element of its own, so the wrapper places it. -->
<div v-if="rowActions(row.id).length" class="absolute top-1.5 right-1.5">
<MoreMenu :label="`${row.id} actions`">
<DropdownMenuItem v-for="action in rowActions(row.id)" :key="action.label" @select="action.run"><component :is="action.icon" />{{ action.label }}</DropdownMenuItem>
</MoreMenu>
</div>
</li>
</ul>
</div>