refactor(q1): src/api 全量清零 any + types/monitor 扩展输入 DTO

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
This commit is contained in:
attacker committed 2026-06-26 03:37:56 +08:00
1 parent 480e677042
commit b553c7956d
436 files changed
+410 -1198

No files matched your search

@@ -0,0 +1 @@
import{k as Te,m as Re,y as Le,f as $e,r as d,j as e,B as x,q as ne,R as Ae,F as Me,z as ze,E as Be,w as he,A as Oe,H as Fe}from"./index-o4rKtKfJ.js";import{C as V,a as W,b as y,c as S}from"./card-6Ae5ROGi.js";import{B as j}from"./badge-CDGsL4jH.js";import{T as ce,a as le,b as C,c as h,d as de,e as i}from"./table-FZ6-yFwR.js";import{k as U}from"./index-BZgsOVD1.js";import{u as He}from"./use-toast-A4ENhXFA.js";import{Y as ie,S as w,f as me,s as q,P as _e,a as Ye}from"./PodFileBrowser-DLXSENob.js";import{A as De}from"./arrow-left-YLjxMf9c.js";import{T as Ee}from"./tag-CQGKNzcI.js";import{H as qe}from"./hard-drive-P-ztZBRa.js";import{M as Ie}from"./minus-CqgIaHif.js";import{P as Je}from"./plus-BXcAPnTg.js";import"./copy-NHEH4ztb.js";import"./sparkles-B5z94t3h.js";import"./save-CtHT3jpw.js";import"./select-DuV0kIrj.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";import"./xterm-DSqgeKvr.js";import"./box-_NnNRGhN.js";import"./rotate-cw-DBn4I-55.js";import"./minimize-2-FJos9g1e.js";import"./upload-DOm5bdlT.js";import"./refresh-cw-eQ6GkWW0.js";import"./folder-ChrwvSiP.js";import"./download-Gr2Xr683.js";function c({label:t,value:m,sub:P,color:u}){return e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:29:5",className:"bg-slate-900 border-slate-800",children:e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:30:7",className:"p-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:31:9",className:"text-xs text-slate-500",children:t}),e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:32:9",className:"text-base font-bold mt-0.5",style:{color:u||"#e2e8f0"},children:m}),P&&e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:33:17",className:"text-[10px] text-slate-600 mt-0.5",children:P})]})})}function pe({labels:t}){const m=Object.entries(t||{});return m.length===0?e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:42:36",className:"text-xs text-slate-600",children:"无"}):e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:44:5",className:"flex flex-wrap gap-1.5",children:m.map(([P,u])=>e.jsxs(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:46:9",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px] font-mono",children:[P,"=",u]},P))})}function Ps(){const t=Te(),m=Re(),P=Le(),{toast:u}=He(),ke=$e(),r=t.clusterCode||"",n=t.namespace||"",l=t.name||"",p=P.pathname.includes("/DaemonSet/")?"DaemonSet":"StatefulSet",T=t.mode==="yaml"?"yaml":"view",[N,ue]=d.useState(null),[R,be]=d.useState([]),[ge,I]=d.useState(!0),[we,L]=d.useState(!1),[v,F]=d.useState(1),[$,A]=d.useState(!1),[H,J]=d.useState(null),[_,K]=d.useState(null),[je,G]=d.useState(!1),M=d.useCallback(async()=>{I(!0);try{const[s,o]=await Promise.all([U.getResourceYaml(r,n,p.toLowerCase()+"s",l).catch(()=>""),U.getPods(r).catch(()=>[])]);let f=null;if(s&&typeof s=="string")try{f=JSON.parse(s)}catch{f={_raw:s}}else s&&typeof s=="object"&&(f=s);ue(f);const E=(Array.isArray(o)?o:o?.list||o?.data||[]).filter(O=>{const Ue=O.name||O.metadata?.name||"",re=O.namespace||O.namespace_name||"";return Ue.startsWith(l)&&(!re||re===n)});be(E)}catch(s){console.error("load error",s)}finally{I(!1)}},[r,n,l,p]);d.useEffect(()=>{M()},[M]);const Q=s=>{s!==T&&m(`/kubernetes/${r}/namespace/${n}/workload/${s}/${p}/${l}`,{replace:!0})},Pe=async()=>{if(await ke({title:"滚动重启",description:`确认重启 ${p} ${l}?将触发滚动重启。`,confirmText:"重启"})){A(!0);try{p==="StatefulSet"?await U.restartStatefulSet(r,n,l):await U.restartDaemonSet(r,n,l),u({title:"重启指令已下发",description:`${p} 滚动重启已触发`}),setTimeout(M,1e3)}catch(o){u({title:"重启失败",description:o?.message||String(o),variant:"destructive"})}finally{A(!1)}}},Ve=async()=>{A(!0);try{await U.scaleStatefulSet(r,n,l,v),u({title:"扩缩容成功",description:`StatefulSet 副本数已更新为 ${v}`}),L(!1),setTimeout(M,1e3)}catch(s){u({title:"扩缩容失败",description:s?.message||String(s),variant:"destructive"})}finally{A(!1)}},k=N?.spec||{},b=N?.status||{},X=k?.template?.spec?.containers||[],Z=k?.template?.spec?.initContainers||[],z=k.replicas??1,ee=b.readyReplicas??0,We=b.currentReplicas??0,Ne=b.updatedReplicas??0,Y=b.desiredNumberScheduled??0,fe=b.currentNumberScheduled??0,se=b.numberReady??0,ve=b.numberAvailable??0,ye=b.updatedNumberScheduled??0,g=p==="StatefulSet",B=g?ee===z&&z>0:se===Y&&Y>0,a=k.updateStrategy||{},D=a.type||"RollingUpdate",te=k.volumeClaimTemplates||[],Se=k.selector?.matchLabels||{},Ce=N?.metadata?.labels||{},ae=N?.metadata?.annotations||{};return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:190:5",className:"p-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:192:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:193:Line truncated