X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/77c5d854b58b46395c5db5531268494d40f27786..4c34de655fc7f8839b205b48f460a168f302dd63:/src/views-components/form-fields/collection-form-fields.tsx

diff --git a/src/views-components/form-fields/collection-form-fields.tsx b/src/views-components/form-fields/collection-form-fields.tsx
index 7e18111a67..7d5fcf8035 100644
--- a/src/views-components/form-fields/collection-form-fields.tsx
+++ b/src/views-components/form-fields/collection-form-fields.tsx
@@ -9,12 +9,13 @@ import {
     COLLECTION_NAME_VALIDATION, COLLECTION_NAME_VALIDATION_ALLOW_SLASH,
     COLLECTION_DESCRIPTION_VALIDATION, COLLECTION_PROJECT_VALIDATION
 } from "validators/validators";
-import { ProjectTreePickerField, CollectionTreePickerField } from "views-components/projects-tree-picker/tree-picker-field";
+import { ProjectTreePickerField, CollectionTreePickerField, DirectoryTreePickerField } from "views-components/projects-tree-picker/tree-picker-field";
 import { PickerIdProp } from 'store/tree-picker/picker-id';
 import { connect } from "react-redux";
 import { RootState } from "store/store";
 import { MultiCheckboxField } from "components/checkbox-field/checkbox-field";
 import { getStorageClasses } from "common/config";
+import { ERROR_MESSAGE } from "validators/require";
 
 interface CollectionNameFieldProps {
     validate: Validator[];
@@ -58,6 +59,15 @@ export const CollectionPickerField = (props: PickerIdProp) =>
         component={CollectionTreePickerField}
         validate={COLLECTION_PROJECT_VALIDATION} />;
 
+const validateDirectory = (val) => (val && val.uuid ? undefined : ERROR_MESSAGE);
+
+export const DirectoryPickerField = (props: PickerIdProp) =>
+    <Field
+        name="destination"
+        pickerId={props.pickerId}
+        component={DirectoryTreePickerField as any}
+        validate={validateDirectory} />;
+
 interface StorageClassesProps {
     items: string[];
     defaultClasses?: string[];
@@ -78,4 +88,4 @@ export const CollectionStorageClassesField = connect(
             defaultValues={props.defaultClasses}
             helperText='At least one class should be selected'
             component={MultiCheckboxField}
-            items={props.items} />);
\ No newline at end of file
+            items={props.items} />);
