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

Commit 3214db2

Browse files
committed
fix: when sidecar is open, only show status badge, not status text
Fixes #4058
1 parent b53e8f9 commit 3214db2

File tree

4 files changed

+46
-25
lines changed

4 files changed

+46
-25
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ export default function renderCell(
7676
/>
7777
)
7878
} else {
79+
const tag = cidx > 0 && kuiRow.attributes[cidx - 1].tag
80+
const innerText = (kuiRow.attributes[cidx - 1] && kuiRow.attributes[cidx - 1].valueDom) || cell.value
81+
7982
return (
8083
<TableCell
8184
key={cell.id}
@@ -90,15 +93,18 @@ export default function renderCell(
9093
<span
9194
data-key={cidx === 0 ? kuiRow.key : kuiRow.attributes[cidx - 1].key}
9295
data-value={cell.value}
93-
data-tag={cidx > 0 && kuiRow.attributes[cidx - 1].tag}
96+
data-tag={tag}
9497
className={
9598
'cell-inner ' +
9699
(cidx === 0
97100
? (kuiRow.css || '') + (kuiRow.onclick ? ' clickable' : '')
98101
: (kuiRow.attributes[cidx - 1].css || '') + (kuiRow.attributes[cidx - 1].onclick ? ' clickable' : ''))
99102
}
100103
>
101-
{(kuiRow.attributes[cidx - 1] && kuiRow.attributes[cidx - 1].valueDom) || cell.value}
104+
{tag === 'badge' && (
105+
<span title={innerText} data-tag="badge-circle" className={kuiRow.attributes[cidx - 1].css} />
106+
)}
107+
<span className="kui--cell-inner-text">{innerText}</span>
102108
</span>
103109
</TableCell>
104110
)

plugins/plugin-client-common/web/css/static/ui.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,14 +1151,6 @@ body[kui-theme-style] a:hover:not(.plain-anchor) {
11511151

11521152
badge,
11531153
[data-tag="badge"] {
1154-
& {
1155-
overflow: hidden;
1156-
text-overflow: ellipsis;
1157-
white-space: nowrap;
1158-
font-weight: 600;
1159-
background-color: var(--color-tag-beta-fill);
1160-
color: var(--color-tag-beta-text);
1161-
}
11621154
&.clickable:hover {
11631155
/* no underline effect for icons (i) and badges */
11641156
text-decoration: none;
Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
11
.bx--data-table {
2-
[data-tag='badge']:not(.badge-as-image):not(.badge-as-fontawesome) {
3-
color: var(--color-text-02);
4-
background-color: transparent !important;
2+
[data-tag='badge'] {
53
display: flex;
64
align-items: center;
7-
font-weight: normal;
85
}
9-
[data-tag='badge']:not(.badge-as-image):not(.badge-as-fontawesome):before {
10-
content: '';
6+
[data-tag='badge-circle'] {
117
margin-right: 1ex;
12-
width: 0.75em;
13-
height: 0.75em;
8+
width: 0.875em;
9+
height: 0.875em;
1410
background-color: var(--color-ui-05);
1511
border-radius: 50%;
1612
}
17-
[data-tag='badge'].green-background:not(.badge-as-image):before {
13+
[data-tag='badge-circle'].green-background {
1814
background-color: var(--color-green);
1915
color: var(--color-ui-01);
2016
}
21-
[data-tag='badge'].yellow-background:not(.badge-as-image):before,
17+
[data-tag='badge-circle'].yellow-background,
2218
button.yellow-background {
2319
background: var(--color-yellow);
2420
color: var(--color-ui-01);
2521
}
26-
[data-tag='badge'].red-background:not(.badge-as-image):before {
22+
[data-tag='badge-circle'].red-background {
2723
background: var(--color-red);
2824
color: var(--color-ui-01);
2925
}
30-
[data-tag='badge'].gray-background:not(.badge-as-image):before {
26+
[data-tag='badge-circle'].gray-background {
3127
background: var(--color-processing);
3228
color: var(--color-ui-02);
3329
}
3430
}
3531

32+
.repl.sidecar-visible .bx--data-table-container .bx--data-table {
33+
th[data-key='STATUS'] {
34+
padding-left: 0;
35+
}
36+
[data-tag='badge'] {
37+
justify-content: center;
38+
39+
[data-tag='badge-circle'] {
40+
margin: 0;
41+
width: 1em;
42+
height: 1em;
43+
border-radius: 0;
44+
}
45+
46+
.kui--cell-inner-text {
47+
/* show only the badge-circle when the sidecar is open */
48+
display: none;
49+
}
50+
}
51+
}
52+
3653
[data-table-watching='true'] .bx--data-table {
37-
[data-tag='badge'].yellow-background:not(.badge-as-image) {
54+
[data-tag='badge-circle'].yellow-background {
3855
animation: var(--animation-repeating-pulse);
3956
}
4057
}

plugins/plugin-kubectl/src/lib/view/modes/Form.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function SidecarForm({
4343
(typeof vvalue === 'number' ? vvalue.toLocaleString() : typeof vvalue !== 'object' ? vvalue : vvalue.label) ||
4444
''
4545

46-
const colspan = Math.max(Math.ceil(key.length / 8), Math.ceil(value.length / 3))
46+
const colspan = Math.max(Math.ceil(key.length / 7.5), Math.ceil(value.length / 3))
4747
const style = { gridColumn: `span ${colspan > 15 ? 8 : colspan}` }
4848
const className = typeof vvalue !== 'object' ? undefined : 'kui--form-item--for-label'
4949

@@ -63,16 +63,22 @@ export default function SidecarForm({
6363

6464
export function FormWithLabels(props: { map: FormMap; resource: KubeResource }) {
6565
const labelMap: FormMap = {}
66+
let nLabels = 0
6667
if (props.resource.metadata && props.resource.metadata.labels) {
6768
for (const key in props.resource.metadata.labels) {
69+
nLabels++
6870
labelMap[`${key} label`] = { label: props.resource.metadata.labels[key] }
6971
}
7072
}
7173

7274
return (
7375
<div className="padding-content scrollable">
7476
<SidecarForm nested map={props.map} />
75-
<SidecarForm nested map={labelMap} className="top-pad" />
77+
{nLabels > 0 && (
78+
<div style={{ paddingTop: '1em' }}>
79+
<SidecarForm nested map={labelMap} className="top-pad" />
80+
</div>
81+
)}
7682
</div>
7783
)
7884
}

0 commit comments

Comments
 (0)