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{r,j as e,A as ge,$ as z,x as H,S as Te,I as ue,B as y,U as je,K as Me,D as K,b as Q,c as U,d as Z,a0 as Ne,e as G,a1 as w,a2 as fe,a3 as ve,a4 as ye,n as we,q as be}from"./index-DfyorCky.js";import{B as N}from"./badge-xNW8x0G1.js";import{C as p,a as x,b,c as S}from"./card-C55cvSHg.js";import{S as C,a as D,b as I,c as L,d as n}from"./select-D5qUzdAs.js";import{T as Se,a as Ce,b as R,c as A}from"./tabs-CIh_yD4s.js";import{L as s}from"./label-BK0h2apY.js";import{t as B}from"./index-a3ybMjbR.js";import{t as F}from"./monitor-BAaBXIsC.js";import{L as De}from"./layers-FW4KKJMi.js";import{R as Ie}from"./refresh-cw-DUB_tAG-.js";import{T as Le}from"./trending-up-CdusV6gc.js";import{C as Re}from"./circle-x-DK79Dhg2.js";import{C as Ae}from"./code-L62jFLTC.js";import{B as Be}from"./box-TTGA1p57.js";import{Z as Fe}from"./zap-D2uWSK32.js";import{A as Oe}from"./arrow-right-DyIltvNZ.js";import"./index-CWVNW_qu.js";const _e=()=>{const[O,J]=r.useState([]),[l,X]=r.useState([]),[W,k]=r.useState(!1),[f,Y]=r.useState(""),[g,_]=r.useState("all"),[T,ee]=r.useState("all"),[u,ae]=r.useState("1h"),[te,re]=r.useState("traces"),[m,ce]=r.useState(null),[o,se]=r.useState(null),[oe,E]=r.useState(!1),[ne,$]=r.useState(!1);r.useEffect(()=>{me()},[u]);const me=async()=>{await Promise.all([P(),de()])},P=async()=>{k(!0);try{const a=await F.getTraces({timeRange:u,service:g,status:T});J(a.data||[])}catch{B.error("获取链路数据失败")}finally{k(!1)}},de=async()=>{try{const a=await F.getServices(u);X(a.data||[])}catch{B.error("获取服务数据失败")}},ie=async a=>{try{return(await F.getTraceDetail(a)).data}catch{return B.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:140:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:140:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:142:16",variant:"destructive",className:"gap-1",children:[e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:142:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:144:16",variant:"outline",className:"gap-1",children:[e.jsx(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:144:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:146:16",variant:"secondary",children:"未知"})}},pe=a=>{switch(a){case"client":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"server":return e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});case"consumer":return e.jsx(Be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:31",className:"w-4 h-4"});default:return e.jsx(Ae,{"code-path":"src/components/monitor/trace/TraceManager.tsx:156:23",className:"w-4 h-4"})}},xe=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=O.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=g==="all"||a.serviceName===g,c=T==="all"||a.status===T;return t&&i&&c}),le=Array.from(new Set(O.map(a=>a.serviceName))),he=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const j=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const h=t.get(c.parentSpanId);h.children=h.children||[],h.children.push(j)}else i.push(j)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,j]=r.useState(!0),h=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:216:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{se(a),$(!0)},children:[a.children?.length>0&&e.jsx(y,{"code-path":"src/components/monitor/trace/TraceManager.tsx:222:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:M=>{M.stopPropagation(),j(!c)},children:c?e.jsx(ye,{"code-path":"src/components/monitor/trace/TraceManager.tsx:228:27",className:"w-3 h-3"}):e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:228:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:231:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/compoLine truncated