refs #master Merge branch 'origin/master' into 13828-trash-view
[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 { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
8 import { toggleFavorite } from "~/store/favorites/favorites-actions";
9 import { RenameIcon, ShareIcon, MoveToIcon, CopyIcon, DetailsIcon, RemoveIcon } from "~/components/icon/icon";
10 import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
11 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
12 import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
13 import { openCollectionCopyDialog } from '~/store/collections/collection-copy-actions';
14
15 export const collectionResourceActionSet: ContextMenuActionSet = [[
16     {
17         icon: RenameIcon,
18         name: "Edit collection",
19         execute: (dispatch, resource) => {
20             dispatch<any>(openCollectionUpdateDialog(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) => dispatch<any>(openMoveCollectionDialog(resource))
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         component: ToggleTrashAction,
45         execute: (dispatch, resource) => {
46             dispatch<any>(toggleCollectionTrashed(resource));
47         }
48     },
49     {
50         icon: CopyIcon,
51         name: "Copy to project",
52         execute: (dispatch, resource) => {
53             dispatch<any>(openCollectionCopyDialog(resource));
54         },
55     },
56     {
57         icon: DetailsIcon,
58         name: "View details",
59         execute: (dispatch, resource) => {
60             // add code
61         }
62     },
63     {
64         icon: RemoveIcon,
65         name: "Remove",
66         execute: (dispatch, resource) => {
67             // add code
68         }
69     }
70 ]];