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:
Torkel Ödegaard
2020-02-09 10:53:34 +01:00
committed by GitHub
parent 2feaad8b0d
commit 34c397002c
37 changed files with 641 additions and 807 deletions

View File

@@ -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);
});
});