diff --git a/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx b/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx index f465ea6503d..2aeb84b74b3 100644 --- a/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx +++ b/public/app/plugins/panel/status-history/StatusHistoryPanel.tsx @@ -136,6 +136,30 @@ export const StatusHistoryPanel: React.FC = ({ [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 ( + + {hover && coords && focusedSeriesIdx && ( + + {renderCustomTooltip(alignedFrame, focusedSeriesIdx, focusedPointIdx)} + + )} + + ); + }; + const timezones = useMemo(() => getTimezones(options.timezone, timeZone), [options.timezone, timeZone]); if (!frames || warn) { @@ -187,28 +211,10 @@ export const StatusHistoryPanel: React.FC = ({ }); } - if (options.tooltip.mode === TooltipDisplayMode.None) { - return null; - } - - if (focusedPointIdx === null || (!isActive && sync && sync() === DashboardCursorSync.Crosshair)) { - return null; - } - return ( <> - - {hover && coords && focusedSeriesIdx && ( - - {renderCustomTooltip(alignedFrame, focusedSeriesIdx, focusedPointIdx)} - - )} - + {renderTooltip(alignedFrame)} );