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