Fix null checks for currentStatus in Overview component and update variable declaration for currentMonitorStatus

This commit is contained in:
Simon Larsen 2024-09-20 23:32:54 +01:00
parent 89da4dea4c
commit ea0a9d94bc
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA

View File

@ -373,7 +373,9 @@ const Overview: FunctionComponent<PageComponentProps> = (
if (
!downtimeMonitorStatuses.find((downtimeStatus: MonitorStatus) => {
return currentStatus.id?.toString() === downtimeStatus.id?.toString();
return (
currentStatus?.id?.toString() === downtimeStatus?.id?.toString()
);
}) &&
data.group.showUptimePercent
) {
@ -723,7 +725,7 @@ const Overview: FunctionComponent<PageComponentProps> = (
getResourcesInGroup(group);
for (const resource of resourcesInGroup) {
const currentMonitorStatus: MonitorStatus | undefined =
let currentMonitorStatus: MonitorStatus | undefined =
monitorStatuses.find((status: MonitorStatus) => {
return (
status._id?.toString() ===
@ -731,6 +733,10 @@ const Overview: FunctionComponent<PageComponentProps> = (
);
});
if (!currentMonitorStatus) {
currentMonitorStatus = currentStatus;
}
if (
(currentStatus &&
currentStatus.priority &&