mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: Fixes full page reload of fullscreen view of a repeated panel (#76326)
* Progress on view panel for repeats * Good enough * Update
This commit is contained in:
@@ -108,6 +108,16 @@ describe('PanelRepeaterGridItem', () => {
|
||||
// given 5 rows with total height 25 gives new itemHeight of 5
|
||||
expect(repeater.state.itemHeight).toBe(5);
|
||||
});
|
||||
|
||||
it('When updating variable should update repeats', async () => {
|
||||
const { scene, repeater, variable } = buildScene({ variableQueryTime: 0 });
|
||||
|
||||
activateFullSceneTree(scene);
|
||||
|
||||
variable.changeValueTo(['1', '3'], ['A', 'C']);
|
||||
|
||||
expect(repeater.state.repeatedPanels?.length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
interface SceneOptions {
|
||||
@@ -130,27 +140,27 @@ function buildScene(options: SceneOptions) {
|
||||
}),
|
||||
});
|
||||
|
||||
const variable = new TestVariable({
|
||||
name: 'server',
|
||||
query: 'A.*',
|
||||
value: ALL_VARIABLE_VALUE,
|
||||
text: ALL_VARIABLE_TEXT,
|
||||
isMulti: true,
|
||||
includeAll: true,
|
||||
delayMs: options.variableQueryTime,
|
||||
optionsToReturn: [
|
||||
{ label: 'A', value: '1' },
|
||||
{ label: 'B', value: '2' },
|
||||
{ label: 'C', value: '3' },
|
||||
{ label: 'D', value: '4' },
|
||||
{ label: 'E', value: '5' },
|
||||
],
|
||||
});
|
||||
|
||||
const scene = new EmbeddedScene({
|
||||
$timeRange: new SceneTimeRange({ from: 'now-6h', to: 'now' }),
|
||||
$variables: new SceneVariableSet({
|
||||
variables: [
|
||||
new TestVariable({
|
||||
name: 'server',
|
||||
query: 'A.*',
|
||||
value: ALL_VARIABLE_VALUE,
|
||||
text: ALL_VARIABLE_TEXT,
|
||||
isMulti: true,
|
||||
includeAll: true,
|
||||
delayMs: options.variableQueryTime,
|
||||
optionsToReturn: [
|
||||
{ label: 'A', value: '1' },
|
||||
{ label: 'B', value: '2' },
|
||||
{ label: 'C', value: '3' },
|
||||
{ label: 'D', value: '4' },
|
||||
{ label: 'E', value: '5' },
|
||||
],
|
||||
}),
|
||||
],
|
||||
variables: [variable],
|
||||
}),
|
||||
body: new SceneGridLayout({
|
||||
children: [
|
||||
@@ -161,5 +171,5 @@ function buildScene(options: SceneOptions) {
|
||||
}),
|
||||
});
|
||||
|
||||
return { scene, repeater };
|
||||
return { scene, repeater, variable };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user