mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Fixes issue with mobile responsive layout due to repeated grid item class (#85731)
This commit is contained in:
parent
37d39de36d
commit
edf36d9ec0
@ -1,9 +1,11 @@
|
|||||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||||
import { setPluginImportUtils } from '@grafana/runtime';
|
import { setPluginImportUtils } from '@grafana/runtime';
|
||||||
import { SceneGridLayout } from '@grafana/scenes';
|
import { SceneGridLayout, VizPanel } from '@grafana/scenes';
|
||||||
|
|
||||||
import { activateFullSceneTree, buildPanelRepeaterScene } from '../utils/test-utils';
|
import { activateFullSceneTree, buildPanelRepeaterScene } from '../utils/test-utils';
|
||||||
|
|
||||||
|
import { DashboardGridItem } from './DashboardGridItem';
|
||||||
|
|
||||||
setPluginImportUtils({
|
setPluginImportUtils({
|
||||||
importPanelPlugin: (id: string) => Promise.resolve(getPanelPlugin({})),
|
importPanelPlugin: (id: string) => Promise.resolve(getPanelPlugin({})),
|
||||||
getPanelPluginFromCache: (id: string) => undefined,
|
getPanelPluginFromCache: (id: string) => undefined,
|
||||||
@ -116,4 +118,18 @@ describe('PanelRepeaterGridItem', () => {
|
|||||||
'_____default_sys_repeat_var_____'
|
'_____default_sys_repeat_var_____'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should return className when repeat variable is set', () => {
|
||||||
|
const { repeater } = buildPanelRepeaterScene({ variableQueryTime: 0 });
|
||||||
|
|
||||||
|
expect(repeater.getClassName()).toBe('panel-repeater-grid-item');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not className variable is not set', () => {
|
||||||
|
const gridItem = new DashboardGridItem({
|
||||||
|
body: new VizPanel({ pluginId: 'text' }),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(gridItem.getClassName()).toBe('');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -170,7 +170,7 @@ export class DashboardGridItem extends SceneObjectBase<DashboardGridItemState> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getClassName() {
|
public getClassName() {
|
||||||
return 'panel-repeater-grid-item';
|
return this.state.variableName ? 'panel-repeater-grid-item' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public isRepeated() {
|
public isRepeated() {
|
||||||
|
Loading…
Reference in New Issue
Block a user