Dynamic Dashboards: Change look and copy of add variable control to make it more obvious what it does (#113361)

Change look+copy of add variable control
This commit is contained in:
Oscar Kilhed
2025-11-03 18:00:25 +01:00
committed by GitHub
parent 414524e799
commit 06fb3fef43
4 changed files with 11 additions and 3 deletions
@@ -222,6 +222,10 @@ function getStyles(theme: GrafanaTheme2) {
flexDirection: 'column-reverse', flexDirection: 'column-reverse',
alignItems: 'stretch', alignItems: 'stretch',
}, },
'&:hover .dashboard-canvas-add-button': {
opacity: 1,
filter: 'unset',
},
}), }),
controlsPanelEdit: css({ controlsPanelEdit: css({
flexWrap: 'wrap-reverse', flexWrap: 'wrap-reverse',
@@ -27,7 +27,11 @@ export function VariableControls({ dashboard }: { dashboard: DashboardScene }) {
.map((variable) => ( .map((variable) => (
<VariableValueSelectWrapper key={variable.state.key} variable={variable} /> <VariableValueSelectWrapper key={variable.state.key} variable={variable} />
))} ))}
{config.featureToggles.dashboardNewLayouts ? <AddVariableButton dashboard={dashboard} /> : null} {config.featureToggles.dashboardNewLayouts ? (
<div className="dashboard-canvas-add-button">
<AddVariableButton dashboard={dashboard} />
</div>
) : null}
</> </>
); );
} }
@@ -26,7 +26,7 @@ export function AddVariableButton({ dashboard }: { dashboard: DashboardScene })
return ( return (
<Button icon="plus" variant="primary" fill="text" onPointerDown={handlePointerDown}> <Button icon="plus" variant="primary" fill="text" onPointerDown={handlePointerDown}>
<Trans i18nKey="dashboard-scene.variable-controls.add-variable">Add</Trans> <Trans i18nKey="dashboard-scene.variable-controls.add-variable">Add variable</Trans>
</Button> </Button>
); );
} }
+1 -1
View File
@@ -6326,7 +6326,7 @@
"content-variable-referenced-other-variables-dashboard": "This variable is referenced by other variables or dashboard." "content-variable-referenced-other-variables-dashboard": "This variable is referenced by other variables or dashboard."
}, },
"variable-controls": { "variable-controls": {
"add-variable": "Add" "add-variable": "Add variable"
}, },
"variable-editor-form": { "variable-editor-form": {
"aria-label-variable-editor-form": "Variable editor form", "aria-label-variable-editor-form": "Variable editor form",