Skip to content

Commit

Permalink
Fix typo in getTagKeys options
Browse files Browse the repository at this point in the history
  • Loading branch information
ddelemeny committed Mar 26, 2024
1 parent ab85052 commit d04bae6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/LogContext/components/LogContextUI.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState, useCallback, useMemo } from "react";
import { LogRowModel, Field as GrafanaField, getDefaultTimeRange } from '@grafana/data';
import { LogRowModel, Field as GrafanaField } from '@grafana/data';
import { ElasticsearchQuery as DataQuery } from '../../types';
import { LuceneQueryEditor } from "../../components/LuceneQueryEditor";

Expand Down Expand Up @@ -54,8 +54,6 @@ export function LogContextUI(props: LogContextUIProps ){
const {row, origQuery, updateQuery, runContextQuery } = props;

const fieldsSuggestionTimeRange = useMemo(()=>createContextTimeRange(row.timeEpochMs), [row])
const defaultTimeRange = getDefaultTimeRange()
console.log("RANGES", fieldsSuggestionTimeRange, defaultTimeRange)
const {fields, getSuggestions} = useDatasourceFields(props.datasource, fieldsSuggestionTimeRange);

useEffect(()=>{
Expand Down
4 changes: 3 additions & 1 deletion src/datasource/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export type Suggestion = {

export function useDatasourceFields(datasource: BaseQuickwitDataSource, range: TimeRange) {
const [fields, setFields] = useState<MetricFindValue[]>([]);

console.log('from', range.from.toString())
useEffect(() => {
if (datasource.getTagKeys) {
datasource.getTagKeys({ searchable: true, range: range}).then(setFields);
datasource.getTagKeys({ searchable: true, timeRange: range}).then(setFields);
}
}, [datasource, range, setFields]);

Expand Down

0 comments on commit d04bae6

Please sign in to comment.