fix: omv invalid temperature when not available (#2322)

This commit is contained in:
Manuel
2025-02-23 12:34:04 +01:00
committed by GitHub
parent 4f09363823
commit 5dc5d9e04a
4 changed files with 17 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ export interface HealthMonitoring {
}[];
smart: {
deviceName: string;
temperature: number;
temperature: number | null;
overallStatus: string;
}[];
}

View File

@@ -40,7 +40,7 @@ export const smartSchema = z.object({
// Convert string to number if necessary
const temp = typeof val === "string" ? parseFloat(val) : val;
if (isNaN(temp)) {
throw new Error("Invalid temperature value");
return null;
}
return temp;
}),

View File

@@ -64,12 +64,11 @@ export const SystemHealthMonitoring = ({ options, integrationIds }: WidgetCompon
if (!prevData) {
return undefined;
}
const newData = prevData.map((item) =>
return prevData.map((item) =>
item.integrationId === data.integrationId
? { ...item, healthInfo: data.healthInfo, updatedAt: data.timestamp }
: item,
);
return newData;
});
},
},
@@ -294,7 +293,7 @@ interface FileSystem {
interface SmartData {
deviceName: string;
temperature: number;
temperature: number | null;
overallStatus: string;
}