[!!!][TASK] Use eslint default
This commit is contained in:
parent
c451775021
commit
173674c2a1
21 changed files with 387 additions and 159 deletions
|
@ -1,11 +1,11 @@
|
|||
define(function () {
|
||||
define(["helper"], function (helper) {
|
||||
function showStatImg(o, d) {
|
||||
var subst = {};
|
||||
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);
|
||||
return helper.showStat(o, subst);
|
||||
}
|
||||
|
||||
return function (config, el, router, d) {
|
||||
|
@ -19,7 +19,7 @@ define(function () {
|
|||
a1.textContent = unknown ? d.source.id : d.source.node.nodeinfo.hostname;
|
||||
h2.appendChild(a1);
|
||||
h2.appendChild(document.createTextNode(" \uF3D6 "));
|
||||
h2.className = 'ion-inside';
|
||||
h2.className = "ion-inside";
|
||||
var a2 = document.createElement("a");
|
||||
a2.href = "#";
|
||||
a2.onclick = router.node(d.target.node);
|
||||
|
@ -30,12 +30,12 @@ define(function () {
|
|||
var attributes = document.createElement("table");
|
||||
attributes.classList.add("attributes");
|
||||
|
||||
attributeEntry(attributes, "TQ", showTq(d));
|
||||
attributeEntry(attributes, "Entfernung", showDistance(d));
|
||||
attributeEntry(attributes, "Typ", d.type);
|
||||
var hw1 = unknown ? null : 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"));
|
||||
helper.attributeEntry(attributes, "TQ", helper.showTq(d));
|
||||
helper.attributeEntry(attributes, "Entfernung", helper.showDistance(d));
|
||||
helper.attributeEntry(attributes, "Typ", d.type);
|
||||
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"));
|
||||
el.appendChild(attributes);
|
||||
|
||||
if (config.linkInfos) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
define(function () {
|
||||
define(["helper"], function (helper) {
|
||||
return function (config, el, router, d) {
|
||||
var sidebarTitle = document.createElement("h2");
|
||||
sidebarTitle.textContent = "Location: " + d.toString();
|
||||
el.appendChild(sidebarTitle);
|
||||
|
||||
getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat=" + d.lat + "&lon=" + d.lng + "&zoom=18&addressdetails=0")
|
||||
helper.getJSON("https://nominatim.openstreetmap.org/reverse?format=json&lat=" + d.lat + "&lon=" + d.lng + "&zoom=18&addressdetails=0")
|
||||
.then(function (result) {
|
||||
if (result.display_name) {
|
||||
sidebarTitle.textContent = result.display_name;
|
||||
|
@ -84,7 +84,7 @@ define(function () {
|
|||
try {
|
||||
document.execCommand("copy");
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
console.warn(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,17 +33,17 @@ define(["infobox/link", "infobox/node", "infobox/location"], function (Link, Nod
|
|||
|
||||
self.gotoNode = function (d) {
|
||||
create();
|
||||
new Node(config, el, router, d);
|
||||
Node(config, el, router, d);
|
||||
};
|
||||
|
||||
self.gotoLink = function (d) {
|
||||
create();
|
||||
new Link(config, el, router, d);
|
||||
Link(config, el, router, d);
|
||||
};
|
||||
|
||||
self.gotoLocation = function (d) {
|
||||
create();
|
||||
new Location(config, el, router, d);
|
||||
Location(config, el, router, d);
|
||||
};
|
||||
|
||||
return self;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(["moment", "tablesort", "moment.de"],
|
||||
function (moment, Tablesort) {
|
||||
define(["moment", "tablesort", "helper", "moment.de"],
|
||||
function (moment, Tablesort, helper) {
|
||||
function showGeoURI(d) {
|
||||
function showLatitude(d) {
|
||||
var suffix = Math.sign(d) > -1 ? "' N" : "' S";
|
||||
|
@ -21,7 +21,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
return a + "° " + min.toFixed(3) + suffix;
|
||||
}
|
||||
|
||||
if (!has_location(d)) {
|
||||
if (!helper.hasLocation(d)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ define(["moment", "tablesort", "moment.de"],
|
|||
}
|
||||
|
||||
function showFirmware(d) {
|
||||
var release = dictGet(d.nodeinfo, ["software", "firmware", "release"]);
|
||||
var base = dictGet(d.nodeinfo, ["software", "firmware", "base"]);
|
||||
var release = helper.dictGet(d.nodeinfo, ["software", "firmware", "release"]);
|
||||
var base = helper.dictGet(d.nodeinfo, ["software", "firmware", "base"]);
|
||||
|
||||
if (release === null || base === null) {
|
||||
return undefined;
|
||||
|
@ -60,7 +60,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
}
|
||||
|
||||
function showSite(d, config) {
|
||||
var site = dictGet(d.nodeinfo, ["system", "site_code"]);
|
||||
var site = helper.dictGet(d.nodeinfo, ["system", "site_code"]);
|
||||
var rt = site;
|
||||
if (config.siteNames) {
|
||||
config.siteNames.forEach(function (t) {
|
||||
|
@ -220,7 +220,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
}
|
||||
|
||||
function showIPs(d) {
|
||||
var ips = dictGet(d.nodeinfo, ["network", "addresses"]);
|
||||
var ips = helper.dictGet(d.nodeinfo, ["network", "addresses"]);
|
||||
if (ips === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -340,13 +340,13 @@ define(["moment", "tablesort", "moment.de"],
|
|||
|
||||
function showGateway(d, router) {
|
||||
var nh;
|
||||
if (dictGet(d.statistics, ["nexthop"])) {
|
||||
nh = dictGet(d.statistics, ["nexthop"]);
|
||||
if (helper.dictGet(d.statistics, ["nexthop"])) {
|
||||
nh = helper.dictGet(d.statistics, ["nexthop"]);
|
||||
}
|
||||
if (dictGet(d.statistics, ["gateway_nexthop"])) {
|
||||
nh = dictGet(d.statistics, ["gateway_nexthop"]);
|
||||
if (helper.dictGet(d.statistics, ["gateway_nexthop"])) {
|
||||
nh = helper.dictGet(d.statistics, ["gateway_nexthop"]);
|
||||
}
|
||||
var gw = dictGet(d.statistics, ["gateway"]);
|
||||
var gw = helper.dictGet(d.statistics, ["gateway"]);
|
||||
|
||||
if (!gw) {
|
||||
return null;
|
||||
|
@ -362,16 +362,16 @@ define(["moment", "tablesort", "moment.de"],
|
|||
if (!nh.node || !nh.node.statistics) {
|
||||
break;
|
||||
}
|
||||
if (!dictGet(nh.node.statistics, ["gateway"]) || !dictGet(nh.node.statistics, ["gateway"]).id) {
|
||||
if (!helper.dictGet(nh.node.statistics, ["gateway"]) || !helper.dictGet(nh.node.statistics, ["gateway"]).id) {
|
||||
break;
|
||||
}
|
||||
if (dictGet(nh.node.statistics, ["gateway"]).id !== gw.id) {
|
||||
if (helper.dictGet(nh.node.statistics, ["gateway"]).id !== gw.id) {
|
||||
break;
|
||||
}
|
||||
if (dictGet(nh.node.statistics, ["gateway_nexthop"])) {
|
||||
nh = dictGet(nh.node.statistics, ["gateway_nexthop"]);
|
||||
} else if (dictGet(nh.node.statistics, ["nexthop"])) {
|
||||
nh = dictGet(nh.node.statistics, ["nexthop"]);
|
||||
if (helper.dictGet(nh.node.statistics, ["gateway_nexthop"])) {
|
||||
nh = helper.dictGet(nh.node.statistics, ["gateway_nexthop"]);
|
||||
} else if (helper.dictGet(nh.node.statistics, ["nexthop"])) {
|
||||
nh = helper.dictGet(nh.node.statistics, ["nexthop"]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
}
|
||||
|
||||
function showPages(d) {
|
||||
var webpages = dictGet(d.nodeinfo, ["pages"]);
|
||||
var webpages = helper.dictGet(d.nodeinfo, ["pages"]);
|
||||
if (webpages === null) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
}
|
||||
|
||||
function showAutoupdate(d) {
|
||||
var au = dictGet(d.nodeinfo, ["software", "autoupdater"]);
|
||||
var au = helper.dictGet(d.nodeinfo, ["software", "autoupdater"]);
|
||||
if (!au) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -469,8 +469,8 @@ define(["moment", "tablesort", "moment.de"],
|
|||
function showStatImg(o, d) {
|
||||
var subst = {};
|
||||
subst["{NODE_ID}"] = d.nodeinfo.node_id ? d.nodeinfo.node_id : "unknown";
|
||||
subst["{NODE_NAME}"] = d.nodeinfo.hostname ? d.nodeinfo.hostname.replace(/[^a-z0-9\-]/ig, '_') : "unknown";
|
||||
return showStat(o, subst);
|
||||
subst["{NODE_NAME}"] = d.nodeinfo.hostname ? d.nodeinfo.hostname.replace(/[^a-z0-9\-]/ig, "_") : "unknown";
|
||||
return helper.showStat(o, subst);
|
||||
}
|
||||
|
||||
return function (config, el, router, d) {
|
||||
|
@ -483,47 +483,47 @@ define(["moment", "tablesort", "moment.de"],
|
|||
try {
|
||||
config.hwImg.forEach(function (hwImg) {
|
||||
try {
|
||||
top.appendChild(showNodeImg(hwImg, dictGet(d, ["nodeinfo", "hardware", "model"])));
|
||||
top.appendChild(showNodeImg(hwImg, helper.dictGet(d, ["nodeinfo", "hardware", "model"])));
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
console.warn(err.message);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
console.warn(err.message);
|
||||
}
|
||||
attributeEntry(attributes, top, d.nodeinfo.hostname);
|
||||
helper.attributeEntry(attributes, top, d.nodeinfo.hostname);
|
||||
} else {
|
||||
var h2 = document.createElement("h2");
|
||||
h2.textContent = d.nodeinfo.hostname;
|
||||
el.appendChild(h2);
|
||||
}
|
||||
|
||||
attributeEntry(attributes, "Status", showStatus(d));
|
||||
attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null);
|
||||
attributeEntry(attributes, "Koordinaten", showGeoURI(d));
|
||||
helper.attributeEntry(attributes, "Status", showStatus(d));
|
||||
helper.attributeEntry(attributes, "Gateway", d.flags.gateway ? "ja" : null);
|
||||
helper.attributeEntry(attributes, "Koordinaten", showGeoURI(d));
|
||||
|
||||
if (config.showContact) {
|
||||
attributeEntry(attributes, "Kontakt", dictGet(d.nodeinfo, ["owner", "contact"]));
|
||||
helper.attributeEntry(attributes, "Kontakt", helper.dictGet(d.nodeinfo, ["owner", "contact"]));
|
||||
}
|
||||
|
||||
attributeEntry(attributes, "Hardware", dictGet(d.nodeinfo, ["hardware", "model"]));
|
||||
attributeEntry(attributes, "Primäre MAC", dictGet(d.nodeinfo, ["network", "mac"]));
|
||||
attributeEntry(attributes, "Node ID", dictGet(d.nodeinfo, ["node_id"]));
|
||||
attributeEntry(attributes, "Firmware", showFirmware(d));
|
||||
attributeEntry(attributes, "Site", showSite(d, config));
|
||||
attributeEntry(attributes, "Uptime", showUptime(d));
|
||||
attributeEntry(attributes, "Teil des Netzes", showFirstseen(d));
|
||||
attributeEntry(attributes, "Kanal 2.4 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan2"])));
|
||||
attributeEntry(attributes, "Kanal 5 GHz", showWifiChannel(dictGet(d.nodeinfo, ["wireless", "chan5"])));
|
||||
attributeEntry(attributes, "Airtime 2.4 GHz", showAirtime(2, dictGet(d.statistics, ["wireless", "airtime2"])));
|
||||
attributeEntry(attributes, "Airtime 5 GHz", showAirtime(5, dictGet(d.statistics, ["wireless", "airtime5"])));
|
||||
attributeEntry(attributes, "Systemlast", showLoad(d));
|
||||
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d));
|
||||
attributeEntry(attributes, "IP Adressen", showIPs(d));
|
||||
attributeEntry(attributes, "Webseite", showPages(d));
|
||||
attributeEntry(attributes, "Gewähltes Gateway", showGateway(d, router));
|
||||
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d));
|
||||
attributeEntry(attributes, "Clients", showClients(d), showMeshClients(d));
|
||||
helper.attributeEntry(attributes, "Hardware", helper.dictGet(d.nodeinfo, ["hardware", "model"]));
|
||||
helper.attributeEntry(attributes, "Primäre MAC", helper.dictGet(d.nodeinfo, ["network", "mac"]));
|
||||
helper.attributeEntry(attributes, "Node ID", helper.dictGet(d.nodeinfo, ["node_id"]));
|
||||
helper.attributeEntry(attributes, "Firmware", showFirmware(d));
|
||||
helper.attributeEntry(attributes, "Site", showSite(d, config));
|
||||
helper.attributeEntry(attributes, "Uptime", showUptime(d));
|
||||
helper.attributeEntry(attributes, "Teil des Netzes", showFirstseen(d));
|
||||
helper.attributeEntry(attributes, "Kanal 2.4 GHz", showWifiChannel(helper.dictGet(d.nodeinfo, ["wireless", "chan2"])));
|
||||
helper.attributeEntry(attributes, "Kanal 5 GHz", showWifiChannel(helper.dictGet(d.nodeinfo, ["wireless", "chan5"])));
|
||||
helper.attributeEntry(attributes, "Airtime 2.4 GHz", showAirtime(2, helper.dictGet(d.statistics, ["wireless", "airtime2"])));
|
||||
helper.attributeEntry(attributes, "Airtime 5 GHz", showAirtime(5, helper.dictGet(d.statistics, ["wireless", "airtime5"])));
|
||||
helper.attributeEntry(attributes, "Systemlast", showLoad(d));
|
||||
helper.attributeEntry(attributes, "Arbeitsspeicher", showRAM(d));
|
||||
helper.attributeEntry(attributes, "IP Adressen", showIPs(d));
|
||||
helper.attributeEntry(attributes, "Webseite", showPages(d));
|
||||
helper.attributeEntry(attributes, "Gewähltes Gateway", showGateway(d, router));
|
||||
helper.attributeEntry(attributes, "Autom. Updates", showAutoupdate(d));
|
||||
helper.attributeEntry(attributes, "Clients", showClients(d), showMeshClients(d));
|
||||
|
||||
el.appendChild(attributes);
|
||||
|
||||
|
@ -577,14 +577,14 @@ define(["moment", "tablesort", "moment.de"],
|
|||
var tr = document.createElement("tr");
|
||||
|
||||
var td1 = document.createElement("td");
|
||||
td1.className = 'ion-inside';
|
||||
td1.className = "ion-inside";
|
||||
td1.appendChild(document.createTextNode(d.incoming ? " \uF3D5 " : " \uF3D6 "));
|
||||
tr.appendChild(td1);
|
||||
|
||||
var td2 = document.createElement("td");
|
||||
td2.appendChild(createLink(d, router));
|
||||
|
||||
if (!unknown && has_location(d.node)) {
|
||||
if (!unknown && helper.hasLocation(d.node)) {
|
||||
var span = document.createElement("span");
|
||||
span.classList.add("icon");
|
||||
span.classList.add("ion-location");
|
||||
|
@ -596,7 +596,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
var td3 = document.createElement("td");
|
||||
var a2 = document.createElement("a");
|
||||
a2.href = "#";
|
||||
a2.textContent = showTq(d.link);
|
||||
a2.textContent = helper.showTq(d.link);
|
||||
a2.onclick = router.link(d.link);
|
||||
td3.appendChild(a2);
|
||||
tr.appendChild(td3);
|
||||
|
@ -612,7 +612,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
var td5 = document.createElement("td");
|
||||
var a4 = document.createElement("a");
|
||||
a4.href = "#";
|
||||
a4.textContent = showDistance(d.link);
|
||||
a4.textContent = helper.showDistance(d.link);
|
||||
a4.onclick = router.link(d.link);
|
||||
td5.appendChild(a4);
|
||||
td5.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1);
|
||||
|
@ -624,7 +624,7 @@ define(["moment", "tablesort", "moment.de"],
|
|||
table.appendChild(tbody);
|
||||
table.className = "node-links";
|
||||
|
||||
new Tablesort(table);
|
||||
Tablesort(table);
|
||||
|
||||
el.appendChild(table);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue