2015-03-25 11:21:09 +01:00
|
|
|
|
define(function () {
|
2017-02-11 01:21:20 +01:00
|
|
|
|
function showStatImg(o, d) {
|
2016-03-16 20:40:08 +01:00
|
|
|
|
var subst = {}
|
2017-02-11 01:21:20 +01:00
|
|
|
|
subst["{SOURCE}"] = d.source.node_id
|
|
|
|
|
subst["{SOURCE_NAME}"] = d.source.node.nodeinfo.hostname ? d.source.node.nodeinfo.hostname : "unknown"
|
|
|
|
|
subst["{TARGET}"] = d.target.node_id
|
|
|
|
|
subst["{TARGET_NAME}"] = d.target.node.nodeinfo.hostname ? d.target.node.nodeinfo.hostname : "unknown"
|
2016-03-16 20:40:08 +01:00
|
|
|
|
return showStat(o, subst)
|
2016-03-08 20:01:38 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 19:45:21 +01:00
|
|
|
|
return function (config, el, router, d) {
|
2016-02-27 14:43:27 +01:00
|
|
|
|
var unknown = !(d.source.node)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
var h2 = document.createElement("h2")
|
2015-03-30 03:20:43 +02:00
|
|
|
|
var a1 = document.createElement("a")
|
2016-02-27 14:43:27 +01:00
|
|
|
|
if (!unknown) {
|
|
|
|
|
a1.href = "#"
|
|
|
|
|
a1.onclick = router.node(d.source.node)
|
|
|
|
|
}
|
|
|
|
|
a1.textContent = unknown ? d.source.id : d.source.node.nodeinfo.hostname
|
2015-03-25 11:21:09 +01:00
|
|
|
|
h2.appendChild(a1)
|
2016-02-18 17:38:36 +01:00
|
|
|
|
h2.appendChild(document.createTextNode(" → "))
|
2015-03-30 03:20:43 +02:00
|
|
|
|
var a2 = document.createElement("a")
|
2015-03-25 11:21:09 +01:00
|
|
|
|
a2.href = "#"
|
2015-03-25 19:45:21 +01:00
|
|
|
|
a2.onclick = router.node(d.target.node)
|
2015-03-25 11:21:09 +01:00
|
|
|
|
a2.textContent = d.target.node.nodeinfo.hostname
|
|
|
|
|
h2.appendChild(a2)
|
|
|
|
|
el.appendChild(h2)
|
|
|
|
|
|
|
|
|
|
var attributes = document.createElement("table")
|
|
|
|
|
attributes.classList.add("attributes")
|
|
|
|
|
|
|
|
|
|
attributeEntry(attributes, "TQ", showTq(d))
|
|
|
|
|
attributeEntry(attributes, "Entfernung", showDistance(d))
|
2016-02-18 20:26:05 +01:00
|
|
|
|
attributeEntry(attributes, "Typ", d.type)
|
2016-02-27 14:43:27 +01:00
|
|
|
|
var hw1 = unknown ? null : dictGet(d.source.node.nodeinfo, ["hardware", "model"])
|
2015-05-30 12:29:43 +02:00
|
|
|
|
var hw2 = dictGet(d.target.node.nodeinfo, ["hardware", "model"])
|
|
|
|
|
attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"))
|
2015-03-25 11:21:09 +01:00
|
|
|
|
el.appendChild(attributes)
|
2016-03-08 20:01:38 +01:00
|
|
|
|
|
2017-02-11 01:21:20 +01:00
|
|
|
|
if (config.linkInfos)
|
2016-03-08 20:01:38 +01:00
|
|
|
|
config.linkInfos.forEach( function (linkInfo) {
|
|
|
|
|
var h4 = document.createElement("h4")
|
|
|
|
|
h4.textContent = linkInfo.name
|
|
|
|
|
el.appendChild(h4)
|
2017-02-11 01:21:20 +01:00
|
|
|
|
el.appendChild(showStatImg(linkInfo, d))
|
2016-03-08 20:01:38 +01:00
|
|
|
|
})
|
2015-03-25 11:21:09 +01:00
|
|
|
|
}
|
|
|
|
|
})
|