"use client" import {Loader2} from "lucide-react" import {Badge} from "@/components/ui/badge" import {Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle,} from "@/components/ui/dialog" import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow,} from "@/components/ui/table" import type {ConfigDiffResult} from "@/lib/services/openflare" interface DiffDialogProps { open: boolean onOpenChange: (open: boolean) => void diff: ConfigDiffResult | null loading: boolean error: string | null } function DiffChipList({ title, items }: { title: string; items: string[] }) { return (

{title}

{items.length} 项
{items.length > 0 ? (
{items.map((item) => ( {item} ))}
) : (

无变更

)}
) } function renderOptionValue(value: string) { return value === "" ? "空" : value } export function DiffDialog({ open, onOpenChange, diff, loading, error, }: DiffDialogProps) { return ( 配置差异 对比当前待发布配置与已激活版本之间的差异。 {loading ? (
正在加载差异数据...
) : error ? (

{error}

) : diff ? (

激活版本

{diff.active_version || "无"}

新增域名

{diff.added_domains.length}

删除域名

{diff.removed_domains.length}

修改域名

{diff.modified_domains.length}

主配置 {diff.main_config_changed ? "已变化" : "无变化"} WAF {diff.waf_config_changed ? "已变化" : "无变化"} 网站数 {diff.active_website_count} → {diff.current_website_count}
{diff.changed_option_details.length > 0 ? (
参数 激活值 待发布值 {diff.changed_option_details.map((item) => ( {item.key} {renderOptionValue(item.previous_value)} {renderOptionValue(item.current_value)} ))}
) : (

当前无 OpenResty 参数变化。

)}
) : null}
) }