2016-05-26 16:37:24 +00:00
|
|
|
|
define(["helper"], function (helper) {
|
2016-05-27 21:59:01 +00:00
|
|
|
|
"use strict";
|
|
|
|
|
|
2016-06-22 01:15:53 +00:00
|
|
|
|
function showStatImg(o, source, target, time) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var subst = {};
|
|
|
|
|
subst["{SOURCE}"] = source;
|
|
|
|
|
subst["{TARGET}"] = target;
|
2016-06-22 01:15:53 +00:00
|
|
|
|
subst["{TIME}"] = time;
|
2016-05-26 16:37:24 +00:00
|
|
|
|
return helper.showStat(o, subst);
|
2016-03-08 19:01:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-25 18:45:21 +00:00
|
|
|
|
return function (config, el, router, d) {
|
2016-05-26 23:34:42 +00:00
|
|
|
|
var unknown = !d.source.node;
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var h2 = document.createElement("h2");
|
2016-05-26 23:34:42 +00:00
|
|
|
|
var a1;
|
2016-02-27 13:43:27 +00:00
|
|
|
|
if (!unknown) {
|
2016-05-26 23:34:42 +00:00
|
|
|
|
a1 = document.createElement("a");
|
2016-05-22 11:23:43 +00:00
|
|
|
|
a1.href = "#";
|
|
|
|
|
a1.onclick = router.node(d.source.node);
|
2016-05-26 23:34:42 +00:00
|
|
|
|
} else {
|
|
|
|
|
a1 = document.createElement("span");
|
2016-02-27 13:43:27 +00:00
|
|
|
|
}
|
2016-05-22 11:23:43 +00:00
|
|
|
|
a1.textContent = unknown ? d.source.id : d.source.node.nodeinfo.hostname;
|
|
|
|
|
h2.appendChild(a1);
|
2016-05-26 23:34:42 +00:00
|
|
|
|
|
|
|
|
|
var arrow = document.createElement("spam");
|
|
|
|
|
arrow.classList.add("ion-ios-arrow-thin-right");
|
|
|
|
|
h2.appendChild(arrow);
|
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var a2 = document.createElement("a");
|
|
|
|
|
a2.href = "#";
|
|
|
|
|
a2.onclick = router.node(d.target.node);
|
|
|
|
|
a2.textContent = d.target.node.nodeinfo.hostname;
|
|
|
|
|
h2.appendChild(a2);
|
|
|
|
|
el.appendChild(h2);
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var attributes = document.createElement("table");
|
|
|
|
|
attributes.classList.add("attributes");
|
2015-03-25 10:21:09 +00:00
|
|
|
|
|
2016-05-26 16:37:24 +00:00
|
|
|
|
helper.attributeEntry(attributes, "TQ", helper.showTq(d));
|
|
|
|
|
helper.attributeEntry(attributes, "Entfernung", helper.showDistance(d));
|
|
|
|
|
var hw1 = unknown ? null : helper.dictGet(d.source.node.nodeinfo, ["hardware", "model"]);
|
|
|
|
|
var hw2 = helper.dictGet(d.target.node.nodeinfo, ["hardware", "model"]);
|
|
|
|
|
helper.attributeEntry(attributes, "Hardware", (hw1 != null ? hw1 : "unbekannt") + " – " + (hw2 != null ? hw2 : "unbekannt"));
|
2016-05-22 11:23:43 +00:00
|
|
|
|
el.appendChild(attributes);
|
2016-03-08 19:01:38 +00:00
|
|
|
|
|
|
|
|
|
if (config.linkInfos) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var source = d.source.node_id;
|
|
|
|
|
var target = d.target.node_id;
|
2016-06-22 01:15:53 +00:00
|
|
|
|
var time = d.target.node.lastseen.format("DDMMYYYYHmmss");
|
2016-05-22 12:51:30 +00:00
|
|
|
|
config.linkInfos.forEach(function (linkInfo) {
|
2016-05-22 11:23:43 +00:00
|
|
|
|
var h4 = document.createElement("h4");
|
|
|
|
|
h4.textContent = linkInfo.name;
|
|
|
|
|
el.appendChild(h4);
|
2016-06-22 01:15:53 +00:00
|
|
|
|
el.appendChild(showStatImg(linkInfo, source, target, time));
|
2016-05-22 11:23:43 +00:00
|
|
|
|
});
|
2016-03-08 19:01:38 +00:00
|
|
|
|
}
|
2016-05-22 11:23:43 +00:00
|
|
|
|
};
|
|
|
|
|
});
|