15768: changed all context menu actions to take an array of resources Arvados-DCO...
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / workflow-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set';
6 import { openRunProcess } from 'store/workflow-panel/workflow-panel-actions';
7 import { DetailsIcon, AdvancedIcon, OpenIcon, Link, StartIcon } from 'components/icon/icon';
8 import { copyToClipboardAction, openInNewTabAction } from 'store/open-in-new-tab/open-in-new-tab.actions';
9 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
10 import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
11
12 export const workflowActionSet: ContextMenuActionSet = [
13     [
14         {
15             icon: OpenIcon,
16             name: 'Open in new tab',
17             execute: (dispatch, resources) => {
18                 resources.forEach((resource) => dispatch<any>(openInNewTabAction(resource)));
19             },
20         },
21         {
22             icon: Link,
23             name: 'Copy to clipboard',
24             execute: (dispatch, resources) => {
25                 resources.forEach((resource) => dispatch<any>(copyToClipboardAction(resource)));
26             },
27         },
28         {
29             icon: DetailsIcon,
30             name: 'View details',
31             execute: (dispatch) => {
32                 dispatch<any>(toggleDetailsPanel());
33             },
34         },
35         {
36             icon: AdvancedIcon,
37             name: 'API Details',
38             execute: (dispatch, resources) => {
39                 resources.forEach((resource) => dispatch<any>(openAdvancedTabDialog(resource.uuid)));
40             },
41         },
42         {
43             icon: StartIcon,
44             name: 'Run Workflow',
45             execute: (dispatch, resources) => {
46                 resources.forEach((resource) => dispatch<any>(openRunProcess(resource.uuid, resource.ownerUuid, resource.name)));
47             },
48         },
49     ],
50 ];