Create permission service, create public access and sharing management actions
[arvados-workbench2.git] / src / views-components / context-menu / action-sets / project-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 { NewProjectIcon, RenameIcon, CopyIcon, MoveToIcon, DetailsIcon } from '~/components/icon/icon';
7 import { ToggleFavoriteAction } from "../actions/favorite-action";
8 import { toggleFavorite } from "~/store/favorites/favorites-actions";
9 import { favoritePanelActions } from "~/store/favorite-panel/favorite-panel-action";
10 import { openMoveProjectDialog } from '~/store/projects/project-move-actions';
11 import { openProjectCreateDialog } from '~/store/projects/project-create-actions';
12 import { openProjectUpdateDialog } from '~/store/projects/project-update-actions';
13 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
14 import { toggleProjectTrashed } from "~/store/trash/trash-actions";
15 import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
16 import { ShareIcon } from '~/components/icon/icon';
17 import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
18
19 export const projectActionSet: ContextMenuActionSet = [[
20     {
21         icon: NewProjectIcon,
22         name: "New project",
23         execute: (dispatch, resource) => {
24             dispatch<any>(openProjectCreateDialog(resource.uuid));
25         }
26     },
27     {
28         icon: RenameIcon,
29         name: "Edit project",
30         execute: (dispatch, resource) => {
31             dispatch<any>(openProjectUpdateDialog(resource));
32         }
33     },
34     {
35         icon: ShareIcon,
36         name: "Share",
37         execute: (dispatch, { uuid }) => {
38             dispatch<any>(openSharingDialog(uuid));
39         }
40     },
41     {
42         component: ToggleFavoriteAction,
43         execute: (dispatch, resource) => {
44             dispatch<any>(toggleFavorite(resource)).then(() => {
45                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
46             });
47         }
48     },
49     {
50         component: ToggleTrashAction,
51         execute: (dispatch, resource) => {
52             dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
53         }
54     },
55     {
56         icon: MoveToIcon,
57         name: "Move to",
58         execute: (dispatch, resource) => dispatch<any>(openMoveProjectDialog(resource))
59     },
60     {
61         icon: CopyIcon,
62         name: "Copy to project",
63         execute: (dispatch, resource) => {
64             // add code
65         }
66     },
67     {
68         icon: DetailsIcon,
69         name: "View details",
70         execute: dispatch => dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL())
71     }
72 ]];