1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { reduxForm, change } from 'redux-form';
6 import { withStyles } from '@material-ui/core';
8 COLLECTION_CREATE_PROPERTIES_FORM_NAME,
9 COLLECTION_CREATE_FORM_NAME
10 } from 'store/collections/collection-create-actions';
12 ResourcePropertiesForm,
13 ResourcePropertiesFormData
14 } from 'views-components/resource-properties-form/resource-properties-form';
15 import { addPropertyToResourceForm } from 'store/resources/resources-actions';
16 import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
18 const Form = withStyles(
25 )(ResourcePropertiesForm);
27 export const CreateCollectionPropertiesForm = reduxForm<ResourcePropertiesFormData>({
28 form: COLLECTION_CREATE_PROPERTIES_FORM_NAME,
29 onSubmit: (data, dispatch) => {
30 dispatch(addPropertyToResourceForm(data, COLLECTION_CREATE_FORM_NAME));
31 dispatch(change(COLLECTION_CREATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));