From: Jo-Philipp Wich Date: Thu, 14 Nov 2019 08:30:16 +0000 (+0100) Subject: luci-mod-status: fix free swap calculation X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=80c9b6fee0aff23b4c56563612f70ef2c412b7ac;p=oweals%2Fluci.git luci-mod-status: fix free swap calculation Fixes: #3295 Signed-off-by: Jo-Philipp Wich --- 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) : '?' ]) ])); }