gluon-status-page: refactor creation of table rows and cells
This commit is contained in:
parent
c936fd8054
commit
f678d5e9e7
@ -31,20 +31,13 @@ function (Helper, SignalGraph, Signal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TableEntry(parent, nodeInfo, color, stream, mgmtBus, signal) {
|
function TableEntry(parent, nodeInfo, color, stream, mgmtBus, signal) {
|
||||||
var el = document.createElement("tr")
|
var el = parent.insertRow()
|
||||||
parent.appendChild(el)
|
|
||||||
|
|
||||||
var tdHostname = document.createElement("td")
|
var tdHostname = el.insertCell()
|
||||||
var tdTQ = document.createElement("td")
|
var tdTQ = el.insertCell()
|
||||||
var tdSignal = document.createElement("td")
|
var tdSignal = el.insertCell()
|
||||||
var tdDistance = document.createElement("td")
|
var tdDistance = el.insertCell()
|
||||||
var tdInactive = document.createElement("td")
|
var tdInactive = el.insertCell()
|
||||||
|
|
||||||
el.appendChild(tdHostname)
|
|
||||||
el.appendChild(tdTQ)
|
|
||||||
el.appendChild(tdSignal)
|
|
||||||
el.appendChild(tdDistance)
|
|
||||||
el.appendChild(tdInactive)
|
|
||||||
|
|
||||||
var marker = document.createElement("span")
|
var marker = document.createElement("span")
|
||||||
marker.textContent = "⬤ "
|
marker.textContent = "⬤ "
|
||||||
@ -69,7 +62,7 @@ function (Helper, SignalGraph, Signal) {
|
|||||||
|
|
||||||
el.destroy = function () {
|
el.destroy = function () {
|
||||||
unsubscribe()
|
unsubscribe()
|
||||||
parent.removeChild(el)
|
parent.tBodies[0].removeChild(el)
|
||||||
}
|
}
|
||||||
|
|
||||||
return el
|
return el
|
||||||
@ -135,8 +128,7 @@ function (Helper, SignalGraph, Signal) {
|
|||||||
el.appendChild(h)
|
el.appendChild(h)
|
||||||
|
|
||||||
var table = document.createElement("table")
|
var table = document.createElement("table")
|
||||||
var tr = document.createElement("tr")
|
var tr = table.insertRow()
|
||||||
table.appendChild(tr)
|
|
||||||
table.classList.add("datatable")
|
table.classList.add("datatable")
|
||||||
|
|
||||||
var th = document.createElement("th")
|
var th = document.createElement("th")
|
||||||
|
@ -49,10 +49,11 @@ define(["lib/helper"], function (Helper) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mkTrafficRow(table, children, label, stream, selector) {
|
function mkTrafficRow(table, children, label, stream, selector) {
|
||||||
var tr = document.createElement("tr")
|
var tr = table.insertRow()
|
||||||
var th = document.createElement("th")
|
var th = document.createElement("th")
|
||||||
var td = document.createElement("td")
|
|
||||||
th.textContent = label
|
th.textContent = label
|
||||||
|
tr.appendChild(th)
|
||||||
|
var td = tr.insertCell()
|
||||||
|
|
||||||
var traffic = stream.slidingWindow(2, 2)
|
var traffic = stream.slidingWindow(2, 2)
|
||||||
var pkts = streamNode(traffic.map(deltaUptime(selector + ".packets")).map(prettyPackets))
|
var pkts = streamNode(traffic.map(deltaUptime(selector + ".packets")).map(prettyPackets))
|
||||||
@ -65,10 +66,6 @@ define(["lib/helper"], function (Helper) {
|
|||||||
td.appendChild(document.createElement("br"))
|
td.appendChild(document.createElement("br"))
|
||||||
td.appendChild(bytes)
|
td.appendChild(bytes)
|
||||||
|
|
||||||
tr.appendChild(th)
|
|
||||||
tr.appendChild(td)
|
|
||||||
table.appendChild(tr)
|
|
||||||
|
|
||||||
children.push(pkts)
|
children.push(pkts)
|
||||||
children.push(bw)
|
children.push(bw)
|
||||||
children.push(bytes)
|
children.push(bytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user