15768: fixed rename of single collection bug Arvados-DCO-1.1-Signed-off-by: Lisa...
[arvados.git] / src / views-components / collection-properties / create-collection-properties-form.tsx
index 8e3f8eb8e2b37b0ea7095f78c7df60a8d3e55a1d..fb18bb1ad818e362fb03028bdba204f285235aba 100644 (file)
@@ -2,22 +2,23 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { reduxForm, reset } from 'redux-form';
+import { reduxForm, change } from 'redux-form';
 import { withStyles } from '@material-ui/core';
 import {
     COLLECTION_CREATE_PROPERTIES_FORM_NAME,
-    addPropertyToCreateCollectionForm
+    COLLECTION_CREATE_FORM_NAME
 } from 'store/collections/collection-create-actions';
 import {
     ResourcePropertiesForm,
     ResourcePropertiesFormData
 } from 'views-components/resource-properties-form/resource-properties-form';
+import { addPropertyToResourceForm } from 'store/resources/resources-actions';
+import { PROPERTY_VALUE_FIELD_NAME } from 'views-components/resource-properties-form/property-value-field';
 
 const Form = withStyles(
     ({ spacing }) => (
         { container:
             {
-                paddingTop: spacing.unit,
                 margin: 0,
             }
         })
@@ -26,7 +27,7 @@ const Form = withStyles(
 export const CreateCollectionPropertiesForm = reduxForm<ResourcePropertiesFormData>({
     form: COLLECTION_CREATE_PROPERTIES_FORM_NAME,
     onSubmit: (data, dispatch) => {
-        dispatch(addPropertyToCreateCollectionForm(data));
-        dispatch(reset(COLLECTION_CREATE_PROPERTIES_FORM_NAME));
+        dispatch(addPropertyToResourceForm(data, COLLECTION_CREATE_FORM_NAME));
+        dispatch(change(COLLECTION_CREATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
     }
 })(Form);
\ No newline at end of file