1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
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';
12 const Form = withStyles(({ spacing }) => ({ container: { marginBottom: spacing.unit * 2 } }))(ResourcePropertiesForm);
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));