Skip to content
Snippets Groups Projects
Select Git revision
  • 6e452f207a747adf64de2f1fa7250a6a7a663a30
  • experimental
  • master
  • v2021.1.2-ffs
  • v2021.1.1-ffs
  • nrb/gluon-master-cpe510
  • v2021.1-ffs
  • v2020.2.3-ffs
  • nrbffs/fastd-remove-delay
  • v2020.2.2-ffs
  • v2020.2.1-ffs
  • v2020.2-ffs
  • v2020.2.x
  • v2020.1.3-ffs
  • v2020.1.1-ffs
  • v2020.1-ffs
  • v2019.1.2-ffs
  • v2019.1.1-ffs
  • nrb/test-radv-filter
  • v2019.1-ffs
  • nrbffs/netgear-ex6120
  • v2021.1.2-ffs0.2
  • v2021.1.2-ffs0.1
  • v2021.1.1-ffs0.4
  • v2021.1.1-ffs0.3
  • v2021.1.1-ffs0.2
  • v2021.1.1-ffs0.1
  • v2021.1-ffs0.1
  • v2020.2.3-ffs0.3
  • v2020.2.3-ffs0.2
  • v2020.2.3-ffs0.1
  • v2020.2.2-ffs0.1
  • v2020.2.1-ffs0.1
  • v2020.2-ffs0.1
  • v2020.2
  • v2020.2.x-ffs0.1
  • v2020.1.3-ffs0.1
  • v2020.1.1-ffs0.1
  • v2020.1-ffs0.1
  • v2019.1.2-ffs0.1
  • v2019.1.1-ffs0.1
41 results

statistics.js

Blame
  • Forked from firmware / FFS Gluon
    Source project has a limited visibility.
    statistics.js 6.62 KiB
    "use strict"
    define(["lib/helper"], function (Helper) {
      function streamElement(type, stream) {
        var el = document.createElement(type)
        el.destroy = stream.onValue(update)
    
        function update(d) {
          el.textContent = d
        }
    
        return el
      }
    
      function streamNode(stream) {
        var el = document.createTextNode("")
        el.destroy = stream.onValue(update)
    
        function update(d) {
          el.textContent = d
        }
    
        return el
      }
    
      function mkRow(table, label, stream) {
        var tr = document.createElement("tr")
        var th = document.createElement("th")
        var td = streamElement("td", stream)
        th.textContent = label
        tr.appendChild(th)
        tr.appendChild(td)
        table.appendChild(tr)
    
        tr.destroy = function () {
          td.destroy()
          table.removeChild(tr)
        }
    
        return tr
      }
    
      function mkTrafficRow(table, children, label, stream, selector) {
        var tr = document.createElement("tr")
        var th = document.createElement("th")
        var td = document.createElement("td")
        th.textContent = label
    
        var traffic = stream.slidingWindow(2, 2)
        var pkts = streamNode(traffic.map(deltaUptime(selector + ".packets")).map(prettyPackets))
        var bw = streamNode(traffic.map(deltaUptime(selector + ".bytes")).map(prettyBits))
        var bytes = streamNode(stream.map(selector).map(".bytes").map(prettyBytes))
    
        td.appendChild(pkts)
        td.appendChild(document.createElement("br"))
        td.appendChild(bw)
        td.appendChild(document.createElement("br"))
        td.appendChild(bytes)
    
        tr.appendChild(th)
        tr.appendChild(td)
        table.appendChild(tr)
    
        children.push(pkts)
        children.push(bw)
        children.push(bytes)
      }
    
      function mkMeshVPN(el, stream) {
        var children = {}
        var init = false