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

@@ -22,7 +22,7 @@ import { useParams, useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState, useTransition } from "react";
function formatBytes(bytes: number | null): string {
if (bytes === null || bytes === undefined) return "";
if (bytes === null || bytes === undefined) return "-";
if (bytes === 0) return "0 B";
const units = ["B", "KB", "MB", "GB", "TB"];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
@@ -33,7 +33,7 @@ function formatBytes(bytes: number | null): string {
function formatDuration(startedAt: number, endedAt: number | null): string {
if (endedAt === null || endedAt === undefined) return "Active";
const durationSec = endedAt - startedAt;
if (durationSec < 0) return "";
if (durationSec < 0) return "-";
if (durationSec < 60) return `${durationSec}s`;
if (durationSec < 3600) {
const m = Math.floor(durationSec / 60);
@@ -460,7 +460,7 @@ export default function ConnectionLogsPage() {
}
return (
<span className="whitespace-nowrap">
{row.original.resourceName ?? ""}
{row.original.resourceName ?? "-"}
</span>
);
}
@@ -503,7 +503,7 @@ export default function ConnectionLogsPage() {
}
return (
<span className="whitespace-nowrap">
{row.original.clientName ?? ""}
{row.original.clientName ?? "-"}
</span>
);
}
@@ -538,7 +538,7 @@ export default function ConnectionLogsPage() {
</span>
);
}
return <span></span>;
return <span>-</span>;
}
},
{
@@ -612,23 +612,23 @@ export default function ConnectionLogsPage() {
<div>
<strong>Session ID:</strong>{" "}
<span className="font-mono">
{row.sessionId ?? ""}
{row.sessionId ?? "-"}
</span>
</div>
<div>
<strong>Protocol:</strong>{" "}
{row.protocol?.toUpperCase() ?? ""}
{row.protocol?.toUpperCase() ?? "-"}
</div>
<div>
<strong>Source:</strong>{" "}
<span className="font-mono">
{row.sourceAddr ?? ""}
{row.sourceAddr ?? "-"}
</span>
</div>
<div>
<strong>Destination:</strong>{" "}
<span className="font-mono">
{row.destAddr ?? ""}
{row.destAddr ?? "-"}
</span>
</div>
</div>
@@ -638,7 +638,7 @@ export default function ConnectionLogsPage() {
</div>*/}
{/*<div>
<strong>Resource:</strong>{" "}
{row.resourceName ?? ""}
{row.resourceName ?? "-"}
{row.resourceNiceId && (
<span className="text-muted-foreground ml-1">
({row.resourceNiceId})
@@ -646,7 +646,7 @@ export default function ConnectionLogsPage() {
)}
</div>*/}
<div>
<strong>Site:</strong> {row.siteName ?? ""}
<strong>Site:</strong> {row.siteName ?? "-"}
{row.siteNiceId && (
<span className="text-muted-foreground ml-1">
({row.siteNiceId})
@@ -654,7 +654,7 @@ export default function ConnectionLogsPage() {
)}
</div>
<div>
<strong>Site ID:</strong> {row.siteId ?? ""}
<strong>Site ID:</strong> {row.siteId ?? "-"}
</div>
<div>
<strong>Started At:</strong>{" "}
@@ -662,7 +662,7 @@ export default function ConnectionLogsPage() {
? new Date(
row.startedAt * 1000
).toLocaleString()
: ""}
: "-"}
</div>
<div>
<strong>Ended At:</strong>{" "}
@@ -676,7 +676,7 @@ export default function ConnectionLogsPage() {
</div>
{/*<div>
<strong>Resource ID:</strong>{" "}
{row.siteResourceId ?? ""}
{row.siteResourceId ?? "-"}
</div>*/}
</div>
<div className="space-y-2">

View File

@@ -434,7 +434,7 @@ export default function StreamingDestinationsPage() {
disabled={!isEnterprise}
/>
))}
{/* Add card is always clickable paywall is enforced inside the picker */}
{/* Add card is always clickable - paywall is enforced inside the picker */}
<AddDestinationCard onClick={openCreate} />
</div>
)}

View File

@@ -341,19 +341,6 @@ function ProxyResourceTargetsForm({
header: () => <span className="p-3">{t("healthCheck")}</span>,
cell: ({ row }) => {
const status = row.original.hcHealth || "unknown";
const isEnabled = row.original.hcEnabled;
const getStatusColor = (status: string) => {
switch (status) {
case "healthy":
return "green";
case "unhealthy":
return "red";
case "unknown":
default:
return "secondary";
}
};
const getStatusText = (status: string) => {
switch (status) {
@@ -367,19 +354,7 @@ function ProxyResourceTargetsForm({
}
};
const getStatusIcon = (status: string) => {
switch (status) {
case "healthy":
return <CircleCheck className="w-3 h-3" />;
case "unhealthy":
return <CircleX className="w-3 h-3" />;
case "unknown":
default:
return null;
}
};
return (
return (
<div className="flex items-center justify-center w-full">
{row.original.siteType === "newt" ? (
<Button
@@ -390,12 +365,15 @@ function ProxyResourceTargetsForm({
}
>
<div
className={`flex items-center gap-2 ${status === "healthy" ? "text-green-500" : status === "unhealthy" ? "text-destructive" : ""}`}
className={`flex items-center gap-2 ${status === "healthy" ? "text-green-500" : status === "unhealthy" ? "text-destructive" : "text-neutral-500"}`}
>
<Settings className="h-4 w-4 text-foreground" />
<div
className={`w-2 h-2 rounded-full ${status === "healthy" ? "bg-green-500" : status === "unhealthy" ? "bg-destructive" : "bg-neutral-500"}`}
></div>
{getStatusText(status)}
</div>
</Button>
) : (
<span>-</span>
)}

View File

@@ -425,7 +425,7 @@ export default function Page() {
setRemoteExitNodeOptions(exitNodeOptions);
if (exitNodeOptions.length === 0) {
// No remote exit nodes available remove local option and default to newt
// No remote exit nodes available - remove local option and default to newt
setTunnelTypes((prev: any) =>
prev.filter((item: any) => item.id !== "local")
);
@@ -434,7 +434,7 @@ export default function Page() {
}
} catch (error) {
console.error("Failed to fetch remote exit nodes:", error);
// If fetch fails, no remote exit nodes available remove local option and default to newt
// If fetch fails, no remote exit nodes available - remove local option and default to newt
setTunnelTypes((prev: any) =>
prev.filter((item: any) => item.id !== "local")
);