"use client"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { ShieldCheck, ShieldOff, EyeOff, CheckCircle2, XCircle } from "lucide-react"; import { useResourceContext } from "@app/hooks/useResourceContext"; import CopyToClipboard from "@app/components/CopyToClipboard"; import { InfoSection, InfoSectionContent, InfoSections, InfoSectionTitle } from "@app/components/InfoSection"; import { useTranslations } from "next-intl"; import CertificateStatus from "@app/components/CertificateStatus"; import { toUnicode } from "punycode"; import { build } from "@server/build"; type ResourceInfoBoxType = {}; export default function ResourceInfoBox({}: ResourceInfoBoxType) { const { resource, authInfo } = useResourceContext(); const t = useTranslations(); const fullUrl = `${resource.ssl ? "https" : "http"}://${toUnicode(resource.fullDomain || "")}`; const showCertificate = !!( ["http", "ssh", "rdp", "vnc"].includes(resource.mode) && resource.domainId && resource.fullDomain && build != "oss" ); const showType = !!( ["http", "ssh", "rdp", "vnc"].includes(resource.mode) && resource.mode ); const showHealth = !["ssh", "rdp", "vnc"].includes(resource.mode || "") && !!resource.health && resource.health !== "unknown"; const showVisibility = !resource.enabled; const numSections = [ true, // URL or Protocol true, // Authentication or Port showType, showCertificate, showHealth, showVisibility ].filter(Boolean).length; return ( {/* {t("identifier")} {resource.niceId} */} {["http", "ssh", "rdp", "vnc"].includes(resource.mode) ? ( <> URL {resource.wildcard ? ( {fullUrl} ) : ( )} {showType && ( {t("type")} {resource.mode == "http" ? resource.ssl ? "HTTPS" : "HTTP" : resource.mode?.toUpperCase()} )} {t("authentication")} {authInfo.password || authInfo.pincode || authInfo.sso || authInfo.whitelist || authInfo.headerAuth ? (
{t("protected")}
) : (
{t("notProtected")}
)}
) : ( <> {t("protocol")} {resource.mode?.toUpperCase()} {t("port")} {/* {build == "oss" && ( {t("externalProxyEnabled")} {resource.enableProxy ? t("enabled") : t("disabled")} )} */} )} {/* */} {/* {t('visibility')} */} {/* */} {/* */} {/* {resource.enabled ? t('enabled') : t('disabled')} */} {/* */} {/* */} {/* */} {/* Certificate Status Column */} {showCertificate && ( {t("certificateStatus", { defaultValue: "Certificate" })} )} {showHealth && ( {t("health")} {resource.health === "healthy" && (
{t("resourcesTableHealthy")}
)} {resource.health === "degraded" && (
{t("resourcesTableDegraded")}
)} {resource.health === "unhealthy" && (
{t("resourcesTableUnhealthy")}
)}
)} {showVisibility && ( {t("visibility")}
{t("disabled")}
)}
); }