mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
fix: fixed panel size rerendering issues
This commit is contained in:
parent
47014ddb65
commit
55609382f1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user