mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 08:35:43 -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 { DataFrame, Field, PanelProps } from '@grafana/data';
|
||||
import { Field, PanelProps } from '@grafana/data';
|
||||
import { PanelDataErrorView } from '@grafana/runtime';
|
||||
import { TooltipDisplayMode } from '@grafana/schema';
|
||||
import { KeyboardPlugin, TimeSeries, TooltipPlugin, usePanelContext, ZoomPlugin } from '@grafana/ui';
|
||||
@ -37,25 +37,6 @@ export const TimeSeriesPanel = ({
|
||||
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 timezones = useMemo(() => getTimezones(options.timezone, timeZone), [options.timezone, timeZone]);
|
||||
|
||||
@ -107,7 +88,9 @@ export const TimeSeriesPanel = ({
|
||||
/>
|
||||
)}
|
||||
{/* Renders annotation markers*/}
|
||||
{annotations && <AnnotationsPlugin annotations={annotations} config={config} timeZone={timeZone} />}
|
||||
{data.annotations && (
|
||||
<AnnotationsPlugin annotations={data.annotations} config={config} timeZone={timeZone} />
|
||||
)}
|
||||
{/* Enables annotations creation*/}
|
||||
{enableAnnotationCreation ? (
|
||||
<AnnotationEditorPlugin data={alignedDataFrame} timeZone={timeZone} config={config}>
|
||||
@ -149,11 +132,11 @@ export const TimeSeriesPanel = ({
|
||||
defaultItems={[]}
|
||||
/>
|
||||
)}
|
||||
{exemplars && (
|
||||
{data.annotations && (
|
||||
<ExemplarsPlugin
|
||||
visibleSeries={getVisibleLabels(config, frames)}
|
||||
config={config}
|
||||
exemplars={exemplars}
|
||||
exemplars={data.annotations}
|
||||
timeZone={timeZone}
|
||||
getFieldLinks={getFieldLinks}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user