From f4e410a5984226818301332c25ac178403c2e0e9 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Mon, 17 Dec 2018 11:02:23 +0100 Subject: [PATCH] Replace advanced search properties fields with ones supporting vocablary Feature #14603 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- .../form-fields/search-bar-form-fields.tsx | 33 ++++++++++++------- .../property-key-field.tsx | 2 +- .../property-value-field.tsx | 4 +-- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/views-components/form-fields/search-bar-form-fields.tsx b/src/views-components/form-fields/search-bar-form-fields.tsx index da0b12b5..85abbe19 100644 --- a/src/views-components/form-fields/search-bar-form-fields.tsx +++ b/src/views-components/form-fields/search-bar-form-fields.tsx @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; -import { Field, WrappedFieldProps, FieldArray } from 'redux-form'; +import { Field, WrappedFieldProps, FieldArray, formValues } from 'redux-form'; import { TextField, DateTextField } from "~/components/text-field/text-field"; import { CheckboxField } from '~/components/checkbox-field/checkbox-field'; import { NativeSelectField } from '~/components/select-field/select-field'; @@ -14,6 +14,10 @@ import { SEARCH_BAR_ADVANCE_FORM_PICKER_ID } from '~/store/search-bar/search-bar import { SearchBarAdvancedPropertiesView } from '~/views-components/search-bar/search-bar-advanced-properties-view'; import { TreeItem } from "~/components/tree/tree"; import { ProjectsTreePickerItem } from "~/views-components/projects-tree-picker/generic-projects-tree-picker"; +import { PropertyKeyInput } from '~/views-components/resource-properties-form/property-key-field'; +import { PropertyValueInput, PropertyValueFieldProps } from '~/views-components/resource-properties-form/property-value-field'; +import { VocabularyProp, connectVocabulary } from '~/views-components/resource-properties-form/property-field-common'; +import { compose } from 'redux'; export const SearchBarTypeField = () => (_: any, { id }: TreeItem) => { props.input.onChange(id); } - }/> + } /> ; export const SearchBarTrashField = () => @@ -74,17 +78,22 @@ export const SearchBarPropertiesField = () => name="properties" component={SearchBarAdvancedPropertiesView} />; -export const SearchBarKeyField = () => - ; +export const SearchBarKeyField = connectVocabulary( + ({ vocabulary }: VocabularyProp) => + ); -export const SearchBarValueField = () => - ; +export const SearchBarValueField = compose( + connectVocabulary, + formValues({ propertyKey: 'key' }) +)( + (props: PropertyValueFieldProps) => + ); export const SearchBarSaveSearchField = () => ); -const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) => +export const PropertyKeyInput = ({ vocabulary, ...props }: WrappedFieldProps & VocabularyProp) => ); -const PropertyValueInput = ({ vocabulary, propertyKey, ...props }: WrappedFieldProps & PropertyValueFieldProps) => +export const PropertyValueInput = ({ vocabulary, propertyKey, ...props }: WrappedFieldProps & PropertyValueFieldProps) =>