X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/cf3a9e014c504405624cc704dda509f38b38ef7b..d892b953431e67c2c8df25c4387f2111b88b820f:/src/views-components/resource-properties-form/resource-properties-form.tsx

diff --git a/src/views-components/resource-properties-form/resource-properties-form.tsx b/src/views-components/resource-properties-form/resource-properties-form.tsx
index c881928c..979d772e 100644
--- a/src/views-components/resource-properties-form/resource-properties-form.tsx
+++ b/src/views-components/resource-properties-form/resource-properties-form.tsx
@@ -2,29 +2,37 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { InjectedFormProps, reduxForm } from 'redux-form';
-import { Grid, withStyles } from '@material-ui/core';
-import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME } from './property-key-field';
-import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME } from './property-value-field';
-import { ProgressButton } from '~/components/progress-button/progress-button';
+import React from 'react';
+import { InjectedFormProps } from 'redux-form';
+import { Grid, withStyles, WithStyles } from '@material-ui/core';
+import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME, PROPERTY_KEY_FIELD_ID } from './property-key-field';
+import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME, PROPERTY_VALUE_FIELD_ID } from './property-value-field';
+import { ProgressButton } from 'components/progress-button/progress-button';
+import { GridClassKey } from '@material-ui/core/Grid';
 
 export interface ResourcePropertiesFormData {
+    uuid: string;
     [PROPERTY_KEY_FIELD_NAME]: string;
+    [PROPERTY_KEY_FIELD_ID]: string;
     [PROPERTY_VALUE_FIELD_NAME]: string;
+    [PROPERTY_VALUE_FIELD_ID]: string;
 }
 
-export const ResourcePropertiesForm = ({ handleSubmit, submitting, invalid }: InjectedFormProps<ResourcePropertiesFormData>) =>
-    <form onSubmit={handleSubmit}>
-        <Grid container spacing={16}>
+export type ResourcePropertiesFormProps = {uuid: string; } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string; }> & WithStyles<GridClassKey>;
+
+export const ResourcePropertiesForm = ({ handleSubmit, change, submitting, invalid, classes, uuid }: ResourcePropertiesFormProps ) => {
+    change('uuid', uuid); // Sets the uuid field to the uuid of the resource.
+    return <form data-cy='resource-properties-form' onSubmit={handleSubmit}>
+        <Grid container spacing={16} classes={classes}>
             <Grid item xs>
                 <PropertyKeyField />
             </Grid>
             <Grid item xs>
                 <PropertyValueField />
             </Grid>
-            <Grid item xs>
+            <Grid item>
                 <Button
+                    data-cy='property-add-btn'
                     disabled={invalid}
                     loading={submitting}
                     color='primary'
@@ -34,8 +42,8 @@ export const ResourcePropertiesForm = ({ handleSubmit, submitting, invalid }: In
                 </Button>
             </Grid>
         </Grid>
-    </form>;
+    </form>};
 
-const Button = withStyles(theme => ({
+export const Button = withStyles(theme => ({
     root: { marginTop: theme.spacing.unit }
 }))(ProgressButton);
