mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-16 22:14:29 +00:00
Fix display and query issues
This commit is contained in:
@@ -1998,6 +1998,7 @@
|
|||||||
"resourcesTableUnhealthy": "Unhealthy",
|
"resourcesTableUnhealthy": "Unhealthy",
|
||||||
"resourcesTableUnknown": "Unknown",
|
"resourcesTableUnknown": "Unknown",
|
||||||
"resourcesTableNotMonitored": "Not monitored",
|
"resourcesTableNotMonitored": "Not monitored",
|
||||||
|
"resourcesTableNoTargets": "No targets",
|
||||||
"editInternalResourceDialogEditClientResource": "Edit Private Resource",
|
"editInternalResourceDialogEditClientResource": "Edit Private Resource",
|
||||||
"editInternalResourceDialogUpdateResourceProperties": "Update the resource configuration and access controls for {resourceName}",
|
"editInternalResourceDialogUpdateResourceProperties": "Update the resource configuration and access controls for {resourceName}",
|
||||||
"editInternalResourceDialogResourceProperties": "Resource Properties",
|
"editInternalResourceDialogResourceProperties": "Resource Properties",
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ const listResourcesSchema = z.object({
|
|||||||
.catch(undefined)
|
.catch(undefined)
|
||||||
.openapi({
|
.openapi({
|
||||||
type: "string",
|
type: "string",
|
||||||
enum: ["no_targets", "healthy", "degraded", "offline", "unknown"],
|
enum: ["healthy", "degraded", "offline", "unknown"],
|
||||||
description:
|
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<string>().int().positive().optional().openapi({
|
siteId: z.coerce.number<string>().int().positive().optional().openapi({
|
||||||
type: "integer",
|
type: "integer",
|
||||||
@@ -374,21 +374,22 @@ export async function listResources(
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (typeof healthStatus !== "undefined") {
|
}
|
||||||
conditions.push(eq(resources.health, healthStatus));
|
|
||||||
}
|
if (typeof healthStatus !== "undefined") {
|
||||||
if (siteId != null) {
|
conditions.push(eq(resources.health, healthStatus));
|
||||||
const resourcesWithSite = db
|
}
|
||||||
.select({ resourceId: targets.resourceId })
|
if (siteId != null) {
|
||||||
.from(targets)
|
const resourcesWithSite = db
|
||||||
.innerJoin(sites, eq(targets.siteId, sites.siteId))
|
.select({ resourceId: targets.resourceId })
|
||||||
.where(
|
.from(targets)
|
||||||
and(eq(sites.orgId, orgId), eq(sites.siteId, siteId))
|
.innerJoin(sites, eq(targets.siteId, sites.siteId))
|
||||||
);
|
.where(
|
||||||
conditions.push(
|
and(eq(sites.orgId, orgId), eq(sites.siteId, siteId))
|
||||||
inArray(resources.resourceId, resourcesWithSite)
|
|
||||||
);
|
);
|
||||||
}
|
conditions.push(
|
||||||
|
inArray(resources.resourceId, resourcesWithSite)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseQuery = queryResourcesBase().where(and(...conditions));
|
const baseQuery = queryResourcesBase().where(and(...conditions));
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ export default function HealthChecksTable({
|
|||||||
<Switch
|
<Switch
|
||||||
checked={r.hcEnabled}
|
checked={r.hcEnabled}
|
||||||
disabled={
|
disabled={
|
||||||
!isPaid || togglingId === r.targetHealthCheckId
|
!isPaid || togglingId === r.targetHealthCheckId || !!r.resourceId
|
||||||
}
|
}
|
||||||
onCheckedChange={(v) => handleToggleEnabled(r, v)}
|
onCheckedChange={(v) => handleToggleEnabled(r, v)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export type ResourceRow = {
|
|||||||
targetHost?: string;
|
targetHost?: string;
|
||||||
targetPort?: number;
|
targetPort?: number;
|
||||||
targets?: TargetHealth[];
|
targets?: TargetHealth[];
|
||||||
health?: "online" | "degraded" | "unhealthy" | "unknown";
|
health?: "healthy" | "degraded" | "unhealthy" | "unknown";
|
||||||
sites: ResourceSiteRow[];
|
sites: ResourceSiteRow[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -265,8 +265,8 @@ export default function ProxyResourcesTable({
|
|||||||
>
|
>
|
||||||
<StatusIcon status={overallStatus} />
|
<StatusIcon status={overallStatus} />
|
||||||
<span className="text-sm">
|
<span className="text-sm">
|
||||||
{overallStatus === "online" &&
|
{overallStatus === "healthy" &&
|
||||||
t("resourcesTableHealthy")}
|
t("resourcesTableHealthy")}
|
||||||
{overallStatus === "degraded" &&
|
{overallStatus === "degraded" &&
|
||||||
t("resourcesTableDegraded")}
|
t("resourcesTableDegraded")}
|
||||||
{overallStatus === "unhealthy" &&
|
{overallStatus === "unhealthy" &&
|
||||||
@@ -469,7 +469,7 @@ export default function ProxyResourcesTable({
|
|||||||
label: t("resourcesTableDegraded")
|
label: t("resourcesTableDegraded")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "unhealty",
|
value: "unhealthy",
|
||||||
label: t("resourcesTableUnhealthy")
|
label: t("resourcesTableUnhealthy")
|
||||||
},
|
},
|
||||||
{ value: "unknown", label: t("resourcesTableUnknown") }
|
{ value: "unknown", label: t("resourcesTableUnknown") }
|
||||||
@@ -488,7 +488,7 @@ export default function ProxyResourcesTable({
|
|||||||
),
|
),
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const resourceRow = row.original;
|
const resourceRow = row.original;
|
||||||
return <TargetStatusCell targets={resourceRow.targets} />;
|
return <TargetStatusCell targets={resourceRow.targets} healthStatus={resourceRow.health} />;
|
||||||
},
|
},
|
||||||
sortingFn: (rowA, rowB) => {
|
sortingFn: (rowA, rowB) => {
|
||||||
const statusA = rowA.original.health;
|
const statusA = rowA.original.health;
|
||||||
@@ -497,7 +497,7 @@ export default function ProxyResourcesTable({
|
|||||||
if (!statusA) return 1;
|
if (!statusA) return 1;
|
||||||
if (!statusB) return -1;
|
if (!statusB) return -1;
|
||||||
const statusOrder = {
|
const statusOrder = {
|
||||||
online: 3,
|
healthy: 3,
|
||||||
degraded: 2,
|
degraded: 2,
|
||||||
unhealthy: 1,
|
unhealthy: 1,
|
||||||
unknown: 0
|
unknown: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user