@@ -17,9 +17,10 @@ export type Suggestion = {
17
17
18
18
export function useDatasourceFields ( datasource : BaseQuickwitDataSource , range : TimeRange ) {
19
19
const [ fields , setFields ] = useState < MetricFindValue [ ] > ( [ ] ) ;
20
+
20
21
useEffect ( ( ) => {
21
22
if ( datasource . getTagKeys ) {
22
- datasource . getTagKeys ( { searchable : true , range : range } ) . then ( setFields ) ;
23
+ datasource . getTagKeys ( { searchable : true , timeRange : range } ) . then ( setFields ) ;
23
24
}
24
25
} , [ datasource , range , setFields ] ) ;
25
26
@@ -29,7 +30,7 @@ export function useDatasourceFields(datasource: BaseQuickwitDataSource, range: T
29
30
const wordIsField = word . match ( / ( [ ^ : \s ] + ) : " ? ( [ ^ " \s ] * ) " ? / ) ;
30
31
if ( wordIsField ?. length ) {
31
32
const [ _match , fieldName , _fieldValue ] = wordIsField ;
32
- const candidateValues = await datasource . getTagValues ( { key : fieldName } ) ;
33
+ const candidateValues = await datasource . getTagValues ( { key : fieldName , timeRange : range } ) ;
33
34
suggestions . from = fieldName . length + 1 ; // Replace only the value part
34
35
suggestions . options = candidateValues . map ( v => ( {
35
36
type : 'text' ,
@@ -46,7 +47,7 @@ export function useDatasourceFields(datasource: BaseQuickwitDataSource, range: T
46
47
}
47
48
return suggestions ;
48
49
49
- } , [ datasource , fields ] ) ;
50
+ } , [ datasource , fields , range ] ) ;
50
51
51
52
return { fields, getSuggestions}
52
53
}
0 commit comments