refs #14364 Merge branch 'origin/14364-searchbar-arrow-navigation'
[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 import { openCopyProcessDialog } from '~/store/processes/process-copy-actions';
13 import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
14
15 export const processResourceActionSet: ContextMenuActionSet = [[
16     {
17         icon: RenameIcon,
18         name: "Edit process",
19         execute: (dispatch, resource) => {
20             dispatch<any>(openProcessUpdateDialog(resource));
21         }
22     },
23     {
24         icon: ShareIcon,
25         name: "Share",
26         execute: (dispatch, resource) => {
27             // add code
28         }
29     },
30     {
31         icon: MoveToIcon,
32         name: "Move to",
33         execute: (dispatch, resource) => {
34             dispatch<any>(openMoveProcessDialog(resource));
35         }
36     },
37     {
38         component: ToggleFavoriteAction,
39         execute: (dispatch, resource) => {
40             dispatch<any>(toggleFavorite(resource)).then(() => {
41                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
42             });
43         }
44     },
45     {
46         icon: CopyIcon,
47         name: "Copy to project",
48         execute: (dispatch, resource) => {
49             dispatch<any>(openCopyProcessDialog(resource));
50         }
51     },
52     {
53         icon: DetailsIcon,
54         name: "View details",
55         execute: dispatch => {
56             dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
57         }
58     },
59     {
60         icon: RemoveIcon,
61         name: "Remove",
62         execute: (dispatch, resource) => {
63             // add code
64         }
65     }
66 ]];