fix: 调整数据库自动清理设置文案

This commit is contained in:
ryan
2026-07-12 19:07:56 +08:00
parent 69467914fc
commit 83f126795d
2 changed files with 22 additions and 12 deletions
+1
View File
@@ -29,6 +29,7 @@ sidebar: false
### 修改 ### 修改
- 调整数据库自动清理设置文案,明确自动清理按 ClickHouse 表 TTL 执行,并提示访问日志 90 天、其它观测数据 30 天的保留下限。
- 重构并清理了分析仓统计层 `node_access_log_stats.go` 和 `openflare_access_log.go` 之间的重复模型,使用底层 type aliases 简化了类型转换和拷贝逻辑。 - 重构并清理了分析仓统计层 `node_access_log_stats.go` 和 `openflare_access_log.go` 之间的重复模型,使用底层 type aliases 简化了类型转换和拷贝逻辑。
- 配置快照、OpenResty 渲染、Tunnel 与 Uptime Kuma 监控改为从 Zone 域名绑定读取域名 and 证书,移除对反代路由旧域名/证书字段的运行时回退。 - 配置快照、OpenResty 渲染、Tunnel 与 Uptime Kuma 监控改为从 Zone 域名绑定读取域名 and 证书,移除对反代路由旧域名/证书字段的运行时回退。
- 管理端网站入口改为 Zone 列表与 `/websites/:zoneId` 详情(概览 / 域名 / 路由 / 证书 / 设置),反代路由通过 Zone 域名选择器绑定。 - 管理端网站入口改为 Zone 列表与 `/websites/:zoneId` 详情(概览 / 域名 / 路由 / 证书 / 设置),反代路由通过 Zone 域名选择器绑定。
@@ -53,17 +53,17 @@ const cleanupTargets: Array<{
{ {
target: "node_access_logs", target: "node_access_logs",
label: "访问日志", label: "访问日志",
description: "清理 node_access_logs,影响访问明细与 IP 汇总。", description: "清理 node_access_logs,影响访问明细与 IP 汇总;表 TTL 为 90 天。",
}, },
{ {
target: "node_metric_snapshots", target: "node_metric_snapshots",
label: "性能快照", label: "性能快照",
description: "清理 node_metric_snapshots,影响节点资源趋势。", description: "清理 node_metric_snapshots,影响节点资源趋势;表 TTL 为 30 天。",
}, },
{ {
target: "node_request_reports", target: "node_request_reports",
label: "请求聚合", label: "请求聚合",
description: "清理 node_request_reports,影响请求量与错误量统计。", description: "清理 node_request_reports,影响请求量与错误量统计;表 TTL 为 30 天。",
}, },
] ]
@@ -540,7 +540,9 @@ export function OpenFlareOpsSettings() {
<CardHeader className="flex flex-row items-center justify-between gap-4"> <CardHeader className="flex flex-row items-center justify-between gap-4">
<div> <div>
<CardTitle className="text-base">数据库自动清理</CardTitle> <CardTitle className="text-base">数据库自动清理</CardTitle>
<CardDescription>每天凌晨 3 点清理超出保留期的观测数据。</CardDescription> <CardDescription>
每天凌晨 3 点物化 ClickHouse 表 TTL;访问日志至少保留 90 天,其它观测数据至少保留 30 天。
</CardDescription>
</div> </div>
<Button <Button
size="sm" size="sm"
@@ -556,19 +558,26 @@ export function OpenFlareOpsSettings() {
checked={fields.database_auto_cleanup_enabled} checked={fields.database_auto_cleanup_enabled}
onChange={(value) => updateField("database_auto_cleanup_enabled", value)} onChange={(value) => updateField("database_auto_cleanup_enabled", value)}
/> />
<FieldInput <div className="space-y-1.5">
label="保留天数" <FieldInput
value={fields.database_auto_cleanup_retention_days} label="期望保留天数"
type="number" value={fields.database_auto_cleanup_retention_days}
onChange={(value) => updateField("database_auto_cleanup_retention_days", value)} type="number"
/> onChange={(value) => updateField("database_auto_cleanup_retention_days", value)}
/>
<p className="text-xs text-muted-foreground">
小于表 TTL 时自动按下限执行:访问日志 90 天,其它观测数据 30 天。
</p>
</div>
</CardContent> </CardContent>
</Card> </Card>
<Card className="border-dashed shadow-none"> <Card className="border-dashed shadow-none">
<CardHeader> <CardHeader>
<CardTitle className="text-base">手动数据清理</CardTitle> <CardTitle className="text-base">手动数据清理</CardTitle>
<CardDescription>保留天数留空时将删除该类数据的全部历史记录。</CardDescription> <CardDescription>
按表 TTL 清理;输入天数不能小于对应表 TTL,留空时将删除该类数据的全部历史记录。
</CardDescription>
</CardHeader> </CardHeader>
<CardContent className="space-y-3"> <CardContent className="space-y-3">
{cleanupTargets.map((item) => ( {cleanupTargets.map((item) => (
@@ -617,7 +626,7 @@ export function OpenFlareOpsSettings() {
<AlertDialogHeader> <AlertDialogHeader>
<AlertDialogTitle>清理{cleanupTarget?.label}</AlertDialogTitle> <AlertDialogTitle>清理{cleanupTarget?.label}</AlertDialogTitle>
<AlertDialogDescription> <AlertDialogDescription>
输入保留天数后仅删除超出范围的数据;留空则删除全部历史记录,操作不可恢复。 输入保留天数后会按该表 TTL 物化过期数据;小于表 TTL 的天数会被拒绝。留空则删除全部历史记录,操作不可恢复。
</AlertDialogDescription> </AlertDialogDescription>
</AlertDialogHeader> </AlertDialogHeader>
<FieldInput <FieldInput