Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/netdata-ui",
"version": "5.5.8",
"version": "5.5.9",
"description": "netdata UI kit",
"main": "dist/index.js",
"module": "dist/es6/index.js",
Expand Down
4 changes: 3 additions & 1 deletion src/components/table/body/header/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ const BodyHeaderCell = ({
overflow="hidden"
width="100%"
>
<DragHandle dragHandleProps={dragHandleProps} visible={isDragging} />
{!hasSubheaders && !header.isPlaceholder && (
<DragHandle dragHandleProps={dragHandleProps} visible={isDragging} />
)}
{column.isPlaceholder ? null : (
<Label
as={column.columnDef.labelAs}
Expand Down
41 changes: 41 additions & 0 deletions src/components/table/groupHeaderDragHandle.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react"
import { renderWithProviders } from "testUtilities"
import Table from "./table"

const serverColumn = { id: "server", accessorKey: "server", header: "Server" }
const alertsColumn = { id: "alerts", accessorKey: "alerts", header: "Alerts" }
const cpuColumn = { id: "cpu", accessorKey: "cpu", header: "CPU" }

it("renders drag handles only on leaf header cells when columns are grouped", async () => {
const { container, findByText } = renderWithProviders(
<Table
data={[]}
dataColumns={[
{ id: "Device", header: "", headerString: () => "", columns: [serverColumn, alertsColumn] },
{ id: "Metrics", header: "", headerString: () => "", columns: [cpuColumn] },
]}
enableColumnReordering
/>
)

await findByText("Server")

expect(container.querySelectorAll(".drag-handle")).toHaveLength(3)
})

it("renders no drag handle on placeholder header cells of ungrouped columns", async () => {
const { container, findByText } = renderWithProviders(
<Table
data={[]}
dataColumns={[
serverColumn,
{ id: "Metrics", header: "", headerString: () => "", columns: [cpuColumn, alertsColumn] },
]}
enableColumnReordering
/>
)

await findByText("CPU")

expect(container.querySelectorAll(".drag-handle")).toHaveLength(3)
})
Loading