From 5d84a328bda4b1e446696f41a7148ebbde883d75 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Tue, 24 May 2016 23:21:46 +0200 Subject: [PATCH] [TASK] Remove unsupported stats --- lib/infobox/link.js | 1 - lib/infobox/node.js | 20 +++--------- lib/linklist.js | 12 ++------ lib/proportions.js | 75 ++------------------------------------------- 4 files changed, 8 insertions(+), 100 deletions(-) diff --git a/lib/infobox/link.js b/lib/infobox/link.js index 2a56451..66f75fc 100644 --- a/lib/infobox/link.js +++ b/lib/infobox/link.js @@ -30,7 +30,6 @@ define(function () { 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")); diff --git a/lib/infobox/node.js b/lib/infobox/node.js index 5b04e19..689e4d5 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -307,13 +307,9 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"], tr.appendChild(th3); var th4 = document.createElement("th"); - th4.textContent = "Typ"; + th4.textContent = "Entfernung"; tr.appendChild(th4); - var th5 = document.createElement("th"); - th5.textContent = "Entfernung"; - tr.appendChild(th5); - thead.appendChild(tr); table.appendChild(thead); @@ -356,21 +352,13 @@ define(["moment", "numeral", "tablesort", "tablesort.number", "moment.de"], tr.appendChild(td3); var td4 = document.createElement("td"); - var a3 = document.createElement("a"); - a3.href = "#"; - a3.textContent = d.link.type; - a3.onclick = router.link(d.link); - td4.appendChild(a3); - tr.appendChild(td4); - - var td5 = document.createElement("td"); var a4 = document.createElement("a"); a4.href = "#"; a4.textContent = showDistance(d.link); a4.onclick = router.link(d.link); - td5.appendChild(a4); - td5.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1); - tr.appendChild(td5); + td4.appendChild(a4); + td4.setAttribute("data-sort", d.link.distance !== undefined ? -d.link.distance : 1); + tr.appendChild(td4); tbody.appendChild(tr); }); diff --git a/lib/linklist.js b/lib/linklist.js index 96e7447..b26d45f 100644 --- a/lib/linklist.js +++ b/lib/linklist.js @@ -17,13 +17,6 @@ define(["sorttable", "virtual-dom"], function (SortTable, V) { }, reverse: true }, - { - name: "Typ", - sort: function (a, b) { - return a.type.localeCompare(b.type); - }, - reverse: false - }, { name: "Entfernung", sort: function (a, b) { @@ -41,10 +34,9 @@ define(["sorttable", "virtual-dom"], function (SortTable, V) { var td1 = V.h("td", td1Content); var td2 = V.h("td", {style: {color: linkScale(d.tq).hex()}}, showTq(d)); - var td3 = V.h("td", d.type); - var td4 = V.h("td", showDistance(d)); + var td3 = V.h("td", showDistance(d)); - return V.h("tr", [td1, td2, td3, td4]); + return V.h("tr", [td1, td2, td3]); } this.render = function (d) { diff --git a/lib/proportions.js b/lib/proportions.js index a059510..3a27ac6 100644 --- a/lib/proportions.js +++ b/lib/proportions.js @@ -20,15 +20,6 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom var autoTable = document.createElement("table"); autoTable.classList.add("proportion"); - var uplinkTable = document.createElement("table"); - uplinkTable.classList.add("proportion"); - - var gwNodesTable = document.createElement("table"); - gwNodesTable.classList.add("proportion"); - - var gwClientsTable = document.createElement("table"); - gwClientsTable.classList.add("proportion"); - var siteTable = document.createElement("table"); siteTable.classList.add("proportion"); @@ -58,29 +49,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom }); } - function countClients(nodes, key, f) { - var dict = {}; - - nodes.forEach(function (d) { - var v = dictGet(d, key.slice(0)); - - if (f !== undefined) { - v = f(v); - } - - if (v === null) { - return; - } - - dict[v] = d.statistics.clients + (v in dict ? dict[v] : 0); - }); - - return Object.keys(dict).map(function (d) { - return [d, dict[d], key, f]; - }); - } - - function addFilter(filter) { + function addFilter(filter) { return function () { filterManager.addFilter(filter); @@ -154,34 +123,6 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom } }); - var uplinkDict = count(nodes, ["flags", "uplink"], function (d) { - return d ? "ja" : "nein"; - }); - - var gwNodesDict = count(onlineNodes, ["statistics", "gateway"], function (d) { - if (d === null) { - return null; - } - - if (d in nodeDict) { - return nodeDict[d].nodeinfo.hostname; - } - - return d; - }); - - var gwClientsDict = countClients(onlineNodes, ["statistics", "gateway"], function (d) { - if (d === null) { - return null; - } - - if (d in nodeDict) { - return nodeDict[d].nodeinfo.hostname; - } - - return d; - }); - var siteDict = count(nodes, ["nodeinfo", "system", "site_code"], function (d) { var rt = d; if (config.siteNames) { @@ -206,19 +147,10 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom fillTable("Koordinaten", geoTable, geoDict.sort(function (a, b) { return b[1] - a[1]; })); - fillTable("Uplink", uplinkTable, uplinkDict.sort(function (a, b) { - return b[1] - a[1]; - })); fillTable("Autom. Updates", autoTable, autoDict.sort(function (a, b) { return b[1] - a[1]; })); - fillTable("Nodes an Gateway", gwNodesTable, gwNodesDict.sort(function (a, b) { - return b[1] - a[1]; - })); - fillTable("Clients an Gateway", gwClientsTable, gwClientsDict.sort(function (a, b) { - return b[1] - a[1]; - })); - fillTable("Site", siteTable, siteDict.sort(function (a, b) { + fillTable("Site", siteTable, siteDict.sort(function (a, b) { return b[1] - a[1]; })); }; @@ -226,10 +158,7 @@ define(["chroma-js", "virtual-dom", "numeral.de", "filters/genericnode", "vercom self.render = function (el) { var h2; self.renderSingle(el, "Status", statusTable); - self.renderSingle(el, "Nodes an Gateway", gwNodesTable); - self.renderSingle(el, "Clients an Gateway", gwClientsTable); self.renderSingle(el, "Firmwareversionen", fwTable); - self.renderSingle(el, "Uplink", uplinkTable); self.renderSingle(el, "Hardwaremodelle", hwTable); self.renderSingle(el, "Auf der Karte sichtbar", geoTable); self.renderSingle(el, "Autoupdater", autoTable);