From 5c898f83a2bdd822a27484664e771dc4c5027851 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Thu, 19 Oct 2023 16:56:58 -0400 Subject: [PATCH] 20382: refactored process-resource-action-set to remove duplicate code Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../process-resource-action-set.ts | 33 +++++++------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/views-components/context-menu/action-sets/process-resource-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-action-set.ts index 6db875f2b2..64b90ff45c 100644 --- a/src/views-components/context-menu/action-sets/process-resource-action-set.ts +++ b/src/views-components/context-menu/action-sets/process-resource-action-set.ts @@ -116,17 +116,16 @@ export const processResourceActionSet: ContextMenuActionSet = [ ], ]; -export const runningProcessResourceActionSet = [ +const runningProcessOnlyActionSet: ContextMenuActionSet = [ [ - ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []), { name: "CANCEL", icon: StopIcon, execute: (dispatch, resources) => { - dispatch(cancelRunningWorkflow(resources[0].uuid)); + dispatch(cancelRunningWorkflow(resources[0].uuid)); }, }, - ], + ] ]; export const processResourceAdminActionSet: ContextMenuActionSet = [ @@ -144,24 +143,16 @@ export const processResourceAdminActionSet: ContextMenuActionSet = [ ], ]; -export const runningProcessResourceAdminActionSet: ContextMenuActionSet = [ +export const runningProcessResourceActionSet = [ [ ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []), - { - component: TogglePublicFavoriteAction, - name: "Add to public favorites", - execute: (dispatch, resources) => { - dispatch(togglePublicFavorite(resources[0])).then(() => { - dispatch(publicFavoritePanelActions.REQUEST_ITEMS()); - }); - }, - }, - { - name: "CANCEL", - icon: StopIcon, - execute: (dispatch, resources) => { - dispatch(cancelRunningWorkflow(resources[0].uuid)); - }, - }, + ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []), + ], +]; + +export const runningProcessResourceAdminActionSet: ContextMenuActionSet = [ + [ + ...processResourceAdminActionSet.reduce((prev, next) => prev.concat(next), []), + ...runningProcessOnlyActionSet.reduce((prev, next) => prev.concat(next), []), ], ]; -- 2.30.2