diff --git a/lib/infobox/link.js b/lib/infobox/link.js index 794753a..82b2d9f 100644 --- a/lib/infobox/link.js +++ b/lib/infobox/link.js @@ -1,8 +1,10 @@ define(function () { - function showStatImg(o, source, target) { + function showStatImg(o, d) { var subst = {} - subst["{SOURCE}"] = source - subst["{TARGET}"] = target + 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" return showStat(o, subst) } @@ -35,15 +37,12 @@ define(function () { attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt")) el.appendChild(attributes) - if (config.linkInfos) { - var source = d.source.node_id - var target = d.target.node_id + if (config.linkInfos) config.linkInfos.forEach( function (linkInfo) { var h4 = document.createElement("h4") h4.textContent = linkInfo.name el.appendChild(h4) - el.appendChild(showStatImg(linkInfo, source, target)) + el.appendChild(showStatImg(linkInfo, d)) }) - } } })