neighbourslist in nodeinfo
This commit is contained in:
parent
c766d064e7
commit
25477baa24
45
history.js
45
history.js
@ -166,7 +166,7 @@ function handle_data(config, map) {
|
|||||||
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
||||||
})
|
})
|
||||||
|
|
||||||
var gotoAnything = gotoBuilder(config, showNodeinfo, showLinkinfo)
|
var gotoAnything = new gotoBuilder(config, showNodeinfo, showLinkinfo)
|
||||||
|
|
||||||
var markers = mkmap(map, newnodes, lostnodes, onlinenodes, graph, gotoAnything)
|
var markers = mkmap(map, newnodes, lostnodes, onlinenodes, graph, gotoAnything)
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ function showMeshstats(el, nodes) {
|
|||||||
totalGateways + " Gateways"
|
totalGateways + " Gateways"
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNodeinfo(config, d) {
|
function showNodeinfo(config, gotoAnything, d) {
|
||||||
var el = document.getElementById("nodeinfo")
|
var el = document.getElementById("nodeinfo")
|
||||||
|
|
||||||
destroy()
|
destroy()
|
||||||
@ -466,25 +466,36 @@ function showNodeinfo(config, d) {
|
|||||||
var table = document.createElement("table")
|
var table = document.createElement("table")
|
||||||
|
|
||||||
var neighbours = d.neighbours.slice().sort( function (a, b) {
|
var neighbours = d.neighbours.slice().sort( function (a, b) {
|
||||||
return a.link.tq - b.link.tq
|
return a.node.nodeinfo.hostname.localeCompare(b.node.nodeinfo.hostname)
|
||||||
}).reverse()
|
})
|
||||||
|
|
||||||
|
console.log(gotoAnything)
|
||||||
|
|
||||||
neighbours.forEach( function (d) {
|
neighbours.forEach( function (d) {
|
||||||
var tr = document.createElement("tr")
|
var tr = document.createElement("tr")
|
||||||
|
|
||||||
var td1 = document.createElement("td")
|
var td1 = document.createElement("td")
|
||||||
var a = document.createElement("a")
|
var a1 = document.createElement("a")
|
||||||
// a.href = "#"
|
a1.href = "#"
|
||||||
a.textContent = d.node.nodeinfo.hostname
|
a1.textContent = d.node.nodeinfo.hostname
|
||||||
td1.appendChild(a)
|
a1.onclick = gotoAnything.node(d.node)
|
||||||
|
td1.appendChild(a1)
|
||||||
tr.appendChild(td1)
|
tr.appendChild(td1)
|
||||||
|
|
||||||
var td2 = document.createElement("td")
|
var td2 = document.createElement("td")
|
||||||
td2.textContent = showTq(d.link)
|
var a2 = document.createElement("a")
|
||||||
|
a2.href = "#"
|
||||||
|
a2.textContent = showTq(d.link)
|
||||||
|
a2.onclick = gotoAnything.link(d.link)
|
||||||
|
td2.appendChild(a2)
|
||||||
tr.appendChild(td2)
|
tr.appendChild(td2)
|
||||||
|
|
||||||
var td3 = document.createElement("td")
|
var td3 = document.createElement("td")
|
||||||
td3.textContent = showDistance(d.link)
|
var a3 = document.createElement("a")
|
||||||
|
a3.href = "#"
|
||||||
|
a3.textContent = showDistance(d.link)
|
||||||
|
a3.onclick = gotoAnything.link(d.link)
|
||||||
|
td3.appendChild(a3)
|
||||||
tr.appendChild(td3)
|
tr.appendChild(td3)
|
||||||
|
|
||||||
table.appendChild(tr)
|
table.appendChild(tr)
|
||||||
@ -664,6 +675,7 @@ function trueDefault(d) {
|
|||||||
|
|
||||||
function gotoBuilder(config, nodes, links) {
|
function gotoBuilder(config, nodes, links) {
|
||||||
var markers = {}
|
var markers = {}
|
||||||
|
var self = this
|
||||||
|
|
||||||
function gotoNode(d, showMap, push) {
|
function gotoNode(d, showMap, push) {
|
||||||
showMap = trueDefault(showMap)
|
showMap = trueDefault(showMap)
|
||||||
@ -672,7 +684,7 @@ function gotoBuilder(config, nodes, links) {
|
|||||||
if (showMap && d.nodeinfo.node_id in markers)
|
if (showMap && d.nodeinfo.node_id in markers)
|
||||||
markers[d.nodeinfo.node_id]()
|
markers[d.nodeinfo.node_id]()
|
||||||
|
|
||||||
nodes(config, d)
|
nodes(config, self, d)
|
||||||
|
|
||||||
if (push)
|
if (push)
|
||||||
pushHistory( { node: d })
|
pushHistory( { node: d })
|
||||||
@ -701,10 +713,13 @@ function gotoBuilder(config, nodes, links) {
|
|||||||
markers = d
|
markers = d
|
||||||
}
|
}
|
||||||
|
|
||||||
return { node: function (d, m, p) { return function () { return gotoNode(d, m, p) }},
|
this.node = function (d, m, p) { return function () { return gotoNode(d, m, p) }}
|
||||||
link: function (d, m, p) { return function () { return gotoLink(d, m, p) }},
|
this.link = function (d, m, p) { return function () { return gotoLink(d, m, p) }}
|
||||||
addMarkers: addMarkers
|
this.addMarkers = function (d) {
|
||||||
}
|
markers = d
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
function dictGet(dict, key) {
|
function dictGet(dict, key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user