Create permission service, create public access and sharing management actions
[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/trash/trash-actions";
15 import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
16 import { openSharingDialog } from '../../../store/sharing-dialog/sharing-dialog-actions';
17
18 export const collectionActionSet: ContextMenuActionSet = [[
19     {
20         icon: RenameIcon,
21         name: "Edit collection",
22         execute: (dispatch, resource) => {
23             dispatch<any>(openCollectionUpdateDialog(resource));
24         }
25     },
26     {
27         icon: ShareIcon,
28         name: "Share",
29         execute: (dispatch, { uuid }) => {
30             dispatch<any>(openSharingDialog(uuid));
31         }
32     },
33     {
34         icon: MoveToIcon,
35         name: "Move to",
36         execute: (dispatch, resource) => dispatch<any>(openMoveCollectionDialog(resource))
37     },
38     {
39         component: ToggleFavoriteAction,
40         execute: (dispatch, resource) => {
41             dispatch<any>(toggleFavorite(resource)).then(() => {
42                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
43             });
44         }
45     },
46     {
47         component: ToggleTrashAction,
48         execute: (dispatch, resource) => {
49             dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
50         }
51     },
52     {
53         icon: CopyIcon,
54         name: "Copy to project",
55         execute: (dispatch, resource) => {
56             dispatch<any>(openCollectionCopyDialog(resource));
57         }
58     },
59     {
60         icon: DetailsIcon,
61         name: "View details",
62         execute: dispatch => dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL())
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 ]];