Create actions for panels using bindDataExplorerActions function, move panel identifi...
[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 { projectActions } from "../../../store/project/project-action";
7 import { NewProjectIcon } from "../../../components/icon/icon";
8 import { ToggleFavoriteAction } from "./favorite-action";
9 import { toggleFavorite } from "../../../store/favorites/favorites-actions";
10 import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
11
12 export const projectActionSet: ContextMenuActionSet = [[{
13     icon: NewProjectIcon,
14     name: "New project",
15     execute: (dispatch, resource) => {
16         dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
17     }
18 }, {
19     component: ToggleFavoriteAction,
20     execute: (dispatch, resource) => {
21         dispatch<any>(toggleFavorite(resource)).then(() => {
22             dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
23         });
24     }
25 }]];