@@ -17,9 +17,10 @@ export type Suggestion = {
1717
1818export function useDatasourceFields ( datasource : BaseQuickwitDataSource , range : TimeRange ) {
1919 const [ fields , setFields ] = useState < MetricFindValue [ ] > ( [ ] ) ;
20+
2021 useEffect ( ( ) => {
2122 if ( datasource . getTagKeys ) {
22- datasource . getTagKeys ( { searchable : true , range : range } ) . then ( setFields ) ;
23+ datasource . getTagKeys ( { searchable : true , timeRange : range } ) . then ( setFields ) ;
2324 }
2425 } , [ datasource , range , setFields ] ) ;
2526
@@ -29,7 +30,7 @@ export function useDatasourceFields(datasource: BaseQuickwitDataSource, range: T
2930 const wordIsField = word . match ( / ( [ ^ : \s ] + ) : " ? ( [ ^ " \s ] * ) " ? / ) ;
3031 if ( wordIsField ?. length ) {
3132 const [ _match , fieldName , _fieldValue ] = wordIsField ;
32- const candidateValues = await datasource . getTagValues ( { key : fieldName } ) ;
33+ const candidateValues = await datasource . getTagValues ( { key : fieldName , timeRange : range } ) ;
3334 suggestions . from = fieldName . length + 1 ; // Replace only the value part
3435 suggestions . options = candidateValues . map ( v => ( {
3536 type : 'text' ,
@@ -46,7 +47,7 @@ export function useDatasourceFields(datasource: BaseQuickwitDataSource, range: T
4647 }
4748 return suggestions ;
4849
49- } , [ datasource , fields ] ) ;
50+ } , [ datasource , fields , range ] ) ;
5051
5152 return { fields, getSuggestions}
5253}
0 commit comments