Commit 55609382 by Torkel Ödegaard

fix: fixed panel size rerendering issues

parent 47014ddb
......@@ -75,7 +75,7 @@ export class DashboardViewState {
}
// remember if editStateChanged
this.editStateChanged = state.edit !== this.state.edit;
this.editStateChanged = (state.edit || false) !== (this.state.edit || false);
_.extend(this.state, state);
this.dashboard.meta.fullscreen = this.state.fullscreen;
......
......@@ -52,12 +52,9 @@ export class PanelCtrl {
this.events.emit('panel-teardown');
this.events.removeAllListeners();
});
this.calculatePanelHeight();
}
init() {
this.events.on('panel-size-changed', this.onSizeChanged.bind(this));
this.events.emit('panel-initialized');
this.publishAppEvent('panel-initialized', {scope: this.$scope});
}
......@@ -184,13 +181,6 @@ export class PanelCtrl {
this.events.emit('render', payload);
}
private onSizeChanged() {
this.calculatePanelHeight();
this.$timeout(() => {
this.render();
}, 100);
}
duplicate() {
this.dashboard.duplicatePanel(this.panel);
this.$timeout(() => {
......
......@@ -53,7 +53,7 @@ var panelTemplate = `
</div>
`;
module.directive('grafanaPanel', function($rootScope, $document) {
module.directive('grafanaPanel', function($rootScope, $document, $timeout) {
return {
restrict: 'E',
template: panelTemplate,
......@@ -106,11 +106,19 @@ module.directive('grafanaPanel', function($rootScope, $document) {
}
});
ctrl.events.on('render', () => {
if (lastHeight !== ctrl.height) {
panelHeightUpdated();
}
ctrl.events.on('panel-size-changed', () => {
ctrl.calculatePanelHeight();
panelHeightUpdated();
$timeout(() => {
ctrl.render();
});
});
// set initial height
ctrl.calculatePanelHeight();
panelHeightUpdated();
ctrl.events.on('render', () => {
if (transparentLastState !== ctrl.panel.transparent) {
panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true);
transparentLastState = ctrl.panel.transparent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment