From e8561c6b0f546f1d94c4376a276863a515dc57c9 Mon Sep 17 00:00:00 2001 From: L2D2Grafana Date: Thu, 11 Dec 2025 08:53:55 -0800 Subject: [PATCH] Logs: disable link to log line when log line is not there --- .../features/explore/Logs/LogsTableActionButtons.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/app/features/explore/Logs/LogsTableActionButtons.tsx b/public/app/features/explore/Logs/LogsTableActionButtons.tsx index f60d5eaa072..91d2cdaf1e1 100644 --- a/public/app/features/explore/Logs/LogsTableActionButtons.tsx +++ b/public/app/features/explore/Logs/LogsTableActionButtons.tsx @@ -43,6 +43,11 @@ export const LogsTableActionButtons = memo((props: Props) => { return logRowById?.raw ?? ''; }; + const lineValue = getLineValue(); + + // Check if line value is available + const isLineValueAvailable = lineValue !== undefined && lineValue !== null && lineValue !== ''; + const styles = getStyles(theme); // Generate link to the log line @@ -94,7 +99,9 @@ export const LogsTableActionButtons = memo((props: Props) => { }, [absoluteRange, displayedFields, exploreId, logId, logRows, rowIndex, panelState]); const handleViewClick = () => { - setIsInspecting(true); + if (isLineValueAvailable) { + setIsInspecting(true); + } }; return ( @@ -110,6 +117,7 @@ export const LogsTableActionButtons = memo((props: Props) => { name="eye" onClick={handleViewClick} tabIndex={0} + disabled={!isLineValueAvailable} /> { tabIndex={0} aria-label={t('explore.logs-table.action-buttons.copy-link', 'Copy link to log line')} getText={getText} + disabled={!isLineValueAvailable} /> {isInspecting && (