chore: 重新编译前端产物(补装CodeMirror依赖)
This commit is contained in:
1 parent
23e9e3da62
commit
4e384ca401
115 files changed
+147
-147
No files matched your search
@@ -0,0 +1 @@
|
||||
import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as E,a as L}from"./card-BIfzBCEy.js";import{g as H,i as M,L as k,B as j}from"./index-Dungj95X.js";import{B as D}from"./badge-CGJlVD3L.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-CiTqGGhE.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-B2F10oba.js";import{k as p}from"./index-drGq01ok.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-DmqcWdzX.js";import"./index-5FEebgvX.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:78:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:78:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:87:46",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:94:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:98:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:101:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapLine truncated
|
||||
Reference in new issue
Block a user