1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { InjectedFormProps, Field } from 'redux-form';
7 import { WithDialogProps } from 'store/dialog/with-dialog';
8 import { CollectionCreateFormDialogData, COLLECTION_CREATE_FORM_NAME } from 'store/collections/collection-create-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 { FileUploaderField } from '../file-uploader/file-uploader';
16 import { ResourceParentField } from '../form-fields/resource-form-fields';
17 import { CreateCollectionPropertiesForm } from 'views-components/collection-properties/create-collection-properties-form';
18 import { CustomStyleRulesCallback } from 'common/custom-theme';
19 import { FormGroup, FormLabel } from '@mui/material';
20 import { WithStyles } from '@mui/styles';
21 import withStyles from '@mui/styles/withStyles';
22 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
24 type CssRules = 'propertiesForm';
26 const styles: CustomStyleRulesCallback<CssRules> = theme => ({
28 marginTop: theme.spacing(2),
29 marginBottom: theme.spacing(2),
33 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
35 export const DialogCollectionCreate = (props: DialogCollectionProps) =>
37 dialogTitle='New collection'
38 formFields={CollectionAddFields as any}
39 submitLabel='Create a Collection'
43 const CreateCollectionPropertiesList = resourcePropertiesList(COLLECTION_CREATE_FORM_NAME);
45 const CollectionAddFields = withStyles(styles)(
46 ({ classes }: WithStyles<CssRules>) => <span>
47 <ResourceParentField />
48 <CollectionNameField />
49 <CollectionDescriptionField />
50 <div className={classes.propertiesForm}>
51 <FormLabel>Properties</FormLabel>
53 <CreateCollectionPropertiesForm />
54 <CreateCollectionPropertiesList />
57 <CollectionStorageClassesField defaultClasses={['default']} />
61 component={FileUploaderField} />