mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-15 09:20:32 +00:00
Fix: TrueNAS Core support for pool stats (#3206)
--------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
268d8efa0e
commit
4e69ea6088
5 changed files with 27 additions and 3 deletions
|
@ -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";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue