Add resource column to hc and remove —

This commit is contained in:
Owen
2026-04-16 17:42:30 -07:00
parent b958537f3e
commit d6c15c8b81
60 changed files with 257 additions and 211 deletions

View File

@@ -49,7 +49,7 @@ export default function SiteInfoCard({}: ClientInfoCardProps) {
</div>
) : (
<div className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</div>
)}

View File

@@ -133,7 +133,7 @@ function aggregateStatusDotClass(status: AggregateSitesStatus): string {
return "bg-yellow-500";
case "allOffline":
default:
return "bg-gray-500";
return "bg-neutral-500";
}
}
@@ -188,7 +188,7 @@ function ClientResourceSitesStatusCell({
"h-2 w-2 shrink-0 rounded-full",
isOnline
? "bg-green-500"
: "bg-gray-500"
: "bg-neutral-500"
)}
/>
<span className="truncate">

View File

@@ -32,7 +32,7 @@ export default function ExitNodeInfoCard({}: ExitNodeInfoCardProps) {
</div>
) : (
<div className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</div>
)}

View File

@@ -146,7 +146,7 @@ export default function ExitNodesTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</span>
);

View File

@@ -61,6 +61,9 @@ export type HealthCheckRow = {
hcTlsServerName: string | null;
hcHealthyThreshold: number | null;
hcUnhealthyThreshold: number | null;
resourceId: number | null;
resourceName: string | null;
resourceNiceId: string | null;
};
export type HealthCheckCredenzaProps =

View File

@@ -10,6 +10,7 @@ import {
SelectTrigger,
SelectValue
} from "@/components/ui/select";
import { StrategySelect } from "@app/components/StrategySelect";
import { Switch } from "@/components/ui/switch";
import { HeadersInput } from "@app/components/HeadersInput";
import {
@@ -103,22 +104,27 @@ export function HealthCheckFormFields({
render={({ field }) => (
<FormItem>
<FormLabel>{t("healthCheckStrategy")}</FormLabel>
<Select
onValueChange={(value) =>
handleChange("hcMode", value, field.onChange)
}
value={field.value}
>
<FormControl>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
</FormControl>
<SelectContent>
<SelectItem value="http">HTTP</SelectItem>
<SelectItem value="tcp">TCP</SelectItem>
</SelectContent>
</Select>
<FormControl>
<StrategySelect
cols={2}
options={[
{
id: "http",
title: "HTTP",
description: "Validates connectivity and checks the HTTP response status."
},
{
id: "tcp",
title: "TCP",
description: "Verifies TCP connectivity only, without inspecting the response."
}
]}
value={field.value}
onChange={(value) =>
handleChange("hcMode", value, field.onChange)
}
/>
</FormControl>
<FormMessage />
</FormItem>
)}

View File

@@ -19,17 +19,17 @@ import { useEnvContext } from "@app/hooks/useEnvContext";
import { createApiClient, formatAxiosError } from "@app/lib/api";
import { orgQueries } from "@app/lib/queries";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { ArrowUpDown, MoreHorizontal } from "lucide-react";
import { ArrowUpDown, ArrowUpRight, MoreHorizontal } from "lucide-react";
import { useTranslations } from "next-intl";
import { useState } from "react";
import { Span } from "next/dist/trace";
import Link from "next/link";
type StandaloneHealthChecksTableProps = {
orgId: string;
};
function formatTarget(row: HealthCheckRow): string {
if (!row.hcHostname) return "";
if (!row.hcHostname) return "-";
if (row.hcMode === "tcp") {
if (!row.hcPort) return row.hcHostname;
return `${row.hcHostname}:${row.hcPort}`;
@@ -154,7 +154,7 @@ export default function HealthChecksTable({
),
cell: ({ row }) => (
<span>
{row.original.hcMode?.toUpperCase() ?? ""}
{row.original.hcMode?.toUpperCase() ?? "-"}
</span>
)
},
@@ -166,6 +166,27 @@ export default function HealthChecksTable({
),
cell: ({ row }) => <span>{formatTarget(row.original)}</span>
},
{
id: "resource",
friendlyName: "Resource",
header: () => (
<span className="p-3">Resource</span>
),
cell: ({ row }) => {
const r = row.original;
if (!r.resourceId || !r.resourceName || !r.resourceNiceId) {
return <span className="text-neutral-400">-</span>;
}
return (
<Link href={`/${orgId}/settings/resources/proxy/${r.resourceNiceId}`}>
<Button variant="outline" size="sm">
{r.resourceName}
<ArrowUpRight className="ml-2 h-3 w-3" />
</Button>
</Link>
);
}
},
{
id: "health",
friendlyName: t("standaloneHcColumnHealth"),
@@ -191,7 +212,7 @@ export default function HealthChecksTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{healthLabel.unknown}</span>
</span>
);

View File

@@ -36,7 +36,7 @@ export default function LocaleSwitcherSelect({
});
// Persist locale to the database (fire-and-forget)
api.post("/user/locale", { locale }).catch(() => {
// Silently ignore errors cookie is already set as fallback
// Silently ignore errors - cookie is already set as fallback
});
}

View File

@@ -293,7 +293,7 @@ export default function MachineClientsTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("disconnected")}</span>
</span>
);

View File

@@ -204,7 +204,7 @@ export default function PendingSitesTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</span>
);

View File

@@ -79,7 +79,7 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
</span>
) : (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>Offline</span>
</span>
)}

View File

@@ -52,7 +52,7 @@ export default function SiteInfoCard({}: SiteInfoCardProps) {
</div>
) : (
<div className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</div>
)}

View File

@@ -212,7 +212,7 @@ export default function SitesTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("offline")}</span>
</span>
);

View File

@@ -427,7 +427,7 @@ export default function UserDevicesTable({
} else {
return (
<span className="text-neutral-500 flex items-center space-x-2">
<div className="w-2 h-2 bg-gray-500 rounded-full"></div>
<div className="w-2 h-2 bg-neutral-500 rounded-full"></div>
<span>{t("disconnected")}</span>
</span>
);