diff options
Diffstat (limited to 'modules/luci-mod-status/htdocs/luci-static')
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js | 39 | ||||
-rw-r--r-- | modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js | 2 |
2 files changed, 24 insertions, 17 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js index c2aa3a9b0d..3a895eca18 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/index.js @@ -1,13 +1,15 @@ -function progressbar(q, v, m) +function progressbar(query, value, max, byte) { - var pg = document.querySelector(q), - vn = parseInt(v) || 0, - mn = parseInt(m) || 100, + var pg = document.querySelector(query), + vn = parseInt(value) || 0, + mn = parseInt(max) || 100, + fv = byte ? String.format('%1024.2mB', value) : value, + fm = byte ? String.format('%1024.2mB', max) : max, pc = Math.floor((100 / mn) * vn); if (pg) { pg.firstElementChild.style.width = pc + '%'; - pg.setAttribute('title', '%s / %s (%d%%)'.format(v, m, pc)); + pg.setAttribute('title', '%s / %s (%d%%)'.format(fv, fm, pc)); } } @@ -189,27 +191,32 @@ L.poll(5, L.location(), { status: 1 }, ); progressbar('#memtotal', - ((info.memory.free + info.memory.buffered) / 1024) + ' ' + _('kB'), - (info.memory.total / 1024) + ' ' + _('kB')); + info.memory.free + info.memory.buffered, + info.memory.total, + true); progressbar('#memfree', - (info.memory.free / 1024) + ' ' + _('kB'), - (info.memory.total / 1024) + ' ' + _('kB')); + info.memory.free, + info.memory.total, + true); progressbar('#membuff', - (info.memory.buffered / 1024) + ' ' + _('kB'), - (info.memory.total / 1024) + ' ' + _('kB')); + info.memory.buffered, + info.memory.total, + true); progressbar('#swaptotal', - (info.swap.free / 1024) + ' ' + _('kB'), - (info.swap.total / 1024) + ' ' + _('kB')); + info.swap.free, + info.swap.total, + true); progressbar('#swapfree', - (info.swap.free / 1024) + ' ' + _('kB'), - (info.swap.total / 1024) + ' ' + _('kB')); + info.swap.free, + info.swap.total, + true); progressbar('#conns', - info.conncount, info.connmax); + info.conncount, info.connmax, false); } ); diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js index 39ddab3979..a742243a03 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/iptables.js @@ -165,7 +165,7 @@ function parse_output(table, s) else if (m[1].match(/^num /)) { continue; } - else if ((m2 = m[1].match(/^(\d+) +(\d+) +(\d+) +(.*?) +(\S+) +(\S*) +(\S+) +(\S+) +([a-f0-9:.]+\/\d+) +([a-f0-9:.]+\/\d+) +(.+)$/)) !== null) { + else if ((m2 = m[1].match(/^(\d+) +(\d+) +(\d+) +(.*?) +(\S+) +(\S*) +(\S+) +(\S+) +([a-f0-9:.]+(?:\/[a-f0-9:.]+)?) +([a-f0-9:.]+(?:\/[a-f0-9:.]+)?) +(.+)$/)) !== null) { var num = +m2[1], pkts = +m2[2], bytes = +m2[3], |