fix linux storage volumes 0kb

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
si458 2024-05-21 19:42:52 +01:00
parent bc6451fee5
commit 4cd7b408fa
2 changed files with 14 additions and 6 deletions

View File

@ -6480,9 +6480,13 @@
x += addDetailItem("Capacity", EscapeHtml(fsize), s);
}
if (m.available) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
if (Math.abs(m.available) == 0) {
var fsize = `0 KB`;
} else {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
}
x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s);
}
if (m.type) {

View File

@ -12295,9 +12295,13 @@
x += addDetailItem("Capacity", EscapeHtml(fsize), s);
}
if (m.available) {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
if (Math.abs(m.available) == 0) {
var fsize = `0 KB`;
} else {
var sizes = ['KB', 'MB', 'GB', 'TB'];
var j = parseInt(Math.floor(Math.log(Math.abs(m.available)) / Math.log(1024)), 10);
var fsize = (j === 0 ? `${m.available} ${sizes[j]}` : `${(m.available / (1024 ** j)).toFixed(2)} ${sizes[j]}`);
}
x += addDetailItem("Capacity Remaining", EscapeHtml(fsize), s);
}
if (m.type) {