Jannis Moßhammer fa5c499733 Allow container-based url in history api
When a url is now loaded for an non-main container, the url for the
container is appended to the GET part of the URL

refs #4303
2013-06-19 13:22:02 +02:00

86 lines
2.1 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/modules/actionTable','icinga/modules/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, 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) {
},
loadUrl: function(url, target, params) {
target = target || "icinga-main";
async.loadToTarget(target, url, params);
},
getFailedModules: function() {
return failedModules;
}
};
};
return new Icinga();
});