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 { WithDialogProps } from 'store/dialog/with-dialog';
8 import { CollectionUpdateFormDialogData, COLLECTION_UPDATE_FORM_NAME } from 'store/collections/collection-update-actions';
9 import { FormDialog } from 'components/form-dialog/form-dialog';
12 CollectionDescriptionField,
13 CollectionStorageClassesField
14 } from 'views-components/form-fields/collection-form-fields';
15 import { UpdateCollectionPropertiesForm } from 'views-components/collection-properties/update-collection-properties-form';
16 import { FormGroup, FormLabel, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core';
17 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
19 type CssRules = 'propertiesForm';
21 const styles: StyleRulesCallback<CssRules> = theme => ({
23 marginTop: theme.spacing.unit * 2,
24 marginBottom: theme.spacing.unit * 2,
28 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionUpdateFormDialogData>;
30 export const DialogCollectionUpdate = (props: DialogCollectionProps) =>
32 dialogTitle='Edit Collection'
33 formFields={CollectionEditFields as any}
38 const UpdateCollectionPropertiesList = resourcePropertiesList(COLLECTION_UPDATE_FORM_NAME);
40 const CollectionEditFields = withStyles(styles)(
41 ({ classes }: WithStyles<CssRules>) => <span>
42 <CollectionNameField />
43 <CollectionDescriptionField />
44 <div className={classes.propertiesForm}>
45 <FormLabel>Properties</FormLabel>
47 <UpdateCollectionPropertiesForm />
48 <UpdateCollectionPropertiesList />
51 <CollectionStorageClassesField />