fix: make system health temp optional (#2247)

This commit is contained in:
Manuel
2025-02-04 19:10:12 +01:00
committed by GitHub
parent 8058b6207a
commit da09826393
3 changed files with 8 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ export interface HealthMonitoring {
};
rebootRequired: boolean;
availablePkgUpdates: number;
cpuTemp: number;
cpuTemp: number | undefined;
fileSystem: {
deviceName: string;
used: string;

View File

@@ -63,9 +63,6 @@ export class OpenMediaVaultIntegration extends Integration {
if (!smartResult.success) {
throw new Error("Invalid SMART information response");
}
if (!cpuTempResult.success) {
throw new Error("Invalid CPU temperature response");
}
const fileSystem = fileSystemResult.data.response.map((fileSystem) => ({
deviceName: fileSystem.devicename,
@@ -94,7 +91,7 @@ export class OpenMediaVaultIntegration extends Integration {
},
rebootRequired: systemResult.data.response.rebootRequired,
availablePkgUpdates: systemResult.data.response.availablePkgUpdates,
cpuTemp: cpuTempResult.data.response.cputemp,
cpuTemp: cpuTempResult.success ? cpuTempResult.data.response.cputemp : undefined,
fileSystem,
smart,
};

View File

@@ -347,9 +347,14 @@ const CpuRing = ({ cpuUtilization }: { cpuUtilization: number }) => {
);
};
const CpuTempRing = ({ fahrenheit, cpuTemp }: { fahrenheit: boolean; cpuTemp: number }) => {
const CpuTempRing = ({ fahrenheit, cpuTemp }: { fahrenheit: boolean; cpuTemp: number | undefined }) => {
const { width, ref } = useElementSize();
const fallbackWidth = width || 1; // See https://github.com/homarr-labs/homarr/issues/2196
if (!cpuTemp) {
return null;
}
return (
<Box ref={ref} w="100%" h="100%" className="health-monitoring-cpu-temperature">
<RingProgress