X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/ff8bab30fa2c0dabc4ef54d538b6979adf813beb..e10e24d713e5c31cbc34efca458f5718eb6eb000:/src/views-components/context-menu/action-sets/workflow-action-set.ts diff --git a/src/views-components/context-menu/action-sets/workflow-action-set.ts b/src/views-components/context-menu/action-sets/workflow-action-set.ts index cfcb2c24..4a1460bf 100644 --- a/src/views-components/context-menu/action-sets/workflow-action-set.ts +++ b/src/views-components/context-menu/action-sets/workflow-action-set.ts @@ -2,48 +2,61 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set'; -import { openRunProcess } from 'store/workflow-panel/workflow-panel-actions'; -import { DetailsIcon, AdvancedIcon, OpenIcon, Link, StartIcon } from 'components/icon/icon'; -import { copyToClipboardAction, openInNewTabAction } from 'store/open-in-new-tab/open-in-new-tab.actions'; -import { toggleDetailsPanel } from 'store/details-panel/details-panel-action'; -import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab'; +import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set"; +import { openRunProcess, deleteWorkflow } from "store/workflow-panel/workflow-panel-actions"; +import { DetailsIcon, AdvancedIcon, OpenIcon, Link, StartIcon, TrashIcon } from "components/icon/icon"; +import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions"; +import { toggleDetailsPanel } from "store/details-panel/details-panel-action"; +import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab"; -export const workflowActionSet: ContextMenuActionSet = [ +export const readOnlyWorkflowActionSet: ContextMenuActionSet = [ [ { icon: OpenIcon, - name: 'Open in new tab', + name: "Open in new tab", execute: (dispatch, resources) => { - resources.forEach((resource) => dispatch(openInNewTabAction(resource))); + dispatch(openInNewTabAction(resources[0])); }, }, { icon: Link, - name: 'Copy to clipboard', + name: "Copy to clipboard", execute: (dispatch, resources) => { dispatch(copyToClipboardAction(resources)); }, }, { icon: DetailsIcon, - name: 'View details', - execute: (dispatch) => { + name: "View details", + execute: dispatch => { dispatch(toggleDetailsPanel()); }, }, { icon: AdvancedIcon, - name: 'API Details', + name: "API Details", execute: (dispatch, resources) => { - resources.forEach((resource) => dispatch(openAdvancedTabDialog(resource.uuid))); + dispatch(openAdvancedTabDialog(resources[0].uuid)); }, }, { icon: StartIcon, - name: 'Run Workflow', + name: "Run Workflow", + execute: (dispatch, resources) => { + dispatch(openRunProcess(resources[0].uuid, resources[0].ownerUuid, resources[0].name)); + }, + }, + ], +]; + +export const workflowActionSet: ContextMenuActionSet = [ + [ + ...readOnlyWorkflowActionSet[0], + { + icon: TrashIcon, + name: "Delete Workflow", execute: (dispatch, resources) => { - resources.forEach((resource) => dispatch(openRunProcess(resource.uuid, resource.ownerUuid, resource.name))); + dispatch(deleteWorkflow(resources[0].uuid, resources[0].ownerUuid)); }, }, ],