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

Commit

Permalink
feature/k8s-tab (#422)
Browse files Browse the repository at this point in the history
* introduce dashboardOptions on DashboardList

* v2.26.7
  • Loading branch information
jjtsou authored Jun 23, 2022
1 parent 6ab6b06 commit fd54c57
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/dashboard",
"version": "2.26.6",
"version": "2.26.7",
"homepage": ".",
"main": "./lib/src/index-npm.js",
"files": [
Expand Down
63 changes: 38 additions & 25 deletions src/domains/dashboard/components/virtualized/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ const makeThrottleScroll = () =>
onActiveSubMenuId(subMenuId)
})

const List = ({ onActiveMenuGroupId, onActiveSubMenuId, getComponent }) => {
const List = ({
onActiveMenuGroupId,
onActiveSubMenuId,
getComponent,
dashboardOptions = { firstMenuGroup: true, onboarding: true },
}) => {
const { firstMenuGroup, onboarding } = dashboardOptions
const container = useContainer()
const ids = useMenuGroupIds()

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

const rowRenderMeasurer = useMemo(
() => ({ index, parent, key, style, isScrolling, isVisible }) => {
const id = ids[index]
return (
<CellMeasurer
cache={cache}
columnIndex={0}
key={key}
parent={parent}
rowIndex={index}
width={widthRef.current}
>
{({ measure }) => {
measures.current[id] = measure
const Component = getComponent(id, index)

return (
<CellMeasurerWrapper style={style} index={index} id={id} measure={measure}>
<Component id={id} isVisible={isVisible} isScrolling={isScrolling} />
</CellMeasurerWrapper>
)
}}
</CellMeasurer>
)
},
() =>
({ index, parent, key, style, isScrolling, isVisible }) => {
const id = ids[index]
return (
<CellMeasurer
cache={cache}
columnIndex={0}
key={key}
parent={parent}
rowIndex={index}
width={widthRef.current}
>
{({ measure }) => {
measures.current[id] = measure
const hasFirstMenuGroup = index === 0 && firstMenuGroup
const Component = getComponent(id, hasFirstMenuGroup)

return (
<CellMeasurerWrapper style={style} index={index} id={id} measure={measure}>
<Component
id={id}
isVisible={isVisible}
isScrolling={isScrolling}
onboarding={onboarding}
/>
</CellMeasurerWrapper>
)
}}
</CellMeasurer>
)
},
[ids.length]
)

Expand Down

0 comments on commit fd54c57

Please sign in to comment.