Fix various search issues
[arvados.git] / src / views-components / dialog-create / dialog-collection-create.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { InjectedFormProps, Field } from 'redux-form';
7 import { WithDialogProps } from '~/store/dialog/with-dialog';
8 import { CollectionCreateFormDialogData } from '~/store/collections/collection-create-actions';
9 import { FormDialog } from '~/components/form-dialog/form-dialog';
10 import { CollectionNameField, CollectionDescriptionField } from '~/views-components/form-fields/collection-form-fields';
11 import { require } from '~/validators/require';
12 import { FileUploaderField } from '../file-uploader/file-uploader';
13
14
15 type DialogCollectionProps = WithDialogProps<{}> & InjectedFormProps<CollectionCreateFormDialogData>;
16
17 export const DialogCollectionCreate = (props: DialogCollectionProps) =>
18     <FormDialog
19         dialogTitle='New collection'
20         formFields={CollectionAddFields}
21         submitLabel='Create a Collection'
22         {...props}
23     />;
24
25 const CollectionAddFields = () => <span>
26     <CollectionNameField />
27     <CollectionDescriptionField />
28     <Field
29         name='files'
30         validate={[require]}
31         label='Files'
32         component={FileUploaderField} />
33 </span>;
34