From 4dad1415e648b326b6ffae1d49cfb8e7ec5e7d96 Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Fri, 6 Nov 2026 22:06:25 +1100 Subject: [PATCH] fix(ui): workflow reads keep their error instead of showing empty (#1732) Triggers: a failed bindings/schedules read surfaces as an error with Retry in TriggerSettings instead of "Manual runs only." Run stages: a failed attempts read sets stagesError, shown with Retry above the canvas instead of a bare canvas. Bind form: failed reads show an error with Retry rather than empty pickers, and save refuses to mappingUpdate an existing mapping unless the bindings list actually loaded. History: a failed revisions read shows the error with Retry in the revision list, and "No recorded changes" appears only after a successful read. --- ui/src/workflows/BindEvent.vue | 32 ++++++++++++++++++++++----- ui/src/workflows/TriggerSettings.vue | 10 ++++++--- ui/src/workflows/WorkflowEditor.vue | 14 +++++++----- ui/src/workflows/WorkflowHistory.vue | 7 ++++-- ui/src/workflows/workflow-runs.ts | 10 +++++++-- ui/src/workflows/workflow-triggers.ts | 11 ++++++--- 6 files changed, 63 insertions(+), 21 deletions(-) diff --git a/ui/src/workflows/BindEvent.vue b/ui/src/workflows/BindEvent.vue index 44d565db8..c7aebdd44 100644 --- a/ui/src/workflows/BindEvent.vue +++ b/ui/src/workflows/BindEvent.vue @@ -61,6 +61,11 @@ const eventTypes = ref([]); const mappings = ref([]); const bindings = ref([]); const loading = ref(true); +// A failed read of the form's data is an error with Retry, not empty pickers. +const loadError = ref(""); +// Saving must know whether the bindings list actually loaded: on a failed +// read, sharedMapping() cannot tell, and mappingUpdate must not run. +const bindingsLoaded = ref(false); const source = ref(""); const newSource = ref(""); @@ -80,12 +85,14 @@ async function loadCaptures(): Promise { captures.value = listed?.captures ?? []; } -onMounted(async () => { +async function loadAll(): Promise { + loading.value = true; + let readError = ""; const [listed, types, mapped, bound] = await Promise.all([ - api.sources<{ sources?: { path: string; name?: string }[] }>().catch(() => null), - api.eventTypes<{ event_types?: EventType[] }>().catch(() => null), - api.mappings<{ mappings?: Mapping[] }>().catch(() => null), - api.bindings<{ bindings?: Binding[] }>().catch(() => null), + api.sources<{ sources?: { path: string; name?: string }[] }>().catch((err) => { readError = String((err as Error).message || err); return null; }), + api.eventTypes<{ event_types?: EventType[] }>().catch((err) => { readError = String((err as Error).message || err); return null; }), + api.mappings<{ mappings?: Mapping[] }>().catch((err) => { readError = String((err as Error).message || err); return null; }), + api.bindings<{ bindings?: Binding[] }>().catch((err) => { readError = String((err as Error).message || err); return null; }), loadCaptures(), ]); sources.value = (listed?.sources ?? []).map((s) => s.path); @@ -93,6 +100,8 @@ onMounted(async () => { eventTypes.value = types?.event_types ?? []; mappings.value = mapped?.mappings ?? []; bindings.value = bound?.bindings ?? []; + bindingsLoaded.value = bound !== null; + loadError.value = [listed, types, mapped, bound].some((leg) => leg === null) ? readError || "Couldn't load the bind form" : ""; if (props.binding) { source.value = props.binding.matcher?.source ?? ""; const mapping = mappings.value.find((m) => String(m.id) === props.binding?.mapping_id); @@ -104,7 +113,8 @@ onMounted(async () => { } for (const [name] of inputs.value) rows.value[name] ??= { from: "path", path: "", value: "" }; loading.value = false; -}); +} +onMounted(loadAll); useLiveResource("captures", () => void loadCaptures(), 500); const sourcePath = computed(() => (source.value === NEW_SOURCE ? newSource.value.trim() : source.value)); @@ -186,6 +196,12 @@ async function createSource(): Promise { async function save(): Promise { if (blockers.value.length || !capture.value) return; + // Without the bindings list, sharedMapping() cannot tell whether the + // mapping is shared, and mappingUpdate must not run on it. + if (props.binding?.mapping_id && !bindingsLoaded.value) { + error.value = "The bindings list did not load, so this edit cannot tell whether the mapping is shared. Retry the load first."; + return; + } saving.value = true; error.value = ""; try { @@ -261,6 +277,10 @@ const resume = () => transition(api.bindingResume, "pending_approval");
+
+ {{ loadError }} + +
diff --git a/ui/src/workflows/TriggerSettings.vue b/ui/src/workflows/TriggerSettings.vue index f09c7d08e..958b4701c 100644 --- a/ui/src/workflows/TriggerSettings.vue +++ b/ui/src/workflows/TriggerSettings.vue @@ -10,8 +10,8 @@ import ScheduleTrigger from "./ScheduleTrigger.vue"; import SpecList from "./SpecList.vue"; import type { WorkflowTrigger } from "./workflow-triggers"; -defineProps<{ yaml: string; triggers: WorkflowTrigger[] }>(); -const emit = defineEmits<{ "update:yaml": [string]; bound: [] }>(); +defineProps<{ yaml: string; triggers: WorkflowTrigger[]; error?: string }>(); +const emit = defineEmits<{ "update:yaml": [string]; bound: []; reload: [] }>(); // The bind flow takes over the card; a null binding is a new one. const binding = ref(); @@ -53,7 +53,11 @@ function open(trigger: WorkflowTrigger): void { -

Manual runs only.

+ +

Manual runs only.

diff --git a/ui/src/workflows/WorkflowEditor.vue b/ui/src/workflows/WorkflowEditor.vue index 4450bc6f0..ff59acdf0 100644 --- a/ui/src/workflows/WorkflowEditor.vue +++ b/ui/src/workflows/WorkflowEditor.vue @@ -80,7 +80,7 @@ function openStepAt(path: StepPath | null): void { } const localError = ref(""); -const { runs, error: runsError, loading: runsLoading, watched, watchedRun, stages, attempt, pick, follow, refresh } = useWorkflowRuns(selected); +const { runs, error: runsError, loading: runsLoading, watched, watchedRun, stages, stagesError, attempt, pick, follow, refresh } = useWorkflowRuns(selected); const stepTab = ref("definition"); // A run without a pinned definition cannot be matched to the drawn steps, so // the canvas draws the definition alone. @@ -114,9 +114,9 @@ async function restartFrom(from: string): Promise { restarting.value = false; } } -const { triggers, reload: reloadTriggers } = useWorkflowTriggers(selected); +const { triggers, reload: reloadTriggers, error: triggersError } = useWorkflowTriggers(selected); -const { revisions, error: historyError } = useWorkflowHistory(selected); +const { revisions, error: historyError, reload: reloadHistory } = useWorkflowHistory(selected); const historyRevision = ref(0); const historyMode = ref("yaml"); // The revision a run used, matched by the definition it pinned. @@ -454,6 +454,10 @@ onBeforeUnmount(() => yamlObserver?.disconnect());

Could not load recent runs: {{ runsError }}

+

No snapshot for this run.

@@ -482,7 +486,7 @@ onBeforeUnmount(() => yamlObserver?.disconnect()); >