Merge branch '14276-structured-search-searvice'
[arvados.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
17 export const projectActionSet: ContextMenuActionSet = [[
18     {
19         icon: NewProjectIcon,
20         name: "New project",
21         execute: (dispatch, resource) => {
22             dispatch<any>(openProjectCreateDialog(resource.uuid));
23         }
24     },
25     {
26         icon: RenameIcon,
27         name: "Edit project",
28         execute: (dispatch, resource) => {
29             dispatch<any>(openProjectUpdateDialog(resource));
30         }
31     },
32     {
33         component: ToggleFavoriteAction,
34         execute: (dispatch, resource) => {
35             dispatch<any>(toggleFavorite(resource)).then(() => {
36                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
37             });
38         }
39     },
40     {
41         component: ToggleTrashAction,
42         execute: (dispatch, resource) => {
43             dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.isTrashed!!));
44         }
45     },
46     {
47         icon: MoveToIcon,
48         name: "Move to",
49         execute: (dispatch, resource) => dispatch<any>(openMoveProjectDialog(resource))
50     },
51     {
52         icon: CopyIcon,
53         name: "Copy to project",
54         execute: (dispatch, resource) => {
55             // add code
56         }
57     },
58     {
59         icon: DetailsIcon,
60         name: "View details",
61         execute: dispatch => dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL())
62     }
63 ]];