From 00af2a177e8312d6cb99898bfd29ac2c734743ae Mon Sep 17 00:00:00 2001 From: vhu-axelor <146069039+vhu-axelor@users.noreply.github.com> Date: Mon, 16 Dec 2024 10:30:17 +0100 Subject: [PATCH] feat: add options management in generic action --- packages/apps/dms/src/hooks/use-dms-header-actions.ts | 3 ++- packages/apps/dms/src/utils/attachedFilesGenericAction.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/apps/dms/src/hooks/use-dms-header-actions.ts b/packages/apps/dms/src/hooks/use-dms-header-actions.ts index ec3623edb..8719cc692 100644 --- a/packages/apps/dms/src/hooks/use-dms-header-actions.ts +++ b/packages/apps/dms/src/hooks/use-dms-header-actions.ts @@ -62,10 +62,11 @@ const useAttachedFilesGenericAction = () => { useEffect(() => { headerActionsProvider.registerGenericAction( 'attached_files_generic_action', - async ({model, modelId}) => + async ({model, modelId, options}) => await getAction({ model, modelId, + options, isFolderCreationAllowed: mobileSettings?.isFolderCreationAllowed, navigation, translator: I18n.t, diff --git a/packages/apps/dms/src/utils/attachedFilesGenericAction.ts b/packages/apps/dms/src/utils/attachedFilesGenericAction.ts index 99f0fd4ea..04469b77e 100644 --- a/packages/apps/dms/src/utils/attachedFilesGenericAction.ts +++ b/packages/apps/dms/src/utils/attachedFilesGenericAction.ts @@ -22,6 +22,7 @@ import {countAttachedFiles, fetchDirectory} from '../api/document-api'; interface getActionProps { model: string; modelId: number; + options: any; isFolderCreationAllowed: boolean; navigation: any; translator: (key: string) => string; @@ -30,6 +31,7 @@ interface getActionProps { export const getAction = async ({ model, modelId, + options, isFolderCreationAllowed, navigation, translator, @@ -64,5 +66,6 @@ export const getAction = async ({ }), showInHeader: true, hideIf: !directory && !isFolderCreationAllowed, + ...options, }; };