fix(ui): restoring shipped workflows keeps custom ones

This commit is contained in:
sam committed 2026-10-05 20:27:38 +11:00
1 parent 22b23f78cf
commit a5b7b9232c
4 files changed
+98 -73

No files matched your search

+9
View File
@@ -234,6 +234,15 @@ export function upsertWorkflowDefinition(
};
}
// restoreShippedDefinitions resets every shipped workflow to what archie ships
// and keeps the operator's custom ones, which archie has no copy of to restore.
export function restoreShippedDefinitions(
collection: WorkflowDefinitionCollection,
shipped: WorkflowDefinitionCollection,
): WorkflowDefinitionCollection {
return shipped.definitions.reduce(upsertWorkflowDefinition, collection);
}
export function removeWorkflowDefinition(
collection: WorkflowDefinitionCollection,
id: string,
+3 -2
View File
@@ -16,7 +16,7 @@ import { delivered } from "@/lib/delivered";
import { compact } from "@/lib/format";
import { cn } from "@/lib/utils";
import { statusLabel } from "@/lib/task-meta";
import { cloneControlPlaneValue, useControlPlaneStore, type WorkflowDefinitionCollection } from "@/stores/control-plane";
import { cloneControlPlaneValue, restoreShippedDefinitions, useControlPlaneStore, type WorkflowDefinitionCollection } from "@/stores/control-plane";
import { useLiveResource } from "@/stores/live-updates";
import SlowestStagesCard from "./SlowestStagesCard.vue";
import StageFailuresCard from "./StageFailuresCard.vue";
@@ -107,7 +107,8 @@ function create() {
}
async function restoreShipped() {
const shipped = store.shippedWorkflows();
if (await store.replace("workflow-definitions", cloneControlPlaneValue(shipped)))
const restored = restoreShippedDefinitions({ definitions: stored.value }, shipped);
if (await store.replace("workflow-definitions", cloneControlPlaneValue(restored)))
selected.value = shipped.definitions[0]?.id ?? "";
}
// The share of a workflow's runs whose work is finished: merged, or ended