fix: omv invalid temperature when not available (#2322)
This commit is contained in:
13
.run/typecheck.run.xml
Normal file
13
.run/typecheck.run.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="typecheck" type="js.build_tools.npm">
|
||||||
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
|
<command value="run" />
|
||||||
|
<scripts>
|
||||||
|
<script value="typecheck" />
|
||||||
|
</scripts>
|
||||||
|
<node-interpreter value="project" />
|
||||||
|
<package-manager value="pnpm" />
|
||||||
|
<envs />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
@@ -21,7 +21,7 @@ export interface HealthMonitoring {
|
|||||||
}[];
|
}[];
|
||||||
smart: {
|
smart: {
|
||||||
deviceName: string;
|
deviceName: string;
|
||||||
temperature: number;
|
temperature: number | null;
|
||||||
overallStatus: string;
|
overallStatus: string;
|
||||||
}[];
|
}[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const smartSchema = z.object({
|
|||||||
// Convert string to number if necessary
|
// Convert string to number if necessary
|
||||||
const temp = typeof val === "string" ? parseFloat(val) : val;
|
const temp = typeof val === "string" ? parseFloat(val) : val;
|
||||||
if (isNaN(temp)) {
|
if (isNaN(temp)) {
|
||||||
throw new Error("Invalid temperature value");
|
return null;
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -64,12 +64,11 @@ export const SystemHealthMonitoring = ({ options, integrationIds }: WidgetCompon
|
|||||||
if (!prevData) {
|
if (!prevData) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const newData = prevData.map((item) =>
|
return prevData.map((item) =>
|
||||||
item.integrationId === data.integrationId
|
item.integrationId === data.integrationId
|
||||||
? { ...item, healthInfo: data.healthInfo, updatedAt: data.timestamp }
|
? { ...item, healthInfo: data.healthInfo, updatedAt: data.timestamp }
|
||||||
: item,
|
: item,
|
||||||
);
|
);
|
||||||
return newData;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -294,7 +293,7 @@ interface FileSystem {
|
|||||||
|
|
||||||
interface SmartData {
|
interface SmartData {
|
||||||
deviceName: string;
|
deviceName: string;
|
||||||
temperature: number;
|
temperature: number | null;
|
||||||
overallStatus: string;
|
overallStatus: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user