add edit process - actions, dialogs and files
[arvados-workbench2.git] / src / views-components / form-fields / collection-form-fields.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 { Field, WrappedFieldProps } from "redux-form";
7 import { TextField } from "~/components/text-field/text-field";
8 import { COLLECTION_NAME_VALIDATION, COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION } from "~/validators/validators";
9 import { ProjectTreePicker } from "~/views-components/project-tree-picker/project-tree-picker";
10
11 export const CollectionNameField = () =>
12     <Field
13         name='name'
14         component={TextField}
15         validate={COLLECTION_NAME_VALIDATION}
16         label="Collection Name" />;
17
18 export const CollectionDescriptionField = () =>
19     <Field
20         name='description'
21         component={TextField}
22         validate={COLLECTION_DESCRIPTION_VALIDATION}
23         label="Description - optional" />;
24
25 export const CollectionProjectPickerField = () =>
26     <Field
27         name="projectUuid"
28         component={ProjectPicker}
29         validate={COLLECTION_PROJECT_VALIDATION} />;
30
31 const ProjectPicker = (props: WrappedFieldProps) =>
32     <div style={{ width: '400px', height: '144px', display: 'flex', flexDirection: 'column' }}>
33         <ProjectTreePicker onChange={projectUuid => props.input.onChange(projectUuid)} />
34     </div>;