Merge branch '21394-docker-tag-push'
[arvados.git] / services / workbench2 / src / views-components / project-properties / update-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, change } from 'redux-form';
6 import { withStyles } from '@material-ui/core';
7 import {
8     PROJECT_UPDATE_PROPERTIES_FORM_NAME,
9     PROJECT_UPDATE_FORM_NAME
10 } from 'store/projects/project-update-actions';
11 import {
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';
17
18 const Form = withStyles(
19     ({ spacing }) => (
20         { container:
21             {
22                 margin: 0,
23             }
24         })
25     )(ResourcePropertiesForm);
26
27 export const UpdateProjectPropertiesForm = reduxForm<ResourcePropertiesFormData>({
28     form: PROJECT_UPDATE_PROPERTIES_FORM_NAME,
29     onSubmit: (data, dispatch) => {
30         dispatch(addPropertyToResourceForm(data, PROJECT_UPDATE_FORM_NAME));
31         dispatch(change(PROJECT_UPDATE_PROPERTIES_FORM_NAME, PROPERTY_VALUE_FIELD_NAME, ''));
32     }
33 })(Form);