summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-11-14 09:30:16 +0100
committerJo-Philipp Wich <jo@mein.io>2019-11-14 09:30:49 +0100
commit80c9b6fee0aff23b4c56563612f70ef2c412b7ac (patch)
treea176a2de12607fa507ac88ed7672dbd3d7d953e2
parenta07d0b482481c3be7e9e22b75b2e174b66e4de9e (diff)
luci-mod-status: fix free swap calculation
Fixes: #3295 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
index 2e8477434..b2ebdec71 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
@@ -31,24 +31,24 @@ return L.Class.extend({
swap = L.isObject(systeminfo.swap) ? systeminfo.swap : {};
var fields = [
- _('Total Available'), (mem.available) ? mem.available : (mem.total && mem.free && mem.buffered) ? mem.free + mem.buffered : null,
- _('Free'), (mem.total && mem.free) ? mem.free : null,
- _('Buffered'), (mem.total && mem.buffered) ? mem.buffered : null
+ _('Total Available'), (mem.available) ? mem.available : (mem.total && mem.free && mem.buffered) ? mem.free + mem.buffered : null, mem.total,
+ _('Free'), (mem.total && mem.free) ? mem.free : null, mem.total,
+ _('Buffered'), (mem.total && mem.buffered) ? mem.buffered : null, mem.total
];
if (mem.cached)
- fields.push(_('Cached'), mem.cached);
+ fields.push(_('Cached'), mem.cached, mem.total);
if (swap.total > 0)
- fields.push(_('Swap free'), swap.free);
+ fields.push(_('Swap free'), swap.free, swap.total);
var table = E('div', { 'class': 'table' });
- for (var i = 0; i < fields.length; i += 2) {
+ for (var i = 0; i < fields.length; i += 3) {
table.appendChild(E('div', { 'class': 'tr' }, [
E('div', { 'class': 'td left', 'width': '33%' }, [ fields[i] ]),
E('div', { 'class': 'td left' }, [
- (fields[i + 1] != null) ? progressbar(fields[i + 1], mem.total, true) : '?'
+ (fields[i + 1] != null) ? progressbar(fields[i + 1], fields[i + 2], true) : '?'
])
]));
}