Commit f3090d8c by Torkel Ödegaard

fix(dashboard): fixed issue with resizing panel, #6442

parent 18056e53
...@@ -56,7 +56,7 @@ var panelTemplate = ` ...@@ -56,7 +56,7 @@ var panelTemplate = `
</div> </div>
`; `;
module.directive('grafanaPanel', function() { module.directive('grafanaPanel', function($rootScope) {
return { return {
restrict: 'E', restrict: 'E',
template: panelTemplate, template: panelTemplate,
...@@ -72,8 +72,14 @@ module.directive('grafanaPanel', function() { ...@@ -72,8 +72,14 @@ module.directive('grafanaPanel', function() {
var lastHasAlertRule; var lastHasAlertRule;
var lastAlertState; var lastAlertState;
var hasAlertRule; var hasAlertRule;
var lastHeight = 0;
ctrl.events.on('render', () => { ctrl.events.on('render', () => {
if (lastHeight !== ctrl.containerHeight) {
panelContainer.css({minHeight: ctrl.containerHeight});
lastHeight = ctrl.containerHeight;
}
if (transparentLastState !== ctrl.panel.transparent) { if (transparentLastState !== ctrl.panel.transparent) {
panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true); panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true);
transparentLastState = ctrl.panel.transparent; transparentLastState = ctrl.panel.transparent;
...@@ -102,10 +108,13 @@ module.directive('grafanaPanel', function() { ...@@ -102,10 +108,13 @@ module.directive('grafanaPanel', function() {
} }
}); });
scope.$watchGroup(['ctrl.fullscreen', 'ctrl.containerHeight'], function() { var lastFullscreen;
panelContainer.css({minHeight: ctrl.containerHeight}); $rootScope.onAppEvent('panel-change-view', function(evt, payload) {
elem.toggleClass('panel-fullscreen', ctrl.fullscreen ? true : false); if (lastFullscreen !== ctrl.fullscreen) {
}); elem.toggleClass('panel-fullscreen', ctrl.fullscreen ? true : false);
lastFullscreen = ctrl.fullscreen;
}
}, scope);
} }
}; };
}); });
...@@ -171,11 +180,10 @@ module.directive('panelResizer', function($rootScope) { ...@@ -171,11 +180,10 @@ module.directive('panelResizer', function($rootScope) {
lastPanel.span = Math.round(lastPanel.span); lastPanel.span = Math.round(lastPanel.span);
} }
ctrl.row.panelSpanChanged();
// first digest to propagate panel width change // first digest to propagate panel width change
// then render // then render
$rootScope.$apply(function() { $rootScope.$apply(function() {
ctrl.row.panelSpanChanged();
setTimeout(function() { setTimeout(function() {
$rootScope.$broadcast('render'); $rootScope.$broadcast('render');
}); });
......
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