mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-13 12:42:09 +08:00
Fix: TrueNAS Core support for pool stats (#3206)
--------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
import classNames from "classnames";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
|
||||
export default function Pool({ name, free, allocated, healthy }) {
|
||||
const total = free + allocated;
|
||||
export default function Pool({ name, free, allocated, healthy, data, nasType }) {
|
||||
let total = 0;
|
||||
if (nasType === "scale") {
|
||||
total = free + allocated;
|
||||
} else {
|
||||
allocated = 0; // eslint-disable-line no-param-reassign
|
||||
for (let i = 0; i < data.length; i += 1) {
|
||||
total += data[i].stats.size;
|
||||
allocated += data[i].stats.allocated; // eslint-disable-line no-param-reassign
|
||||
}
|
||||
}
|
||||
|
||||
const usedPercent = Math.round((allocated / total) * 100);
|
||||
const statusColor = healthy ? "bg-green-500" : "bg-yellow-500";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user