Log jQuery info at startup, fix JS reload

This commit is contained in:
Thomas Gelf 2014-03-26 10:30:45 +00:00
parent e4c268ca92
commit 632616671d

View File

@ -15,6 +15,8 @@
var Icinga = function (config) { var Icinga = function (config) {
this.initialized = false;
/** /**
* Our config object * Our config object
*/ */
@ -73,6 +75,9 @@
* Icinga startup, will be triggerd once the document is ready * Icinga startup, will be triggerd once the document is ready
*/ */
initialize: function () { initialize: function () {
if (this.initialized) {
return false;
}
this.utils = new Icinga.Utils(this); this.utils = new Icinga.Utils(this);
this.logger = new Icinga.Logger(this); this.logger = new Icinga.Logger(this);
@ -87,7 +92,8 @@
this.history.initialize(); this.history.initialize();
this.ui.initialize(); this.ui.initialize();
this.loader.initialize(); this.loader.initialize();
this.logger.info('Icinga is ready'); this.logger.info('Icinga is ready, running on jQuery ', $().jquery);
this.initialized = true;
}, },
/** /**
@ -149,6 +155,7 @@
this.modules = []; this.modules = [];
this.timer = this.events = this.loader = this.ui = this.logger = this.timer = this.events = this.loader = this.ui = this.logger =
this.utils = null; this.utils = null;
this.initialized = false;
}, },
reload: function () { reload: function () {
@ -160,19 +167,23 @@
window.Icinga = undefined; window.Icinga = undefined;
window.$ = undefined; window.$ = undefined;
window.jQuery = undefined; window.jQuery = undefined;
jQuery = undefined;
$ = undefined;
oldjQuery.getScript( oldjQuery.getScript(
oldConfig.baseUrl + 'js/icinga.min.js' oldConfig.baseUrl + 'js/icinga.min.js'
).done(function () { ).done(function () {
window.jQuery = oldjQuery; var jQuery = window.jQuery;
window.$ = window.jQuery; window.icinga = new window.Icinga(oldConfig);
window.Icinga = oldIcinga; window.icinga.initialize();
window.icinga = new Icinga(oldConfig);
window.icinga.ui.reloadCss(); window.icinga.ui.reloadCss();
oldjQuery = undefined; oldjQuery = undefined;
oldConfig = undefined; oldConfig = undefined;
oldIcinga = undefined; oldIcinga = undefined;
}).fail(function () { }).fail(function () {
window.jQuery = oldjQuery;
window.$ = window.jQuery;
window.Icinga = oldIcinga;
window.icinga = new Icinga(oldConfig); window.icinga = new Icinga(oldConfig);
window.icinga.ui.reloadCss(); window.icinga.ui.reloadCss();
}); });
@ -185,4 +196,4 @@
Icinga.availableModules = {}; Icinga.availableModules = {};
})(window, window.jQuery); })(window, jQuery);