Compare commits

...

2 Commits

Author SHA1 Message Date
Torkel Ödegaard
673c185340 Modal: Fix modal button row 2025-12-17 12:56:25 +01:00
Torkel Ödegaard
65345c737a ControlsMenu: Fix button spacing 2025-12-17 07:38:06 +01:00
4 changed files with 10 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ export const getModalStyles = (theme: GrafanaTheme2) => {
modalContent: css({ modalContent: css({
overflow: 'auto', overflow: 'auto',
padding: theme.spacing(3, 3, 0, 3), padding: theme.spacing(3, 3, 0, 3),
marginBottom: theme.spacing(3), marginBottom: theme.spacing(2.5),
scrollbarWidth: 'thin', scrollbarWidth: 'thin',
width: '100%', width: '100%',
@@ -91,7 +91,7 @@ export const getModalStyles = (theme: GrafanaTheme2) => {
modalButtonRow: css({ modalButtonRow: css({
background: theme.colors.background.primary, background: theme.colors.background.primary,
position: 'sticky', position: 'sticky',
bottom: 0, bottom: 1,
paddingTop: theme.spacing(2), paddingTop: theme.spacing(2),
paddingBottom: theme.spacing(0.5), paddingBottom: theme.spacing(0.5),
zIndex: 1, zIndex: 1,

View File

@@ -15,13 +15,14 @@ export function DashboardDataLayerControls({ dashboard }: { dashboard: Dashboard
const state = sceneGraph.getData(dashboard).useState(); const state = sceneGraph.getData(dashboard).useState();
// It is possible to render the controls for the annotation data layers in separate places using the `placement` property. // It is possible to render the controls for the annotation data layers in separate places using the `placement` property.
// In case it's not specified, we are rendering the controls here (default). // In case it's not specified, we are rendering the controls here (default).
const isDefaultPlacement = (layer: SceneDataLayerProvider) => layer.state.placement === undefined; const isDefaultPlacementAndNotHidden = (layer: SceneDataLayerProvider) =>
layer.state.placement === undefined && !layer.state.isHidden;
const styles = useStyles2(getStyles); const styles = useStyles2(getStyles);
if (isDashboardDataLayerSetState(state)) { if (isDashboardDataLayerSetState(state)) {
return ( return (
<> <>
{state.annotationLayers.filter(isDefaultPlacement).map((layer) => ( {state.annotationLayers.filter(isDefaultPlacementAndNotHidden).map((layer) => (
<div key={layer.state.key} className={styles.container}> <div key={layer.state.key} className={styles.container}>
<DataLayerControl layer={layer} /> <DataLayerControl layer={layer} />
</div> </div>
@@ -35,6 +36,7 @@ export function DashboardDataLayerControls({ dashboard }: { dashboard: Dashboard
const getStyles = (theme: GrafanaTheme2) => ({ const getStyles = (theme: GrafanaTheme2) => ({
container: css({ container: css({
label: 'dashboard-data-layer-controls',
display: 'inline-flex', display: 'inline-flex',
alignItems: 'center', alignItems: 'center',
verticalAlign: 'middle', verticalAlign: 'middle',

View File

@@ -18,7 +18,7 @@ export function DashboardLinksControls({ links, dashboard }: Props) {
const uid = dashboard.state.uid; const uid = dashboard.state.uid;
const styles = useStyles2(getStyles); const styles = useStyles2(getStyles);
if (!links || !uid) { if (!links || !uid || links.length === 0) {
return null; return null;
} }
@@ -36,6 +36,7 @@ export function DashboardLinksControls({ links, dashboard }: Props) {
function getStyles(theme: GrafanaTheme2) { function getStyles(theme: GrafanaTheme2) {
return { return {
linksContainer: css({ linksContainer: css({
label: 'dashboard-links-controls',
display: 'inline-flex', display: 'inline-flex',
gap: theme.spacing(1), gap: theme.spacing(1),
marginRight: theme.spacing(1), marginRight: theme.spacing(1),

View File

@@ -47,5 +47,7 @@ export function DashboardControlsButton({ dashboard }: { dashboard: DashboardSce
const getStyles = (theme: GrafanaTheme2) => ({ const getStyles = (theme: GrafanaTheme2) => ({
dropdownButton: css({ dropdownButton: css({
display: 'inline-flex', display: 'inline-flex',
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1),
}), }),
}); });