diff --git a/server/routers/resource/listResources.ts b/server/routers/resource/listResources.ts index fa7ec8a48..d1accfc9d 100644 --- a/server/routers/resource/listResources.ts +++ b/server/routers/resource/listResources.ts @@ -6,6 +6,7 @@ import { resourcePincode, resources, roleResources, + sites, targetHealthCheck, targets, userResources @@ -138,6 +139,7 @@ export type ResourceWithTargets = { port: number; enabled: boolean; healthStatus: "healthy" | "unhealthy" | "unknown" | null; + siteName: string | null; }>; }; @@ -446,14 +448,16 @@ export async function listResources( port: targets.port, enabled: targets.enabled, healthStatus: targetHealthCheck.hcHealth, - hcEnabled: targetHealthCheck.hcEnabled + hcEnabled: targetHealthCheck.hcEnabled, + siteName: sites.name }) .from(targets) .where(inArray(targets.resourceId, resourceIdList)) .leftJoin( targetHealthCheck, eq(targetHealthCheck.targetId, targets.targetId) - ); + ) + .leftJoin(sites, eq(targets.siteId, sites.siteId)); // avoids TS issues with reduce/never[] const map = new Map(); diff --git a/src/app/[orgId]/settings/resources/proxy/page.tsx b/src/app/[orgId]/settings/resources/proxy/page.tsx index 57505c53c..05425b4bd 100644 --- a/src/app/[orgId]/settings/resources/proxy/page.tsx +++ b/src/app/[orgId]/settings/resources/proxy/page.tsx @@ -95,7 +95,8 @@ export default async function ProxyResourcesPage( ip: target.ip, port: target.port, enabled: target.enabled, - healthStatus: target.healthStatus + healthStatus: target.healthStatus, + siteName: target.siteName })) }; }); diff --git a/src/components/ProxyResourcesTable.tsx b/src/components/ProxyResourcesTable.tsx index 353eddb50..fbb544ddf 100644 --- a/src/components/ProxyResourcesTable.tsx +++ b/src/components/ProxyResourcesTable.tsx @@ -54,6 +54,7 @@ export type TargetHealth = { port: number; enabled: boolean; healthStatus: "healthy" | "unhealthy" | "unknown" | null; + siteName: string | null; }; export type ResourceRow = { @@ -274,7 +275,9 @@ export default function ProxyResourcesTable({ } className="h-3 w-3" /> - {`${target.ip}:${target.port}`} + {target.siteName + ? `${target.siteName} (${target.ip}:${target.port})` + : `${target.ip}:${target.port}`} - {`${target.ip}:${target.port}`} + {target.siteName + ? `${target.siteName} (${target.ip}:${target.port})` + : `${target.ip}:${target.port}`} {!target.enabled