[Release 12.0.1] TableNG: Fix interpolation for actions (#104577) (#104799)

TableNG: Fix interpolation for actions (#104577)

(cherry picked from commit 6c0250dde2)
This commit is contained in:
Adela Almasan 2025-05-01 08:45:58 -05:00 committed by GitHub
parent 3c62214699
commit 5f3107c401
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 1 deletions

24
COMMIT_EDITMSG Normal file
View File

@ -0,0 +1,24 @@
TableNG: Fix interpolation for actions (#104577)
(cherry picked from commit 6c0250dde285affbdc56edcd069473f33d48b3be)
# Conflicts:
# packages/grafana-ui/src/components/Table/TableNG/Cells/TableCellNG.tsx
#
# It looks like you may be committing a cherry-pick.
# If this is not correct, please run
# git update-ref -d CHERRY_PICK_HEAD
# and try again.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Author: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
# Date: Wed Apr 30 09:42:15 2025 -0500
#
# On branch backport-104577-to-release-12.0.1
# Your branch is up to date with 'origin/backport-104577-to-release-12.0.1'.
#
# You are currently cherry-picking commit 6c0250dde28.
#

View File

@ -45,6 +45,7 @@ export function TableCellNG(props: TableCellNGProps) {
getActions, getActions,
rowBg, rowBg,
onCellFilterAdded, onCellFilterAdded,
replaceVariables,
} = props; } = props;
const cellInspect = field.config?.custom?.inspect ?? false; const cellInspect = field.config?.custom?.inspect ?? false;
@ -74,7 +75,7 @@ export function TableCellNG(props: TableCellNGProps) {
const [divWidth, setDivWidth] = useState(0); const [divWidth, setDivWidth] = useState(0);
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
const actions = getActions ? getActions(frame, field, rowIdx) : []; const actions = getActions ? getActions(frame, field, rowIdx, replaceVariables) : [];
useLayoutEffect(() => { useLayoutEffect(() => {
if (divWidthRef.current && divWidthRef.current.clientWidth !== 0) { if (divWidthRef.current && divWidthRef.current.clientWidth !== 0) {

View File

@ -75,6 +75,7 @@ export function TableNG(props: TableNGProps) {
data, data,
enableSharedCrosshair, enableSharedCrosshair,
showTypeIcons, showTypeIcons,
replaceVariables,
} = props; } = props;
const initialSortColumns = useMemo<SortColumn[]>(() => { const initialSortColumns = useMemo<SortColumn[]>(() => {
@ -461,6 +462,7 @@ export function TableNG(props: TableNGProps) {
styles, styles,
theme, theme,
showTypeIcons, showTypeIcons,
replaceVariables,
...props, ...props,
}, },
handlers: { handlers: {
@ -669,6 +671,7 @@ export function mapFrameToDataGrid({
timeRange, timeRange,
getActions, getActions,
showTypeIcons, showTypeIcons,
replaceVariables,
} = options; } = options;
const { onCellExpand, onColumnResize } = handlers; const { onCellExpand, onColumnResize } = handlers;
@ -816,6 +819,7 @@ export function mapFrameToDataGrid({
getActions={getActions} getActions={getActions}
rowBg={rowBg} rowBg={rowBg}
onCellFilterAdded={onCellFilterAdded} onCellFilterAdded={onCellFilterAdded}
replaceVariables={replaceVariables}
/> />
); );
}, },

View File

@ -157,6 +157,7 @@ export interface TableCellNGProps {
value: TableCellValue; value: TableCellValue;
rowBg: Function | undefined; rowBg: Function | undefined;
onCellFilterAdded?: TableFilterActionCallback; onCellFilterAdded?: TableFilterActionCallback;
replaceVariables?: InterpolateFunction;
} }
/* ------------------------- Specialized Cell Props ------------------------- */ /* ------------------------- Specialized Cell Props ------------------------- */