X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/6578e959652ed10a51424d1b66f80280164824dd..46751b9305a7e991d484494facd1f40790254d40:/src/views-components/resource-properties-form/property-key-field.tsx

diff --git a/src/views-components/resource-properties-form/property-key-field.tsx b/src/views-components/resource-properties-form/property-key-field.tsx
index 85cc07f6..3fb2d377 100644
--- a/src/views-components/resource-properties-form/property-key-field.tsx
+++ b/src/views-components/resource-properties-form/property-key-field.tsx
@@ -4,11 +4,11 @@
 
 import * as React from 'react';
 import { WrappedFieldProps, Field } from 'redux-form';
-import { identity, memoize } from 'lodash';
+import { memoize } from 'lodash';
 import { Autocomplete } from '~/components/autocomplete/autocomplete';
 import { Vocabulary } from '~/models/vocabulary';
-import { require } from '~/validators/require';
-import { ITEMS_PLACEHOLDER, connectVocabulary, VocabularyProp, hasError, getErrorMsg, handleBlur } from '~/views-components/resource-properties-form/property-field-common';
+import { connectVocabulary, VocabularyProp, buildProps } from '~/views-components/resource-properties-form/property-field-common';
+import { TAG_KEY_VALIDATION } from '~/validators/validators';
 
 export const PROPERTY_KEY_FIELD_NAME = 'key';
 
@@ -20,25 +20,18 @@ export const PropertyKeyField = connectVocabulary(
             vocabulary={vocabulary}
             validate={getValidation(vocabulary)} />);
 
-const PropertyKeyInput = ({ input, meta, vocabulary }: WrappedFieldProps & VocabularyProp) =>
+export const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) =>
     <Autocomplete
-        value={input.value}
-        onChange={input.onChange}
-        onBlur={handleBlur(input)}
         label='Key'
-        suggestions={getSuggestions(input.value, vocabulary)}
-        items={ITEMS_PLACEHOLDER}
-        onSelect={input.onChange}
-        renderSuggestion={identity}
-        error={hasError(meta)}
-        helperText={getErrorMsg(meta)}
+        suggestions={getSuggestions(props.input.value, vocabulary)}
+        {...buildProps(props)}
     />;
 
 const getValidation = memoize(
     (vocabulary: Vocabulary) =>
         vocabulary.strict
-            ? [require, matchTags(vocabulary)]
-            : [require]);
+            ? [...TAG_KEY_VALIDATION, matchTags(vocabulary)]
+            : TAG_KEY_VALIDATION);
 
 const matchTags = (vocabulary: Vocabulary) =>
     (value: string) =>
