fix: make system health temp optional (#2247)
This commit is contained in:
@@ -12,7 +12,7 @@ export interface HealthMonitoring {
|
||||
};
|
||||
rebootRequired: boolean;
|
||||
availablePkgUpdates: number;
|
||||
cpuTemp: number;
|
||||
cpuTemp: number | undefined;
|
||||
fileSystem: {
|
||||
deviceName: string;
|
||||
used: string;
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user