Files
aiops/backend/static/assets/AIPredictiveAnalytics-Dr8sfqna.js
T
attacker 77c234b060 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 ✅
2026-06-25 20:16:30 +08:00

2 lines
32 KiB
JavaScript

import{g as J,j as e,L as D,G as q,r as g,aJ as Q,B as ee,A as se,a3 as te,T as _,K as ce,o as ae,N as ie}from"./index-DfyorCky.js";import{C as w,b as K,c as H,a as C}from"./card-C55cvSHg.js";import{B as X}from"./badge-xNW8x0G1.js";import{T as ne,a as oe,b as F,c as B}from"./tabs-CIh_yD4s.js";import{S as re,a as le,b as de,c as pe,d as U}from"./select-D5qUzdAs.js";import{d as me}from"./dashboard-BjQPIG2G.js";import{s as xe}from"./server-CjDPBaTN.js";import{a as W}from"./monitor-BAaBXIsC.js";import{H as z}from"./hard-drive-BbPmnARR.js";import{Z as Y}from"./zap-D2uWSK32.js";import{S as G}from"./sparkles-Bld4NX5y.js";import{T as O}from"./trending-up-CdusV6gc.js";import{M as he}from"./memory-stick-QMV-0CnU.js";import{M as Ae}from"./minus-UVrx3jLc.js";import{T as ye}from"./trending-down-BGTWG_dA.js";import"./index-CWVNW_qu.js";const ve=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ue=J("calendar",ve);const je=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],be=J("chart-line",je);function Pe({forecasts:a,loading:i}){return e.jsxs(w,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(H,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(C,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(D,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:a.map((c,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(q,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:c.resource})]}),e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:c.daysUntilThreshold<=7?"紧急":c.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:c.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[c.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${c.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,c.predictedUsage-c.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",className:"text-slate-500",children:["当前 ",c.currentUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:86:21",className:"text-amber-400",children:["预测 ",c.predictedUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:87:21",className:"text-red-400",children:["阈值 ",c.threshold,"%"]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:91:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:92:19",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:93:21",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:94:21",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:95:23",className:"text-sm text-slate-400",children:"AI建议:"}),e.jsx("p",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:96:23",className:"text-sm text-slate-300 mt-1",children:c.recommendation})]})]})})]},p))})})]})}const M=[{key:"cpu",label:"CPU使用率",exprKey:"cpu_usage",threshold:85},{key:"memory",label:"内存使用率",exprKey:"memory_usage",threshold:85},{key:"disk",label:"磁盘使用率",exprKey:"disk_usage",threshold:90}],Ne={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},ge={"1h":1,"24h":24,"7d":168,"30d":720};function E(a){const i=a.length;if(i<2)return{slope:0,r2:0};const c=a.map((o,h)=>h),p=c.reduce((o,h)=>o+h,0)/i,A=a.reduce((o,h)=>o+h,0)/i;let j=0,b=0,I=0,T=0;for(let o=0;o<i;o++)j+=(c[o]-p)*(a[o]-A),b+=(c[o]-p)**2,I+=(a[o]-A)**2;const P=b===0?0:j/b,f=A-P*p;for(let o=0;o<i;o++){const h=f+P*c[o];T+=(a[o]-h)**2}const k=I===0?1:Math.max(0,1-T/I);return{slope:P,r2:k}}function $(a,i){return a.filter(c=>c.name===i).sort((c,p)=>new Date(c.timestamp).getTime()-new Date(p.timestamp).getTime()).map(c=>Number(c.value)||0)}function Ie(a){const i=a.match(/[><=]\s*([\d.]+)/);return i?parseFloat(i[1]):null}function fe(a,i){const c=i<=7?"urgent":i<=14?"warning":"normal";return{urgent:{cpu:"CPU增长趋势明显,建议尽快扩容计算资源或优化高负载进程",memory:"内存增长趋势明显,建议增加内存或排查内存泄漏",disk:"磁盘空间即将耗尽,建议立即扩容或清理历史数据与日志"},warning:{cpu:"CPU使用率呈上升趋势,建议持续监控并准备扩容计划",memory:"内存使用率呈上升趋势,建议优化应用内存使用",disk:"磁盘使用率持续增长,建议规划数据归档和清理策略"},normal:{cpu:"CPU使用正常,建议持续监控",memory:"内存使用正常,建议持续监控",disk:"磁盘空间充足,建议持续监控"}}[c]?.[a]||"建议持续监控资源使用趋势"}function V(a){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[a]||"建议检查相关服务状态并持续监控"}function we(a){const{rawMetrics:i,serverStats:c,alertEvents:p,alertRules:A,selectedTimeRange:j}=a,b=ge[j]||24,I=Ne[j]||"24小时后",T=M.map(t=>{const n=$(i,t.key),{slope:m,r2:x}=E(n),r=t.key==="cpu"?c.avg_cpu:t.key==="memory"?c.avg_memory:c.avg_disk,l=n.length>0?n[n.length-1]:r||0;let v=l+m*b;v=Math.max(0,Math.min(100,v));const s=m>.05?"up":m<-.05?"down":"stable",d=Math.round(60+x*35);return{name:t.label,current:Math.round(l),predicted:Math.round(v),unit:"%",trend:s,confidence:d,timeRange:I}}),P=M.map(t=>{const n=$(i,t.key),{slope:m}=E(n),x=t.key==="cpu"?c.avg_cpu:t.key==="memory"?c.avg_memory:c.avg_disk,r=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,v=Math.round(Math.min(100,r+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-r)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:r,predictedUsage:v,threshold:s,daysUntilThreshold:d,recommendation:fe(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of A){if(!t.enabled)continue;const n=Ie(t.expression||""),m=(t.expression||"").toLowerCase(),x=M.find(r=>m.includes(r.exprKey));if(x&&n){const r=$(i,x.key),{slope:l}=E(r),v=x.key==="cpu"?c.avg_cpu:x.key==="memory"?c.avg_memory:c.avg_disk,s=r.length>0?r[r.length-1]:v||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const R=p.filter(y=>y.rule_id===t.id||y.rule_name===t.name).length;u+=Math.min(20,R*3),u=Math.max(5,Math.min(90,u));let N="未来24小时";if(l>.01&&n>s){const y=(n-s)/l;y<4?N="未来4小时":y<12?N="未来12小时":y<24?N="未来24小时":N=`未来${Math.ceil(y/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:N,suggestedAction:V(x.key)})}else{const r=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(r>0){const l=m.includes("service")?"service":m.includes("pod")?"pod":"service";f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能再次发生`,probability:Math.min(60,20+r*5),timeframe:"未来24小时",suggestedAction:V(l)})}}}const k=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),o=M.length>0?M.reduce((t,n)=>t+E($(i,n.key)).r2,0)/M.length:0,h=Math.round(78+o*17),S=k.filter(t=>t.probability>=50).length,L=P.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:T,capacityForecasts:P,dedupedAnomalies:k,accuracy:h,predictedAlertCount:S,capacityWarningCount:L}}function Z(a){switch(a){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function ze(){const[a,i]=g.useState("24h"),[c,p]=g.useState(!1),[A,j]=g.useState(!0),[b,I]=g.useState([]),[T,P]=g.useState({}),[f,k]=g.useState([]),[o,h]=g.useState([]);g.useEffect(()=>{S()},[]);const S=async()=>{j(!0);try{const[s,d,u,R]=await Promise.all([me.getMetrics(72),xe.getServerStats(),W.getAlerts({page:1,page_size:100}),W.getRules()]);I(Array.isArray(s)?s:[]),P(d||{});const N=u?.list||u||[];k(Array.isArray(N)?N:[]);const y=R?.list||R||[];h(Array.isArray(y)?y:[])}catch{}finally{j(!1)}},L=async()=>{p(!0),await S(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:r,capacityWarningCount:l}=we({rawMetrics:b,serverStats:T,alertEvents:f,alertRules:o,selectedTimeRange:a}),v=s=>{switch(s){case"up":return e.jsx(O,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:99:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:101:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(Ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:103:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:108:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:110:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center",children:e.jsx(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:115:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:120:9",className:"flex items-center gap-2",children:[e.jsxs(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:11",value:a,onValueChange:i,children:[e.jsxs(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:15",className:"h-4 w-4 mr-2"}),e.jsx(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15"})]}),e.jsxs(pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:126:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:15",value:"1h",children:"1小时"}),e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"24h",children:"24小时"}),e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"7d",children:"7天"}),e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"30d",children:"30天"})]})]}),e.jsx(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:133:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:L,children:c||A?e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:39",className:"h-4 w-4 animate-spin"}):e.jsx(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:86",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:140:7",className:"grid grid-cols-4 gap-4",children:[e.jsx(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:141:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:142:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:143:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:144:15",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:145:17",className:"text-sm text-slate-400",children:"预测置信度"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:146:17",className:"text-2xl font-bold text-slate-100",children:[x,"%"]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:148:15",className:"w-10 h-10 rounded-lg bg-emerald-500/20 flex items-center justify-center",children:e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:149:17",className:"h-5 w-5 text-emerald-400"})})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:13",className:"flex items-center gap-1 mt-2 text-xs text-slate-500",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:153:15",children:["基于 ",b.length," 个时序数据点回归拟合 R²"]})})]})}),e.jsx(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:158:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:159:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:161:15",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:162:17",className:"text-sm text-slate-400",children:"高风险预测"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:163:17",className:"text-2xl font-bold text-slate-100",children:r})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:165:15",className:"w-10 h-10 rounded-lg bg-amber-500/20 flex items-center justify-center",children:e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:17",className:"h-5 w-5 text-amber-400"})})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:13",className:"flex items-center gap-1 mt-2 text-xs text-amber-400",children:e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:15",children:"概率 ≥50% 的异常预测"})})]})}),e.jsx(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:175:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:176:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:177:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:178:15",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:179:17",className:"text-sm text-slate-400",children:"容量预警"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:180:17",className:"text-2xl font-bold text-slate-100",children:l})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:15",className:"w-10 h-10 rounded-lg bg-red-500/20 flex items-center justify-center",children:e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:183:17",className:"h-5 w-5 text-red-400"})})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:186:13",className:"flex items-center gap-1 mt-2 text-xs text-slate-500",children:e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:187:15",children:"14天内触及阈值"})})]})}),e.jsx(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:15",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:17",className:"text-sm text-slate-400",children:"监控指标数"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:197:17",className:"text-2xl font-bold text-slate-100",children:t.length})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:199:15",className:"w-10 h-10 rounded-lg bg-purple-500/20 flex items-center justify-center",children:e.jsx(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:200:17",className:"h-5 w-5 text-purple-400"})})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:203:13",className:"flex items-center gap-1 mt-2 text-xs text-slate-500",children:e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:204:15",children:"CPU / 内存 / 磁盘"})})]})})]}),e.jsxs(ne,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:210:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:211:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:212:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(be,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:213:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(ce,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:217:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:220:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:221:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:9",value:"metrics",className:"space-y-4",children:e.jsxs(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:228:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:229:15",className:"flex items-center justify-between",children:[e.jsxs(H,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:230:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(O,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:231:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:234:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:235:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:240:13",children:A?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:242:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:243:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:246:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:253:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:254:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:255:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ie,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:256:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:257:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:259:25",className:"flex items-center gap-1",children:[v(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:27",className:`text-sm ${Z(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:267:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:268:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:270:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:275:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:276:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:277:27",className:`text-lg font-bold ${Z(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:284:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:285:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:286:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:287:27",className:"w-16 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:288:29",className:"h-full bg-gradient-to-r from-blue-500 to-purple-500",style:{width:`${s.confidence}%`}})}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:304:9",value:"capacity",className:"space-y-4",children:e.jsx(Pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:11",forecasts:n,loading:A})}),e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:308:9",value:"anomaly",className:"space-y-4",children:e.jsxs(w,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:309:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:310:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:311:15",className:"flex items-center justify-between",children:[e.jsxs(H,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:312:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:313:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:316:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(C,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:319:13",children:A?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:321:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:322:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:325:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:327:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:329:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:330:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:331:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:332:27",className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.probability>=70?"bg-red-500/20":s.probability>=50?"bg-amber-500/20":"bg-blue-500/20"}`,children:e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:29",className:`h-5 w-5 ${s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"}`})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:351:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:352:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:353:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:354:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:355:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:356:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:358:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:365:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:366:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:367:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",className:"text-slate-700"}),e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:376:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",strokeDasharray:`${s.probability*1.76} 176`,className:s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:393:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:394:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:398:23",className:"mt-3 p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:399:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:400:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:401:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:402:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:403:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{ze as AIPredictiveAnalytics};