feat(audit): F1+F2 告警静默规则标记完成 + 审计日志CSV导出实现

F1 告警静默规则 [done]:
- 后端 alert_silence.go: CRUD + Toggle (onetime/daily/weekly 三模式)
- 告警引擎 isSilenced 集成 (alert_engine.go)
- 前端 SilenceRuleTab + SilenceDialog
- 路由 /alerts/silences 已注册

F2 审计日志导出 [done]:
- 重写 ExportAuditLogs: 真正的 CSV 导出 (encoding/csv + UTF-8 BOM)
- 支持 module/action/username/startTime/endTime 筛选
- 导出限制 10000 条防溢出,自动记录审计日志
- JSON 格式向后兼容 (format=json)
- 前端 exportLogs 传递查询参数

同时包含累积的前期工作:
- 目录重构 internal/ -> controller/model/router (v0.55-v0.57)
- 后端分层架构 dto/repository/service/utils
- 审计模块全功能 (终端审计/操作审计/登录日志)
- asciicast v2 录制格式
- SFTP 文件浏览器
- StatStrip 紧凑统计条
- 在线会话自动刷新
- LiveMonitor WebSocket 诊断修复

验证: go build ✅ | npm run build ✅ | Docker 部署 ✅ | 10 回归端点 ✅ | CSV 导出 ✅ | 静默 CRUD ✅
This commit is contained in:
attacker committed 2026-06-25 20:16:30 +08:00
1 parent e57718998a
commit 77c234b060
314 files changed
+10050 -4065

No files matched your search

@@ -172,62 +172,6 @@ export function CloudAccountManager() {
</div>
</div>
{/* Stats */}
<div className="grid grid-cols-4 gap-4">
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">账号总数</p>
<p className="text-2xl font-bold text-slate-100 mt-1">{stats.total}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center">
<Cloud className="h-5 w-5 text-blue-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">正常</p>
<p className="text-2xl font-bold text-green-400 mt-1">{stats.active}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-green-500/20 flex items-center justify-center">
<CheckCircle2 className="h-5 w-5 text-green-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">已停用</p>
<p className="text-2xl font-bold text-slate-400 mt-1">{stats.inactive}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-slate-500/20 flex items-center justify-center">
<XCircle className="h-5 w-5 text-slate-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">异常</p>
<p className="text-2xl font-bold text-red-400 mt-1">{stats.error}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-red-500/20 flex items-center justify-center">
<Key className="h-5 w-5 text-red-400" />
</div>
</div>
</CardContent>
</Card>
</div>
{/* Filters */}
<div className="flex items-center gap-4">
<div className="relative flex-1 max-w-md">
+9 -25
View File
@@ -28,6 +28,7 @@ import { toast } from 'sonner';
import { useConfirm } from '@/components/ui/confirm-dialog';
import { billingApi } from '@/services/api';
import { formatCurrency, StatCard, TrendChart, providerLabels, providerColors } from './CloudBillingHelpers';
import { StatStrip } from '@/components/ui/stat-strip';
import { BillingRecordDialog } from './BillingRecordDialog';
import { BillingRuleDialog } from './BillingRuleDialog';
@@ -208,31 +209,14 @@ export function CloudBilling() {
<div className="flex items-center justify-center py-20 text-slate-500"><Loader2 className="h-6 w-6 animate-spin mr-2" />加载中...</div>
) : stats ? (
<>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3">
<StatCard
icon={<Wallet className="h-5 w-5" />}
label="今日成本"
value={formatCurrency(stats.today_cost || 0)}
trend={stats.today_cost - (stats.yesterday_cost || 0)}
trendLabel={`昨日 ${formatCurrency(stats.yesterday_cost || 0)}`}
/>
<StatCard
icon={<CalendarDays className="h-5 w-5" />}
label="本月成本"
value={formatCurrency(stats.month_cost || 0)}
/>
<StatCard
icon={<TrendingUp className="h-5 w-5" />}
label="年度成本"
value={formatCurrency(stats.year_cost || 0)}
/>
<StatCard
icon={<AlertTriangle className="h-5 w-5" />}
label="活跃预警"
value={`${stats.alerts?.length || 0} 条`}
alert={stats.alerts?.length > 0}
/>
</div>
<StatStrip
items={[
{ label: '今日', value: formatCurrency(stats.today_cost || 0), color: 'blue' },
{ label: '本月', value: formatCurrency(stats.month_cost || 0), color: 'amber' },
{ label: '年度', value: formatCurrency(stats.year_cost || 0), color: 'purple' },
{ label: '预警', value: `${stats.alerts?.length || 0} 条`, color: stats.alerts?.length > 0 ? 'red' : 'muted' },
]}
/>
{stats.alerts?.length > 0 && (
<div className="rounded-lg border border-amber-500/30 bg-amber-500/5 p-4">
@@ -178,75 +178,6 @@ export function DomainManager() {
</div>
</div>
{/* Stats */}
<div className="grid grid-cols-5 gap-4">
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">域名总数</p>
<p className="text-2xl font-bold text-slate-100 mt-1">{stats.total}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center">
<Globe className="h-5 w-5 text-blue-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">正常</p>
<p className="text-2xl font-bold text-green-400 mt-1">{stats.active}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-green-500/20 flex items-center justify-center">
<CheckCircle2 className="h-5 w-5 text-green-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">已过期</p>
<p className="text-2xl font-bold text-red-400 mt-1">{stats.expired}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-red-500/20 flex items-center justify-center">
<XCircle className="h-5 w-5 text-red-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">待审核</p>
<p className="text-2xl font-bold text-yellow-400 mt-1">{stats.pending}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center">
<Clock className="h-5 w-5 text-yellow-400" />
</div>
</div>
</CardContent>
</Card>
<Card className="bg-slate-800 border-slate-700">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div>
<p className="text-slate-400 text-sm">SSL证书</p>
<p className="text-2xl font-bold text-cyan-400 mt-1">{stats.sslEnabled}</p>
</div>
<div className="w-10 h-10 rounded-lg bg-cyan-500/20 flex items-center justify-center">
<CheckCircle2 className="h-5 w-5 text-cyan-400" />
</div>
</div>
</CardContent>
</Card>
</div>
{/* Filters */}
<div className="flex items-center gap-4">
<div className="relative flex-1 max-w-md">