18219: Adds property editor to groups create dialog.
[arvados-workbench2.git] / src / views-components / resource-properties-dialog / resource-properties-dialog-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 { RESOURCE_PROPERTIES_FORM_NAME } 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 import { Dispatch } from 'redux';
10 import { createResourceProperty } from 'store/resources/resources-actions';
11
12 const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.unit * 2 } }))(ResourcePropertiesForm);
13
14 export const ResourcePropertiesDialogForm = reduxForm<ResourcePropertiesFormData, {uuid: string}>({
15     form: RESOURCE_PROPERTIES_FORM_NAME,
16     onSubmit: (data, dispatch: Dispatch) => {
17         dispatch<any>(createResourceProperty(data));
18         dispatch(reset(RESOURCE_PROPERTIES_FORM_NAME));
19     }
20 })(Form);