merge master
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-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 { openUpdater } from "~/store/collections/updater/collection-updater-action";
10 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
11 import { openMakeACopyDialog, MAKE_A_COPY_DIALOG } from "~/views-components/make-a-copy-dialog/make-a-copy-dialog";
12 import { openMoveToDialog } from '../../move-to-dialog/move-to-dialog';
13 import { reset } from 'redux-form';
14
15 export const collectionResourceActionSet: ContextMenuActionSet = [[
16     {
17         icon: RenameIcon,
18         name: "Edit collection",
19         execute: (dispatch, resource) => {
20             dispatch<any>(openUpdater(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 => dispatch<any>(openMoveToDialog())
34     },
35     {
36         component: ToggleFavoriteAction,
37         execute: (dispatch, resource) => {
38             dispatch<any>(toggleFavorite(resource)).then(() => {
39                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
40             });
41         }
42     },
43     {
44         icon: CopyIcon,
45         name: "Copy to project",
46         execute: (dispatch, resource) => {
47             dispatch(reset(MAKE_A_COPY_DIALOG));
48             dispatch<any>(openMakeACopyDialog({name: resource.name, projectUuid: resource.uuid}));
49         },
50     },
51     {
52         icon: DetailsIcon,
53         name: "View details",
54         execute: (dispatch, resource) => {
55             // add code
56         }
57     },
58     {
59         icon: RemoveIcon,
60         name: "Remove",
61         execute: (dispatch, resource) => {
62             // add code
63         }
64     }
65 ]];