mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 04:09:17 +08:00
Loki: Send current time range when fetching labels and values (#26622)
* Send current time range when fetching labels and values in Explore * Pass range to Editors, in the same way as it was in Angular editors * Remove unused imports * Remove unused imports, props * Update * Update * Update refresh condition * Add comment
This commit is contained in:
@ -5,14 +5,16 @@ import LokiLanguageProvider from '../language_provider';
|
||||
|
||||
type LokiQueryFieldProps = Omit<
|
||||
LokiQueryFieldFormProps,
|
||||
'syntax' | 'syntaxLoaded' | 'onLoadOptions' | 'onLabelsRefresh' | 'logLabelOptions'
|
||||
'syntax' | 'syntaxLoaded' | 'onLoadOptions' | 'onLabelsRefresh' | 'logLabelOptions' | 'absoluteRange'
|
||||
>;
|
||||
|
||||
export const LokiQueryField: FunctionComponent<LokiQueryFieldProps> = props => {
|
||||
const { datasource, absoluteRange, ...otherProps } = props;
|
||||
const { datasource, range, ...otherProps } = props;
|
||||
const absoluteTimeRange = { from: range!.from!.valueOf(), to: range!.to!.valueOf() }; // Range here is never optional
|
||||
|
||||
const { isSyntaxReady, setActiveOption, refreshLabels, syntax, logLabelOptions } = useLokiSyntaxAndLabels(
|
||||
datasource.languageProvider as LokiLanguageProvider,
|
||||
absoluteRange
|
||||
absoluteTimeRange
|
||||
);
|
||||
|
||||
return (
|
||||
@ -26,7 +28,7 @@ export const LokiQueryField: FunctionComponent<LokiQueryFieldProps> = props => {
|
||||
*/
|
||||
onLoadOptions={setActiveOption}
|
||||
onLabelsRefresh={refreshLabels}
|
||||
absoluteRange={absoluteRange}
|
||||
absoluteRange={absoluteTimeRange}
|
||||
syntax={syntax}
|
||||
syntaxLoaded={isSyntaxReady}
|
||||
logLabelOptions={logLabelOptions}
|
||||
|
Reference in New Issue
Block a user