Skip to content

Commit

Permalink
fix linux storage volumes 0kb
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed May 21, 2024
1 parent bc6451f commit 4cd7b40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions views/default-mobile.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 7 additions & 3 deletions views/default.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4cd7b40

Please sign in to comment.