X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/92b4ae921e7393c504d846c6476766aec57da313..2d230988f0c91d088e68bc0aecb1fd91d52c1f1f:/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 90a6a301..c4dc494b 100644 --- a/src/views-components/resource-properties-form/property-field-common.tsx +++ b/src/views-components/resource-properties-form/property-field-common.tsx @@ -2,13 +2,11 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ChangeEvent } from 'react'; import { connect } from 'react-redux'; -import { change, WrappedFieldMetaProps, WrappedFieldInputProps, WrappedFieldProps, reset } from 'redux-form'; -import { Vocabulary, PropFieldSuggestion } from '~/models/vocabulary'; -import { RootState } from '~/store/store'; -import { getVocabulary } from '~/store/vocabulary/vocabulary-selectors'; -import { PROPERTY_KEY_FIELD_ID } from './property-key-field'; +import { change, WrappedFieldMetaProps, WrappedFieldInputProps, WrappedFieldProps } from 'redux-form'; +import { Vocabulary, PropFieldSuggestion } from 'models/vocabulary'; +import { RootState } from 'store/store'; +import { getVocabulary } from 'store/vocabulary/vocabulary-selectors'; export interface VocabularyProp { vocabulary: Vocabulary; @@ -70,19 +68,3 @@ export const handleSelect = ( dispatch(change(formName, fieldName, item.id)); } }; - -export const handleChange = ( - fieldName: string, - formName: string, - { onChange }: WrappedFieldInputProps, - { dispatch }: WrappedFieldMetaProps) => - (value: ChangeEvent) => { - if (fieldName === PROPERTY_KEY_FIELD_ID) { - // Properties' values are dependant on the keys, if any value is - // pre-existant, a change on the property key should mean that the - // previous value is invalid. - dispatch(reset(formName)); - } - onChange(value); - dispatch(change(formName, fieldName, value)); - }; \ No newline at end of file