From 8bddf00ef458476e7ecc75c60f07104110f17953 Mon Sep 17 00:00:00 2001 From: alphaeusmote <41258468-alphaeusmote@users.noreply.replit.com> Date: Thu, 10 Apr 2025 00:17:00 +0000 Subject: [PATCH] Enhance DNS record management by adding auto IP detection, notes field, and improved UI. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9111ef36-26c8-4085-84ca-a35dc1fec1b5 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7083d608-d6d3-4a6a-9a27-6286c5109627/e33594f7-ad24-43f5-a4e1-0d9d2f261947.jpg --- client/src/components/layouts/sidebar.tsx | 5 + client/src/components/shared/back-button.tsx | 35 +++++ client/src/pages/dns-records.tsx | 153 ++++++++++++++++--- server/storage.ts | 42 ++++- shared/schema.ts | 4 + 5 files changed, 214 insertions(+), 25 deletions(-) create mode 100644 client/src/components/shared/back-button.tsx diff --git a/client/src/components/layouts/sidebar.tsx b/client/src/components/layouts/sidebar.tsx index 8c0bb49..4a07659 100644 --- a/client/src/components/layouts/sidebar.tsx +++ b/client/src/components/layouts/sidebar.tsx @@ -28,6 +28,11 @@ export function Sidebar() { href: "/", icon: , }, + { + title: "Organizations", + href: "/organizations", + icon: , + }, { title: "Domains", href: "/domains", diff --git a/client/src/components/shared/back-button.tsx b/client/src/components/shared/back-button.tsx new file mode 100644 index 0000000..3557f97 --- /dev/null +++ b/client/src/components/shared/back-button.tsx @@ -0,0 +1,35 @@ +import { Button } from "@/components/ui/button"; +import { ChevronLeft } from "lucide-react"; +import { useLocation } from "wouter"; + +interface BackButtonProps { + to?: string; + fallbackPath?: string; + className?: string; +} + +export function BackButton({ to, fallbackPath = "/", className = "" }: BackButtonProps) { + const [_, setLocation] = useLocation(); + + const handleBack = () => { + if (to) { + setLocation(to); + } else if (window.history.length > 2) { + window.history.back(); + } else { + setLocation(fallbackPath); + } + }; + + return ( + + ); +} \ No newline at end of file diff --git a/client/src/pages/dns-records.tsx b/client/src/pages/dns-records.tsx index b041e14..9cd903c 100644 --- a/client/src/pages/dns-records.tsx +++ b/client/src/pages/dns-records.tsx @@ -54,10 +54,16 @@ import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger +} from "@/components/ui/tooltip"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbSeparator } from "@/components/ui/breadcrumb"; import { RecentActivity } from "@/components/activity/recent-activity"; import { Pagination } from "@/components/shared/pagination"; -import { Loader2, Home, Plus, Pencil, Trash2, ArrowLeft } from "lucide-react"; +import { Loader2, Home, Plus, Pencil, Trash2, ArrowLeft, FileText } from "lucide-react"; import { formatDistanceToNow } from "date-fns"; import { Link } from "wouter"; @@ -69,6 +75,8 @@ const dnsRecordSchema = z.object({ ttl: z.number().int().min(1).default(3600), proxied: z.boolean().default(false), isActive: z.boolean().default(true), + isAutoIP: z.boolean().default(false), + notes: z.string().optional(), }); export default function DnsRecordsPage() { @@ -113,6 +121,8 @@ export default function DnsRecordsPage() { ttl: 3600, proxied: false, isActive: true, + isAutoIP: false, + notes: "", }, }); @@ -123,9 +133,11 @@ export default function DnsRecordsPage() { name: selectedRecord.name, type: selectedRecord.type as any, content: selectedRecord.content, - ttl: selectedRecord.ttl, - proxied: selectedRecord.proxied, + ttl: selectedRecord.ttl ?? 3600, + proxied: selectedRecord.proxied ?? false, isActive: selectedRecord.isActive, + isAutoIP: selectedRecord.isAutoIP ?? false, + notes: selectedRecord.notes ?? "", }); } else { form.reset({ @@ -135,6 +147,8 @@ export default function DnsRecordsPage() { ttl: 3600, proxied: false, isActive: true, + isAutoIP: false, + notes: "", }); } }, [selectedRecord, form]); @@ -289,7 +303,7 @@ export default function DnsRecordsPage() { - {domain?.name || 'Loading...'} + {domain?.name || 'Loading...'} @@ -345,6 +359,11 @@ export default function DnsRecordsPage() { {record.name} {record.type} + {record.isAutoIP && (record.type === 'A' || record.type === 'AAAA') && ( + + Auto IP + + )} {record.content.length > 30 @@ -369,21 +388,37 @@ export default function DnsRecordsPage() { : "Never"} - - +
+ {record.notes && ( + + + + + + +

{record.notes}

+
+
+
+ )} + + +
))} @@ -559,6 +594,46 @@ export default function DnsRecordsPage() { )} /> + {(form.watch("type") === "A" || form.watch("type") === "AAAA") && ( + ( + +
+ Auto IP Address + + Automatically determine IP address using STUN + +
+ + + +
+ )} + /> + )} + + ( + + Notes + + + + + Add any additional information about this record + + + + )} + /> +