Browse Source

Show full site name if available

Michael Schwarz 8 years ago
parent
commit
677d883fa9
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lib/infobox/node.js

+ 8 - 1
lib/infobox/node.js

@@ -195,6 +195,13 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
     return p
   }
 
+  function showSite(d) {
+    var siteName = dictGet(d.nodeinfo, ["system", "site_name"])
+    var siteCode = dictGet(d.nodeinfo, ["system", "site_code"])
+
+    return siteName ? siteName : siteCode
+  }
+
   return function(config, el, router, d) {
     var h2 = document.createElement("h2")
     h2.textContent = d.nodeinfo.hostname
@@ -212,7 +219,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
     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, "Sitecode", dictGet(d.nodeinfo, ["system", "site_code"]))
+    attributeEntry(attributes, "Site", showSite(d))
     attributeEntry(attributes, "Firmware", showFirmware(d))
     attributeEntry(attributes, "Uptime", showUptime(d))
     attributeEntry(attributes, "Teil des Netzes", showFirstseen(d))