Allow IcingaWeb to trigger a browser-side CSS reload

This commit is contained in:
Thomas Gelf 2014-03-26 07:41:23 +00:00
parent 48913767d3
commit 8dbf7b0729
2 changed files with 20 additions and 0 deletions

View File

@ -304,6 +304,11 @@
req.$target.attr('class', 'container'); // TODO: remove module-$name
}
var cssreload = req.getResponseHeader('X-Icinga-CssReload');
if (cssreload) {
this.icinga.ui.reloadCss();
}
var title = req.getResponseHeader('X-Icinga-Title');
if (title && req.$target.closest('.dashboard').length === 0) {
this.icinga.ui.setTitle(title);

View File

@ -76,6 +76,21 @@
return this;
},
reloadCss: function () {
var utils = this.icinga.utils;
$('link').each(function() {
if ($(this).attr('type').indexOf('css') > -1) {
$(this).attr(
'href',
utils.addUrlParams(
$(this).attr('href'),
[ { name: 'id', value: new Date().getTime() } ]
)
);
}
});
},
enableTimeCounters: function () {
this.timeCounterTimer = this.icinga.timer.register(
this.refreshTimeSince,