Fix CSS issues when rerendering the layout

fixes #13467
This commit is contained in:
Eric Lippmann 2016-12-12 15:02:51 +01:00
parent 67e41af308
commit e030229d7f
1 changed files with 28 additions and 26 deletions

View File

@ -480,40 +480,42 @@
newBody = true;
}
var moduleName = req.getResponseHeader('X-Icinga-Module');
classes = $.grep(req.$target.classes(), function (el) {
if (el === 'icinga-module' || el.match(/^module\-/)) {
return false;
}
return true;
});
if (moduleName) {
req.$target.data('icingaModule', moduleName);
classes.push('icinga-module');
classes.push('module-' + moduleName);
} else {
req.$target.removeData('icingaModule');
if (req.$target.attr('data-icinga-module')) {
req.$target.removeAttr('data-icinga-module');
if (target !== 'layout') {
var moduleName = req.getResponseHeader('X-Icinga-Module');
classes = $.grep(req.$target.classes(), function (el) {
if (el === 'icinga-module' || el.match(/^module\-/)) {
return false;
}
return true;
});
if (moduleName) {
req.$target.data('icingaModule', moduleName);
classes.push('icinga-module');
classes.push('module-' + moduleName);
} else {
req.$target.removeData('icingaModule');
if (req.$target.attr('data-icinga-module')) {
req.$target.removeAttr('data-icinga-module');
}
}
req.$target.attr('class', classes.join(' '));
var refresh = req.autoRefreshInterval || req.getResponseHeader('X-Icinga-Refresh');
if (refresh) {
req.$target.data('icingaRefresh', refresh);
} else {
req.$target.removeData('icingaRefresh');
if (req.$target.attr('data-icinga-refresh')) {
req.$target.removeAttr('data-icinga-refresh');
}
}
}
req.$target.attr('class', classes.join(' '));
var title = req.getResponseHeader('X-Icinga-Title');
if (title && ! req.autorefresh && req.$target.closest('.dashboard').length === 0) {
this.icinga.ui.setTitle(decodeURIComponent(title));
}
var refresh = req.autoRefreshInterval || req.getResponseHeader('X-Icinga-Refresh');
if (refresh) {
req.$target.data('icingaRefresh', refresh);
} else {
req.$target.removeData('icingaRefresh');
if (req.$target.attr('data-icinga-refresh')) {
req.$target.removeAttr('data-icinga-refresh');
}
}
// Set a window identifier if the server asks us to do so
var windowId = req.getResponseHeader('X-Icinga-WindowId');
if (windowId) {