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