1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as 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/project-tree-picker/project-tree-picker';
11 import { COPY_NAME_VALIDATION, COPY_FILE_VALIDATION } from '~/validators/validators';
12 import { TextField } from "~/components/text-field/text-field";
13 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
15 type CopyFormDialogProps = WithDialogProps<string> & InjectedFormProps<CopyFormDialogData>;
17 export const DialogCopy = (props: CopyFormDialogProps & { pickerId: string }) =>
19 dialogTitle='Make a copy'
20 formFields={CopyDialogFields(props.pickerId)}
25 const CopyDialogFields = memoize((pickerId: string) =>
31 validate={COPY_NAME_VALIDATION}
32 label="Enter a new name for the copy" />
35 component={ProjectTreePickerField}
36 validate={COPY_FILE_VALIDATION}