Fix RAM usage display in router cards

This commit is contained in:
kzolotarev95 committed 2026-07-04 22:13:27 +04:00
1 parent c88b3ebf47
commit 6126ca2725
1 file changed
+4 -2
+4 -2
View File
@@ -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 + ' МБ';
}} }}