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

@@ -0,0 +1 @@
import{g as X,r as o,j as e,B as x,O as v,x as O,S as q,I as i,D as J,b as K,c as V,d as W,e as Y,f as Z,L as ee}from"./index-DfyorCky.js";import{L as m}from"./label-BK0h2apY.js";import{C as r,a as l}from"./card-C55cvSHg.js";import{B as D}from"./badge-xNW8x0G1.js";import{c as j}from"./cloud-Dzoer-2i.js";import{R as P}from"./refresh-cw-DUB_tAG-.js";import{P as I}from"./plus-CUG-9kpu.js";import{C as M}from"./circle-check-DWcXrx2k.js";import{C as B}from"./circle-x-DK79Dhg2.js";import{T as se}from"./trash-2-Dx32pOzT.js";const ae=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],F=X("pen",ae);function xe(){const[p,f]=o.useState([]),[y,_]=o.useState(!0),[N,T]=o.useState(""),[b,z]=o.useState("all"),[R,h]=o.useState(!1),[w,C]=o.useState(!1),[d,S]=o.useState(null),[a,t]=o.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),$=()=>{S(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},Q=()=>{$(),h(!0)},U=s=>{S(s);const c=n=>n?n.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),h(!0)},A=async()=>{if(a.name.trim())try{C(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};d?await j.updateDomain(d.id,s):await j.createDomain(s),h(!1),g()}catch(s){console.error(d?"更新域名失败:":"创建域名失败:",s)}finally{C(!1)}},g=async()=>{try{_(!0);const s=await j.getDomains();f(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),f([])}finally{_(!1)}};o.useEffect(()=>{g()},[]);const G=async s=>{try{await j.deleteDomain(s),g()}catch(c){console.error("删除域名失败:",c)}},L=p.filter(s=>{const c=(s.name||"").toLowerCase().includes(N.toLowerCase())||(s.registrar||"").toLowerCase().includes(N.toLowerCase()),n=b==="all"||s.status===b;return c&&n}),u={total:p.length,active:p.filter(s=>s.status==="active").length,expired:p.filter(s=>s.status==="expired").length,pending:p.filter(s=>s.status==="pending").length,sslEnabled:p.filter(s=>s.ssl_enabled||s.sslEnabled).length},H=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(x,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:g,className:"border-slate-700 text-slate-300",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${y?"animate-spin":""}`}),"刷新"]}),e.jsxs(x,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:Q,children:[e.jsx(I,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"grid grid-cols-5 gap-4",children:[e.jsx(r,{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"bg-slate-800 border-slate-700",children:e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:185:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:186:15",children:[e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:187:17",className:"text-slate-400 text-sm",children:"域名总数"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:188:17",className:"text-2xl font-bold text-slate-100 mt-1",children:u.total})]}),e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:190:15",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(v,{"code-path":"src/components/cloud/DomainManLine truncated