From 39929b9e48d74eaeeaa32940a0223b9e656e738a Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 13 Nov 2026 14:04:02 +1100 Subject: [PATCH] fix(ui): discarding or restoring over unpublished workflow changes asks first (#1945) --- ui/src/workflows/WorkflowEditor.vue | 38 +++++++++++++++++++++++++--- ui/src/workflows/WorkflowHistory.vue | 4 +-- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/ui/src/workflows/WorkflowEditor.vue b/ui/src/workflows/WorkflowEditor.vue index 54259c4f6..79b036fa0 100644 --- a/ui/src/workflows/WorkflowEditor.vue +++ b/ui/src/workflows/WorkflowEditor.vue @@ -129,8 +129,17 @@ function openRevision(version: number): void { historyRevision.value = version; view.value = "history"; } -// A restored version becomes the draft: nothing runs it until Publish. +// A restored version becomes the draft: nothing runs it until Publish. It +// replaces unpublished edits, so with any it asks first; while Archie works it +// is refused, as Archie's proposal would replace it when the turn ends. +const pendingRestore = ref(null); function restoreRevision(restored: string): void { + if (archieWorking.value) return; + if (dirty.value) pendingRestore.value = restored; + else applyRestore(restored); +} +function applyRestore(restored: string): void { + pendingRestore.value = null; yaml.value = restored; open.value = null; view.value = "canvas"; @@ -328,6 +337,7 @@ async function publish(): Promise { const runOpen = ref(false); const draftOpen = ref(false); const confirmDelete = ref(false); +const confirmDiscard = ref(false); async function remove(): Promise { if (!selected.value) return; if ( @@ -493,7 +503,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect()); Open run Version {{ watchedRevision.version }} Draft changes {{ changes.length }} - Restore + Discard changes Delete workflow @@ -561,7 +571,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect()); - + @@ -646,6 +656,28 @@ onBeforeUnmount(() => yamlObserver?.disconnect()); + + + + Discard the unpublished changes to {{ selected }}? + + + Cancel + Discard + + + + + + + Replace the unpublished changes with this version? + + + Cancel + Replace + + + diff --git a/ui/src/workflows/WorkflowHistory.vue b/ui/src/workflows/WorkflowHistory.vue index 99808608b..f31e7efd2 100644 --- a/ui/src/workflows/WorkflowHistory.vue +++ b/ui/src/workflows/WorkflowHistory.vue @@ -13,7 +13,7 @@ import { cn } from "@/lib/utils"; import WorkflowCanvas from "./WorkflowCanvas.vue"; import { lineDiff, stepMarks, type WorkflowRevision } from "./workflow-revisions"; -const props = defineProps<{ revisions: WorkflowRevision[]; current: string; error?: string }>(); +const props = defineProps<{ revisions: WorkflowRevision[]; current: string; error?: string; locked?: boolean }>(); const emit = defineEmits<{ restore: [yaml: string]; retry: [] }>(); const selected = defineModel("selected", { default: 0 }); const mode = defineModel("mode", { default: "yaml" }); @@ -70,7 +70,7 @@ const CHANGE_VARIANTS = { added: "default", edited: "secondary", removed: "destr
YAMLCanvas -
Workflow removed in this revision.