mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore/Loki: Show results of instant queries only in table and time series only in graph (#25845)
* Show results of instant queries only in table and rest in graph
* Add type to QueryResultMeta
* Update log row hover background only if context is not open
* Revert "Update log row hover background only if context is not open"
This reverts commit 144197c954.
This commit is contained in:
@@ -4,7 +4,7 @@ import { Observable, from, merge, of } from 'rxjs';
|
||||
import { map, filter, catchError, switchMap } from 'rxjs/operators';
|
||||
|
||||
// Services & Utils
|
||||
import { DataFrame, dateMath, FieldCache } from '@grafana/data';
|
||||
import { DataFrame, dateMath, FieldCache, QueryResultMeta } from '@grafana/data';
|
||||
import { getBackendSrv } from '@grafana/runtime';
|
||||
import { addLabelToQuery } from 'app/plugins/datasource/prometheus/add_label_to_query';
|
||||
import { DatasourceRequestOptions } from 'app/core/services/backend_srv';
|
||||
@@ -140,6 +140,10 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
||||
time: `${timeNs + (1e9 - (timeNs % 1e9))}`,
|
||||
limit: Math.min(options.maxDataPoints || Infinity, this.maxLines),
|
||||
};
|
||||
/** Show results of Loki instant queries only in table */
|
||||
const meta: QueryResultMeta = {
|
||||
preferredVisualisationType: 'table',
|
||||
};
|
||||
|
||||
return this._request(INSTANT_QUERY_ENDPOINT, query).pipe(
|
||||
catchError((err: any) => this.throwUnless(err, err.cancelled, target)),
|
||||
@@ -150,7 +154,7 @@ export class LokiDatasource extends DataSourceApi<LokiQuery, LokiOptions> {
|
||||
}
|
||||
|
||||
return {
|
||||
data: [lokiResultsToTableModel(response.data.data.result, responseListLength, target.refId, true)],
|
||||
data: [lokiResultsToTableModel(response.data.data.result, responseListLength, target.refId, meta, true)],
|
||||
key: `${target.refId}_instant`,
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user