improve code after CR
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / process-resource-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 "../context-menu-action-set";
6 import { ToggleFavoriteAction } from "../actions/favorite-action";
7 import { toggleFavorite } from "~/store/favorites/favorites-actions";
8 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
9 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
10 import { openMoveProcessDialog } from '~/store/processes/process-move-actions';
11 import { openProcessUpdateDialog } from "~/store/processes/process-update-actions";
12
13 export const processResourceActionSet: ContextMenuActionSet = [[
14     {
15         icon: RenameIcon,
16         name: "Edit process",
17         execute: (dispatch, resource) => dispatch<any>(openProcessUpdateDialog(resource))
18     },
19     {
20         icon: ShareIcon,
21         name: "Share",
22         execute: (dispatch, resource) => {
23             // add code
24         }
25     },
26     {
27         icon: MoveToIcon,
28         name: "Move to",
29         execute: (dispatch, resource) => dispatch<any>(openMoveProcessDialog(resource))
30     },
31     {
32         component: ToggleFavoriteAction,
33         execute: (dispatch, resource) => {
34             dispatch<any>(toggleFavorite(resource)).then(() => {
35                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
36             });
37         }
38     },
39     {
40         icon: CopyIcon,
41         name: "Copy to project",
42         execute: (dispatch, resource) => {
43             // add code
44         }
45     },
46     {
47         icon: DetailsIcon,
48         name: "View details",
49         execute: (dispatch, resource) => {
50             // add code
51         }
52     },
53     {
54         icon: RemoveIcon,
55         name: "Remove",
56         execute: (dispatch, resource) => {
57             // add code
58         }
59     }
60 ]];