mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Panels: Fixed issue with panel type change and data updates (#16871)
This commit is contained in:
@@ -87,7 +87,10 @@ describe('PanelModel', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('when changing panel type', () => {
|
describe('when changing panel type', () => {
|
||||||
|
let panelQueryRunner: any;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
panelQueryRunner = model.getQueryRunner();
|
||||||
model.changePlugin(getPanelPlugin({ id: 'graph' }));
|
model.changePlugin(getPanelPlugin({ id: 'graph' }));
|
||||||
model.alert = { id: 2 };
|
model.alert = { id: 2 };
|
||||||
});
|
});
|
||||||
@@ -105,6 +108,11 @@ describe('PanelModel', () => {
|
|||||||
model.changePlugin(getPanelPlugin({ id: 'table' }));
|
model.changePlugin(getPanelPlugin({ id: 'table' }));
|
||||||
expect(model.alert).toBe(undefined);
|
expect(model.alert).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getQueryRunner() should return same instance after plugin change', () => {
|
||||||
|
const sameQueryRunner = model.getQueryRunner();
|
||||||
|
expect(panelQueryRunner).toBe(sameQueryRunner);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when changing from angular panel', () => {
|
describe('when changing from angular panel', () => {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ const notPersistedProperties: { [str: string]: boolean } = {
|
|||||||
// To make sure the change happens without strange bugs happening when panels use same
|
// To make sure the change happens without strange bugs happening when panels use same
|
||||||
// named property with different type / value expectations
|
// named property with different type / value expectations
|
||||||
// This is not required for react panels
|
// This is not required for react panels
|
||||||
|
|
||||||
const mustKeepProps: { [str: string]: boolean } = {
|
const mustKeepProps: { [str: string]: boolean } = {
|
||||||
id: true,
|
id: true,
|
||||||
gridPos: true,
|
gridPos: true,
|
||||||
@@ -63,6 +62,7 @@ const mustKeepProps: { [str: string]: boolean } = {
|
|||||||
cachedPluginOptions: true,
|
cachedPluginOptions: true,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
pluginVersion: true,
|
pluginVersion: true,
|
||||||
|
queryRunner: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaults: any = {
|
const defaults: any = {
|
||||||
|
|||||||
Reference in New Issue
Block a user