@@ -29,12 +29,12 @@ import { getRecordsByStaticSlice, searchRecordsExtended } from "@/src/services/b
2929import { staticDataSlicesCurrentCount } from "@/src/services/base/dataSlices" ;
3030import KernButton from "@/submodules/react-components/components/kern-button/KernButton" ;
3131import { MemoIconArrowDown , MemoIconArrowsRandom , MemoIconFilterOff , MemoIconPlus , MemoIconPointerOff , MemoIconTrash } from "@/submodules/react-components/components/kern-icons/icons" ;
32- import { useConsoleLog } from "@/submodules/react- components/hooks/useConsoleLog " ;
32+ import { SearchGroupsProps } from "@/src/types/ components/projects/projectId/data-browser/data-browser " ;
3333
3434const GROUP_SORT_ORDER = 0 ;
3535let GLOBAL_SEARCH_GROUP_COUNT = 0 ;
3636
37- export default function SearchGroups ( ) {
37+ export default function SearchGroups ( props : SearchGroupsProps ) {
3838 const dispatch = useDispatch ( ) ;
3939
4040 const projectId = useSelector ( selectProjectId ) ;
@@ -97,7 +97,7 @@ export default function SearchGroups() {
9797 } ) ;
9898 setBackgroundColors ( colors ) ;
9999 setAttributeSortOrder ( attributesSort ) ;
100- } , [ attributes ] ) ;
100+ } , [ attributes , props . clearRequest ] ) ;
101101
102102 useEffect ( ( ) => {
103103 if ( ! attributesSortOrder || ! searchGroupsStore ) return ;
@@ -339,10 +339,10 @@ export default function SearchGroups() {
339339 }
340340 if ( attributeType == DataTypeEnum . TEXT_LIST ) {
341341 operatorsCopy . push ( {
342- value : SearchOperator . CONTAINS . split ( "_" ) . join ( " " ) ,
342+ value : SearchOperator . EQUAL . split ( "_" ) . join ( " " ) ,
343343 } ) ;
344- tooltipsCopy . push ( getSearchOperatorTooltip ( SearchOperator . CONTAINS ) ) ;
345- formControlsIdx [ 'operator' ] = SearchOperator . CONTAINS ;
344+ tooltipsCopy . push ( getSearchOperatorTooltip ( SearchOperator . EQUAL ) ) ;
345+ formControlsIdx [ 'operator' ] = SearchOperator . EQUAL ;
346346
347347 } else if ( attributeType !== DataTypeEnum . BOOLEAN ) {
348348 for ( let t of Object . values ( SearchOperator ) ) {
@@ -365,8 +365,6 @@ export default function SearchGroups() {
365365 dispatch ( setFullSearchStore ( fullSearchCopy ) ) ;
366366 }
367367
368- useConsoleLog ( uniqueValuesDict , 'uniqueValuesDict' ) ;
369-
370368 function removeSearchGroupItem ( groupKey , index ) {
371369 const fullSearchCopy = jsonCopy ( fullSearchStore ) ;
372370 fullSearchCopy [ groupKey ] . groupElements . splice ( index , 1 ) ;
@@ -622,17 +620,17 @@ export default function SearchGroups() {
622620 < div className = "flex-grow mr-2.5 flex flex-col mt-2 " >
623621 < div className = "flex-grow flex flex-row flex-wrap gap-1" >
624622 < div style = { { width : groupItem . operator != '' ? '49%' : '100%' } } >
625- < KernDropdown options = { attributesSortOrder } buttonName = { groupItem . name } backgroundColors = { backgroundColors }
626- selectedOption = { ( option : any ) => selectValueDropdown ( option . name , index , 'name' , group . key ) } fontClass = "font-dmMono" buttonClasses = "text-xs" />
623+ { attributesSortOrder && < KernDropdown options = { attributesSortOrder } buttonName = { groupItem . name } backgroundColors = { backgroundColors }
624+ selectedOption = { ( option : any ) => selectValueDropdown ( option . name , index , 'name' , group . key ) } fontClass = "font-dmMono" buttonClasses = "text-xs" /> }
627625 </ div >
628626 < div style = { { width : '49%' } } >
629- { groupItem . operator != '' &&
627+ { ( groupItem . operator != '' && operatorsDropdown ) &&
630628 < KernDropdown options = { operatorsDropdown } buttonName = { groupItem . operator } tooltipsArray = { tooltipsArray } tooltipArrayPlacement = "right" buttonClasses = "text-xs"
631629 selectedOption = { ( option : any ) => selectValueDropdown ( option . value , index , 'operator' , group . key ) } fontClass = "font-dmMono" />
632630 }
633631 </ div >
634632 </ div >
635- { ( uniqueValuesDict [ groupItem [ 'name' ] ] && groupItem [ 'operator' ] != '' && groupItem [ 'operator' ] != 'BETWEEN' && groupItem [ 'operator' ] != 'IN' && groupItem [ 'operator' ] != 'IN WC' || saveAttributeType == DataTypeEnum . TEXT_LIST ) ? (
633+ { ( uniqueValuesDict && uniqueValuesDict [ groupItem [ 'name' ] ] && groupItem [ 'operator' ] != '' && groupItem [ 'operator' ] != 'BETWEEN' && groupItem [ 'operator' ] != 'IN' && groupItem [ 'operator' ] != 'IN WC' || saveAttributeType == DataTypeEnum . TEXT_LIST ) ? (
636634 < div className = "my-2" >
637635 < KernDropdown options = { uniqueValuesDict [ groupItem [ 'name' ] ] } buttonName = { groupItem [ 'searchValue' ] ? groupItem [ 'searchValue' ] : 'Select value' }
638636 selectedOption = { ( option : any ) => selectValueDropdown ( option , index , 'searchValue' , group . key ) } fontClass = "font-dmMono" />
@@ -651,7 +649,7 @@ export default function SearchGroups() {
651649 </ div >
652650 ) }
653651
654- { ( groupItem [ 'operator' ] == "BEGINS WITH" || groupItem [ 'operator' ] == "ENDS WITH" || groupItem [ 'operator' ] == SearchOperator . CONTAINS || groupItem [ 'operator' ] == "IN WC" ) && ( saveAttributeType != DataTypeEnum . INTEGER && saveAttributeType != DataTypeEnum . FLOAT ) &&
652+ { ( groupItem [ 'operator' ] == "BEGINS WITH" || groupItem [ 'operator' ] == "ENDS WITH" || groupItem [ 'operator' ] == SearchOperator . CONTAINS || groupItem [ 'operator' ] == "IN WC" ) && ( saveAttributeType != DataTypeEnum . INTEGER && saveAttributeType != DataTypeEnum . FLOAT && saveAttributeType != DataTypeEnum . TEXT_LIST ) &&
655653 < label htmlFor = "caseSensitive" className = "text-xs text-gray-500 cursor-pointer flex items-center pb-2" >
656654 < input name = "caseSensitive" className = "mr-1 cursor-pointer" id = "caseSensitive"
657655 onChange = { ( e : any ) => selectValueDropdown ( e . target . checked , index , 'caseSensitive' , group . key ) } type = "checkbox" /> Case sensitive</ label > }
0 commit comments