mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Inspect: include annotation data in DataFrameJSON debugger (#49204)
This commit is contained in:
parent
d0d4d8af7f
commit
3b017e0fb1
@ -1,7 +1,7 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import AutoSizer from 'react-virtualized-auto-sizer';
|
||||
|
||||
import { AppEvents, dataFrameToJSON, PanelData, SelectableValue } from '@grafana/data';
|
||||
import { AppEvents, DataFrameJSON, dataFrameToJSON, DataTopic, PanelData, SelectableValue } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { Button, CodeEditor, Field, Select } from '@grafana/ui';
|
||||
import { appEvents } from 'app/core/core';
|
||||
@ -76,11 +76,7 @@ export class InspectJSONTab extends PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
if (show === ShowContent.DataFrames) {
|
||||
const series = data?.series;
|
||||
if (!series) {
|
||||
return { note: 'Missing Response Data' };
|
||||
}
|
||||
return data.series.map((frame) => dataFrameToJSON(frame));
|
||||
return getPanelDataFrames(data);
|
||||
}
|
||||
|
||||
if (this.hasPanelJSON && show === ShowContent.PanelJSON) {
|
||||
@ -159,6 +155,26 @@ export class InspectJSONTab extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
function getPanelDataFrames(data?: PanelData): DataFrameJSON[] {
|
||||
const frames: DataFrameJSON[] = [];
|
||||
if (data?.series) {
|
||||
for (const f of data.series) {
|
||||
frames.push(dataFrameToJSON(f));
|
||||
}
|
||||
}
|
||||
if (data?.annotations) {
|
||||
for (const f of data.annotations) {
|
||||
const json = dataFrameToJSON(f);
|
||||
if (!json.schema?.meta) {
|
||||
json.schema!.meta = {};
|
||||
}
|
||||
json.schema!.meta.dataTopic = DataTopic.Annotations;
|
||||
frames.push(json);
|
||||
}
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
||||
function getPrettyJSON(obj: any): string {
|
||||
return JSON.stringify(obj, null, 2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user