fix: health-check widget sorting & last seen (#1363)
Co-authored-by: Yossi Hillali <950010+hillaliy@users.noreply.github.com>
This commit is contained in:
@@ -36,7 +36,7 @@ export const healthMonitoringRouter = createTRPCRouter({
|
|||||||
emit.next({
|
emit.next({
|
||||||
integrationId: integration.id,
|
integrationId: integration.id,
|
||||||
healthInfo,
|
healthInfo,
|
||||||
timestamp: new Date(0),
|
timestamp: new Date(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
unsubscribes.push(unsubscribe);
|
unsubscribes.push(unsubscribe);
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ export default function HealthMonitoringWidget({ options, integrationIds }: Widg
|
|||||||
}
|
}
|
||||||
const newData = prevData.map((item) =>
|
const newData = prevData.map((item) =>
|
||||||
item.integrationId === data.integrationId
|
item.integrationId === data.integrationId
|
||||||
? { ...item, healthInfo: data.healthInfo, timestamp: new Date(0) }
|
? { ...item, healthInfo: data.healthInfo, timestamp: data.timestamp }
|
||||||
: item,
|
: item,
|
||||||
);
|
);
|
||||||
return newData.filter(
|
return newData.filter(
|
||||||
@@ -323,19 +323,21 @@ interface SmartData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const matchFileSystemAndSmart = (fileSystems: FileSystem[], smartData: SmartData[]) => {
|
export const matchFileSystemAndSmart = (fileSystems: FileSystem[], smartData: SmartData[]) => {
|
||||||
return fileSystems.map((fileSystem) => {
|
return fileSystems
|
||||||
const baseDeviceName = fileSystem.deviceName.replace(/[0-9]+$/, "");
|
.map((fileSystem) => {
|
||||||
const smartDisk = smartData.find((smart) => smart.deviceName === baseDeviceName);
|
const baseDeviceName = fileSystem.deviceName.replace(/[0-9]+$/, "");
|
||||||
|
const smartDisk = smartData.find((smart) => smart.deviceName === baseDeviceName);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
deviceName: smartDisk?.deviceName ?? fileSystem.deviceName,
|
deviceName: smartDisk?.deviceName ?? fileSystem.deviceName,
|
||||||
used: fileSystem.used,
|
used: fileSystem.used,
|
||||||
available: fileSystem.available,
|
available: fileSystem.available,
|
||||||
percentage: fileSystem.percentage,
|
percentage: fileSystem.percentage,
|
||||||
temperature: smartDisk?.temperature ?? 0,
|
temperature: smartDisk?.temperature ?? 0,
|
||||||
overallStatus: smartDisk?.overallStatus ?? "",
|
overallStatus: smartDisk?.overallStatus ?? "",
|
||||||
};
|
};
|
||||||
});
|
})
|
||||||
|
.sort((fileSystemA, fileSystemB) => fileSystemA.deviceName.localeCompare(fileSystemB.deviceName));
|
||||||
};
|
};
|
||||||
|
|
||||||
const CpuRing = ({ cpuUtilization }: { cpuUtilization: number }) => {
|
const CpuRing = ({ cpuUtilization }: { cpuUtilization: number }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user