From 9e805368a5f79c6403b0947a6821ed8319943fe9 Mon Sep 17 00:00:00 2001 From: John Obelenus Date: Tue, 25 Jun 2024 18:38:56 -0400 Subject: [PATCH] Fix detachment for current schema variant. Allow users to delete funcs with attachments --- .../src/components/FuncEditor/FuncDetails.vue | 7 +- .../Workspace/WorkspaceCustomizeAssets.vue | 7 - lib/dal/src/action/prototype.rs | 37 ++- lib/dal/src/func/authoring.rs | 36 ++- .../func/authoring/save_func/detach.rs | 226 +++++++++++++++++- .../src/server/service/func/delete_func.rs | 5 +- 6 files changed, 298 insertions(+), 20 deletions(-) diff --git a/app/web/src/components/FuncEditor/FuncDetails.vue b/app/web/src/components/FuncEditor/FuncDetails.vue index 8cd6f9e75c..6bfc10ed3a 100644 --- a/app/web/src/components/FuncEditor/FuncDetails.vue +++ b/app/web/src/components/FuncEditor/FuncDetails.vue @@ -298,7 +298,6 @@ const funcStore = useFuncStore(); const assetStore = useAssetStore(); const emit = defineEmits<{ - (e: "detached"): void; (e: "expandPanel"): void; }>(); @@ -389,7 +388,7 @@ const execFunc = () => { const isDetaching = ref(false); const detachFunc = async () => { if (detachRef.value && "detachFunc" in detachRef.value) { - await detachRef.value.detachFunc(); + const associations = await detachRef.value.detachFunc(); if (assetStore.selectedAssetId) assetStore.LOAD_ASSET(assetStore.selectedAssetId); // reloads the fn list if (funcStore.selectedFuncId) @@ -401,16 +400,14 @@ const detachFunc = async () => { ); funcStore.selectedFuncId = undefined; // brings you back to the asset detail - /* this code was never reachable if (associations && editingFunc.value) { isDetaching.value = true; await funcStore.UPDATE_FUNC({ ...editingFunc.value, associations, }); - emit("detached"); isDetaching.value = false; - } */ + } } }; diff --git a/app/web/src/components/Workspace/WorkspaceCustomizeAssets.vue b/app/web/src/components/Workspace/WorkspaceCustomizeAssets.vue index 7306147b18..c7a183cf15 100644 --- a/app/web/src/components/Workspace/WorkspaceCustomizeAssets.vue +++ b/app/web/src/components/Workspace/WorkspaceCustomizeAssets.vue @@ -48,7 +48,6 @@ :funcId="funcStore.selectedFuncId" :schemaVariantId="assetStore.selectedAsset?.defaultSchemaVariantId" allowTestPanel - @detached="onDetach" @expand-panel="rightResizablePanelRef?.maximize()" />