Function: calculateSiteStatus()
calculateSiteStatus(
site
:SiteForStatus
):SiteStatus
Defined in: shared/utils/siteStatus.ts:87
Calculates the overall operational status for a site based on the statuses of its monitors.
Parametersโ
siteโ
The SiteForStatus object representing the site to evaluate.
Returnsโ
The operational status as a SiteStatus value.
Remarksโ
The operational status reflects the aggregate health of all monitors:
- Returns
"up"
if all monitors are up. - Returns
"down"
if all monitors are down. - Returns
"pending"
if all monitors are pending. - Returns
"paused"
if all monitors are paused. - Returns
"mixed"
if monitors have different statuses. - Returns
"unknown"
if there are no monitors.
Exampleโ
const status = calculateSiteStatus(site);
// status: "up" | "down" | "pending" | "paused" | "mixed" | "unknown"