refs #master Merge branch 'origin/master' into 13828-trash-view
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / collection-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, ProvenanceGraphIcon, AdvancedIcon, RemoveIcon } from "~/components/icon/icon";
9 import { openCollectionUpdateDialog } from "~/store/collections/collection-update-actions";
10 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
11 import { openMoveCollectionDialog } from '~/store/collections/collection-move-actions';
12 import { openCollectionCopyDialog } from "~/store/collections/collection-copy-actions";
13 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
14 import { toggleCollectionTrashed } from "~/store/collections/collection-trash-actions";
15
16 export const collectionActionSet: ContextMenuActionSet = [[
17     {
18         icon: RenameIcon,
19         name: "Edit collection",
20         execute: (dispatch, resource) => {
21             dispatch<any>(openCollectionUpdateDialog(resource));
22         }
23     },
24     {
25         icon: ShareIcon,
26         name: "Share",
27         execute: (dispatch, resource) => {
28             // add code
29         }
30     },
31     {
32         icon: MoveToIcon,
33         name: "Move to",
34         execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
35     },
36     {
37         component: ToggleFavoriteAction,
38         execute: (dispatch, resource) => {
39             dispatch<any>(toggleFavorite(resource)).then(() => {
40                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
41             });
42         }
43     },
44     {
45         component: ToggleTrashAction,
46         execute: (dispatch, resource) => {
47             dispatch<any>(toggleCollectionTrashed(resource));
48         }
49     },
50     {
51         icon: CopyIcon,
52         name: "Copy to project",
53         execute: (dispatch, resource) => {
54             dispatch<any>(openCollectionCopyDialog(resource));
55         }
56     },
57     {
58         icon: DetailsIcon,
59         name: "View details",
60         execute: (dispatch, resource) => {
61             // add code
62         }
63     },
64     {
65         icon: ProvenanceGraphIcon,
66         name: "Provenance graph",
67         execute: (dispatch, resource) => {
68             // add code
69         }
70     },
71     {
72         icon: AdvancedIcon,
73         name: "Advanced",
74         execute: (dispatch, resource) => {
75             // add code
76         }
77     },
78     {
79         icon: RemoveIcon,
80         name: "Remove",
81         execute: (dispatch, resource) => {
82             // add code
83         }
84     }
85 ]];