09c847c33329783a8760179a3a9c1e4c552686b9
[arvados-workbench2.git] / src / views-components / project-properties-dialog / project-properties-form.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { reduxForm, reset } from 'redux-form';
6 import { PROJECT_PROPERTIES_FORM_NAME, createProjectProperty } from 'store/details-panel/details-panel-action';
7 import { ResourcePropertiesForm, ResourcePropertiesFormData } from 'views-components/resource-properties-form/resource-properties-form';
8 import { withStyles } from '@material-ui/core';
9
10 const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.unit * 2 } }))(ResourcePropertiesForm);
11
12 export const ProjectPropertiesForm = reduxForm<ResourcePropertiesFormData>({
13     form: PROJECT_PROPERTIES_FORM_NAME,
14     onSubmit: (data, dispatch) => {
15         dispatch<any>(createProjectProperty(data));
16         dispatch(reset(PROJECT_PROPERTIES_FORM_NAME));
17     }
18 })(Form);