1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
4 import * as React from "react";
5 import { Field, InjectedFormProps, WrappedFieldProps } from "redux-form";
6 import { Dialog, DialogTitle, DialogContent, DialogActions, Button, CircularProgress } from "@material-ui/core";
7 import { WithDialogProps } from "~/store/dialog/with-dialog";
8 import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
9 import { MAKE_A_COPY_VALIDATION, COPY_NAME_VALIDATION } from "~/validators/validators";
10 import { TextField } from '~/components/text-field/text-field';
12 export interface CopyFormData {
18 export const MakeACopyDialog = (props: WithDialogProps<string> & InjectedFormProps<CopyFormData>) =>
20 <Dialog open={props.open}
21 disableBackdropClick={true}
22 disableEscapeKeyDown={true}>
23 <DialogTitle>Make a copy</DialogTitle>
28 validate={COPY_NAME_VALIDATION}
29 label="Enter a new name for the copy" />
33 validate={MAKE_A_COPY_VALIDATION} />
39 disabled={props.submitting}
40 onClick={props.closeDialog}>
47 onClick={props.handleSubmit}
48 disabled={props.pristine || props.invalid || props.submitting}>
49 {props.submitting ? <CircularProgress size={20} /> : 'Copy'}
54 const Picker = (props: WrappedFieldProps) =>
55 <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
56 <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />