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