init view log with props
[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 } 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
14 export const projectActionSet: ContextMenuActionSet = [[
15     {
16         icon: NewProjectIcon,
17         name: "New project",
18         execute: (dispatch, resource) => {
19             dispatch<any>(openProjectCreateDialog(resource.uuid));
20         }
21     },
22     {
23         icon: RenameIcon,
24         name: "Edit project",
25         execute: (dispatch, resource) => {
26             dispatch<any>(openProjectUpdateDialog(resource));
27         }
28     },
29     {
30         component: ToggleFavoriteAction,
31         execute: (dispatch, resource) => {
32             dispatch<any>(toggleFavorite(resource)).then(() => {
33                 dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
34             });
35         }
36     },
37     {
38         icon: MoveToIcon,
39         name: "Move to",
40         execute: (dispatch, resource) => dispatch<any>(openMoveProjectDialog(resource))
41     },
42     {
43         icon: CopyIcon,
44         name: "Copy to project",
45         execute: (dispatch, resource) => {
46             // add code
47         }
48     },
49 ]];