1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { InjectedFormProps } from 'redux-form';
7 import { Grid, withStyles, WithStyles } from '@material-ui/core';
8 import { PropertyKeyField, PROPERTY_KEY_FIELD_NAME, PROPERTY_KEY_FIELD_ID } from './property-key-field';
9 import { PropertyValueField, PROPERTY_VALUE_FIELD_NAME, PROPERTY_VALUE_FIELD_ID } from './property-value-field';
10 import { ProgressButton } from 'components/progress-button/progress-button';
11 import { GridClassKey } from '@material-ui/core/Grid';
13 export interface ResourcePropertiesFormData {
15 [PROPERTY_KEY_FIELD_NAME]: string;
16 [PROPERTY_KEY_FIELD_ID]: string;
17 [PROPERTY_VALUE_FIELD_NAME]: string;
18 [PROPERTY_VALUE_FIELD_ID]: string;
21 export type ResourcePropertiesFormProps = {uuid: string; } & InjectedFormProps<ResourcePropertiesFormData, {uuid: string; }> & WithStyles<GridClassKey>;
23 export const ResourcePropertiesForm = ({ handleSubmit, change, submitting, invalid, classes, uuid }: ResourcePropertiesFormProps ) => {
24 change('uuid', uuid); // Sets the uuid field to the uuid of the resource.
25 return <form data-cy='resource-properties-form' onSubmit={handleSubmit}>
26 <Grid container spacing={16} classes={classes}>
31 <PropertyValueField />
35 data-cy='property-add-btn'
47 export const Button = withStyles(theme => ({
48 root: { marginTop: theme.spacing.unit }