Skip to content

Commit ff972b6

Browse files
authored
v5.5.9 (#639)
1 parent 34d7b9b commit ff972b6

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netdata/netdata-ui",
3-
"version": "5.5.8",
3+
"version": "5.5.9",
44
"description": "netdata UI kit",
55
"main": "dist/index.js",
66
"module": "dist/es6/index.js",

‎src/components/table/body/header/cell.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ const BodyHeaderCell = ({
152152
overflow="hidden"
153153
width="100%"
154154
>
155-
<DragHandle dragHandleProps={dragHandleProps} visible={isDragging} />
155+
{!hasSubheaders && !header.isPlaceholder && (
156+
<DragHandle dragHandleProps={dragHandleProps} visible={isDragging} />
157+
)}
156158
{column.isPlaceholder ? null : (
157159
<Label
158160
as={column.columnDef.labelAs}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from "react"
2+
import { renderWithProviders } from "testUtilities"
3+
import Table from "./table"
4+
5+
const serverColumn = { id: "server", accessorKey: "server", header: "Server" }
6+
const alertsColumn = { id: "alerts", accessorKey: "alerts", header: "Alerts" }
7+
const cpuColumn = { id: "cpu", accessorKey: "cpu", header: "CPU" }
8+
9+
it("renders drag handles only on leaf header cells when columns are grouped", async () => {
10+
const { container, findByText } = renderWithProviders(
11+
<Table
12+
data={[]}
13+
dataColumns={[
14+
{ id: "Device", header: "", headerString: () => "", columns: [serverColumn, alertsColumn] },
15+
{ id: "Metrics", header: "", headerString: () => "", columns: [cpuColumn] },
16+
]}
17+
enableColumnReordering
18+
/>
19+
)
20+
21+
await findByText("Server")
22+
23+
expect(container.querySelectorAll(".drag-handle")).toHaveLength(3)
24+
})
25+
26+
it("renders no drag handle on placeholder header cells of ungrouped columns", async () => {
27+
const { container, findByText } = renderWithProviders(
28+
<Table
29+
data={[]}
30+
dataColumns={[
31+
serverColumn,
32+
{ id: "Metrics", header: "", headerString: () => "", columns: [cpuColumn, alertsColumn] },
33+
]}
34+
enableColumnReordering
35+
/>
36+
)
37+
38+
await findByText("CPU")
39+
40+
expect(container.querySelectorAll(".drag-handle")).toHaveLength(3)
41+
})

0 commit comments

Comments
 (0)