[v11.0.x] Table Panel: Fix image disappearing when datalinks applied (#86160)

Table Panel: Fix image disappearing when datalinks applied (#84625)

* Fix link image disappearing

* Prettier

* i18n

* Fix offset to compensate for padding

* Prettier

---------

Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
(cherry picked from commit 154868e624)

Co-authored-by: Kyle Cunningham <codeincarnate@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-15 15:42:46 +01:00
committed by GitHub
co-authored by Kyle Cunningham
parent ffe58a03b1
commit 16695fe0df
@@ -8,6 +8,8 @@ import { DataLinksContextMenu } from '../DataLinks/DataLinksContextMenu';
import { TableCellProps } from './types';
const DATALINKS_HEIGHT_OFFSET = 10;
export const ImageCell = (props: TableCellProps) => {
const { field, cell, tableStyles, row, cellProps } = props;
@@ -20,7 +22,10 @@ export const ImageCell = (props: TableCellProps) => {
<div {...cellProps} className={tableStyles.cellContainer}>
{!hasLinks && <img src={displayValue.text} className={tableStyles.imageCell} alt="" />}
{hasLinks && (
<DataLinksContextMenu style={{ height: '100%' }} links={() => getCellLinks(field, row) || []}>
<DataLinksContextMenu
style={{ height: tableStyles.cellHeight - DATALINKS_HEIGHT_OFFSET, width: 'auto' }}
links={() => getCellLinks(field, row) || []}
>
{(api) => {
const img = <img src={displayValue.text} className={tableStyles.imageCell} alt="" />;
if (api.openMenu) {