mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelChrome: Use react Panel Header for angular panels. (#21265)
* WIP: Angular panel chrome, this is going to be tricky * AngularPanelChrome: initial render works * Options are showing up * viz options working * Fixed singlestat background * AngularPanels: Fixed alert tab * Removed anuglar loading spinner * Dashboard: Refactor dashboard reducer & actions * Dashboard: minor refactoring * PanelChrome: loading state moved to header * Subscribe to render events to solve title update issue * Time info and query errors now works * PanelHeader: unifying angular and react behavior * added getPanelMenu test * Scrollable now works again * Various fixes * Making stuff work * seperate event emitter for angular * Fixed issue sending updated dimensions to angular panel * Minor tweaks * Fixed tests * Alerting: alert state now works * Fixed unit tests * Fixed a few null check errors * Simplified events handling * Fixed strict null checks
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { PanelModel } from './PanelModel';
|
||||
import { getPanelPlugin } from '../../plugins/__mocks__/pluginMocks';
|
||||
import { PanelEvents } from '@grafana/data';
|
||||
|
||||
class TablePanelCtrl {}
|
||||
|
||||
@@ -148,18 +147,19 @@ describe('PanelModel', () => {
|
||||
});
|
||||
|
||||
describe('when changing from angular panel', () => {
|
||||
let tearDownPublished = false;
|
||||
const angularPanel = {
|
||||
scope: {},
|
||||
destroy: jest.fn(),
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
model.events.on(PanelEvents.panelTeardown, () => {
|
||||
tearDownPublished = true;
|
||||
});
|
||||
model.angularPanel = angularPanel;
|
||||
model.changePlugin(getPanelPlugin({ id: 'graph' }));
|
||||
});
|
||||
|
||||
it('should teardown / destroy panel so angular panels event subscriptions are removed', () => {
|
||||
expect(tearDownPublished).toBe(true);
|
||||
expect(model.events.getEventCount()).toBe(0);
|
||||
it('should set angularPanel to undefined and call destory', () => {
|
||||
expect(angularPanel.destroy.mock.calls.length).toBe(1);
|
||||
expect(model.angularPanel).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user