From b8a9ac9a26ac5d7537f8cc99c6ce7da19cb3efae Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 31 Mar 2015 17:21:58 +0200 Subject: [PATCH] wrap links/nodes in graph --- lib/linklist.js | 4 ++-- lib/main.js | 5 ++++- lib/map.js | 2 +- lib/router.js | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/linklist.js b/lib/linklist.js index ca748bb..a23100e 100644 --- a/lib/linklist.js +++ b/lib/linklist.js @@ -9,7 +9,7 @@ define(["tablesort", "tablesort.numeric"], function (Tablesort) { } self.setData = function (data) { - if (data.links.length === 0) + if (data.graph.links.length === 0) return var h2 = document.createElement("h2") @@ -39,7 +39,7 @@ define(["tablesort", "tablesort.numeric"], function (Tablesort) { var tbody = document.createElement("tbody") - data.links.forEach( function (d) { + data.graph.links.forEach( function (d) { var row = document.createElement("tr") var td1 = document.createElement("td") var a = document.createElement("a") diff --git a/lib/main.js b/lib/main.js index f69e875..350f530 100644 --- a/lib/main.js +++ b/lib/main.js @@ -70,7 +70,10 @@ function (config, moment, Router, L, GUI) { new: newnodes, lost: lostnodes }, - links: links + graph: { + links: links, + nodes: graph.nodes + } } } diff --git a/lib/map.js b/lib/map.js index b8dc851..73e18ea 100644 --- a/lib/map.js +++ b/lib/map.js @@ -81,7 +81,7 @@ define(["leaflet", "moment", "leaflet.label"], function (L, moment) { nodeDict = {} linkDict = {} - var lines = addLinksToMap(linkDict, linkScale, data.links, router) + var lines = addLinksToMap(linkDict, linkScale, data.graph.links, router) L.featureGroup(lines).addTo(map) var nodesOnline = subtract(data.nodes.all.filter(online), data.nodes.new) diff --git a/lib/router.js b/lib/router.js index df3bc6f..c071a10 100644 --- a/lib/router.js +++ b/lib/router.js @@ -121,7 +121,7 @@ define(function () { objects.nodes[d.nodeinfo.node_id] = d }) - data.links.forEach( function (d) { + data.graph.links.forEach( function (d) { objects.links[linkId(d)] = d }) }