diff --git a/docs/widgets/services/truenas.md b/docs/widgets/services/truenas.md index 029923ecd..97bba3be7 100644 --- a/docs/widgets/services/truenas.md +++ b/docs/widgets/services/truenas.md @@ -11,7 +11,7 @@ To create an API Key, follow [the official TrueNAS documentation](https://www.tr A detailed pool listing is disabled by default, but can be enabled with the `enablePools` option. -TrueNAS Scale and Core APIs differ, the optional `nasType` parameter is needed if using the `enablePools` option. +To use the `enablePools` option with TrueNAS Core, the `nasType` parameter is required. ```yaml widget: @@ -21,5 +21,5 @@ widget: password: pass # not required if using api key key: yourtruenasapikey # not required if using username / password enablePools: true # optional, defaults to false - nasType: scale # defaults to scale, values are core or scale + nasType: scale # defaults to scale, must be set to 'core' if using enablePools with TrueNAS Core ``` diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js index 07d1e2bf7..618e296f3 100644 --- a/src/utils/config/service-helpers.js +++ b/src/utils/config/service-helpers.js @@ -521,7 +521,7 @@ export function cleanServiceGroups(groups) { } if (type === "truenas") { if (enablePools !== undefined) cleanedService.widget.enablePools = JSON.parse(enablePools); - cleanedService.widget.nasType = nasType ?? "scale"; + if (nasType !== undefined) cleanedService.widget.nasType = nasType; } if (["diskstation", "qnap"].includes(type)) { if (volume) cleanedService.widget.volume = volume; diff --git a/src/widgets/truenas/component.jsx b/src/widgets/truenas/component.jsx index 917358571..10d45bf61 100644 --- a/src/widgets/truenas/component.jsx +++ b/src/widgets/truenas/component.jsx @@ -44,10 +44,10 @@ export default function Component({ service }) { key={pool.id} name={pool.name} healthy={pool.healthy} - scaleAllocated={pool.allocated} - scaleFree={pool.free} + allocated={pool.allocated} + free={pool.free} data={pool.data} - nasType={widget?.nasType} + nasType={widget?.nasType ?? "scale"} /> ))} diff --git a/src/widgets/truenas/pool.jsx b/src/widgets/truenas/pool.jsx index 612fc740b..fb3e468a6 100644 --- a/src/widgets/truenas/pool.jsx +++ b/src/widgets/truenas/pool.jsx @@ -1,16 +1,15 @@ import classNames from "classnames"; import prettyBytes from "pretty-bytes"; -export default function Pool({ name, scaleFree, scaleAllocated, healthy, data, nasType }) { +export default function Pool({ name, free, allocated, healthy, data, nasType }) { let total = 0; - let allocated = 0; if (nasType === "scale") { - total = scaleFree + scaleAllocated; - allocated = scaleAllocated; + 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; + allocated += data[i].stats.allocated; // eslint-disable-line no-param-reassign } }