Commit 7b70e0ff by Torkel Ödegaard

fix(UI): fixed 3 UI bugs, fixes #6225

parent 6b16fcea
......@@ -315,6 +315,7 @@ export class AlertTabCtrl {
this.alert = null;
this.panel.thresholds = [];
this.conditionModels = [];
this.panelCtrl.alertState = null;
this.panelCtrl.render();
}
});
......
......@@ -83,6 +83,9 @@ function (angular, _, $) {
};
DashboardViewState.prototype.update = function(state) {
// remember if editStateChanged
this.editStateChanged = state.edit !== this.state.edit;
_.extend(this.state, state);
this.dashboard.meta.fullscreen = this.state.fullscreen;
......@@ -115,7 +118,7 @@ function (angular, _, $) {
if (this.fullscreenPanel) {
// if already fullscreen
if (this.fullscreenPanel === panelScope) {
if (this.fullscreenPanel === panelScope && this.editStateChanged === false) {
return;
} else {
this.leaveFullscreen(false);
......
......@@ -68,21 +68,39 @@ module.directive('grafanaPanel', function() {
// the reason for handling these classes this way is for performance
// limit the watchers on panels etc
var transparentLastState;
var lastHasAlertRule;
var lastAlertState;
var hasAlertRule;
ctrl.events.on('render', () => {
if (transparentLastState !== ctrl.panel.transparent) {
panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true);
panelContainer.toggleClass('panel-has-alert', ctrl.panel.alert !== undefined);
transparentLastState = ctrl.panel.transparent;
}
hasAlertRule = ctrl.panel.alert !== undefined;
if (lastHasAlertRule !== hasAlertRule) {
panelContainer.toggleClass('panel-has-alert', hasAlertRule);
if (panelContainer.hasClass('panel-has-alert')) {
panelContainer.removeClass('panel-alert-state--ok panel-alert-state--alerting');
lastHasAlertRule = hasAlertRule;
}
// set special class for ok, or alerting states
if (ctrl.alertState) {
if (lastAlertState) {
panelContainer.removeClass('panel-alert-state--' + lastAlertState);
}
if (ctrl.alertState.state === 'ok' || ctrl.alertState.state === 'alerting') {
panelContainer.addClass('panel-alert-state--' + ctrl.alertState.state);
}
lastAlertState = ctrl.alertState.state;
} else if (lastAlertState) {
panelContainer.removeClass('panel-alert-state--' + lastAlertState);
lastAlertState = null;
}
});
scope.$watchGroup(['ctrl.fullscreen', 'ctrl.containerHeight'], function() {
......
......@@ -88,7 +88,8 @@ function (angular, $, _, Tether) {
$scope.$watchCollection('ctrl.panel.links', function(newValue) {
var showIcon = (newValue ? newValue.length > 0 : false) && ctrl.panel.title !== '';
$panelLinksBtn.toggle(showIcon);
// cannot use toggle here, only works for attached elements
$panelLinksBtn.css({display: showIcon ? 'inline' : 'none'});
});
function dismiss(time, force) {
......
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