Commit f3090d8c by Torkel Ödegaard

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

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