Apply suggestions from code review
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
7b93dc4847
commit
e313ae5f41
@ -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.
|
||||
|
||||
The Scale and Core API's provide information on the pools in different manners. The `nasType` option choses which API response parsing should be used.
|
||||
TrueNAS Scale and Core APIs differ, the optional `nasType` parameter is needed if using the `enablePools` option.
|
||||
|
||||
```yaml
|
||||
widget:
|
||||
|
||||
@ -521,11 +521,7 @@ export function cleanServiceGroups(groups) {
|
||||
}
|
||||
if (type === "truenas") {
|
||||
if (enablePools !== undefined) cleanedService.widget.enablePools = JSON.parse(enablePools);
|
||||
if (nasType) {
|
||||
cleanedService.widget.nasType = nasType;
|
||||
} else {
|
||||
cleanedService.widget.nasType = "scale";
|
||||
}
|
||||
cleanedService.widget.nasType = nasType ?? "scale";
|
||||
}
|
||||
if (["diskstation", "qnap"].includes(type)) {
|
||||
if (volume) cleanedService.widget.volume = volume;
|
||||
|
||||
@ -31,8 +31,6 @@ export default function Component({ service }) {
|
||||
}
|
||||
|
||||
const enablePools = widget?.enablePools && Array.isArray(poolsData) && poolsData.length > 0;
|
||||
const scaleDeployment = widget?.nasType === "scale";
|
||||
const coreDeployment = widget?.nasType === "core";
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -42,7 +40,7 @@ export default function Component({ service }) {
|
||||
<Block label="truenas.alerts" value={t("common.number", { value: alertData.pending })} />
|
||||
</Container>
|
||||
{enablePools &&
|
||||
scaleDeployment &&
|
||||
widget?.nasType === "scale" &&
|
||||
poolsData.map((pool) => (
|
||||
<ScalePool
|
||||
key={pool.id}
|
||||
@ -53,7 +51,7 @@ export default function Component({ service }) {
|
||||
/>
|
||||
))}
|
||||
{enablePools &&
|
||||
coreDeployment &&
|
||||
widget?.nasType === "core" &&
|
||||
poolsData.map((pool) => <CorePool key={pool.id} name={pool.name} healthy={pool.healthy} data={pool.data} />)}
|
||||
</>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user