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