Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

fix(true-nas): ignore offline/exported pools (#5225)

Meier Lukas451602d1e612
diff --git a/packages/integrations/src/truenas/truenas-integration.ts b/packages/integrations/src/truenas/truenas-integration.ts
index 4ff38d819..a712bc076 100644
--- a/packages/integrations/src/truenas/truenas-integration.ts
+++ b/packages/integrations/src/truenas/truenas-integration.ts
@@ -126,11 +126,28 @@ export class TrueNasIntegration extends Integration implements ISystemHealthMoni
},
]);
const result = await poolSchema.parseAsync(response);
+ // Offline / exported pools have null values for allocated, size and free, so we filter them out
+ // See https://github.com/homarr-labs/homarr/issues/5194
+ const activePools = result
+ .map((pool) => {
+ if (pool.allocated !== null && pool.size !== null && pool.free !== null) {
+ return {
+ ...pool,
+ allocated: pool.allocated,
+ size: pool.size,
+ free: pool.free,
+ };
+ }
+
+ return null;
+ })
+ .filter((pool) => pool !== null);
logger.debug("Retrieved pools", {
url: this.wsUrl(),
- count: result.length,
+ totalCount: result.length,
+ activeCount: activePools.length,
});
- return result;
+ return activePools;
}
/**
@@ -388,9 +405,11 @@ const poolSchema = z.array(
name: z.string(),
status: z.string(),
healthy: z.boolean(),
- free: z.number().min(0),
- size: z.number(),
- allocated: z.number(),
+ // free, size and allocated are null when the pool is offline or exported
+ // see https://github.com/homarr-labs/homarr/issues/5194
+ free: z.number().min(0).nullable(),
+ size: z.number().nullable(),
+ allocated: z.number().nullable(),
}),
);