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 { FormGroup, FormLabel, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
19 import { resourcePropertiesList } from 'views-components/resource-properties/resource-properties-list';
21 type CssRules = 'propertiesForm';
23 const styles: StyleRulesCallback<CssRules> = theme => ({
25 marginTop: theme.spacing.unit * 2,
26 marginBottom: theme.spacing.unit * 2,
30 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
32 export const DialogCollectionCreate = (props: DialogCollectionProps) =>
34 dialogTitle='New collection'
35 formFields={CollectionAddFields as any}
36 submitLabel='Create a Collection'
40 const CreateCollectionPropertiesList = resourcePropertiesList(COLLECTION_CREATE_FORM_NAME);
42 const CollectionAddFields = withStyles(styles)(
43 ({ classes }: WithStyles<CssRules>) => <span>
44 <ResourceParentField />
45 <CollectionNameField />
46 <CollectionDescriptionField />
47 <div className={classes.propertiesForm}>
48 <FormLabel>Properties</FormLabel>
50 <CreateCollectionPropertiesForm />
51 <CreateCollectionPropertiesList />
54 <CollectionStorageClassesField defaultClasses={['default']} />
58 component={FileUploaderField} />