1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { compose } from "redux";
6 import { reduxForm } from 'redux-form';
7 import { withDialog } from "store/dialog/with-dialog";
8 import { PROJECT_CREATE_FORM_NAME, ProjectCreateFormDialogData } from 'store/projects/project-create-actions';
9 import { DialogProjectCreate } from 'views-components/dialog-create/dialog-project-create';
10 import { createProject } from "store/workbench/workbench-actions";
11 import { GroupClass } from "models/group";
12 import { createGroup } from "store/groups-panel/groups-panel-actions";
14 export const CreateProjectDialog = compose(
15 withDialog(PROJECT_CREATE_FORM_NAME),
16 reduxForm<ProjectCreateFormDialogData>({
17 form: PROJECT_CREATE_FORM_NAME,
18 onSubmit: (data, dispatch, props) => {
19 switch (props.data.sourcePanel) {
20 case GroupClass.PROJECT:
21 dispatch(createProject(data));
24 dispatch(createGroup(data));
31 )(DialogProjectCreate);