瀏覽代碼

Show full site name if available

Michael Schwarz 8 年之前
父節點
當前提交
677d883fa9
共有 1 個文件被更改,包括 8 次插入1 次删除
  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))