fix(k8s): 可视化编辑器 YAML 解析失败(managedFields 清理)
- 先解析原始 YAML 再对象级剥离,避免 cleanYAML 破坏结构 - managedFields 从 METADATA_LINE_KEYS 移除,改整块删除含数组项 - YamlViewer 同步使用 parseEditableManifest
This commit is contained in:
1 parent
21d40b186a
commit
5fad2db0c6
101 files changed
+195
-146
No files matched your search
@@ -0,0 +1 @@
|
||||
import{r as u,j as e,R as le,y as pe,o as xe}from"./vendor-codemirror-C7mXSpXt.js";import{C as ue,a as ie}from"./card-D4L46nh3.js";import{B as p,g as de,k as he,i as be,L as I}from"./index-BBDEBVET.js";import{I as ge}from"./input-e2KnvZus.js";import{B as m}from"./badge-D4cmFHTS.js";import{S as U,a as J,b as G,c as X,d as q}from"./select-B_wPmYeS.js";import{T as Ne,a as ke,b as i,c as je,d as Re,e as t}from"./table-BHSiRRpd.js";import{Y as Pe,P as ve,a as fe}from"./PodFileBrowser-D_SJAX96.js";import{R as we}from"./ResourceVisualEditor-CSC75r5p.js";import{u as Z}from"./use-toast-CkA38LVP.js";import{k as l}from"./index-CoT9mL1C.js";import{ah as B,X as Ce,L as E,j as w,B as C,b as Se,A as ye,F as Ye,N as K,k as $e,f as _,R as De,v as Q,P as Ae,S as Ie,o as N,d as M,r as _e,H as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";import"./label-J75lkt_x.js";import"./textarea-Bhm4J_66.js";function Be({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=Z(),[n,x]=u.useState(""),[h,k]=u.useState(!1),S=async()=>{if(!n.trim()){r({title:"请输入 YAML",variant:"destructive"});return}k(!0);try{await l.applyYAML(s,n),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(b){r({title:"导入失败",description:b.message,variant:"destructive"})}finally{k(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:40:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:11",className:"flex items-center gap-2",children:[e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:49:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Ce,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:9",className:"flex-1 overflow-auto p-4",children:e.jsx(le,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:55:11",value:n,height:"420px",theme:xe,extensions:[pe()],onChange:x,placeholder:"粘贴 YAML 内容...",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},style:{fontSize:"12px"}})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:66:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:67:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:68:11",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:h,children:[h?e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const W=["services","ingresses","configmaps","secrets","pvcs"],R=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:36:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:37:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),L={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",iLine truncated
|
||||
Reference in new issue
Block a user