infobox: handle directional links

This commit is contained in:
Milan Pässler 2016-02-18 16:38:36 +00:00
parent d13b032b61
commit f354a6fbc7
3 changed files with 7 additions and 4 deletions

View file

@ -6,7 +6,7 @@ define(function () {
a1.onclick = router.node(d.source.node)
a1.textContent = d.source.node.nodeinfo.hostname
h2.appendChild(a1)
h2.appendChild(document.createTextNode(" "))
h2.appendChild(document.createTextNode(" "))
var a2 = document.createElement("a")
a2.href = "#"
a2.onclick = router.node(d.target.node)
@ -19,7 +19,7 @@ define(function () {
attributeEntry(attributes, "TQ", showTq(d))
attributeEntry(attributes, "Entfernung", showDistance(d))
attributeEntry(attributes, "VPN", d.vpn ? "ja" : "nein")
attributeEntry(attributes, "VPN", d.vpn ? "ja" : null)
var hw1 = dictGet(d.source.node.nodeinfo, ["hardware", "model"])
var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " " + (hw2 != null ? hw2 : "unbekannt"))

View file

@ -259,10 +259,13 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
a1.textContent = d.node.nodeinfo.hostname
a1.href = "#"
a1.onclick = router.node(d.node)
td1.appendChild(document.createTextNode(d.incoming ? " ← " : " → "))
td1.appendChild(a1)
if (d.link.vpn)
td1.appendChild(document.createTextNode(" (VPN)"))
if (d.link.cable)
td1.appendChild(document.createTextNode(" (Kabel)"))
if (has_location(d.node)) {
var span = document.createElement("span")

View file

@ -100,8 +100,8 @@ function (moment, Router, L, GUI, numeral) {
})
links.forEach( function (d) {
d.source.node.neighbours.push({ node: d.target.node, link: d })
d.target.node.neighbours.push({ node: d.source.node, link: d })
d.source.node.neighbours.push({ node: d.target.node, link: d, incoming: false })
d.target.node.neighbours.push({ node: d.source.node, link: d, incoming: true })
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