Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 4062489

Browse files
committed
fix(plugins/plugin-client-common): With full-width blocks, PatternFly Tables have odd column spacing
Fixes #6766
1 parent d9f6548 commit 4062489

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

plugins/plugin-client-common/src/components/Content/Table/TableCell.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default function renderCell(table: KuiTable, kuiRow: KuiRow, justUpdated:
107107
const cellClassName =
108108
cidx === 0
109109
? 'entity-name ' + (outerCSS || '')
110-
: (key === 'NAME' ? 'kui--entity-name-secondary ' : key === 'STATUS' ? 'kui--status-cell' : '') +
110+
: (/NAME/i.test(key) ? 'kui--entity-name-secondary ' : /STATUS/i.test(key) ? 'kui--status-cell' : '') +
111111
(outerCSS || '')
112112

113113
const outerClassName = 'cell-inner ' + (css || '') + (onclick ? ' clickable' : '')
@@ -122,7 +122,12 @@ export default function renderCell(table: KuiTable, kuiRow: KuiRow, justUpdated:
122122

123123
const { attributes = [] } = kuiRow
124124
return (
125-
<Td key={cidx} className={cellClassName} onClick={onClickForCell(kuiRow, tab, repl, attributes[cidx - 1], table)}>
125+
<Td
126+
key={cidx}
127+
className={cellClassName}
128+
onClick={onClickForCell(kuiRow, tab, repl, attributes[cidx - 1], table)}
129+
modifier={!/NAME|NAMESPACE/i.test(key) ? 'fitContent' : undefined}
130+
>
126131
<span data-key={key} data-value={value} data-tag={tag} className={outerClassName}>
127132
{tag === 'badge' && (
128133
<span

plugins/plugin-client-common/src/components/Content/Table/TableHeader.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ import React from 'react'
2020
import { Thead, Th, Tr } from '@patternfly/react-table'
2121

2222
function th(key: string, value: string, outerCSS: string, css?: string) {
23+
// nowrap seems to be needed to avoid PatternFly using a "truncate"
24+
// mode; see TableCell, where we set "fitContent" as the modifier
25+
// for the cells; but that alone seems to cause truncation in the
26+
// header :( hence this "nowrap". A bit puzzling.
2327
return (
24-
<Th key={key || value} data-key={key || value} className={`kui--header-cell ${outerCSS || ''}`}>
28+
<Th key={key || value} data-key={key || value} className={`kui--header-cell ${outerCSS || ''}`} modifier="nowrap">
2529
{css ? <span className={css}>{value}</span> : value}
2630
</Th>
2731
)

plugins/plugin-client-common/web/scss/components/Table/badges.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ $grid-cell-size: 1.25rem;
126126
.kui--table-like {
127127
th[data-key='STATUS'],
128128
td.kui--status-cell {
129-
width: 2rem;
129+
width: 5rem; /* leave from for "Status" in the header */
130130
}
131131
[data-tag='badge'] {
132132
justify-content: center;

0 commit comments

Comments
 (0)