Merge branch 'master' into 14603-add-controlled-vocabulary-to-advanced-search
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / process-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 { ToggleFavoriteAction } from "~/views-components/context-menu/actions/favorite-action";
7 import { toggleFavorite } from "~/store/favorites/favorites-actions";
8 import {
9     RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, ProvenanceGraphIcon,
10     AdvancedIcon, RemoveIcon, ReRunProcessIcon, LogIcon, InputIcon, CommandIcon, OutputIcon
11 } from "~/components/icon/icon";
12 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
13 import { navigateToProcessLogs } from '~/store/navigation/navigation-action';
14 import { openMoveProcessDialog } from '~/store/processes/process-move-actions';
15 import { openProcessUpdateDialog } from "~/store/processes/process-update-actions";
16 import { openCopyProcessDialog } from '~/store/processes/process-copy-actions';
17 import { openProcessCommandDialog } from '~/store/processes/process-command-actions';
18 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
19 import { openAdvancedTabDialog } from "~/store/advanced-tab/advanced-tab";
20 import { openProcessInputDialog } from "~/store/processes/process-input-actions";
21 import { toggleDetailsPanel } from '~/store/details-panel/details-panel-action';
22 import { openRemoveProcessDialog } from "~/store/processes/processes-actions";
23 import { navigateToOutput } from "~/store/process-panel/process-panel-actions";
24
25 export const processActionSet: ContextMenuActionSet = [[
26     {
27         icon: RenameIcon,
28         name: "Edit process",
29         execute: (dispatch, resource) => {
30             dispatch<any>(openProcessUpdateDialog(resource));
31         }
32     },
33     {
34         icon: ShareIcon,
35         name: "Share",
36         execute: (dispatch, { uuid }) => {
37             dispatch<any>(openSharingDialog(uuid));
38         }
39     },
40     {
41         component: ToggleFavoriteAction,
42         execute: (dispatch, resource) => {
43             dispatch<any>(toggleFavorite(resource)).then(() => {
44                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
45             });
46         }
47     },
48     {
49         icon: MoveToIcon,
50         name: "Move to",
51         execute: (dispatch, resource) => {
52             dispatch<any>(openMoveProcessDialog(resource));
53         }
54     },
55     {
56         icon: CopyIcon,
57         name: "Copy to project",
58         execute: (dispatch, resource) => {
59             dispatch<any>(openCopyProcessDialog(resource));
60         }
61     },
62     {
63         icon: ReRunProcessIcon,
64         name: "Re-run process",
65         execute: (dispatch, resource) => {
66             // add code
67         }
68     },
69     {
70         icon: InputIcon,
71         name: "Inputs",
72         execute: (dispatch, resource) => {
73             dispatch<any>(openProcessInputDialog(resource.uuid));
74         }
75     },
76     {
77         icon: OutputIcon,
78         name: "Outputs",
79         execute: (dispatch, resource) => {
80             if(resource.outputUuid){
81                 dispatch<any>(navigateToOutput(resource.outputUuid));
82             }
83         }
84     },
85     {
86         icon: CommandIcon,
87         name: "Command",
88         execute: (dispatch, resource) => {
89             dispatch<any>(openProcessCommandDialog(resource.uuid));
90         }
91     },
92     {
93         icon: LogIcon,
94         name: "Log",
95         execute: (dispatch, resource) => {
96             dispatch<any>(navigateToProcessLogs(resource.uuid));
97         }
98     },
99     {
100         icon: DetailsIcon,
101         name: "View details",
102         execute: dispatch => {
103             dispatch<any>(toggleDetailsPanel());
104         }
105     },
106     // {
107     //     icon: ProvenanceGraphIcon,
108     //     name: "Provenance graph",
109     //     execute: (dispatch, resource) => {
110     //         // add code
111     //     }
112     // },
113     {
114         icon: AdvancedIcon,
115         name: "Advanced",
116         execute: (dispatch, resource) => {
117             dispatch<any>(openAdvancedTabDialog(resource.uuid));
118         }
119     },
120     {
121         name: "Remove",
122         icon: RemoveIcon,
123         execute: (dispatch, resource) => {
124             dispatch<any>(openRemoveProcessDialog(resource.uuid));
125         }
126     }
127 ]];