Dashboard Controls: Only render the "stack" if the drop-down is menu is visible (#110856)

fix: only show the dashboard controls menu if it has contents
This commit is contained in:
Levente Balogh 2025-09-10 09:57:07 +02:00 committed by GitHub
parent 4dbd3a00b7
commit 60d26ac0ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -124,6 +124,10 @@ function DashboardControlsRenderer({ model }: SceneComponentProps<DashboardContr
const { links, editPanel } = dashboard.useState();
const styles = useStyles2(getStyles);
const showDebugger = window.location.search.includes('scene-debugger');
const hasControlMenuVariables = sceneGraph
.getVariables(dashboard)
.useState()
.variables.some((v) => v.state.showInControlsMenu === true);
if (!model.hasControls()) {
// To still have spacing when no controls are rendered
@ -152,9 +156,11 @@ function DashboardControlsRenderer({ model }: SceneComponentProps<DashboardContr
<refreshPicker.Component model={refreshPicker} />
</Stack>
)}
<Stack>
<DropdownVariableControls dashboard={dashboard} />
</Stack>
{hasControlMenuVariables && (
<Stack>
<DropdownVariableControls dashboard={dashboard} />
</Stack>
)}
{showDebugger && <SceneDebugger scene={model} key={'scene-debugger'} />}
</div>
);