mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
StatuHistoryPanel: Fix zoom not working (#57240)
This commit is contained in:
parent
ed1176adc8
commit
0dd721d4ce
@ -136,6 +136,30 @@ export const StatusHistoryPanel: React.FC<TimelinePanelProps> = ({
|
||||
[timeZone, frames, shouldDisplayCloseButton]
|
||||
);
|
||||
|
||||
const renderTooltip = (alignedFrame: DataFrame) => {
|
||||
if (options.tooltip.mode === TooltipDisplayMode.None) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (focusedPointIdx === null || (!isActive && sync && sync() === DashboardCursorSync.Crosshair)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Portal>
|
||||
{hover && coords && focusedSeriesIdx && (
|
||||
<VizTooltipContainer
|
||||
position={{ x: coords.viewport.x, y: coords.viewport.y }}
|
||||
offset={{ x: TOOLTIP_OFFSET, y: TOOLTIP_OFFSET }}
|
||||
allowPointerEvents={isToolTipOpen.current}
|
||||
>
|
||||
{renderCustomTooltip(alignedFrame, focusedSeriesIdx, focusedPointIdx)}
|
||||
</VizTooltipContainer>
|
||||
)}
|
||||
</Portal>
|
||||
);
|
||||
};
|
||||
|
||||
const timezones = useMemo(() => getTimezones(options.timezone, timeZone), [options.timezone, timeZone]);
|
||||
|
||||
if (!frames || warn) {
|
||||
@ -187,28 +211,10 @@ export const StatusHistoryPanel: React.FC<TimelinePanelProps> = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (options.tooltip.mode === TooltipDisplayMode.None) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (focusedPointIdx === null || (!isActive && sync && sync() === DashboardCursorSync.Crosshair)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
|
||||
<Portal>
|
||||
{hover && coords && focusedSeriesIdx && (
|
||||
<VizTooltipContainer
|
||||
position={{ x: coords.viewport.x, y: coords.viewport.y }}
|
||||
offset={{ x: TOOLTIP_OFFSET, y: TOOLTIP_OFFSET }}
|
||||
allowPointerEvents={isToolTipOpen.current}
|
||||
>
|
||||
{renderCustomTooltip(alignedFrame, focusedSeriesIdx, focusedPointIdx)}
|
||||
</VizTooltipContainer>
|
||||
)}
|
||||
</Portal>
|
||||
{renderTooltip(alignedFrame)}
|
||||
<OutsideRangePlugin config={config} onChangeTimeRange={onChangeTimeRange} />
|
||||
</>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user