mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Unification of logs/metrics/traces user interface (#25890)
Removes "Metrics"/"Logs" mode switcher from Explore, allowing for both metrics and logs queries at the same time. Co-authored-by: kay delaney <kay@grafana.com>
This commit is contained in:
@@ -2,7 +2,14 @@ import _ from 'lodash';
|
||||
import flatten from 'app/core/utils/flatten';
|
||||
import * as queryDef from './query_def';
|
||||
import TableModel from 'app/core/table_model';
|
||||
import { DataQueryResponse, DataFrame, toDataFrame, FieldType, MutableDataFrame } from '@grafana/data';
|
||||
import {
|
||||
DataQueryResponse,
|
||||
DataFrame,
|
||||
toDataFrame,
|
||||
FieldType,
|
||||
MutableDataFrame,
|
||||
PreferredVisualisationType,
|
||||
} from '@grafana/data';
|
||||
import { ElasticsearchAggregation } from './types';
|
||||
|
||||
export class ElasticResponse {
|
||||
@@ -430,7 +437,7 @@ export class ElasticResponse {
|
||||
|
||||
const { propNames, docs } = flattenHits(response.hits.hits);
|
||||
if (docs.length > 0) {
|
||||
const series = createEmptyDataFrame(propNames, this.targets[0].timeField, logMessageField, logLevelField);
|
||||
let series = createEmptyDataFrame(propNames, this.targets[0].timeField, logMessageField, logLevelField);
|
||||
|
||||
// Add a row for each document
|
||||
for (const doc of docs) {
|
||||
@@ -443,6 +450,7 @@ export class ElasticResponse {
|
||||
series.add(doc);
|
||||
}
|
||||
|
||||
series = addPreferredVisualisationType(series, 'logs');
|
||||
dataFrame.push(series);
|
||||
}
|
||||
|
||||
@@ -578,7 +586,7 @@ const createEmptyDataFrame = (
|
||||
return series;
|
||||
};
|
||||
|
||||
const addPreferredVisualisationType = (series: any, type: string) => {
|
||||
const addPreferredVisualisationType = (series: any, type: PreferredVisualisationType) => {
|
||||
let s = series;
|
||||
s.meta
|
||||
? (s.meta.preferredVisualisationType = type)
|
||||
|
||||
Reference in New Issue
Block a user