17782: Fixes almost all tests (4 left) mostly by fixing namespace-type imports.
[arvados.git] / src / views-components / dialog-move / dialog-move-to.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from "react";
6 import { memoize } from 'lodash/fp';
7 import { InjectedFormProps, Field } from 'redux-form';
8 import { WithDialogProps } from 'store/dialog/with-dialog';
9 import { FormDialog } from 'components/form-dialog/form-dialog';
10 import { ProjectTreePickerField } from 'views-components/projects-tree-picker/tree-picker-field';
11 import { MOVE_TO_VALIDATION } from 'validators/validators';
12 import { MoveToFormDialogData } from 'store/move-to-dialog/move-to-dialog';
13 import { PickerIdProp } from "store/tree-picker/picker-id";
14
15 export const DialogMoveTo = (props: WithDialogProps<string> & InjectedFormProps<MoveToFormDialogData> & PickerIdProp) =>
16     <FormDialog
17         dialogTitle='Move to'
18         formFields={MoveToDialogFields(props.pickerId)}
19         submitLabel='Move'
20         {...props}
21     />;
22
23 const MoveToDialogFields = memoize(
24     (pickerId: string) => () =>
25         <Field
26             name="ownerUuid"
27             pickerId={pickerId}
28             component={ProjectTreePickerField}
29             validate={MOVE_TO_VALIDATION} />);
30