update collections create and update (forms and dialogs)
[arvados.git] / src / views-components / context-menu / action-sets / root-project-action-set.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { reset } from "redux-form";
6
7 import { ContextMenuActionSet } from "../context-menu-action-set";
8 import { projectActions } from "~/store/project/project-action";
9 import { PROJECT_CREATE_DIALOG } from "../../dialog-create/dialog-project-create";
10 import { COLLECTION_CREATE_FORM_NAME, openCollectionCreateDialog } from '~/store/collections/collection-create-actions';
11 import { NewProjectIcon, CollectionIcon } from "~/components/icon/icon";
12
13 export const rootProjectActionSet: ContextMenuActionSet =  [[
14     {
15         icon: NewProjectIcon,
16         name: "New project",
17         execute: (dispatch, resource) => {
18             dispatch(reset(PROJECT_CREATE_DIALOG));
19             dispatch(projectActions.OPEN_PROJECT_CREATOR({ ownerUuid: resource.uuid }));
20         }
21     },
22     {
23         icon: CollectionIcon,
24         name: "New Collection",
25         execute: (dispatch, resource) => {
26             dispatch(reset(COLLECTION_CREATE_FORM_NAME));
27             dispatch<any>(openCollectionCreateDialog());
28         }
29     }
30 ]];