From 80c9b6fee0aff23b4c56563612f70ef2c412b7ac Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 14 Nov 2019 09:30:16 +0100 Subject: luci-mod-status: fix free swap calculation Fixes: #3295 Signed-off-by: Jo-Philipp Wich --- .../luci-static/resources/view/status/include/20_memory.js | 14 +++++++------- 1 file 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) : '?' ]) ])); } -- cgit v1.2.3