Skip to content

Commit

Permalink
Fixed the Size Unit in Graph
Browse files Browse the repository at this point in the history
Signed-off-by: Aravinda Vishwanathapura <[email protected]>
  • Loading branch information
aravindavk committed Sep 4, 2020
1 parent 0b66832 commit d243a84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gdash/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Version"""
VERSION = "1.0.3"
VERSION = "1.0.4"
10 changes: 5 additions & 5 deletions ui/src/components/helpers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export function capitalize(string) {
}).join(' ');
}

export function utilization(free, total, suffix) {
let sizeP = free * 100 / total;
export function utilization(used, total, suffix) {
let sizeP = used * 100 / total;

let cls = "h-1 "
if (sizeP > 90) {
Expand All @@ -65,7 +65,7 @@ export function utilization(free, total, suffix) {
<div className="bg-gray-300 mb-1 w-3/4">
<div style={{width: sizeP.toFixed(2) + "%"}} className={cls}></div>
</div>
<div className="text-gray-700">{humanReadable(free, suffix)} / {humanReadable(total, suffix)}</div>
<div className="text-gray-700">{humanReadable(used, suffix)} / {humanReadable(total, suffix)}</div>
</div>
);
}
Expand All @@ -79,7 +79,7 @@ export function sizeUtilization(volume) {
return <>N/A</>
}

return utilization(volume.size_free, volume.size_total, 'B');
return utilization(volume.size_used, volume.size_total, 'B');
}

export function inodesUtilization(volume) {
Expand All @@ -91,7 +91,7 @@ export function inodesUtilization(volume) {
return <>N/A</>
}

return utilization(volume.inodes_free, volume.inodes_total, '');
return utilization(volume.inodes_used, volume.inodes_total, '');
}

export function humanReadable(input_size, suffix) {
Expand Down

0 comments on commit d243a84

Please sign in to comment.