fix: make quicklook optional in Glances integration schema (#5949)
On macOS (and some Glances configurations) the /api/4/all endpoint omits the quicklook key, causing a Zod invalid_type error and crashing the system health widget. Mark quicklook as .optional() in allSchema and add a null-safe fallback (`?? "Unknown"`) for cpuModelName. Fixes #5728 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This commit is contained in:
1 parent
6881b8355c
commit
58058f2ea6
2 files changed
+109
-4
No files matched your search
@@ -55,7 +55,7 @@ export class GlancesIntegration extends Integration implements ISystemHealthMoni
|
||||
})),
|
||||
uptime: stats.uptime.as("seconds"),
|
||||
rebootRequired: false,
|
||||
cpuModelName: stats.quicklook.cpu_name,
|
||||
cpuModelName: stats.quicklook?.cpu_name ?? "Unknown",
|
||||
loadAverage: null,
|
||||
smart: [],
|
||||
cpuTemp: undefined,
|
||||
@@ -155,9 +155,11 @@ const allSchema = z.object({
|
||||
|
||||
return dayjs.duration({ days, hours, minutes, seconds });
|
||||
}),
|
||||
quicklook: z.object({
|
||||
cpu_name: z.string(),
|
||||
}),
|
||||
quicklook: z
|
||||
.object({
|
||||
cpu_name: z.string(),
|
||||
})
|
||||
.optional(),
|
||||
gpu: z
|
||||
.array(
|
||||
z.object({
|
||||
|
||||
Reference in new issue
Block a user