mirror of
https://github.com/freedbygrace/DynamoDNS.git
synced 2026-07-27 03:48:56 +00:00
Checkpoint
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/24e018cf-bcea-47d6-ad75-1ad9ac058ac9.jpg
This commit is contained in:
@@ -44,30 +44,35 @@ export function DomainTable({ onManageDomain, onDeleteDomain, onAddDomain }: Dom
|
||||
});
|
||||
|
||||
const getProviderName = (providerId: string | null | undefined) => {
|
||||
// Special debugging logs
|
||||
console.log("Provider ID:", providerId);
|
||||
console.log("Available providers:", providers);
|
||||
|
||||
if (!providerId) return "None";
|
||||
// Handle completely empty providerId cases
|
||||
if (!providerId || providerId === "") {
|
||||
return "None";
|
||||
}
|
||||
|
||||
// Check if the provider exists in our providers list
|
||||
// The providerId from the database will be a string UUID
|
||||
const provider = providers.find(p => p.id === providerId);
|
||||
|
||||
if (provider) {
|
||||
console.log("Found provider:", provider);
|
||||
return provider.name;
|
||||
} else {
|
||||
console.log("Provider not found for ID:", providerId);
|
||||
return "Unknown";
|
||||
// If we have a providerId but can't find the provider (might be deleted)
|
||||
return "Unknown Provider";
|
||||
}
|
||||
};
|
||||
|
||||
const getProviderIcon = (providerId: string | null | undefined) => {
|
||||
if (!providerId) return <CircleHelp className="mr-2 text-primary" size={16} />;
|
||||
// Handle completely empty providerId cases
|
||||
if (!providerId || providerId === "") {
|
||||
return <CircleHelp className="mr-2 text-muted-foreground" size={16} />;
|
||||
}
|
||||
|
||||
// The providerId from the database will be a string UUID
|
||||
const provider = providers.find(p => p.id === providerId);
|
||||
|
||||
if (!provider) return <CircleHelp className="mr-2 text-primary" size={16} />;
|
||||
if (!provider) {
|
||||
return <CircleHelp className="mr-2 text-warning" size={16} />;
|
||||
}
|
||||
|
||||
switch (provider.type) {
|
||||
case "cloudflare":
|
||||
|
||||
@@ -46,9 +46,14 @@ import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Loader2 } from "lucide-react";
|
||||
|
||||
// Domain name regex
|
||||
const domainRegex = /^((?!-)[A-Za-z0-9-]{1,63}(?<!-)\.)+[A-Za-z]{2,}$/;
|
||||
|
||||
// Domain form schema
|
||||
const domainFormSchema = z.object({
|
||||
name: z.string().min(3, "Domain name must be at least 3 characters"),
|
||||
name: z.string()
|
||||
.min(3, "Domain name must be at least 3 characters")
|
||||
.regex(domainRegex, "Please enter a valid domain name (e.g., example.com)"),
|
||||
providerId: z.string().uuid().optional(),
|
||||
isActive: z.boolean().default(true),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user