nodelist: show number of neighbours
This commit is contained in:
parent
80afc7d162
commit
c0ab7afa15
@ -102,6 +102,10 @@ function (moment, Router, L, GUI, numeral) {
|
|||||||
links.forEach( function (d) {
|
links.forEach( function (d) {
|
||||||
d.source.node.neighbours.push({ node: d.target.node, link: d })
|
d.source.node.neighbours.push({ node: d.target.node, link: d })
|
||||||
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
d.target.node.neighbours.push({ node: d.source.node, link: d })
|
||||||
|
if (!d.vpn) {
|
||||||
|
d.source.node.meshlinks = d.source.node.meshlinks ? d.source.node.meshlinks + 1 : 1
|
||||||
|
d.target.node.meshlinks = d.target.node.meshlinks ? d.target.node.meshlinks + 1 : 1
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return { now: now,
|
return { now: now,
|
||||||
|
@ -31,6 +31,12 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||||||
},
|
},
|
||||||
reverse: true
|
reverse: true
|
||||||
},
|
},
|
||||||
|
{ name: "Neighbours",
|
||||||
|
sort: function (a, b) {
|
||||||
|
return a.meshlinks - b.meshlinks
|
||||||
|
},
|
||||||
|
reverse: true
|
||||||
|
},
|
||||||
{ name: "Clients",
|
{ name: "Clients",
|
||||||
sort: function (a, b) {
|
sort: function (a, b) {
|
||||||
return ("clients" in a.statistics ? a.statistics.clients : -1) -
|
return ("clients" in a.statistics ? a.statistics.clients : -1) -
|
||||||
@ -54,9 +60,10 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||||||
|
|
||||||
var td1 = V.h("td", td1Content)
|
var td1 = V.h("td", td1Content)
|
||||||
var td2 = V.h("td", showUptime(d.uptime))
|
var td2 = V.h("td", showUptime(d.uptime))
|
||||||
var td3 = V.h("td", numeral("clients" in d.statistics ? d.statistics.clients : "").format("0,0"))
|
var td3 = V.h("td", d.meshlinks.toString())
|
||||||
|
var td4 = V.h("td", numeral("clients" in d.statistics ? d.statistics.clients : "").format("0,0"))
|
||||||
|
|
||||||
return V.h("tr", [td1, td2, td3])
|
return V.h("tr", [td1, td2, td3, td4])
|
||||||
}
|
}
|
||||||
|
|
||||||
var table = new SortTable(headings, 0, renderRow)
|
var table = new SortTable(headings, 0, renderRow)
|
||||||
@ -76,6 +83,7 @@ define(["sorttable", "virtual-dom", "numeral"], function (SortTable, V, numeral)
|
|||||||
var data = d.nodes.all.map(function (e) {
|
var data = d.nodes.all.map(function (e) {
|
||||||
var n = Object.create(e)
|
var n = Object.create(e)
|
||||||
n.uptime = getUptime(d.now, e) || 0
|
n.uptime = getUptime(d.now, e) || 0
|
||||||
|
n.meshlinks = e.meshlinks || 0
|
||||||
return n
|
return n
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user