ROADMAP Q1 推进(前端类型安全治理 in_progress): - src/api/ 整个目录 any 清零(含 monitor/ deploy/ 子目录 12+ 文件) create/update 入参 any -> Record<string, unknown> / object mock 桩 trace/grafana 对接 types/ 标准类型(Trace/GrafanaDashboard) 典型接口 LdapFormData/ProbeForm 等强类型表单用 object 接收 - types/monitor.ts 扩展 ~150 行接口: ZabbixDatasource / AlertSilence / 7 个输入 DTO Trace / TraceSpan / TraceServiceMetrics / GrafanaDashboard / DashboardPanel HealthProbeInput 验证: - 整个 src/api/ 目录 any=0 - ESLint no-explicit-any: 995 -> 937 (本项目此轮贡献 -58) - tsc -b 零错误, npm run build ✓ (17.06s) - API 回归 8/8 核心端点通过, Docker 部署 healthy
2 lines
27 KiB
JavaScript
2 lines
27 KiB
JavaScript
import{i as G,j as e,L as U,E as q,r as g,aN as J,B as Q,A as ee,K as se,T as $,p as te,N as ce}from"./index-o4rKtKfJ.js";import{C as F,b as K,c as B,a as H}from"./card-6Ae5ROGi.js";import{S as ae}from"./stat-strip-DYcHo9Kj.js";import{B as Z}from"./badge-CDGsL4jH.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-CoTqT5ed.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-DuV0kIrj.js";import{d as pe}from"./dashboard-Z5J6ei7x.js";import{s as me}from"./server-Cnj_Y0tD.js";import{a as z}from"./alert-BV-5lkdi.js";import{H as X}from"./hard-drive-P-ztZBRa.js";import{Z as Y}from"./zap-BPZOchcR.js";import{C as xe}from"./calendar-DgwL_Rib.js";import{T as W}from"./trending-up-BBigl0ol.js";import{S as he}from"./sparkles-B5z94t3h.js";import{M as ye}from"./memory-stick-BZFgFF9q.js";import{M as ve}from"./minus-CqgIaHif.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=G("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=G("trending-down",be);function Pe({forecasts:a,loading:i}){return e.jsxs(F,{"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(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"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(H,{"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(U,{"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(Z,{"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 T=[{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}],ge={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},Ne={"1h":1,"24h":24,"7d":168,"30d":720};function _(a){const i=a.length;if(i<2)return{slope:0,r2:0};const c=a.map((r,h)=>h),p=c.reduce((r,h)=>r+h,0)/i,y=a.reduce((r,h)=>r+h,0)/i;let b=0,N=0,I=0,C=0;for(let r=0;r<i;r++)b+=(c[r]-p)*(a[r]-y),N+=(c[r]-p)**2,I+=(a[r]-y)**2;const j=N===0?0:b/N,f=y-j*p;for(let r=0;r<i;r++){const h=f+j*c[r];C+=(a[r]-h)**2}const w=I===0?1:Math.max(0,1-C/I);return{slope:j,r2:w}}function R(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 O(a){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[a]||"建议检查相关服务状态并持续监控"}function Ce(a){const{rawMetrics:i,serverStats:c,alertEvents:p,alertRules:y,selectedTimeRange:b}=a,N=Ne[b]||24,I=ge[b]||"24小时后",C=T.map(t=>{const n=R(i,t.key),{slope:m,r2:x}=_(n),o=t.key==="cpu"?c.avg_cpu:t.key==="memory"?c.avg_memory:c.avg_disk,l=n.length>0?n[n.length-1]:o||0;let A=l+m*N;A=Math.max(0,Math.min(100,A));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(A),unit:"%",trend:s,confidence:d,timeRange:I}}),j=T.map(t=>{const n=R(i,t.key),{slope:m}=_(n),x=t.key==="cpu"?c.avg_cpu:t.key==="memory"?c.avg_memory:c.avg_disk,o=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,A=Math.round(Math.min(100,o+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-o)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:o,predictedUsage:A,threshold:s,daysUntilThreshold:d,recommendation:fe(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of y){if(!t.enabled)continue;const n=Ie(t.expression||""),m=(t.expression||"").toLowerCase(),x=T.find(o=>m.includes(o.exprKey));if(x&&n){const o=R(i,x.key),{slope:l}=_(o),A=x.key==="cpu"?c.avg_cpu:x.key==="memory"?c.avg_memory:c.avg_disk,s=o.length>0?o[o.length-1]:A||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const M=p.filter(v=>v.rule_id===t.id||v.rule_name===t.name).length;u+=Math.min(20,M*3),u=Math.max(5,Math.min(90,u));let P="未来24小时";if(l>.01&&n>s){const v=(n-s)/l;v<4?P="未来4小时":v<12?P="未来12小时":v<24?P="未来24小时":P=`未来${Math.ceil(v/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:P,suggestedAction:O(x.key)})}else{const o=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(o>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+o*5),timeframe:"未来24小时",suggestedAction:O(l)})}}}const w=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),r=T.length>0?T.reduce((t,n)=>t+_(R(i,n.key)).r2,0)/T.length:0,h=Math.round(78+r*17),k=w.filter(t=>t.probability>=50).length,E=j.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:C,capacityForecasts:j,dedupedAnomalies:w,accuracy:h,predictedAlertCount:k,capacityWarningCount:E}}function V(a){switch(a){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function Oe(){const[a,i]=g.useState("24h"),[c,p]=g.useState(!1),[y,b]=g.useState(!0),[N,I]=g.useState([]),[C,j]=g.useState({}),[f,w]=g.useState([]),[r,h]=g.useState([]);g.useEffect(()=>{k()},[]);const k=async()=>{b(!0);try{const[s,d,u,M]=await Promise.all([pe.getMetrics(72),me.getServerStats(),z.getAlerts({page:1,page_size:100}),z.getRules()]);I(Array.isArray(s)?s:[]),j(d||{});const P=u?.list||u||[];w(Array.isArray(P)?P:[]);const v=M?.list||M||[];h(Array.isArray(v)?v:[])}catch{}finally{b(!1)}},E=async()=>{p(!0),await k(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:o,capacityWarningCount:l}=Ce({rawMetrics:N,serverStats:C,alertEvents:f,alertRules:r,selectedTimeRange:a}),A=s=>{switch(s){case"up":return e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:100:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(je,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:102:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(ve,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:104:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:109:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113: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(J,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:114:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:118:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:9",className:"flex items-center gap-2",children:[e.jsxs(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:11",value:a,onValueChange:i,children:[e.jsxs(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(xe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15",className:"h-4 w-4 mr-2"}),e.jsx(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:125:15"})]}),e.jsxs(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(S,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"1h",children:"1小时"}),e.jsx(S,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"24h",children:"24小时"}),e.jsx(S,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"7d",children:"7天"}),e.jsx(S,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:131:15",value:"30d",children:"30天"})]})]}),e.jsx(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:E,children:c||y?e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:135:39",className:"h-4 w-4 animate-spin"}):e.jsx(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:135:86",className:"h-4 w-4"})})]})]}),e.jsx(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:141:7",items:[{label:"置信度",value:`${x}%`,color:"emerald"},{label:"高风险",value:o,color:"amber"},{label:"容量预警",value:l,color:"red"},{label:"指标",value:t.length,color:"purple"}]}),e.jsxs(ie,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:150:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(ne,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:151:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:153:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:156:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:157:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:161:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:9",value:"metrics",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:167:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:168:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:15",className:"flex items-center justify-between",children:[e.jsxs(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:171:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(Z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:174:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:175:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(H,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:180:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:183:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:186:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:188:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:190: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:191:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ce,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:197:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:199:25",className:"flex items-center gap-1",children:[A(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:201:27",className:`text-sm ${V(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:207:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:208:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:209:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:210:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:215:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:217:27",className:`text-lg font-bold ${V(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:224:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:225:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227: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:228: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:233:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:244:9",value:"capacity",className:"space-y-4",children:e.jsx(Pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:245:11",forecasts:n,loading:y})}),e.jsx(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:9",value:"anomaly",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:249:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:15",className:"flex items-center justify-between",children:[e.jsxs(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:253:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:256:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(H,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:259:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(U,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:262:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:265:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:267:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269: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:270:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:271:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:272: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:281: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:291:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:292:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:294:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:295:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:296:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:298:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:306:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:307: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:316: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:333:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:334:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:338: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:339:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:340:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:342:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:343:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{Oe as AIPredictiveAnalytics};
|