mirror of https://github.com/grafana/grafana.git
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:
parent
4dbd3a00b7
commit
60d26ac0ce
|
@ -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>
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue