Fix RAM usage display in router cards
This commit is contained in:
1 parent
c88b3ebf47
commit
6126ca2725
1 file changed
+4
-2
@@ -1766,8 +1766,10 @@ function formatMemory(value) {{
|
|||||||
const text = String(value || '');
|
const text = String(value || '');
|
||||||
const match = text.match(/(\\d+)\\s*\\/\\s*(\\d+)\\s*kB/i);
|
const match = text.match(/(\\d+)\\s*\\/\\s*(\\d+)\\s*kB/i);
|
||||||
if (!match) return value || 'unknown';
|
if (!match) return value || 'unknown';
|
||||||
const used = Math.round(Number(match[1]) / 1024);
|
const freeKb = Number(match[1]);
|
||||||
const total = Math.round(Number(match[2]) / 1024);
|
const totalKb = Number(match[2]);
|
||||||
|
const used = Math.max(0, Math.round((totalKb - freeKb) / 1024));
|
||||||
|
const total = Math.max(0, Math.round(totalKb / 1024));
|
||||||
return used + ' / ' + total + ' МБ';
|
return used + ' / ' + total + ' МБ';
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user