chore: 重新编译前端产物(补装CodeMirror依赖)

This commit is contained in:
attacker committed 2026-06-26 23:29:08 +08:00
1 parent 23e9e3da62
commit 4e384ca401
115 files changed
+147 -147

No files matched your search

@@ -0,0 +1 @@
import{r as i,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{B as E}from"./index-Dungj95X.js";import{p as F,c as ee,g as le,M as ue,d as xe,b as me,e as pe,f as he,y as be}from"./PodFileBrowser-B-U8iHmY.js";import{I as f}from"./input-CXoUQQLm.js";import{L as T}from"./label-CMpUoC87.js";import{T as te}from"./textarea-BxfjmLq5.js";import{S as G,a as W,b as U,c as H,d as Y}from"./select-CiTqGGhE.js";import{u as ge}from"./use-toast-DNZLibQY.js";import{k as $,d as ve}from"./index-drGq01ok.js";import{D as ke,f as Re,N as Ee,j as je,F as Ve,X as fe,L as A,P as L,T as O,$ as B}from"./vendor-icons-DmqcWdzX.js";function se(n,l,a){switch(n){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:a,namespace:l},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:a,namespace:l},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:a,namespace:l},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:a,namespace:l},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:a,namespace:l},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};case"deployments":return{apiVersion:"apps/v1",kind:"Deployment",metadata:{name:a||"my-app",namespace:l,labels:{app:a||"my-app"}},spec:{replicas:1,selector:{matchLabels:{app:a||"my-app"}},template:{metadata:{labels:{app:a||"my-app"}},spec:{containers:[{name:"main",image:"nginx:latest",ports:[{containerPort:80,protocol:"TCP"}],resources:{requests:{cpu:"100m",memory:"128Mi"},limits:{cpu:"500m",memory:"512Mi"}}}]}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:a,namespace:l}}}}function Ae({clusterCode:n,namespace:l,resource:a,name:k,onClose:j,onSaved:y,isCreate:h=!1}){const{toast:u}=ge(),[R,g]=i.useState(!0),[v,V]=i.useState(!1),[N,w]=i.useState(""),[b,t]=i.useState(null),[c,m]=i.useState("visual"),[C,M]=i.useState(""),[I,o]=i.useState(""),[x,s]=i.useState(!1),[r,p]=i.useState(!1),[S,P]=i.useState(!1),X=i.useCallback(async()=>{g(!0);try{if(h){const Q=se(a,l,k||""),Z=await F(Q);t(Q),M(Z),o(Z),w(""),s(!0);return}const d=await $.getResourceYaml(n,l,a,k);w(d);const{manifest:z,yaml:_}=await ee(d);M(_),o(_),s(!1),p(!1),t(z),z||(m("yaml"),u({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(d){u({title:"加载失败",description:d.message,variant:"destructive"})}finally{g(!1)}},[n,l,a,k,h]);i.useEffect(()=>{X()},[X]);const D=async d=>{V(!0);try{const z=await F(d),_=d?.metadata?.name||k;if(h){if(!_?.trim()){u({title:"请填写名称",variant:"destructive"});return}await $.applyYAML(n,z),u({title:"创建成功",description:`${a}/${_}`})}else await $.updateResourceYaml(n,l,a,k,z),u({title:"保存成功",description:`${a}/${k} 已更新`});y?.(),j()}catch(z){u({title:h?"创建失败":"保存失败",description:z.message,variant:"destructive"})}finally{V(!1)}},re=async()=>{V(!0);try{const d=await he(I);h?(await $.applyYAML(n,d),u({title:"创建成功",description:"YAML 已应用"})):(await $.updateResourceYaml(n,l,a,k,d),u({title:"保存成功",description:`${a}/${k} 已更新`})),s(!1),M(d),o(d),h||w(d),y?.(),j()}catch(d){u({title:"保存失败",description:d.message,variant:"destructive"})}finally{V(!1)}},oe=async()=>{const d=await pe(I);if(!d){u({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}t(d),m("visual")},ae=async()=>{if(b){const d=await F(b);M(d),o(d)}s(!1),p(!1),m("yaml")},J=()=>x?I:r?N:C,ce=async()=>{await navigator.clipboard.writeText(J()),P(!0),setTimeout(()=>P(!1),2e3)},ne=()=>{const d=be(a,l,k||b?.metadata?.name||"resource");ve(d,J()),u({title:"已下载",description:d})},de=le(a),K={configmaps:{title:"ConfigMap",icon:Ve,color:"text-blue-400"},secrets:{title:"Secret",icon:je,color:"text-amber-400"},services:{title:"Service",icon:Ee,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:Re,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:ke,color:"text-emerald-400"}},q=K[a]||K.configmaps,ie=q.icon;return e.jsx(ue,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:169:5",onClose:j,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:170:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl h-[85vh] flex flex-col shadow-2xl",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:175:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)] gap-3 shrink-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:176:11",className:"Line truncated