INFOBOX - add maybe annouced weblink to sitebar

Add annouced Weblinks to Webpages/Services

As example
alias.json

"pages": [
      "https://kuechenfunk.fffd"
    ]

How it looks like :

http://picpaste.com/pics/Bildschirmfoto_2016-02-25_um_14.49.33-GV9DnX33.1456408206.png
This commit is contained in:
Moorviper 2016-02-25 14:50:40 +01:00
parent 2dc989ab63
commit e385ac73ad

View File

@ -177,6 +177,37 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
} }
} }
function showPages(d) {
var webpages = dictGet(d.nodeinfo, ["pages"])
if (webpages === null)
return undefined
webpages.sort()
return function (el) {
webpages.forEach( function (webpage, i) {
if (i > 0)
el.appendChild(document.createElement("br"))
var a = document.createElement("span")
var link = document.createElement("a")
link.href = webpage
if (webpage.search(/^https:\/\//i) !== -1) {
var lock = document.createElement("span")
lock.className = "ion-android-lock"
a.appendChild(lock)
var t1 = document.createTextNode(" ")
a.appendChild(t1)
link.textContent = webpage.replace(/^https:\/\//i, "")
}
else
link.textContent = webpage.replace(/^http:\/\//i, "")
a.appendChild(link)
el.appendChild(a)
})
}
}
function showAutoupdate(d) { function showAutoupdate(d) {
var au = dictGet(d.nodeinfo, ["software", "autoupdater"]) var au = dictGet(d.nodeinfo, ["software", "autoupdater"])
if (!au) if (!au)
@ -243,6 +274,7 @@ define(["moment", "numeral", "tablesort", "tablesort.numeric"],
attributeEntry(attributes, "Load - avg", showLOAD(d)) attributeEntry(attributes, "Load - avg", showLOAD(d))
attributeEntry(attributes, "Arbeitsspeicher", showRAM(d)) attributeEntry(attributes, "Arbeitsspeicher", showRAM(d))
attributeEntry(attributes, "IP Adressen", showIPs(d)) attributeEntry(attributes, "IP Adressen", showIPs(d))
attributeEntry(attributes, "Webseite", showPages(d))
attributeEntry(attributes, "Gewähltes Gateway", dictGet(d.statistics, ["gateway"])) attributeEntry(attributes, "Gewähltes Gateway", dictGet(d.statistics, ["gateway"]))
attributeEntry(attributes, "Autom. Updates", showAutoupdate(d)) attributeEntry(attributes, "Autom. Updates", showAutoupdate(d))
attributeEntry(attributes, "Clients", showClients(d)) attributeEntry(attributes, "Clients", showClients(d))