2015-03-29 17:54:43 +00:00
|
|
|
define([ "chroma-js", "map", "sidebar", "tabs", "container", "meshstats",
|
2015-03-30 00:58:47 +00:00
|
|
|
"linklist", "nodelist", "simplenodelist", "infobox/main",
|
|
|
|
"proportions" ],
|
2015-03-29 17:54:43 +00:00
|
|
|
function (chroma, Map, Sidebar, Tabs, Container, Meshstats, Linklist,
|
2015-03-30 00:58:47 +00:00
|
|
|
Nodelist, SimpleNodelist, Infobox, Proportions) {
|
2015-03-29 17:54:43 +00:00
|
|
|
return function (config, router) {
|
|
|
|
var self = this
|
|
|
|
var dataTargets = []
|
|
|
|
|
|
|
|
var linkScale = chroma.scale(chroma.interpolate.bezier(["green", "yellow", "red"])).domain([1, 5])
|
|
|
|
var sidebar = new Sidebar(document.body)
|
|
|
|
var infobox = new Infobox(config, sidebar, router)
|
|
|
|
var tabs = new Tabs()
|
|
|
|
var overview = new Container()
|
|
|
|
|
|
|
|
var map = new Map(linkScale, sidebar, router)
|
|
|
|
document.body.insertBefore(map.div, document.body.firstChild)
|
|
|
|
|
|
|
|
var meshstats = new Meshstats()
|
|
|
|
var newnodeslist = new SimpleNodelist(config, "new", "firstseen", router, "Neue Knoten")
|
|
|
|
var lostnodeslist = new SimpleNodelist(config, "lost", "lastseen", router, "Verschwundene Knoten")
|
|
|
|
var nodelist = new Nodelist(router)
|
|
|
|
var linklist = new Linklist(linkScale, router)
|
2015-03-30 00:58:47 +00:00
|
|
|
var statistics = new Proportions()
|
2015-03-29 17:54:43 +00:00
|
|
|
|
|
|
|
dataTargets.push(map)
|
|
|
|
dataTargets.push(meshstats)
|
|
|
|
dataTargets.push(newnodeslist)
|
|
|
|
dataTargets.push(lostnodeslist)
|
|
|
|
dataTargets.push(nodelist)
|
|
|
|
dataTargets.push(linklist)
|
2015-03-30 00:58:47 +00:00
|
|
|
dataTargets.push(statistics)
|
2015-03-29 17:54:43 +00:00
|
|
|
|
|
|
|
overview.add(meshstats)
|
|
|
|
overview.add(newnodeslist)
|
|
|
|
overview.add(lostnodeslist)
|
|
|
|
|
|
|
|
sidebar.add(tabs)
|
|
|
|
tabs.add("Übersicht", overview)
|
|
|
|
tabs.add("Alle Knoten", nodelist)
|
|
|
|
tabs.add("Verbindungen", linklist)
|
2015-03-30 00:58:47 +00:00
|
|
|
tabs.add("Statistiken", statistics)
|
2015-03-29 17:54:43 +00:00
|
|
|
|
|
|
|
router.addTarget(infobox)
|
|
|
|
router.addTarget(map)
|
|
|
|
|
|
|
|
self.setData = function (data) {
|
|
|
|
dataTargets.forEach(function (d) {
|
|
|
|
d.setData(data)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return self
|
|
|
|
}
|
|
|
|
})
|