Merge branch '15803-unsetup' refs #15803
[arvados-workbench2.git] / src / views-components / dialog-copy / dialog-partial-copy-to-collection.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 { memoize } from "lodash/fp";
7 import { FormDialog } from '~/components/form-dialog/form-dialog';
8 import { WithDialogProps } from '~/store/dialog/with-dialog';
9 import { InjectedFormProps } from 'redux-form';
10 import { CollectionPartialCopyToSelectedCollectionFormData } from '~/store/collections/collection-partial-copy-actions';
11 import { PickerIdProp } from "~/store/tree-picker/picker-id";
12 import { CollectionPickerField } from '~/views-components/form-fields/collection-form-fields';
13
14 type DialogCollectionPartialCopyProps = WithDialogProps<string> & InjectedFormProps<CollectionPartialCopyToSelectedCollectionFormData>;
15
16 export const DialogCollectionPartialCopyToSelectedCollection = (props: DialogCollectionPartialCopyProps & PickerIdProp) =>
17     <FormDialog
18         dialogTitle='Choose collection'
19         formFields={CollectionPartialCopyFields(props.pickerId)}
20         submitLabel='Copy files'
21         {...props}
22     />;
23
24 export const CollectionPartialCopyFields = memoize(
25     (pickerId: string) =>
26         () =>
27             <div>
28                 <CollectionPickerField {...{ pickerId }}/>
29             </div>);