feat(core): Change workflow deletions to soft deletes (#14894)

Adds soft‑deletion support for workflows through a new boolean column `isArchived`.

When a workflow is archived we now set `isArchived` flag to true and the workflows
stays in the database and is omitted from the default workflow listing query.

Archived workflows can be viewed in read-only mode, but they cannot be activated.

Archived workflows are still available by ID and can be invoked as sub-executions,
so existing Execute Workflow nodes continue to work. Execution engine doesn't
care about isArchived flag.

Users can restore workflows via Unarchive action at the UI.
This commit is contained in:
Jaakko Husso
2025-05-06 17:48:24 +03:00
committed by GitHub
parent 32b72011e6
commit 3a13139f78
64 changed files with 1616 additions and 124 deletions

View File

@@ -250,6 +250,7 @@ const { isSubNodeType } = useNodeType({
node,
});
const isArchivedWorkflow = computed(() => workflowsStore.workflow.isArchived);
const isReadOnlyRoute = computed(() => route.meta.readOnlyCanvas === true);
const isWaitNodeWaiting = computed(() => {
return (
@@ -549,7 +550,8 @@ const pinButtonDisabled = computed(
(!rawInputData.value.length && !pinnedData.hasData.value) ||
!!binaryData.value?.length ||
isReadOnlyRoute.value ||
readOnlyEnv.value,
readOnlyEnv.value ||
isArchivedWorkflow.value,
);
const activeTaskMetadata = computed((): ITaskMetadata | null => {
@@ -847,7 +849,13 @@ function showPinDataDiscoveryTooltip(value: IDataObject[]) {
const pinDataDiscoveryFlag = useStorage(LOCAL_STORAGE_PIN_DATA_DISCOVERY_NDV_FLAG).value;
if (value && value.length > 0 && !isReadOnlyRoute.value && !pinDataDiscoveryFlag) {
if (
value &&
value.length > 0 &&
!isReadOnlyRoute.value &&
!isArchivedWorkflow.value &&
!pinDataDiscoveryFlag
) {
pinDataDiscoveryComplete();
setTimeout(() => {
@@ -1367,7 +1375,7 @@ defineExpose({ enterEditMode });
data-test-id="ndv-pinned-data-callout"
>
{{ i18n.baseText('runData.pindata.thisDataIsPinned') }}
<span v-if="!isReadOnlyRoute && !readOnlyEnv" class="ml-4xs">
<span v-if="!isReadOnlyRoute && !isArchivedWorkflow && !readOnlyEnv" class="ml-4xs">
<N8nLink
theme="secondary"
size="small"