diff --git a/messages/en-US.json b/messages/en-US.json index d2b79bd35..9347235ef 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1998,6 +1998,7 @@ "resourcesTableUnhealthy": "Unhealthy", "resourcesTableUnknown": "Unknown", "resourcesTableNotMonitored": "Not monitored", + "resourcesTableNoTargets": "No targets", "editInternalResourceDialogEditClientResource": "Edit Private Resource", "editInternalResourceDialogUpdateResourceProperties": "Update the resource configuration and access controls for {resourceName}", "editInternalResourceDialogResourceProperties": "Resource Properties", diff --git a/server/routers/resource/listResources.ts b/server/routers/resource/listResources.ts index 78ef30559..d0c30aaa2 100644 --- a/server/routers/resource/listResources.ts +++ b/server/routers/resource/listResources.ts @@ -110,9 +110,9 @@ const listResourcesSchema = z.object({ .catch(undefined) .openapi({ type: "string", - enum: ["no_targets", "healthy", "degraded", "offline", "unknown"], + enum: ["healthy", "degraded", "offline", "unknown"], description: - "Filter resources based on health status of their targets. `healthy` means all targets are healthy. `degraded` means at least one target is unhealthy, but not all are unhealthy. `offline` means all targets are unhealthy. `unknown` means all targets have unknown health status. `no_targets` means the resource has no targets." + "Filter resources based on health status of their targets. `healthy` means all targets are healthy. `degraded` means at least one target is unhealthy, but not all are unhealthy. `offline` means all targets are unhealthy. `unknown` means all targets have unknown health status." }), siteId: z.coerce.number().int().positive().optional().openapi({ type: "integer", @@ -374,21 +374,22 @@ export async function listResources( ); break; } - if (typeof healthStatus !== "undefined") { - conditions.push(eq(resources.health, healthStatus)); - } - if (siteId != null) { - const resourcesWithSite = db - .select({ resourceId: targets.resourceId }) - .from(targets) - .innerJoin(sites, eq(targets.siteId, sites.siteId)) - .where( - and(eq(sites.orgId, orgId), eq(sites.siteId, siteId)) - ); - conditions.push( - inArray(resources.resourceId, resourcesWithSite) + } + + if (typeof healthStatus !== "undefined") { + conditions.push(eq(resources.health, healthStatus)); + } + if (siteId != null) { + const resourcesWithSite = db + .select({ resourceId: targets.resourceId }) + .from(targets) + .innerJoin(sites, eq(targets.siteId, sites.siteId)) + .where( + and(eq(sites.orgId, orgId), eq(sites.siteId, siteId)) ); - } + conditions.push( + inArray(resources.resourceId, resourcesWithSite) + ); } const baseQuery = queryResourcesBase().where(and(...conditions)); diff --git a/src/components/HealthChecksTable.tsx b/src/components/HealthChecksTable.tsx index 47a1c8cd9..68976bf40 100644 --- a/src/components/HealthChecksTable.tsx +++ b/src/components/HealthChecksTable.tsx @@ -586,7 +586,7 @@ export default function HealthChecksTable({ handleToggleEnabled(r, v)} /> diff --git a/src/components/ProxyResourcesTable.tsx b/src/components/ProxyResourcesTable.tsx index 525b28809..384ad35c6 100644 --- a/src/components/ProxyResourcesTable.tsx +++ b/src/components/ProxyResourcesTable.tsx @@ -90,7 +90,7 @@ export type ResourceRow = { targetHost?: string; targetPort?: number; targets?: TargetHealth[]; - health?: "online" | "degraded" | "unhealthy" | "unknown"; + health?: "healthy" | "degraded" | "unhealthy" | "unknown"; sites: ResourceSiteRow[]; }; @@ -265,8 +265,8 @@ export default function ProxyResourcesTable({ > - {overallStatus === "online" && - t("resourcesTableHealthy")} + {overallStatus === "healthy" && + t("resourcesTableHealthy")} {overallStatus === "degraded" && t("resourcesTableDegraded")} {overallStatus === "unhealthy" && @@ -469,7 +469,7 @@ export default function ProxyResourcesTable({ label: t("resourcesTableDegraded") }, { - value: "unhealty", + value: "unhealthy", label: t("resourcesTableUnhealthy") }, { value: "unknown", label: t("resourcesTableUnknown") } @@ -488,7 +488,7 @@ export default function ProxyResourcesTable({ ), cell: ({ row }) => { const resourceRow = row.original; - return ; + return ; }, sortingFn: (rowA, rowB) => { const statusA = rowA.original.health; @@ -497,7 +497,7 @@ export default function ProxyResourcesTable({ if (!statusA) return 1; if (!statusB) return -1; const statusOrder = { - online: 3, + healthy: 3, degraded: 2, unhealthy: 1, unknown: 0