Logs: disable link to log line when log line is not there

This commit is contained in:
L2D2Grafana
2026-01-07 07:50:07 -08:00
parent 731704fa21
commit e8561c6b0f
@@ -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}
/>
<ClipboardButton
className={styles.icon}
@@ -122,6 +130,7 @@ export const LogsTableActionButtons = memo((props: Props) => {
tabIndex={0}
aria-label={t('explore.logs-table.action-buttons.copy-link', 'Copy link to log line')}
getText={getText}
disabled={!isLineValueAvailable}
/>
</div>
{isInspecting && (