Resolve ui quirks, add link

This commit is contained in:
Owen Schwartz 2025-01-12 15:58:07 -05:00
parent 161e87dbda
commit 3f55103542
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
3 changed files with 88 additions and 61 deletions

View file

@ -200,8 +200,14 @@ export default function CreateSiteForm({
name: data.name, name: data.name,
id: data.siteId, id: data.siteId,
nice: data.niceId.toString(), nice: data.niceId.toString(),
mbIn: data.type == "wireguard" || data.type == "newt" ? "0 MB" : "--", mbIn:
mbOut: data.type == "wireguard" || data.type == "newt" ? "0 MB" : "--", data.type == "wireguard" || data.type == "newt"
? "0 MB"
: "--",
mbOut:
data.type == "wireguard" || data.type == "newt"
? "0 MB"
: "--",
orgId: orgId as string, orgId: orgId as string,
type: data.type as any, type: data.type as any,
online: false online: false
@ -331,8 +337,6 @@ PersistentKeepalive = 5`
</div> </div>
{form.watch("method") === "newt" && ( {form.watch("method") === "newt" && (
<>
<br />
<Link <Link
className="text-sm text-primary flex items-center gap-1" className="text-sm text-primary flex items-center gap-1"
href="https://docs.fossorial.io/Newt/install" href="https://docs.fossorial.io/Newt/install"
@ -345,17 +349,21 @@ PersistentKeepalive = 5`
</span> </span>
<SquareArrowOutUpRight size={14} /> <SquareArrowOutUpRight size={14} />
</Link> </Link>
</>
)} )}
{form.watch("method") === "local" && ( {form.watch("method") === "local" && (
<> <Link
<br /> className="text-sm text-primary flex items-center gap-1"
<p> href="https://docs.fossorial.io/Pangolin/without-tunneling"
Data will leave Traefik and go wherever you target="_blank"
want; no tunneling involved. rel="noopener noreferrer"
</p> >
</> <span>
{" "}
Local sites do not tunnel, learn more
</span>
<SquareArrowOutUpRight size={14} />
</Link>
)} )}
{(form.watch("method") === "newt" || {(form.watch("method") === "newt" ||

View file

@ -23,7 +23,7 @@ import { useState } from "react";
import CreateSiteForm from "./CreateSiteForm"; import CreateSiteForm from "./CreateSiteForm";
import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog"; import ConfirmDeleteDialog from "@app/components/ConfirmDeleteDialog";
import { useToast } from "@app/hooks/useToast"; import { useToast } from "@app/hooks/useToast";
import { formatAxiosError } from "@app/lib/api";; import { formatAxiosError } from "@app/lib/api";
import { createApiClient } from "@app/lib/api"; import { createApiClient } from "@app/lib/api";
import { useEnvContext } from "@app/hooks/useEnvContext"; import { useEnvContext } from "@app/hooks/useEnvContext";
import CreateSiteFormModal from "./CreateSiteModal"; import CreateSiteFormModal from "./CreateSiteModal";
@ -146,7 +146,10 @@ export default function SitesTable({ sites, orgId }: SitesTableProps) {
}, },
cell: ({ row }) => { cell: ({ row }) => {
const originalRow = row.original; const originalRow = row.original;
if (
originalRow.type == "newt" ||
originalRow.type == "wireguard"
) {
if (originalRow.online) { if (originalRow.online) {
return ( return (
<span className="text-green-500 flex items-center space-x-2"> <span className="text-green-500 flex items-center space-x-2">
@ -162,6 +165,9 @@ export default function SitesTable({ sites, orgId }: SitesTableProps) {
</span> </span>
); );
} }
} else {
return <span>--</span>;
}
} }
}, },
{ {

View file

@ -16,12 +16,26 @@ type SiteInfoCardProps = {};
export default function SiteInfoCard({}: SiteInfoCardProps) { export default function SiteInfoCard({}: SiteInfoCardProps) {
const { site, updateSite } = useSiteContext(); const { site, updateSite } = useSiteContext();
const getConnectionTypeString = (type: string) => {
if (type === "newt") {
return "Newt";
} else if (type === "wireguard") {
return "WireGuard";
} else if (type === "local") {
return "Local";
} else {
return "Unknown";
}
};
return ( return (
<Alert> <Alert>
<InfoIcon className="h-4 w-4" /> <InfoIcon className="h-4 w-4" />
<AlertTitle className="font-semibold">Site Information</AlertTitle> <AlertTitle className="font-semibold">Site Information</AlertTitle>
<AlertDescription className="mt-4"> <AlertDescription className="mt-4">
<InfoSections> <InfoSections>
{(site.type == "newt" || site.type == "wireguard") && (
<>
<InfoSection> <InfoSection>
<InfoSectionTitle>Status</InfoSectionTitle> <InfoSectionTitle>Status</InfoSectionTitle>
<InfoSectionContent> <InfoSectionContent>
@ -38,15 +52,14 @@ export default function SiteInfoCard({}: SiteInfoCardProps) {
)} )}
</InfoSectionContent> </InfoSectionContent>
</InfoSection> </InfoSection>
<Separator orientation="vertical" /> <Separator orientation="vertical" />
</>
)}
<InfoSection> <InfoSection>
<InfoSectionTitle>Connection Type</InfoSectionTitle> <InfoSectionTitle>Connection Type</InfoSectionTitle>
<InfoSectionContent> <InfoSectionContent>
{site.type === "newt" {getConnectionTypeString(site.type)}
? "Newt"
: site.type === "wireguard"
? "WireGuard"
: "Unknown"}
</InfoSectionContent> </InfoSectionContent>
</InfoSection> </InfoSection>
</InfoSections> </InfoSections>