Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Commit fd54c57

Browse files
authored
feature/k8s-tab (#422)
* introduce dashboardOptions on DashboardList * v2.26.7
1 parent 6ab6b06 commit fd54c57

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netdata/dashboard",
3-
"version": "2.26.6",
3+
"version": "2.26.7",
44
"homepage": ".",
55
"main": "./lib/src/index-npm.js",
66
"files": [

src/domains/dashboard/components/virtualized/list.js

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ const makeThrottleScroll = () =>
3939
onActiveSubMenuId(subMenuId)
4040
})
4141

42-
const List = ({ onActiveMenuGroupId, onActiveSubMenuId, getComponent }) => {
42+
const List = ({
43+
onActiveMenuGroupId,
44+
onActiveSubMenuId,
45+
getComponent,
46+
dashboardOptions = { firstMenuGroup: true, onboarding: true },
47+
}) => {
48+
const { firstMenuGroup, onboarding } = dashboardOptions
4349
const container = useContainer()
4450
const ids = useMenuGroupIds()
4551

@@ -49,30 +55,37 @@ const List = ({ onActiveMenuGroupId, onActiveSubMenuId, getComponent }) => {
4955
const widthRef = useRef(0)
5056

5157
const rowRenderMeasurer = useMemo(
52-
() => ({ index, parent, key, style, isScrolling, isVisible }) => {
53-
const id = ids[index]
54-
return (
55-
<CellMeasurer
56-
cache={cache}
57-
columnIndex={0}
58-
key={key}
59-
parent={parent}
60-
rowIndex={index}
61-
width={widthRef.current}
62-
>
63-
{({ measure }) => {
64-
measures.current[id] = measure
65-
const Component = getComponent(id, index)
66-
67-
return (
68-
<CellMeasurerWrapper style={style} index={index} id={id} measure={measure}>
69-
<Component id={id} isVisible={isVisible} isScrolling={isScrolling} />
70-
</CellMeasurerWrapper>
71-
)
72-
}}
73-
</CellMeasurer>
74-
)
75-
},
58+
() =>
59+
({ index, parent, key, style, isScrolling, isVisible }) => {
60+
const id = ids[index]
61+
return (
62+
<CellMeasurer
63+
cache={cache}
64+
columnIndex={0}
65+
key={key}
66+
parent={parent}
67+
rowIndex={index}
68+
width={widthRef.current}
69+
>
70+
{({ measure }) => {
71+
measures.current[id] = measure
72+
const hasFirstMenuGroup = index === 0 && firstMenuGroup
73+
const Component = getComponent(id, hasFirstMenuGroup)
74+
75+
return (
76+
<CellMeasurerWrapper style={style} index={index} id={id} measure={measure}>
77+
<Component
78+
id={id}
79+
isVisible={isVisible}
80+
isScrolling={isScrolling}
81+
onboarding={onboarding}
82+
/>
83+
</CellMeasurerWrapper>
84+
)
85+
}}
86+
</CellMeasurer>
87+
)
88+
},
7689
[ids.length]
7790
)
7891

0 commit comments

Comments
 (0)