1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { InjectedFormProps, Field, WrappedFieldProps } from "redux-form";
7 import { WithDialogProps } from "~/store/dialog/with-dialog";
8 import { TextField } from "~/components/text-field/text-field";
9 import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
10 import { ProjectTreePicker } from "../project-tree-picker/project-tree-picker";
11 import { FormDialog } from '../../components/form-dialog/form-dialog';
13 export const DialogCollectionCreateWithSelected = (props: WithDialogProps<string> & InjectedFormProps<{ name: string }>) =>
15 dialogTitle='Create a collection'
16 formFields={FormFields}
17 submitLabel='Create a collection'
21 const FormFields = () => <div style={{ display: 'flex' }}>
26 validate={COLLECTION_NAME_VALIDATION}
27 label="Collection Name" />
31 validate={COLLECTION_DESCRIPTION_VALIDATION}
32 label="Description - optional" />
37 validate={COLLECTION_PROJECT_VALIDATION} />
40 const Picker = (props: WrappedFieldProps) =>
41 <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
42 <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />