From 3bc1a8d71432d5ea4279b82206a3823a09b0a5e2 Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Mon, 30 Oct 2023 01:09:08 -0500 Subject: [PATCH] Table: Fix right column alignment (#77339) --- .../grafana-ui/src/components/Table/DefaultCell.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/grafana-ui/src/components/Table/DefaultCell.tsx b/packages/grafana-ui/src/components/Table/DefaultCell.tsx index c6a00b05ae5..186455b7946 100644 --- a/packages/grafana-ui/src/components/Table/DefaultCell.tsx +++ b/packages/grafana-ui/src/components/Table/DefaultCell.tsx @@ -51,8 +51,14 @@ export const DefaultCell = (props: TableCellProps) => { const cellStyle = getCellStyle(tableStyles, cellOptions, displayValue, inspectEnabled, isStringValue); - if (isStringValue && cellProps.style?.justifyContent === 'flex-end') { - cellProps.style = { ...cellProps.style, textAlign: 'right' }; + if (isStringValue) { + let justifyContent = cellProps.style?.justifyContent; + + if (justifyContent === 'flex-end') { + cellProps.style = { ...cellProps.style, textAlign: 'right' }; + } else if (justifyContent === 'center') { + cellProps.style = { ...cellProps.style, textAlign: 'center' }; + } } return (