15397: Fix usage of deprecated assertRegexpMatches.
[arvados.git] / services / workbench2 / src / views-components / dialog-forms / update-project-dialog.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { compose } from "redux";
6 import { reduxForm } from 'redux-form';
7 import { withDialog } from "store/dialog/with-dialog";
8 import { DialogProjectUpdate } from 'views-components/dialog-update/dialog-project-update';
9 import { PROJECT_UPDATE_FORM_NAME, ProjectUpdateFormDialogData } from 'store/projects/project-update-actions';
10 import { updateProject, updateGroup } from 'store/workbench/workbench-actions';
11 import { GroupClass } from "models/group";
12
13 export const UpdateProjectDialog = compose(
14     withDialog(PROJECT_UPDATE_FORM_NAME),
15     reduxForm<ProjectUpdateFormDialogData>({
16         form: PROJECT_UPDATE_FORM_NAME,
17         onSubmit: (data, dispatch, props) => {
18             switch (props.data.sourcePanel) {
19                 case GroupClass.PROJECT:
20                     dispatch(updateProject(data));
21                     break;
22                 case GroupClass.ROLE:
23                     dispatch(updateGroup(data));
24                     break;
25                 default:
26                     break;
27             }
28         }
29     })
30 )(DialogProjectUpdate);