X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/768d715efc5ecf3f0108a70f695e3c32e187c900..37ef971c0db3e1989dcab9268337bc92aa950499:/src/views-components/resource-properties-form/property-field-common.tsx

diff --git a/src/views-components/resource-properties-form/property-field-common.tsx b/src/views-components/resource-properties-form/property-field-common.tsx
index 028c46b9..5c935854 100644
--- a/src/views-components/resource-properties-form/property-field-common.tsx
+++ b/src/views-components/resource-properties-form/property-field-common.tsx
@@ -4,10 +4,9 @@
 
 import { connect } from 'react-redux';
 import { WrappedFieldMetaProps, WrappedFieldInputProps, WrappedFieldProps } from 'redux-form';
-import { identity } from 'lodash';
 import { Vocabulary } from '~/models/vocabulary';
 import { RootState } from '~/store/store';
-import { getVocabulary } from '~/store/vocabulary/vocabulary-selctors';
+import { getVocabulary } from '~/store/vocabulary/vocabulary-selectors';
 
 export interface VocabularyProp {
     vocabulary: Vocabulary;
@@ -33,13 +32,26 @@ export const handleBlur = ({ onBlur, value }: WrappedFieldInputProps) =>
     () =>
         onBlur(value);
 
-export const buildProps = ({ input, meta }: WrappedFieldProps) => ({
-    value: input.value,
-    onChange: input.onChange,
-    onBlur: handleBlur(input),
-    items: ITEMS_PLACEHOLDER,
-    onSelect: input.onChange,
-    renderSuggestion: identity,
-    error: hasError(meta),
-    helperText: getErrorMsg(meta),
-});
+export const handleSelect = ({ onChange }: WrappedFieldInputProps) => {
+    return (item:PropFieldSuggestion) => {
+        onChange(item.id);
+    };
+};
+
+export const buildProps = ({ input, meta }: WrappedFieldProps) => {
+    return {
+        value: input.value,
+        onChange: input.onChange,
+        onBlur: handleBlur(input),
+        items: ITEMS_PLACEHOLDER,
+        onSelect: handleSelect(input),
+        renderSuggestion: (item:PropFieldSuggestion) => item.label,
+        error: hasError(meta),
+        helperText: getErrorMsg(meta),
+    };
+};
+
+export interface PropFieldSuggestion {
+    "id": string;
+    "label": string;
+}
