X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/5fa710bf0218bd474233fd5867b15cc6622e6b31..3612a36e473bf1599180a9b3b90b03ca0aaafb45:/src/views-components/context-menu/action-sets/process-resource-action-set.ts 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 3d057d42..64b90ff4 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 @@ -36,8 +36,8 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [ [ { component: ToggleFavoriteAction, - execute: (dispatch, resource) => { - dispatch(toggleFavorite(resource)).then(() => { + execute: (dispatch, resources) => { + dispatch(toggleFavorite(resources[0])).then(() => { dispatch(favoritePanelActions.REQUEST_ITEMS()); }); }, @@ -45,23 +45,23 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [ { icon: OpenIcon, name: "Open in new tab", - execute: (dispatch, resource) => { - dispatch(openInNewTabAction(resource)); + execute: (dispatch, resources) => { + dispatch(openInNewTabAction(resources[0])); }, }, { icon: ReRunProcessIcon, name: "Copy and re-run process", - execute: (dispatch, resource) => { - dispatch(openCopyProcessDialog(resource)); + execute: (dispatch, resources) => { + dispatch(openCopyProcessDialog(resources[0])); }, }, { icon: OutputIcon, name: "Outputs", - execute: (dispatch, resource) => { - if (resource.outputUuid) { - dispatch(navigateToOutput(resource.outputUuid)); + execute: (dispatch, resources) => { + if (resources[0].outputUuid) { + dispatch(navigateToOutput(resources[0].outputUuid)); } }, }, @@ -75,8 +75,8 @@ export const readOnlyProcessResourceActionSet: ContextMenuActionSet = [ { icon: AdvancedIcon, name: "API Details", - execute: (dispatch, resource) => { - dispatch(openAdvancedTabDialog(resource.uuid)); + execute: (dispatch, resources) => { + dispatch(openAdvancedTabDialog(resources[0].uuid)); }, }, ], @@ -88,45 +88,44 @@ export const processResourceActionSet: ContextMenuActionSet = [ { icon: RenameIcon, name: "Edit process", - execute: (dispatch, resource) => { - dispatch(openProcessUpdateDialog(resource)); + execute: (dispatch, resources) => { + dispatch(openProcessUpdateDialog(resources[0])); }, }, { icon: ShareIcon, name: "Share", - execute: (dispatch, { uuid }) => { - dispatch(openSharingDialog(uuid)); + execute: (dispatch, resources) => { + dispatch(openSharingDialog(resources[0].uuid)); }, }, { icon: MoveToIcon, name: "Move to", - execute: (dispatch, resource) => { - dispatch(openMoveProcessDialog(resource)); + execute: (dispatch, resources) => { + dispatch(openMoveProcessDialog(resources[0])); }, }, { name: "Remove", icon: RemoveIcon, - execute: (dispatch, resource) => { - dispatch(openRemoveProcessDialog(resource.uuid)); + execute: (dispatch, resources) => { + dispatch(openRemoveProcessDialog(resources[0], resources.length)); }, }, ], ]; -export const runningProcessResourceActionSet = [ +const runningProcessOnlyActionSet: ContextMenuActionSet = [ [ - ...processResourceActionSet.reduce((prev, next) => prev.concat(next), []), { name: "CANCEL", icon: StopIcon, - execute: (dispatch, resource) => { - dispatch(cancelRunningWorkflow(resource.uuid)); + execute: (dispatch, resources) => { + dispatch(cancelRunningWorkflow(resources[0].uuid)); }, }, - ], + ] ]; export const processResourceAdminActionSet: ContextMenuActionSet = [ @@ -135,8 +134,8 @@ export const processResourceAdminActionSet: ContextMenuActionSet = [ { component: TogglePublicFavoriteAction, name: "Add to public favorites", - execute: (dispatch, resource) => { - dispatch(togglePublicFavorite(resource)).then(() => { + execute: (dispatch, resources) => { + dispatch(togglePublicFavorite(resources[0])).then(() => { dispatch(publicFavoritePanelActions.REQUEST_ITEMS()); }); }, @@ -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, resource) => { - dispatch(togglePublicFavorite(resource)).then(() => { - dispatch(publicFavoritePanelActions.REQUEST_ITEMS()); - }); - }, - }, - { - name: "CANCEL", - icon: StopIcon, - execute: (dispatch, resource) => { - dispatch(cancelRunningWorkflow(resource.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), []), ], ];