11import { useEffect , useRef , useState } from 'react' ;
22import { useController , UseControllerProps } from 'react-hook-form' ;
33import { useHotkeys } from 'react-hotkeys-hook' ;
4- import { Field , TableConnection } from '@hyperdx/common-utils/dist/metadata' ;
4+ import {
5+ Field ,
6+ TableConnectionChoice ,
7+ } from '@hyperdx/common-utils/dist/metadata' ;
58import { genEnglishExplanation } from '@hyperdx/common-utils/dist/queryParser' ;
69
710import AutocompleteInput from '@/AutocompleteInput' ;
@@ -25,6 +28,7 @@ export class LuceneLanguageFormatter implements ILanguageFormatter {
2528
2629const luceneLanguageFormatter = new LuceneLanguageFormatter ( ) ;
2730export default function SearchInputV2 ( {
31+ tableConnection,
2832 tableConnections,
2933 placeholder = 'Search your events for anything...' ,
3034 size = 'sm' ,
@@ -38,7 +42,6 @@ export default function SearchInputV2({
3842 'data-testid' : dataTestId ,
3943 ...props
4044} : {
41- tableConnections ?: TableConnection | TableConnection [ ] ;
4245 placeholder ?: string ;
4346 size ?: 'xs' | 'sm' | 'lg' ;
4447 zIndex ?: number ;
@@ -49,7 +52,8 @@ export default function SearchInputV2({
4952 additionalSuggestions ?: string [ ] ;
5053 queryHistoryType ?: string ;
5154 'data-testid' ?: string ;
52- } & UseControllerProps < any > ) {
55+ } & UseControllerProps < any > &
56+ TableConnectionChoice ) {
5357 const {
5458 field : { onChange, value } ,
5559 } = useController ( props ) ;
@@ -59,9 +63,9 @@ export default function SearchInputV2({
5963
6064 const autoCompleteOptions = useAutoCompleteOptions (
6165 luceneLanguageFormatter ,
62- value != null ? `${ value } ` : '' , // value can be null at times
66+ value != null ? `${ value } ` : '' ,
6367 {
64- tableConnections,
68+ tableConnection : tableConnection ? tableConnection : tableConnections ,
6569 additionalSuggestions,
6670 } ,
6771 ) ;
0 commit comments