18874: Merge commit '6f8dcb2b13f3058db656908fb26b09e23b527f08' into 18874-merge-wb2
[arvados.git] / services / workbench2 / 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, deleteWorkflow } from "store/workflow-panel/workflow-panel-actions";
7 import {
8     DetailsIcon,
9     AdvancedIcon,
10     OpenIcon,
11     Link,
12     StartIcon,
13     TrashIcon
14 } from "components/icon/icon";
15 import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions";
16 import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
17 import { openAdvancedTabDialog } from "store/advanced-tab/advanced-tab";
18
19 export const readOnlyWorkflowActionSet: ContextMenuActionSet = [[
20     {
21         icon: OpenIcon,
22         name: "Open in new tab",
23         execute: (dispatch, resource) => {
24             dispatch<any>(openInNewTabAction(resource));
25         }
26     },
27     {
28         icon: Link,
29         name: "Copy to clipboard",
30         execute: (dispatch, resource) => {
31             dispatch<any>(copyToClipboardAction(resource));
32         }
33     },
34     {
35         icon: DetailsIcon,
36         name: "View details",
37         execute: dispatch => {
38             dispatch<any>(toggleDetailsPanel());
39         }
40     },
41     {
42         icon: AdvancedIcon,
43         name: "API Details",
44         execute: (dispatch, resource) => {
45             dispatch<any>(openAdvancedTabDialog(resource.uuid));
46         }
47     },
48     {
49         icon: StartIcon,
50         name: "Run Workflow",
51         execute: (dispatch, resource) => {
52             dispatch<any>(openRunProcess(resource.uuid, resource.ownerUuid, resource.name));
53         }
54     }
55 ]];
56
57 export const workflowActionSet: ContextMenuActionSet = [[
58     ...readOnlyWorkflowActionSet[0],
59     {
60         icon: TrashIcon,
61         name: "Delete Workflow",
62         execute: (dispatch, resource) => {
63             dispatch<any>(deleteWorkflow(resource.uuid, resource.ownerUuid));
64         }
65     },
66 ]];