7ef6e4b3cd4b3b048bfa01b59801fb2b282f93a7
[arvados-workbench2.git] / src / views-components / dialog-forms / create-collection-dialog.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { compose } from "redux";
6 import { reduxForm } from 'redux-form';
7 import { withDialog } from "store/dialog/with-dialog";
8 import { COLLECTION_CREATE_FORM_NAME, CollectionCreateFormDialogData } from 'store/collections/collection-create-actions';
9 import { DialogCollectionCreate } from "views-components/dialog-create/dialog-collection-create";
10 import { createCollection } from "store/workbench/workbench-actions";
11
12 export const CreateCollectionDialog = compose(
13     withDialog(COLLECTION_CREATE_FORM_NAME),
14     reduxForm<CollectionCreateFormDialogData>({
15         form: COLLECTION_CREATE_FORM_NAME,
16         touchOnChange: true,
17         onSubmit: (data, dispatch) => {
18             // Somehow an extra field called 'files' gets added, copy
19             // the data object to get rid of it.
20             dispatch(createCollection({ ownerUuid: data.ownerUuid, name: data.name, description: data.description, storageClassesDesired: data.storageClassesDesired }));
21         }
22     })
23 )(DialogCollectionCreate);