15064: Save/load homeCluster from localStorage.
[arvados.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 } 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 { ProjectTreePickerField, CollectionTreePickerField } from "~/views-components/project-tree-picker/project-tree-picker";
10 import { PickerIdProp } from '~/store/tree-picker/picker-id';
11
12 export const CollectionNameField = () =>
13     <Field
14         name='name'
15         component={TextField}
16         validate={COLLECTION_NAME_VALIDATION}
17         label="Collection Name"
18         autoFocus={true} />;
19
20 export const CollectionDescriptionField = () =>
21     <Field
22         name='description'
23         component={TextField}
24         validate={COLLECTION_DESCRIPTION_VALIDATION}
25         label="Description - optional" />;
26
27 export const CollectionProjectPickerField = (props: PickerIdProp) =>
28     <Field
29         name="projectUuid"
30         pickerId={props.pickerId}
31         component={ProjectTreePickerField}
32         validate={COLLECTION_PROJECT_VALIDATION} />;
33
34 export const CollectionPickerField = (props: PickerIdProp) =>
35     <Field
36         name="collectionUuid"
37         pickerId={props.pickerId}
38         component={CollectionTreePickerField}
39         validate={COLLECTION_PROJECT_VALIDATION} />;