mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Timeseries: Revert annotations rendering changes (#67166)
This commit is contained in:
parent
cd205e3f46
commit
1a347bfb7b
@ -1,6 +1,6 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
|
||||||
import { DataFrame, Field, PanelProps } from '@grafana/data';
|
import { Field, PanelProps } from '@grafana/data';
|
||||||
import { PanelDataErrorView } from '@grafana/runtime';
|
import { PanelDataErrorView } from '@grafana/runtime';
|
||||||
import { TooltipDisplayMode } from '@grafana/schema';
|
import { TooltipDisplayMode } from '@grafana/schema';
|
||||||
import { KeyboardPlugin, TimeSeries, TooltipPlugin, usePanelContext, ZoomPlugin } from '@grafana/ui';
|
import { KeyboardPlugin, TimeSeries, TooltipPlugin, usePanelContext, ZoomPlugin } from '@grafana/ui';
|
||||||
@ -37,25 +37,6 @@ export const TimeSeriesPanel = ({
|
|||||||
return getFieldLinksForExplore({ field, rowIndex, splitOpenFn: onSplitOpen, range: timeRange });
|
return getFieldLinksForExplore({ field, rowIndex, splitOpenFn: onSplitOpen, range: timeRange });
|
||||||
};
|
};
|
||||||
|
|
||||||
const { annotations, exemplars } = useMemo(() => {
|
|
||||||
let annotations: DataFrame[] | null = null;
|
|
||||||
let exemplars: DataFrame[] | null = null;
|
|
||||||
|
|
||||||
if (data?.annotations?.length) {
|
|
||||||
annotations = [];
|
|
||||||
exemplars = [];
|
|
||||||
for (let frame of data.annotations) {
|
|
||||||
if (frame.name === 'exemplar') {
|
|
||||||
exemplars.push(frame);
|
|
||||||
} else {
|
|
||||||
annotations.push(frame);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return { annotations, exemplars };
|
|
||||||
}, [data.annotations]);
|
|
||||||
|
|
||||||
const frames = useMemo(() => prepareGraphableFields(data.series, config.theme2, timeRange), [data, timeRange]);
|
const frames = useMemo(() => prepareGraphableFields(data.series, config.theme2, timeRange), [data, timeRange]);
|
||||||
const timezones = useMemo(() => getTimezones(options.timezone, timeZone), [options.timezone, timeZone]);
|
const timezones = useMemo(() => getTimezones(options.timezone, timeZone), [options.timezone, timeZone]);
|
||||||
|
|
||||||
@ -107,7 +88,9 @@ export const TimeSeriesPanel = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* Renders annotation markers*/}
|
{/* Renders annotation markers*/}
|
||||||
{annotations && <AnnotationsPlugin annotations={annotations} config={config} timeZone={timeZone} />}
|
{data.annotations && (
|
||||||
|
<AnnotationsPlugin annotations={data.annotations} config={config} timeZone={timeZone} />
|
||||||
|
)}
|
||||||
{/* Enables annotations creation*/}
|
{/* Enables annotations creation*/}
|
||||||
{enableAnnotationCreation ? (
|
{enableAnnotationCreation ? (
|
||||||
<AnnotationEditorPlugin data={alignedDataFrame} timeZone={timeZone} config={config}>
|
<AnnotationEditorPlugin data={alignedDataFrame} timeZone={timeZone} config={config}>
|
||||||
@ -149,11 +132,11 @@ export const TimeSeriesPanel = ({
|
|||||||
defaultItems={[]}
|
defaultItems={[]}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{exemplars && (
|
{data.annotations && (
|
||||||
<ExemplarsPlugin
|
<ExemplarsPlugin
|
||||||
visibleSeries={getVisibleLabels(config, frames)}
|
visibleSeries={getVisibleLabels(config, frames)}
|
||||||
config={config}
|
config={config}
|
||||||
exemplars={exemplars}
|
exemplars={data.annotations}
|
||||||
timeZone={timeZone}
|
timeZone={timeZone}
|
||||||
getFieldLinks={getFieldLinks}
|
getFieldLinks={getFieldLinks}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user