mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(UI): fixed 3 UI bugs, fixes #6225
This commit is contained in:
@@ -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', () => {
|
||||
panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true);
|
||||
panelContainer.toggleClass('panel-has-alert', ctrl.panel.alert !== undefined);
|
||||
|
||||
if (panelContainer.hasClass('panel-has-alert')) {
|
||||
panelContainer.removeClass('panel-alert-state--ok panel-alert-state--alerting');
|
||||
if (transparentLastState !== ctrl.panel.transparent) {
|
||||
panelContainer.toggleClass('panel-transparent', ctrl.panel.transparent === true);
|
||||
transparentLastState = ctrl.panel.transparent;
|
||||
}
|
||||
|
||||
hasAlertRule = ctrl.panel.alert !== undefined;
|
||||
if (lastHasAlertRule !== hasAlertRule) {
|
||||
panelContainer.toggleClass('panel-has-alert', hasAlertRule);
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user