mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-11-11 08:29:57 +01:00
the js/modules/%modulename%/%file% is now mapped to the module path (if existing). To prevent name clashing, the modules folder has been renamed to components.
81 lines
1.9 KiB
JavaScript
Executable File
81 lines
1.9 KiB
JavaScript
Executable File
/*global Icinga:false, document: false, define:false require:false base_url:false console:false */
|
|
define([
|
|
'jquery',
|
|
'logging',
|
|
'icinga/module',
|
|
'icinga/util/async',
|
|
'icinga/container',
|
|
'modules/list'
|
|
], function ($, log, moduleMgr, async, containerMgr, modules) {
|
|
'use strict';
|
|
|
|
/**
|
|
* Icinga prototype
|
|
*/
|
|
var Icinga = function() {
|
|
var internalModules = ['icinga/components/actionTable','icinga/components/mainDetail'];
|
|
|
|
this.modules = {};
|
|
var failedModules = [];
|
|
|
|
var initialize = function () {
|
|
enableInternalModules();
|
|
|
|
containerMgr.registerAsyncMgr(async);
|
|
containerMgr.initializeContainers(document);
|
|
log.debug("Initialization finished");
|
|
|
|
enableModules();
|
|
};
|
|
|
|
|
|
|
|
var enableInternalModules = function() {
|
|
$.each(internalModules,function(idx,module) {
|
|
moduleMgr.enableModule(module, log.error);
|
|
});
|
|
};
|
|
|
|
var loadModuleScript = function(name) {
|
|
moduleMgr.enableModule("modules/"+name+"/"+name, function(error) {
|
|
failedModules.push({
|
|
name: name,
|
|
errorMessage: error
|
|
});
|
|
});
|
|
};
|
|
|
|
var enableModules = function(moduleList) {
|
|
moduleList = moduleList || modules;
|
|
|
|
$.each(modules,function(idx,module) {
|
|
loadModuleScript(module.name);
|
|
});
|
|
};
|
|
|
|
|
|
$(document).ready(initialize.bind(this));
|
|
|
|
return {
|
|
/**
|
|
*
|
|
*/
|
|
loadModule: function(blubb,bla) {
|
|
behaviour.registerBehaviour(blubb,bla);
|
|
},
|
|
|
|
loadIntoContainer: function(ctr) {
|
|
|
|
},
|
|
|
|
getFailedModules: function() {
|
|
return failedModules;
|
|
}
|
|
|
|
};
|
|
};
|
|
return new Icinga();
|
|
});
|
|
|
|
|