freifunkmanager/js/main.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-07-02 02:11:17 +02:00
define(["helper/router","helper/storage","menu","popup","controller/nodes","controller/aliases","controller/map","controller/frame"],
function (Router, storage, menu, popup, controllerNodes, controllerAliases, controllerMap, controllerFrame) {
2016-07-01 08:25:32 +02:00
return function(config){
2016-07-01 16:01:28 +02:00
var store = storage(config);
store.refresh();
store.autorefresh(config.reload);
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
document.title = "eventmanager";
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
menu(document.body,store);
el = document.createElement("div");
el.classList.add("content");
document.body.appendChild(el);
2016-07-01 08:25:32 +02:00
2016-07-01 16:01:28 +02:00
var map = controllerMap(el,config);
store.addNotify(map);
2016-07-01 08:25:32 +02:00
2016-07-02 02:11:17 +02:00
var aliases = controllerAliases(el,map);
store.addNotify(aliases);
var popupInstance = popup(document.body,map);
store.addNotifyNew(popupInstance);
2016-07-03 09:59:03 +02:00
var nodes = controllerNodes(el,map);
2016-07-01 16:01:28 +02:00
store.addNotify(nodes);
2016-07-01 08:25:32 +02:00
Router.config({
mode: 'hash'
})
2016-07-01 16:01:28 +02:00
.add(/grafana/, controllerFrame(el,config.grafana.all))
2016-07-01 11:16:39 +02:00
.add(/meshviewer/, controllerFrame(el,config.meshviewer))
2016-07-02 02:11:17 +02:00
.add(/aliases/, aliases.controller)
.add(/nodes/, nodes.controller)
2016-07-01 08:25:32 +02:00
.add(/map\/(.*)/, map.controller)
.add(/map/, map.controller)
.add(nodes.controller)
2016-07-01 16:01:28 +02:00
.check().listen();
};
});