mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-03 09:16:40 +00:00
add alias to client resources table
This commit is contained in:
@@ -1557,6 +1557,7 @@
|
|||||||
"resourcesTableNoProxyResourcesFound": "No proxy resources found.",
|
"resourcesTableNoProxyResourcesFound": "No proxy resources found.",
|
||||||
"resourcesTableNoInternalResourcesFound": "No internal resources found.",
|
"resourcesTableNoInternalResourcesFound": "No internal resources found.",
|
||||||
"resourcesTableDestination": "Destination",
|
"resourcesTableDestination": "Destination",
|
||||||
|
"resourcesTableAlias": "Alias",
|
||||||
"resourcesTableClients": "Clients",
|
"resourcesTableClients": "Clients",
|
||||||
"resourcesTableAndOnlyAccessibleInternally": "and are only accessible internally when connected with a client.",
|
"resourcesTableAndOnlyAccessibleInternally": "and are only accessible internally when connected with a client.",
|
||||||
"resourcesTableNoTargets": "No targets",
|
"resourcesTableNoTargets": "No targets",
|
||||||
|
|||||||
@@ -14,11 +14,7 @@ import {
|
|||||||
import { useEnvContext } from "@app/hooks/useEnvContext";
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
||||||
import { toast } from "@app/hooks/useToast";
|
import { toast } from "@app/hooks/useToast";
|
||||||
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
import { createApiClient, formatAxiosError } from "@app/lib/api";
|
||||||
import {
|
import { ArrowUpDown, ArrowUpRight, MoreHorizontal } from "lucide-react";
|
||||||
ArrowUpDown,
|
|
||||||
ArrowUpRight,
|
|
||||||
MoreHorizontal
|
|
||||||
} from "lucide-react";
|
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
@@ -206,52 +202,34 @@ export default function ClientResourcesTable({
|
|||||||
),
|
),
|
||||||
cell: ({ row }) => {
|
cell: ({ row }) => {
|
||||||
const resourceRow = row.original;
|
const resourceRow = row.original;
|
||||||
let displayText: string;
|
|
||||||
let copyText: string;
|
|
||||||
|
|
||||||
// if (
|
|
||||||
// resourceRow.mode === "port" &&
|
|
||||||
// // resourceRow.protocol &&
|
|
||||||
// // resourceRow.proxyPort &&
|
|
||||||
// // resourceRow.destinationPort
|
|
||||||
// ) {
|
|
||||||
// // const protocol = resourceRow.protocol.toUpperCase();
|
|
||||||
// // For port mode: site part uses alias or site address, destination part uses destination IP
|
|
||||||
// // If site address has CIDR notation, extract just the IP address
|
|
||||||
// let siteAddress = resourceRow.siteAddress;
|
|
||||||
// if (siteAddress && siteAddress.includes("/")) {
|
|
||||||
// siteAddress = siteAddress.split("/")[0];
|
|
||||||
// }
|
|
||||||
// const siteDisplay = resourceRow.alias || siteAddress;
|
|
||||||
// // displayText = `${protocol} ${siteDisplay}:${resourceRow.proxyPort} -> ${resourceRow.destination}:${resourceRow.destinationPort}`;
|
|
||||||
// // copyText = `${siteDisplay}:${resourceRow.proxyPort}`;
|
|
||||||
// } else if (resourceRow.mode === "host") {
|
|
||||||
if (resourceRow.mode === "host") {
|
|
||||||
// For host mode: use alias if available, otherwise use destination
|
|
||||||
const destinationDisplay =
|
|
||||||
resourceRow.alias || resourceRow.destination;
|
|
||||||
displayText = destinationDisplay;
|
|
||||||
copyText = destinationDisplay;
|
|
||||||
} else if (resourceRow.mode === "cidr") {
|
|
||||||
displayText = resourceRow.destination;
|
|
||||||
copyText = resourceRow.destination;
|
|
||||||
} else {
|
|
||||||
const destinationDisplay =
|
|
||||||
resourceRow.alias || resourceRow.destination;
|
|
||||||
displayText = destinationDisplay;
|
|
||||||
copyText = destinationDisplay;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CopyToClipboard
|
<CopyToClipboard
|
||||||
text={copyText}
|
text={resourceRow.destination}
|
||||||
isLink={false}
|
isLink={false}
|
||||||
displayText={displayText}
|
displayText={resourceRow.destination}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "alias",
|
||||||
|
friendlyName: t("resourcesTableAlias"),
|
||||||
|
header: () => (
|
||||||
|
<span className="p-3">{t("resourcesTableAlias")}</span>
|
||||||
|
),
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const resourceRow = row.original;
|
||||||
|
return resourceRow.alias ? (
|
||||||
|
<CopyToClipboard
|
||||||
|
text={resourceRow.alias}
|
||||||
|
isLink={false}
|
||||||
|
displayText={resourceRow.alias}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<span>"-"</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "actions",
|
id: "actions",
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user