Skip to content

Commit 4c993bb

Browse files
committed
Add group headers.
1 parent c7d2b7f commit 4c993bb

File tree

8 files changed

+83
-15
lines changed

8 files changed

+83
-15
lines changed

src/components/drops/drop/container.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const styledAnimation = css`
1818
animation-delay: 0.01s;
1919
`
2020

21-
const Container = styled(Flex).attrs(({ zIndex = 60, ...rest }) => ({
21+
const Container = styled(Flex).attrs(({ zIndex = 60000, ...rest }) => ({
2222
zIndex,
2323
position: "fixed",
2424
...rest,

src/components/drops/drop/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const Backdrop = styled.div`
1515
inset: 0;
1616
pointer-events: all;
1717
background-color: rgba(0, 0, 0, 0.3);
18+
z-index: 50000;
1819
${backdropBlur};
1920
}
2021
`
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/components/icon/icons-list.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,8 @@ import virtualization from "./assets/virtualization.svg"
303303
import warning from "./assets/warning.svg"
304304
import warning_triangle from "./assets/warning_triangle.svg"
305305
import warning_triangle_hollow from "./assets/warning_triangle_hollow.svg"
306+
import weights_compare from "./assets/weights_compare.svg"
307+
import weights_drill_down from "./assets/weights_drill_down.svg"
306308
import x from "./assets/x.svg"
307309
import firewallSolid from "./assets/firewall_solid.svg"
308310
import qualityOfServiceSolid from "./assets/qualityOfService_solid.svg"
@@ -622,5 +624,7 @@ export const iconsList = {
622624
warning,
623625
warning_triangle,
624626
warning_triangle_hollow,
627+
weights_compare,
628+
weights_drill_down,
625629
x,
626630
}

src/components/tableV2/core/fullTable.js

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,39 @@ const FullTable = ({
3434
{...rest}
3535
>
3636
<Table.Head data-testid={`netdata-table-head${testPrefix}`}>
37-
<Table.HeadRow data-testid={`netdata-table-headRow${testPrefix}`}>
38-
<HeadCell
39-
dataGa={dataGa}
40-
enableResize={enableResize}
41-
enableSorting={enableSorting}
42-
headers={headers}
43-
pinnedStyles={pinnedStyles}
44-
table={table}
45-
testPrefix={testPrefix}
46-
coloredSortedColumn={coloredSortedColumn}
47-
/>
48-
</Table.HeadRow>
37+
{Array.isArray(table.getHeaderGroups()) ? (
38+
table.getHeaderGroups().map((headerGroup, index) => (
39+
<Table.HeadRow
40+
key={index}
41+
id={headerGroup.id}
42+
data-testid={`netdata-table-headRow${testPrefix}`}
43+
>
44+
<HeadCell
45+
dataGa={dataGa}
46+
enableResize={enableResize}
47+
enableSorting={enableSorting}
48+
headers={headerGroup.headers}
49+
pinnedStyles={pinnedStyles}
50+
table={table}
51+
testPrefix={testPrefix}
52+
coloredSortedColumn={coloredSortedColumn}
53+
/>
54+
</Table.HeadRow>
55+
))
56+
) : (
57+
<Table.HeadRow data-testid={`netdata-table-headRow${testPrefix}`}>
58+
<HeadCell
59+
dataGa={dataGa}
60+
enableResize={enableResize}
61+
enableSorting={enableSorting}
62+
headers={headers}
63+
pinnedStyles={pinnedStyles}
64+
table={table}
65+
testPrefix={testPrefix}
66+
coloredSortedColumn={coloredSortedColumn}
67+
/>
68+
</Table.HeadRow>
69+
)}
4970
</Table.Head>
5071
<Table.Body data-testid={`netdata-table-body${testPrefix}`}>
5172
<Rows

src/components/tableV2/core/headCell.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const HeadCell = ({
114114

115115
return (
116116
<Table.HeadCell
117+
colSpan={colSpan}
117118
data-testid={`netdata-table-head-cell${testPrefix}`}
118119
filter={
119120
column.getCanFilter() && (

src/components/tableV2/features/useColumns.js

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,36 @@ export default (dataColumns, { rowActions, enableSelection, testPrefix, tableMet
99
return useMemo(() => {
1010
if (!dataColumns || dataColumns.length < 1) return []
1111

12+
let isGrouped = false
13+
1214
dataColumns = dataColumns.map((col, index) => {
15+
if (Array.isArray(col.columns)) {
16+
isGrouped = true
17+
18+
return {
19+
id: index,
20+
...col,
21+
columns: col.columns.map((subCol, index) => {
22+
if (!subCol.id) throw new Error(`Please provide id at ${index}`)
23+
24+
return {
25+
enableColumnFilter: false,
26+
enableGlobalFilter: true,
27+
enableSorting: true,
28+
size: 150,
29+
maxSize: 5000,
30+
minSize: 150,
31+
enableHiding: true,
32+
enableResize: true,
33+
footer: props => props.column.id,
34+
tableMeta,
35+
...subCol,
36+
accessorKey: subCol.accessorKey || subCol.id,
37+
}
38+
}),
39+
}
40+
}
41+
1342
if (!col.id) throw new Error(`Please provide id at ${index}`)
1443

1544
return {
@@ -28,8 +57,14 @@ export default (dataColumns, { rowActions, enableSelection, testPrefix, tableMet
2857
}
2958
})
3059

31-
if (selectionColumn) dataColumns.unshift(selectionColumn)
32-
if (rowActionsColumn) dataColumns.push(rowActionsColumn)
60+
if (selectionColumn)
61+
dataColumns.unshift(
62+
isGrouped ? { id: "selectionColumn", columns: selectionColumn } : selectionColumn
63+
)
64+
if (rowActionsColumn)
65+
dataColumns.push(
66+
isGrouped ? { id: "rowActionsColumn", columns: rowActionsColumn } : rowActionsColumn
67+
)
3368

3469
return dataColumns
3570
}, [dataColumns, rowActionsColumn, selectionColumn])

0 commit comments

Comments
 (0)