P1: kubernetes/system API 拆为子目录模块,导出工具下沉到 lib/export-utils,
http 统一 buildApiUrl/getWsBase;HostMonitor、DeploymentEdit* 拆至子组件。
P2: 新增 hooks/api(queryKeys、useTerminalSessions、useHostMonitor),
TerminalSessionsTab 与 HostMonitor 接入 TanStack Query。
P3: 保留 services/api 路径,未迁移至 api/ 目录。
21 lines
214 KiB
JavaScript
21 lines
214 KiB
JavaScript
import{i as Fe,r as m,v as ot,N as Se,A as Zt,j as e,B as u,L as xe,V as Qt,o as es,E as ts,C as ss,R as bs,p as ys,t as ns,_ as os,z as tt,S as jt,y as vt,G as ks,M as vs,P as gt,Q as xt,m as as,aU as gs,T as Mt,al as Ds,X as cs,$ as Nt,k as js}from"./index-Dmami9WE.js";import{C as L,a as G,b as ie,c as pe}from"./card-CIfC-8Rh.js";import{I as v}from"./input-NsU9nXZF.js";import{L as C}from"./label-Ap_-SPYI.js";import{B as se}from"./badge-3UzCvU7L.js";import{k as te}from"./kubernetes-D2-GnE0t.js";import{u as Pe}from"./use-toast-jvSbBx20.js";import{S as we,f as Ye,e as Ns,b as fs,s as ht,Y as zt,P as Es,a as ws}from"./PodFileBrowser-BLvOIIeH.js";import{T as Re,a as Be,b as De,c as X,d as Oe,e as Z}from"./table-CG4mjNfb.js";import{P as ae}from"./plus-O65gX7Qz.js";import{H as Cs}from"./history-CbX6uocL.js";import{M as ft}from"./minus-DRP_TSA-.js";import{F as Et}from"./file-text-CebshSV-.js";import{H as rs}from"./hard-drive-DmC04Y5r.js";import{E as Dt}from"./external-link-2hCYo_Ng.js";import{T as st}from"./textarea-DHUZ6N85.js";import{S as Le,a as Ge,b as nt,c as He,d as ve}from"./select-DUbxjT0z.js";import{S as wt}from"./switch-TqjD2x0W.js";import{T as ue}from"./trash-2-DWVnIU6o.js";import{P as ls}from"./play-0EwQQJX_.js";import{S as at}from"./save-YtnrpTd8.js";import{R as ds}from"./rotate-cw-CKCO6IKE.js";import{Z as is}from"./zap-CocSkPPl.js";import{F as Ss}from"./folder-open-CjMh_m_2.js";import{D as Ps}from"./disc-BPxL4arn.js";import{F as As,a as ut}from"./folder-B5RGB3GG.js";import{R as ct}from"./refresh-cw-CTBERyFc.js";import{C as Vs}from"./circle-x-BBQeW1R3.js";import{A as Ws}from"./arrow-left-BIbk9wFC.js";import{P as _t}from"./pause-DOhduDQ5.js";import"./copy-CE_T92Lk.js";import"./sparkles-rPZivnlW.js";import"./xterm-DSqgeKvr.js";import"./box-88Ol5qY-.js";import"./minimize-2-BHcbNmdK.js";import"./upload-CRLg7Pbj.js";import"./download-Vuij9wGr.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Ts=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Rs=Fe("hash",Ts);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Fe("heart",Bs);const Is=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ms=Fe("image",Is);const zs=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],_s=Fe("key-round",zs);const $s=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],$t=Fe("tags",$s);function ps(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(d=>(d.type||d.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Ls(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:d,onRefresh:i}=t,{toast:p}=Pe(),[D,h]=m.useState("pods"),[N,I]=m.useState(null),[q,V]=m.useState(null),[R,M]=m.useState(a?.replicas||0),[z,F]=m.useState(!1),[B,U]=m.useState([]),[Y,S]=m.useState([]),[Q,O]=m.useState([]),[H,ne]=m.useState(""),[oe,r]=m.useState([]),[b,f]=m.useState([]),P=a?.ready_replicas??a?.readyReplicas??0,l=a?.replicas??0,w=P===l&&l>0;m.useEffect(()=>{D==="services"&&(ne("services"),Promise.all([te.getNamespaceServices(s,o).catch(()=>[]),te.getNamespaceIngresses(s,o).catch(()=>[])]).then(([y,J])=>{const _=A=>Array.isArray(A)?A:A?.list||A?.items||A?.data||[],$=_(y),be=_(J),K=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},he=$.filter(A=>{const ce=A.spec?.selector||A.selector||{};return Object.keys(ce).length===0?!1:Object.entries(ce).every(([ge,fe])=>K[ge]===fe)}).map(A=>({name:A.name||A.metadata?.name,type:A.spec?.type||A.type||"ClusterIP",clusterIP:A.spec?.clusterIP||A.cluster_ip||"<none>",ports:(A.spec?.ports||A.ports||[]).map(ce=>`${ce.port}${ce.targetPort?":"+ce.targetPort:""}/${ce.protocol||"TCP"}`),selector:A.spec?.selector||A.selector||{},age:A.age||""})),Ne=new Set(he.map(A=>A.name)),de=be.filter(A=>(A.spec?.rules||A.rules||[]).some(ge=>(ge.http?.paths||ge.paths||[]).some(fe=>{const g=fe.backend?.service?.name||fe.backendService||"";return Ne.has(g)}))).map(A=>({name:A.name||A.metadata?.name,className:A.spec?.ingressClassName||A.ingressClass||"-",hosts:(A.spec?.rules||A.rules||[]).map(ce=>ce.host).filter(Boolean),rules:A.spec?.rules||A.rules||[],age:A.age||""}));U(he),S(de)}).catch(()=>{}).finally(()=>ne("")))},[D,s,o,a]),m.useEffect(()=>{D==="events"&&(ne("events"),te.getEvents(s,o,void 0).then(y=>{const _=(Array.isArray(y)?y:y?.list||y?.items||y?.data||[]).filter($=>{const K=($.involvedObject||$.involved_object||{}).name||"";return K===a?.name||K.startsWith(a?.name+"-")}).map($=>({type:$.type||"Normal",reason:$.reason||"",message:$.message||"",source:$.source?.component||$.sourceComponent||"-",firstTimestamp:$.firstTimestamp||$.first_timestamp||"",lastTimestamp:$.lastTimestamp||$.last_timestamp||"",count:$.count||1}));O(_)}).catch(()=>{}).finally(()=>ne("")))},[D,s,o,a?.name]),m.useEffect(()=>{D==="scale"&&(ne("scale"),Promise.all([te.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([y])=>{const _=(be=>Array.isArray(be)?be:be?.list||be?.items||be?.data||[])(y),$=a?.name||"";r(_.filter(be=>(be.scaleTargetRef?.name||be.targetRef?.name||"")===$)),f([])}).catch(()=>{}).finally(()=>ne("")))},[D,s,o,a?.name]);const T=async y=>{const J=y.revision??y.revision_number??y.number;if(confirm(`确认回滚到修订版本 #${J}?`)){V(J);try{await te.rollbackDeployment(s,o,a.name,Number(J)),p({title:"回滚已下发",description:`正在回滚到 #${J}`}),i()}catch(_){p({title:"回滚失败",description:_?.message||String(_),variant:"destructive"})}finally{V(null)}}},c=async()=>{F(!0);try{await te.scaleDeployment(s,o,a.name,R),p({title:"伸缩已提交",description:`副本数 → ${R}`}),i()}catch(y){p({title:"伸缩失败",description:y?.message||String(y),variant:"destructive"})}finally{F(!1)}},k=[{key:"pods",label:"容器组",icon:ot,count:n.length},{key:"services",label:"访问方式",icon:Se,count:B.length},{key:"events",label:"事件",icon:Zt,count:Q.length},{key:"scale",label:"容器伸缩",icon:ae},{key:"history",label:"历史版本",icon:Cs,count:d.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:225:5",className:"space-y-4",children:[e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentView.tsx:227:7",className:"dg-card",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:229:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:13",label:"状态",value:e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:231:15",style:{background:`${w?we.green:we.orange}22`,color:w?we.green:we.orange,border:`1px solid ${w?we.green:we.orange}44`},children:w?"Running":"Updating"})}),e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:235:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:235:41",className:"font-mono",children:[P,"/",l]})}),e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:236:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:240:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${s}/nodes/${n[0].node_name||n[0].node}`,"_blank"),children:n[0].node_name||n[0].node||"-"})}),e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",label:"创建时间",value:Ye(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:251:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(ms,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(y=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${D===y.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>h(y.key),children:[e.jsx(y.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:13",className:"h-4 w-4"}),y.label,y.key==="pods"&&e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:272:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:y.count})]},y.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:276:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:277:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z||R<=0,onClick:()=>M(y=>Math.max(0,y-1)),children:e.jsx(ft,{"code-path":"src/components/kubernetes/DeploymentView.tsx:280:13",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentView.tsx:282:11",type:"number",min:0,value:R,onChange:y=>M(Math.max(0,Number(y.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:287:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z,onClick:()=>M(y=>y+1),children:e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentView.tsx:290:13",className:"h-4 w-4"})}),R!==l&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:293:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:z,onClick:c,children:z?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:295:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),D==="pods"&&e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:302:26",...t,expandedPod:N,setExpandedPod:I}),D==="services"&&e.jsx(Hs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:303:30",services:B,ingresses:Y,loading:H,namespace:o}),D==="events"&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:304:28",events:Q,loading:H}),D==="scale"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:306:9",hpas:oe,cronHpas:b,loading:H,replicas:l}),D==="history"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:313:29",revisions:d,rollbackLoading:q,onRollback:T})]})}function Te({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:321:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentView.tsx:322:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:323:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function ms({pod:t}){const s=ps(t),o=[{label:"已调度",ts:s.scheduled,color:we.blue},{label:"已初始化",ts:s.initialized,color:we.orange},{label:"容器已就绪",ts:s.containersReady,color:we.green},{label:"容器组已就绪",ts:s.ready,color:we.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:338:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,n)=>{const d=o[n-1],i=Ns(d?.ts,a.ts);return e.jsxs(m.Fragment,{"code-path":"src/components/kubernetes/DeploymentView.tsx:343:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:344:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:345:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:346:15",className:"text-[10px] mt-1 font-medium",style:{color:a.ts?a.color:"#475569"},children:a.label}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:347:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ye(a.ts):"-"})]}),n<o.length-1&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:350:15",className:"flex flex-col items-center mx-0.5 min-w-[30px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:351:17",className:"h-0.5 w-8 bg-[var(--dg-border)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:352:17",className:"text-[9px] text-[var(--dg-text-muted)] mt-0.5",children:i!=null?fs(i):""})]})]},a.label)})})}function Gs({clusterCode:t,pods:s,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:n,expandedPod:d,setExpandedPod:i}){return s.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:365:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无容器组"}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:368:5",className:"space-y-2",children:s.map(p=>{const D=ps(p),h=d===p.name,N=p.node_name||p.node;return e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentView.tsx:374:11",className:"dg-card",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentView.tsx:375:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:377:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:378:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>i(h?null:p.name),children:h?e.jsx(Qt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:379:31",className:"h-4 w-4"}):e.jsx(es,{"code-path":"src/components/kubernetes/DeploymentView.tsx:379:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:381:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:p.name}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:382:17",style:{background:`${ht(p.status)}22`,color:ht(p.status),border:`1px solid ${ht(p.status)}44`},children:p.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:385:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:386:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${N}`,"_blank"),children:N||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:390:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:p.ip||p.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:391:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",p.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:392:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ye(D.startTime||p.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:393:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:394:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(p),children:[e.jsx(Et,{"code-path":"src/components/kubernetes/DeploymentView.tsx:395:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:397:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(p),children:[e.jsx(ts,{"code-path":"src/components/kubernetes/DeploymentView.tsx:398:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:400:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>n(p),children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:401:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),h&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:406:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(ms,{"code-path":"src/components/kubernetes/DeploymentView.tsx:407:19",pod:p}),p.containers&&p.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:410:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:p.containers.map((I,q)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:412:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:413:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:414:29",className:"font-medium text-[var(--dg-text-primary)]",children:I.name}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:415:29",className:I.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:I.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:417:27",className:"text-[var(--dg-text-muted)] mt-1",children:I.image}),I.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:419:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:420:31",children:["CPU: ",I.resources?.requests?.cpu||"0","/",I.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:421:31",children:["内存: ",I.resources?.requests?.memory||"0","/",I.resources?.limits?.memory||"-"]})]})]},q))})]})]})},p.name)})})}function Hs({services:t,ingresses:s,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:441:12",className:"flex items-center justify-center py-12",children:e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:441:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:444:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:446:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/DeploymentView.tsx:447:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:448:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentView.tsx:451:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:453:11",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:454:13",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:455:15",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:456:17",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:457:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:458:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:459:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:460:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:461:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:464:15",children:t.map(a=>e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:466:19",className:"border-[var(--dg-border)]",children:[e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:467:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:468:21",children:e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:468:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:469:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:470:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:471:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(a.selector).map(([n,d])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentView.tsx:473:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[n,"=",d]},n))})]},a.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:485:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/DeploymentView.tsx:486:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Dt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:487:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentView.tsx:490:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:492:11",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:493:13",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:494:15",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:495:17",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:496:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:497:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:498:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:499:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:502:15",children:s.map(a=>e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:504:19",className:"border-[var(--dg-border)]",children:[e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:505:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:506:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:507:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:508:21",className:"text-xs text-[var(--dg-text-muted)]",children:a.rules.flatMap(n=>(n.http?.paths||n.paths||[]).map(d=>d.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Fs({events:t,loading:s}){return s==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:525:12",className:"flex items-center justify-center py-12",children:e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:525:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:528:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:531:5",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:532:7",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:533:9",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:534:11",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:535:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:536:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:537:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:538:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:539:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:540:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:543:9",children:t.map((o,a)=>e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:545:13",className:"border-[var(--dg-border)]",children:[e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:546:15",children:e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:547:17",variant:"outline",className:o.type==="Warning"?"text-[var(--dg-yellow)] border-[var(--dg-yellow)]/30":"text-[var(--dg-text-muted)] border-[var(--dg-border)]",children:o.type})}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:551:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:552:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md truncate",title:o.message,children:o.message}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:553:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:554:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:555:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ye(o.lastTimestamp)})]},a))})]})})}function Ys({hpas:t,cronHpas:s,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:567:12",className:"flex items-center justify-center py-12",children:e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:567:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:571:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:573:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:574:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:575:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:576:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentView.tsx:580:7",className:"dg-card",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentView.tsx:581:9",className:"pb-2",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:581:38",className:"text-sm flex items-center gap-2",children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:581:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentView.tsx:582:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:584:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:585:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:588:13",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:589:15",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:590:17",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:591:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:592:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:593:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:594:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:595:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:596:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:599:17",children:t.map((n,d)=>{const i=n.spec?.minReplicas??n.minReplicas??1,p=n.spec?.maxReplicas??n.maxReplicas??10,D=n.spec?.metrics||n.metrics||[],h=n.status?.currentReplicas??n.currentReplicas??0,q=(n.status?.conditions||n.conditions||[]).find(V=>V.type==="AbleToScale")?.status==="True";return e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:609:23",className:"border-[var(--dg-border)]",children:[e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:610:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:611:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[i," → ",p]}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:612:25",className:"text-xs text-[var(--dg-text-muted)]",children:D.map((V,R)=>{const M=V.resource||V.object?.metric?.name||"",z=V.resource?.target?.averageUtilization||V.resource?.target?.averageValue||V.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:616:36",children:[M?.name||M,": ",z,V.resource?.target?.averageUtilization?"%":""]},R)})}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:619:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:h}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:620:25",children:e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:621:27",className:q?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:q?"正常":"异常"})})]},n.name||d)})})]})})})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentView.tsx:636:7",className:"dg-card",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentView.tsx:637:9",className:"pb-2",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:637:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/DeploymentView.tsx:637:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentView.tsx:638:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:640:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:641:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:644:13",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:645:15",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:646:17",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:647:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:648:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:649:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:650:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:651:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:652:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:655:17",children:s.map((n,d)=>{const i=n.spec?.jobs||n.jobs||[],p=n.spec?.timezone||"UTC";return e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:660:23",className:"border-[var(--dg-border)]",children:[e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:661:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:662:25",className:"text-sm text-[var(--dg-text-secondary)]",children:i.map(D=>D.targetSize||D.targetReplicas||"?").join(", ")}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:665:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:i.map(D=>D.schedule||"?").join(", ")}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:666:25",className:"text-xs text-[var(--dg-text-muted)]",children:p}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:667:25",children:e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:668:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||d)})})]})})})]})]})}function Js({revisions:t,rollbackLoading:s,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:686:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:689:5",className:"overflow-x-auto",children:e.jsxs(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:690:7",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:691:9",children:e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:692:11",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:693:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:694:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:695:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:696:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(X,{"code-path":"src/components/kubernetes/DeploymentView.tsx:697:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:700:9",children:t.map((a,n)=>{const d=a.revision??a.revision_number??a.number??n+1,i=n===0;return e.jsxs(De,{"code-path":"src/components/kubernetes/DeploymentView.tsx:705:15",className:"border-[var(--dg-border)]",children:[e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:706:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",d]}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:707:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:708:17",children:i?e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:710:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentView.tsx:711:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:713:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ye(a.created_at||a.time)}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:714:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:715:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:i||s!==null,onClick:()=>o(a),children:[s===d?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:716:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(bs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:716:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},d)})})]})})}function Lt(t){const s=n=>{if(!n)return null;let d="none";return n.httpGet?d="httpGet":n.tcpSocket?d="tcpSocket":n.exec&&(d="exec"),{type:d,httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",httpHost:n.httpGet?.host||"",tcpPort:n.tcpSocket?.port??"",execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(`
|
||
`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let d="none";return n.exec?d="exec":n.httpGet?d="httpGet":n.tcpSocket&&(d="tcpSocket"),{type:d,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(`
|
||
`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function Gt(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function bt(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
|
||
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function Ht(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
|
||
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Ft(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(h=>h.name.trim()).map(h=>{const N={name:h.name};return h.value!=null&&(N.value=h.value),N})),t.ports.length>0&&(s.ports=t.ports.filter(h=>h.containerPort!=="").map(h=>{const N={containerPort:typeof h.containerPort=="number"?h.containerPort:Number(h.containerPort)};return h.name&&(N.name=h.name),h.protocol&&(N.protocol=h.protocol),N}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(h=>h&&h.trim()),d=a&&Object.values(a).some(h=>h&&h.trim());(n||d)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),d&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const i=bt(t.livenessProbe);i&&(s.livenessProbe=i);const p=bt(t.readinessProbe);p&&(s.readinessProbe=p);const D=bt(t.startupProbe);if(D&&(s.startupProbe=D),t.lifecycle){const h={},N=Ht(t.lifecycle.postStart);N&&(h.postStart=N);const I=Ht(t.lifecycle.preStop);I&&(h.preStop=I),Object.keys(h).length>0&&(s.lifecycle=h)}if(t.securityContext){const h=t.securityContext,N={};h.runAsUser!==""&&h.runAsUser!=null&&(N.runAsUser=Number(h.runAsUser)),h.runAsGroup!==""&&h.runAsGroup!=null&&(N.runAsGroup=Number(h.runAsGroup)),h.runAsNonRoot!=null&&(N.runAsNonRoot=h.runAsNonRoot),h.privileged!=null&&(N.privileged=h.privileged),h.readOnlyRootFilesystem!=null&&(N.readOnlyRootFilesystem=h.readOnlyRootFilesystem),h.allowPrivilegeEscalation!=null&&(N.allowPrivilegeEscalation=h.allowPrivilegeEscalation);const I=(h.capabilitiesAdd||[]).filter(Boolean),q=(h.capabilitiesDrop||[]).filter(Boolean);(I.length||q.length)&&(N.capabilities={},I.length&&(N.capabilities.add=I),q.length&&(N.capabilities.drop=q)),Object.keys(N).length>0&&(s.securityContext=N)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(h=>h.name.trim()&&h.mountPath.trim()).map(h=>{const N={name:h.name,mountPath:h.mountPath};return h.subPath&&(N.subPath=h.subPath),h.readOnly&&(N.readOnly=!0),N})),s}function Yt(t){return t.join(`
|
||
`)}function Jt(t){return t.split(`
|
||
`).map(s=>s.trim()).filter(Boolean)}function qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!1),[h,N]=m.useState(!a),[I,q]=m.useState(a||{}),[V,R]=m.useState([]),[M,z]=m.useState([]),[F,B]=m.useState([]);m.useEffect(()=>{if(!a){N(!1);return}q(a);const r=a?.spec?.template?.spec||{};R((Array.isArray(r.containers)?r.containers:[]).map(Lt)),z((Array.isArray(r.initContainers)?r.initContainers:[]).map(Lt)),B((Array.isArray(r.imagePullSecrets)?r.imagePullSecrets:[]).map(b=>b.name||"")),N(!1)},[a]);const U=(r,b)=>{R(f=>f.map((P,l)=>l===r?{...P,...b}:P))},Y=()=>{R(r=>[...r,Gt(`container-${r.length+1}`)])},S=r=>{R(b=>b.filter((f,P)=>P!==r))},Q=r=>{R(b=>{const f=JSON.parse(JSON.stringify(b[r]));f.name=`${f.name}-copy`;const P=[...b];return P.splice(r+1,0,f),P})},O=(r,b)=>{z(f=>f.map((P,l)=>l===r?{...P,...b}:P))},H=()=>{z(r=>[...r,Gt(`init-${r.length+1}`)])},ne=r=>{z(b=>b.filter((f,P)=>P!==r))},oe=async()=>{for(const r of[...M,...V]){if(!r.name.trim()){i({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!r.image.trim()){i({title:"保存失败",description:`容器 ${r.name} 的镜像不能为空`,variant:"destructive"});return}}D(!0);try{const r=JSON.parse(JSON.stringify(I));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{},r.spec.template.spec.containers=V.map(Ft),r.spec.template.spec.initContainers=M.length>0?M.map(Ft):void 0,r.spec.template.spec.imagePullSecrets=F.filter(f=>f.trim()).length>0?F.filter(f=>f.trim()).map(f=>({name:f})):void 0;const b=JSON.stringify(r,null,2);await te.updateResourceYaml(t,s,"deployments",o,b),i({title:"容器配置已保存",description:`${o} 更新已提交`}),n()}catch(r){i({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{D(!1)}};return h?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:400:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:401:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:402:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:403:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:419:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:421:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:422:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:423:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:424:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:426:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:429:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:430:11",className:"flex items-center gap-2 flex-wrap",children:[F.map((r,b)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:432:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:433:17",className:"text-xs text-slate-300 font-mono",children:r}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:434:17",onClick:()=>B(f=>f.filter((P,l)=>l!==b)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:435:68",className:"h-3 w-3"})})]},b)),F.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:438:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:440:11",className:"flex gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:441:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:r=>{if(r.key==="Enter"){const b=r.target.value.trim();b&&(B(f=>[...f,b]),r.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:448:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>B(r=>[...r,""]),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:450:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(qt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:457:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:460:15",className:"h-4 w-4 text-purple-400"}),containers:M,accentColor:"purple",onAdd:H,onRemove:ne,onUpdate:O}),e.jsx(qt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:469:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:472:15",className:"h-4 w-4 text-blue-400"}),containers:V,accentColor:"blue",onAdd:Y,onRemove:S,onUpdate:U,onDuplicate:Q}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:482:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:483:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:484:13",className:"text-slate-300 font-semibold",children:M.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:485:11",className:"text-slate-300 font-semibold ml-1",children:V.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:487:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:488:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:489:11",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:oe,children:[p?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:490:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:490:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:410:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:411:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function qt({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:d,onRemove:i,onUpdate:p,onDuplicate:D}){const[h,N]=m.useState(new Set([0])),I=R=>{N(M=>{const z=new Set(M);return z.has(R)?z.delete(R):z.add(R),z})},q=n==="blue"?"border-blue-500/30":"border-purple-500/30",V=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:527:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:528:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:529:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:530:11",className:"flex items-center gap-2",children:[o,e.jsx(pe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:532:13",className:"text-sm text-slate-200",children:t}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:533:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:535:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:d,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:536:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:539:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:541:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:543:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((R,M)=>{const z=h.has(M)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:548:13",className:`rounded-lg border ${q} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:550:15",className:`flex items-center justify-between px-3 py-2 ${V} cursor-pointer`,onClick:()=>I(M),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:551:17",className:"flex items-center gap-2",children:[z?e.jsx(Qt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:552:29",className:"h-4 w-4 text-slate-500"}):e.jsx(es,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:552:82",className:"h-4 w-4 text-slate-500"}),e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:553:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:554:19",className:"text-sm font-mono text-slate-200 font-semibold",children:R.name||"(未命名)"}),R.image&&e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:555:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:R.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:557:17",className:"flex items-center gap-1",onClick:F=>F.stopPropagation(),children:[D&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:559:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>D(M),children:e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:561:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:564:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:()=>{confirm(`确认删除容器「${R.name}」?`)&&i(M)},children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:566:21",className:"h-3.5 w-3.5"})})]})]}),z&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:572:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:573:19",container:R,onUpdate:F=>p(M,F)})})]},M)})]})]})}function Us({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:596:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:597:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:598:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:599:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:603:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:604:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:605:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:609:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:610:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:611:11",value:o.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:612:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:613:15"})}),e.jsxs(He,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:615:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:616:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:617:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:618:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:619:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:623:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:624:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:625:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:632:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:633:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:634:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(st,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:635:11",value:Yt(o.command),placeholder:`/bin/sh
|
||
-c`,onChange:n=>s({command:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:639:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:640:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(st,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:641:11",value:Yt(o.args),placeholder:`--config=/etc/app.yaml
|
||
--debug`,onChange:n=>s({args:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:648:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:649:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:650:11",className:a,children:[e.jsx(ts,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:650:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:651:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:653:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:656:9",className:"space-y-1.5",children:[o.env.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:658:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:659:15",value:n.name,placeholder:"KEY",onChange:i=>{const p=[...o.env];p[d]={...n,name:i.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:662:15",value:n.value||"",placeholder:"value",onChange:i=>{const p=[...o.env];p[d]={...n,value:i.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:665:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((i,p)=>p!==d)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:667:17",className:"h-3.5 w-3.5"})})]},d)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:671:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:676:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:677:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:678:11",className:a,children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:678:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:679:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:681:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:684:9",className:"space-y-1.5",children:[o.ports.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:686:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:687:15",value:n.name||"",placeholder:"http",onChange:i=>{const p=[...o.ports];p[d]={...n,name:i.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:690:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:i=>{const p=[...o.ports];p[d]={...n,containerPort:i.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:693:15",value:n.protocol||"TCP",onValueChange:i=>{const p=[...o.ports];p[d]={...n,protocol:i},s({ports:p})},children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:694:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:695:19"})}),e.jsxs(He,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:697:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:698:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:699:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:700:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:703:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:o.ports.filter((i,p)=>p!==d)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:705:17",className:"h-3.5 w-3.5"})})]},d)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:709:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:714:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:715:9",className:a,children:[e.jsx(ys,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:715:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:716:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:717:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:718:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:719:13",value:o.resources.requests?.cpu||"",placeholder:"100m",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:723:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:724:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:725:13",value:o.resources.limits?.cpu||"",placeholder:"500m",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:729:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:730:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:731:13",value:o.resources.requests?.memory||"",placeholder:"128Mi",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:735:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:736:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:737:13",value:o.resources.limits?.memory||"",placeholder:"512Mi",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:745:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:746:9",className:a,children:[e.jsx(Os,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:746:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:747:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:749:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:o[n],onChange:d=>s({[n]:d})},n))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:759:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:760:9",className:a,children:[e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:760:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:761:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:762:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:n=>s({lifecycle:{...o.lifecycle,postStart:n}})}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:764:11",label:"终止前 (preStop)",handler:o.lifecycle?.preStop,onChange:n=>s({lifecycle:{...o.lifecycle,preStop:n}})})]}),!o.lifecycle&&e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:768:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>s({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:770:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:776:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:777:9",className:a,children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:777:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:779:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:780:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:781:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:782:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:783:17",type:"number",value:o.securityContext.runAsUser??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsUser:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:787:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:788:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:789:17",type:"number",value:o.securityContext.runAsGroup??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsGroup:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:793:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:794:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:795:17",value:(o.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesAdd:n.target.value.split(",").map(d=>d.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:799:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:800:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:801:17",value:(o.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesDrop:n.target.value.split(",").map(d=>d.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:806:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:807:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...o.securityContext,runAsNonRoot:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:809:15",label:"privileged",value:!!o.securityContext.privileged,onChange:n=>s({securityContext:{...o.securityContext,privileged:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:811:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...o.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:813:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...o.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:816:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:818:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:822:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:824:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:830:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:831:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:832:11",className:a,children:[e.jsx(Ss,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:832:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:833:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({volumeMounts:[...o.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:835:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:838:9",className:"space-y-1.5",children:[o.volumeMounts.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:840:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:841:15",value:n.name,placeholder:"volume 名称",onChange:i=>{const p=[...o.volumeMounts];p[d]={...n,name:i.target.value},s({volumeMounts:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:844:15",value:n.mountPath,placeholder:"/data",onChange:i=>{const p=[...o.volumeMounts];p[d]={...n,mountPath:i.target.value},s({volumeMounts:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:847:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:i=>{const p=[...o.volumeMounts];p[d]={...n,subPath:i.target.value},s({volumeMounts:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:850:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(wt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:851:17",checked:!!n.readOnly,onCheckedChange:i=>{const p=[...o.volumeMounts];p[d]={...n,readOnly:i},s({volumeMounts:p})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:855:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:o.volumeMounts.filter((i,p)=>p!==d)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:857:17",className:"h-3.5 w-3.5"})})]},d)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:861:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function Ks({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},d=i=>o({...n,...i});return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:881:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:882:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:883:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(wt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:884:9",checked:a,onCheckedChange:i=>o(i?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:889:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:890:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:891:13",value:n.type||"httpGet",onValueChange:i=>d({type:i}),children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:892:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:893:17"})}),e.jsxs(He,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:895:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:896:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:897:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:898:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:903:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:904:15",value:n.httpPath||"",placeholder:"/healthz",onChange:i=>d({httpPath:i.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:907:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:i=>d({httpPort:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:910:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:i=>d({httpHost:i.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),n.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:916:13",className:"mb-2",children:e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:917:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:i=>d({tcpPort:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),n.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:923:13",className:"mb-2",children:e.jsx(st,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:924:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:i=>d({execCommand:i.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:929:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:930:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:931:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:932:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:i=>d({initialDelaySeconds:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:936:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:937:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:938:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:i=>d({periodSeconds:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:942:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:943:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:944:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:i=>d({timeoutSeconds:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:948:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:949:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:950:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:i=>d({successThreshold:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:954:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:955:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:956:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:i=>d({failureThreshold:i.target.value===""?void 0:Number(i.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function Ut({label:t,handler:s,onChange:o}){const a=s||{type:"none"},n=!a.type||a.type==="none"?"__none":a.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:978:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:979:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:980:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:981:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:982:9",value:n,onValueChange:d=>o({...a,type:d==="__none"?"none":d}),children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:983:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:984:13"})}),e.jsxs(He,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:986:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:987:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:988:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:989:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:990:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(st,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:995:9",value:a.execCommand||"",placeholder:"每行一个命令片段",onChange:d=>o({...a,execCommand:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),a.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1000:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1001:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:d=>o({...a,httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1004:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:d=>o({...a,httpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),a.type==="tcpSocket"&&e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1010:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:d=>o({...a,tcpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Qe({label:t,value:s,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1026:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(wt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1027:7",checked:s,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:1028:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function yt(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function kt(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Xs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!1),[h,N]=m.useState(!a),[I,q]=m.useState(a||{}),[V,R]=m.useState(1),[M,z]=m.useState([]),[F,B]=m.useState([]),[U,Y]=m.useState([]);m.useEffect(()=>{const l=a;if(!l){N(!1);return}q(l),R(l?.spec?.replicas??1),z(yt(l?.metadata?.labels)),B(yt(l?.metadata?.annotations)),Y(yt(l?.spec?.selector?.matchLabels)),N(!1)},[a]);const S=(l,w)=>{z(T=>T.map((c,k)=>k===l?{...c,...w}:c))},Q=()=>z(l=>[...l,{key:"",value:""}]),O=l=>z(w=>w.filter((T,c)=>c!==l)),H=(l,w)=>{B(T=>T.map((c,k)=>k===l?{...c,...w}:c))},ne=()=>B(l=>[...l,{key:"",value:""}]),oe=l=>B(w=>w.filter((T,c)=>c!==l)),r=(l,w)=>{Y(T=>T.map((c,k)=>k===l?{...c,...w}:c))},b=()=>Y(l=>[...l,{key:"",value:""}]),f=l=>Y(w=>w.filter((T,c)=>c!==l)),P=async()=>{D(!0);try{const l=JSON.parse(JSON.stringify(I));l.spec=l.spec||{},l.spec.replicas=V;const w=kt(M);l.metadata=l.metadata||{},l.metadata.labels=Object.keys(w).length>0?w:void 0;const T=kt(F);l.metadata.annotations=Object.keys(T).length>0?T:void 0;const c=kt(U);Object.keys(c).length>0&&(l.spec.selector=l.spec.selector||{},l.spec.selector.matchLabels=c,l.spec.template=l.spec.template||{},l.spec.template.metadata=l.spec.template.metadata||{},l.spec.template.metadata.labels={...l.spec.template.metadata.labels,...c});const k=JSON.stringify(l,null,2);await te.updateResourceYaml(t,s,"deployments",o,k),i({title:"基本信息已保存",description:`${o} 更新已提交`}),n()}catch(l){i({title:"保存失败",description:l?.message||String(l),variant:"destructive"})}finally{D(!1)}};return h?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:124:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:125:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:126:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:143:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:145:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:146:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:147:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:148:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:11",className:"flex items-center gap-3",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:13",type:"number",min:0,value:V,onChange:l=>R(Math.max(0,Number(l.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:167:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:169:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:170:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:180:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:190:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:191:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:192:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx($t,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:193:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:195:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:M.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Q,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:9",className:"pt-0 space-y-1.5",children:[M.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:203:35",className:"text-[11px] text-slate-600",children:"无标签"}),M.map((l,w)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:206:15",value:l.key,placeholder:"app",onChange:T=>S(w,{key:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:15",value:l.value,placeholder:"nginx",onChange:T=>S(w,{value:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>O(w),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:48",className:"h-3.5 w-3.5"})})]},w))]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:221:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:222:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:223:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx($t,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:224:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:226:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:b,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:234:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),U.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:43",className:"text-[11px] text-slate-600",children:"无选择器"}),U.map((l,w)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:237:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:238:15",value:l.key,placeholder:"app",onChange:T=>r(w,{key:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:15",value:l.value,placeholder:"nginx",onChange:T=>r(w,{value:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>f(w),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:51",className:"h-3.5 w-3.5"})})]},w))]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:253:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:254:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:255:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Et,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:256:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:258:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:F.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ne,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:265:9",className:"pt-0 space-y-1.5",children:[F.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:40",className:"text-[11px] text-slate-600",children:"无注解"}),F.map((l,w)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:268:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:269:15",value:l.key,placeholder:"deployment.kubernetes.io/revision",onChange:T=>H(w,{key:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:272:15",value:l.value,placeholder:"1",onChange:T=>H(w,{value:T.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:275:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>oe(w),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:53",className:"h-3.5 w-3.5"})})]},w))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:283:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:285:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:289:11",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:P,children:[p?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:290:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:290:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:134:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:135:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const Kt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:tt,color:"text-emerald-400",desc:"PVC"},{key:"emptyDir",label:"临时目录",icon:Ps,color:"text-slate-400",desc:"EmptyDir"},{key:"hostPath",label:"HostPath",icon:rs,color:"text-amber-400",desc:"主机路径"},{key:"nfs",label:"NFS",icon:jt,color:"text-purple-400",desc:"网络存储"},{key:"configMap",label:"配置字典",icon:As,color:"text-blue-400",desc:"ConfigMap"},{key:"secret",label:"密文",icon:os,color:"text-rose-400",desc:"Secret"}];function Zs(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.emptyDir?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||"Directory"}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:{name:s,type:"emptyDir"}}function Qs(t){const s={name:t.name.trim()};if(!s.name)return null;switch(t.type){case"emptyDir":{const o={};t.medium&&(o.medium=t.medium),t.sizeLimit&&(o.sizeLimit=t.sizeLimit),s.emptyDir=o;break}case"hostPath":s.hostPath={path:t.path||"",type:t.pathType||"Directory"};break;case"configMap":{if(s.configMap={name:t.configMapName||""},t.cmItems)try{s.configMap.items=JSON.parse(t.cmItems)}catch{}break}case"secret":{if(s.secret={secretName:t.secretName||""},t.secItems)try{s.secret.items=JSON.parse(t.secItems)}catch{}break}case"persistentVolumeClaim":s.persistentVolumeClaim={claimName:t.pvcName||"",...t.pvcReadOnly?{readOnly:!0}:{}};break;case"nfs":s.nfs={server:t.nfsServer||"",path:t.nfsPath||"",...t.nfsReadOnly?{readOnly:!0}:{}};break}return s}function en({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!1),[h,N]=m.useState(!a),[I,q]=m.useState(a||{}),[V,R]=m.useState([]),[M,z]=m.useState([]),[F,B]=m.useState([]);m.useEffect(()=>{const r=a;if(!r){N(!1);return}q(r);const b=r?.spec?.template?.spec||{},f=Array.isArray(b.volumes)?b.volumes:[];R(f.map(Zs));const P=[...b.containers||[],...b.initContainers||[]],l=P.map(T=>T.name||"(unnamed)");B(l);const w=[];for(const T of P){const c=T.name||"(unnamed)",k=Array.isArray(T.volumeMounts)?T.volumeMounts:[];for(const y of k)w.push({containerName:c,volumeName:y.name||"",mountPath:y.mountPath||"",subPath:y.subPath||"",readOnly:!!y.readOnly})}z(w),N(!1)},[a]);const U=()=>R(r=>[...r,{name:"",type:"emptyDir"}]),Y=r=>{const b=V[r]?.name;R(f=>f.filter((P,l)=>l!==r)),b&&z(f=>f.filter(P=>P.volumeName!==b))},S=(r,b)=>R(f=>f.map((P,l)=>l===r?{...P,...b}:P)),Q=()=>z(r=>[...r,{containerName:F[0]||"",volumeName:"",mountPath:"",subPath:"",readOnly:!1}]),O=r=>z(b=>b.filter((f,P)=>P!==r)),H=(r,b)=>z(f=>f.map((P,l)=>l===r?{...P,...b}:P)),ne=async()=>{D(!0);try{const r=JSON.parse(JSON.stringify(I));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{};const b=r.spec.template.spec,f=V.map(Qs).filter(Boolean);f.length>0?b.volumes=f:delete b.volumes;const P=[...b.containers||[],...b.initContainers||[]];for(const w of P){const T=w.name||"(unnamed)",c=M.filter(k=>k.containerName===T&&k.volumeName&&k.mountPath).map(k=>{const y={name:k.volumeName,mountPath:k.mountPath,readOnly:k.readOnly};return k.subPath&&(y.subPath=k.subPath),y});c.length>0?w.volumeMounts=c:delete w.volumeMounts}b.containers=P.filter(w=>!(b.initContainers||[]).includes(w)),b.initContainers=b.initContainers||[];const l=JSON.stringify(r,null,2);await te.updateResourceYaml(t,s,"deployments",o,l),i({title:"存储配置已保存",description:`${o} 更新已提交`}),n()}catch(r){i({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{D(!1)}};if(h)return e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:193:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:194:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:195:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:196:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})});if(!a)return e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:204:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:205:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})});const oe=V.map(r=>r.name).filter(Boolean);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:219:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:220:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(tt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:221:15",className:"h-4 w-4 text-emerald-400"}),"定义数据卷",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:222:15",variant:"outline",className:"border-slate-700 text-slate-400",children:V.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:224:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:U,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:225:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:229:9",className:"pt-0 space-y-3",children:V.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(tt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:232:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷"]}):V.map((r,b)=>{const f=Kt.find(l=>l.key===r.type),P=f?.icon||ut;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:239:15",className:"bg-slate-950/50 border border-slate-800 rounded-lg p-3 space-y-2.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:241:17",className:"flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:242:19",className:`h-4 w-4 ${f?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:243:19",className:"text-[10px] text-slate-500 w-16 shrink-0",children:"数据卷名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:244:19",value:r.name,onChange:l=>S(b,{name:l.target.value}),placeholder:"volume-name",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:247:19",value:r.type,onValueChange:l=>S(b,{type:l}),children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:248:21",className:"h-7 w-[120px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:23",className:"flex items-center gap-1.5",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:250:25",className:"h-3 w-3"}),f?.label||r.type]})}),e.jsx(He,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:253:21",children:Kt.map(l=>{const w=l.icon;return e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:257:27",value:l.key,children:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:258:29",className:"flex items-center gap-1.5 text-xs",children:[e.jsx(w,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:31",className:"h-3 w-3"}),l.label]})},l.key)})})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:266:19",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>Y(b),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:267:21",className:"h-3.5 w-3.5"})})]}),r.type==="persistentVolumeClaim"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:273:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:274:21",value:r.pvcName||"",onChange:l=>S(b,{pvcName:l.target.value}),placeholder:"PVC 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:276:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:23",type:"checkbox",checked:!!r.pvcReadOnly,onChange:l=>S(b,{pvcReadOnly:l.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="emptyDir"&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:285:19",className:"flex items-center gap-2 pl-[88px]",children:e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:286:21",value:r.sizeLimit||"",onChange:l=>S(b,{sizeLimit:l.target.value}),placeholder:"sizeLimit (如 512Mi, 可为空)",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})}),r.type==="hostPath"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:293:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:21",value:r.path||"",onChange:l=>S(b,{path:l.target.value}),placeholder:"主机路径 /data/app",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:297:21",value:r.pathType||"Directory",onChange:l=>S(b,{pathType:l.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:299:23",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:300:23",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:301:23",value:"",children:"(默认)"})]})]}),r.type==="nfs"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:307:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:308:21",value:r.nfsServer||"",onChange:l=>S(b,{nfsServer:l.target.value}),placeholder:"NFS Server IP",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:21",className:"text-slate-600 text-xs",children:":"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:312:21",value:r.nfsPath||"",onChange:l=>S(b,{nfsPath:l.target.value}),placeholder:"/export/path",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:315:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:316:23",type:"checkbox",checked:!!r.nfsReadOnly,onChange:l=>S(b,{nfsReadOnly:l.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="configMap"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:324:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:325:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"ConfigMap"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:326:21",value:r.configMapName||"",onChange:l=>S(b,{configMapName:l.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:329:21",value:r.cmItems||"",onChange:l=>S(b,{cmItems:l.target.value}),placeholder:"KeyToPath (可为空)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),r.type==="secret"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:336:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:337:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"密文"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:338:21",value:r.secretName||"",onChange:l=>S(b,{secretName:l.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:341:21",value:r.secItems||"",onChange:l=>S(b,{secItems:l.target.value}),placeholder:"KeyToPath (可为空)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]},b)})})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:353:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:354:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:355:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:356:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:357:15",className:"h-4 w-4 text-blue-400"}),"将数据卷挂载到容器",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:358:15",variant:"outline",className:"border-slate-700 text-slate-400",children:M.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:360:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Q,disabled:oe.length===0||F.length===0,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:362:15",className:"h-3 w-3 mr-1"}),"添加挂载"]})]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:366:9",className:"pt-0 space-y-2",children:M.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:368:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:369:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),oe.length===0?"请先定义数据卷":"未配置挂载点"]}):M.map((r,b)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:373:13",className:"flex items-center gap-2 bg-slate-950/50 border border-slate-800 rounded-lg p-2.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:375:15",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"容器:"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:376:15",value:r.containerName,onChange:f=>H(b,{containerName:f.target.value}),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[120px]",children:[F.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:378:45",value:"",children:"(无容器)"}),F.map(f=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:379:39",value:f,children:f},f))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:382:15",value:r.volumeName,onChange:f=>H(b,{volumeName:f.target.value}),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[100px]",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:384:17",value:"",children:"选择数据卷"}),oe.map(f=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:385:40",value:f,children:f},f))]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:388:15",value:r.mountPath,onChange:f=>H(b,{mountPath:f.target.value}),placeholder:"挂载路径 /app/data",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:392:15",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:393:17",onClick:()=>H(b,{readOnly:!1}),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${r.readOnly?"text-slate-500":"bg-blue-500/20 text-blue-300"}`,children:"读写"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:397:17",onClick:()=>H(b,{readOnly:!0}),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${r.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500"}`,children:"只读"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:402:15",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>O(b),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:403:17",className:"h-3.5 w-3.5"})})]},b))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:411:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:412:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:413:9",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:ne,children:[p?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:414:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:414:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]})}function tn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!1),[h,N]=m.useState(!a),[I,q]=m.useState(a||{}),[V,R]=m.useState("RollingUpdate"),[M,z]=m.useState("25%"),[F,B]=m.useState("25%"),[U,Y]=m.useState("10"),[S,Q]=m.useState("600"),[O,H]=m.useState("nodeSelector"),[ne,oe]=m.useState(""),[r,b]=m.useState([]),[f,P]=m.useState(!1),[l,w]=m.useState([]),[T,c]=m.useState({}),[k,y]=m.useState([]),[J,_]=m.useState("ClusterFirst"),[$,be]=m.useState("Always"),[K,he]=m.useState("default-scheduler"),[Ne,de]=m.useState("30"),[A,ce]=m.useState(""),[ge,fe]=m.useState(""),[g,ye]=m.useState(""),[je,Ae]=m.useState(""),[We,rt]=m.useState(!1),[Je,lt]=m.useState(!1),[qe,Ce]=m.useState(!1),[Ct,St]=m.useState(!1),[Pt,At]=m.useState(!1),[dt,Ie]=m.useState([]),[Vt,Wt]=m.useState(""),[Tt,Rt]=m.useState(""),[it,Me]=m.useState([]);m.useEffect(()=>{const x=a;if(!x){N(!1);return}q(x);const j=x?.spec||{},E=j?.template?.spec||{},ee=j.strategy||{};R(ee.type||"RollingUpdate");const re=ee.rollingUpdate||{};z(String(re.maxSurge??"25%")),B(String(re.maxUnavailable??"25%")),Y(j.revisionHistoryLimit!=null?String(j.revisionHistoryLimit):"10"),Q(j.progressDeadlineSeconds!=null?String(j.progressDeadlineSeconds):"600");const ke=E.nodeSelector||{},ze=Object.entries(ke).map(([le,_e])=>({key:le,value:String(_e)}));w(ze),oe(E.nodeName||""),E.nodeName?H("nodeName"):E.affinity?.nodeAffinity?H("nodeAffinity"):ze.length>0&&H("nodeSelector"),t&&(P(!0),te.getClusterNodes(t).then(le=>{const It=(Array.isArray(le)?le:le?.items||le?.list||[]).map(Xe=>{const Ve=Xe.metadata||{},Ze=Xe.status||{},hs=(Array.isArray(Ze.addresses)?Ze.addresses:[]).find(us=>us.type==="InternalIP")?.address||"";return{name:Ve.name||"",ip:hs,labels:Ve.labels||{}}});b(It);const $e={};for(const Xe of It)for(const[Ve,Ze]of Object.entries(Xe.labels)){const mt=String(Ze);$e[Ve]||($e[Ve]=[]),$e[Ve].includes(mt)||$e[Ve].push(mt)}c($e)}).catch(()=>{}).finally(()=>P(!1)));const Ke=Array.isArray(E.tolerations)?E.tolerations:[];y(Ke.map(le=>({key:le.key||"",operator:le.operator||"Equal",value:le.value||"",effect:le.effect||"",tolerationSeconds:le.tolerationSeconds!=null?String(le.tolerationSeconds):""}))),_(E.dnsPolicy||"ClusterFirst"),be(E.restartPolicy||"Always"),he(E.schedulerName||"default-scheduler"),de(E.terminationGracePeriodSeconds!=null?String(E.terminationGracePeriodSeconds):"30"),ce(E.serviceAccountName||"");const Ee=E.securityContext||{};fe(Ee.fsGroup!=null?String(Ee.fsGroup):""),ye(Ee.runAsUser!=null?String(Ee.runAsUser):""),Ae(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),rt(!!Ee.runAsNonRoot),lt(!!E.hostNetwork),Ce(!!E.hostIPC),St(!!E.hostPID),At(!!E.shareProcessNamespace);const pt=Array.isArray(E.hostAliases)?E.hostAliases:[];Ie(pt.map(le=>({ip:le.ip||"",hostnames:Array.isArray(le.hostnames)?le.hostnames.join(", "):""})));const W=E.dnsConfig||{};Wt(Array.isArray(W.nameservers)?W.nameservers.join(`
|
||
`):""),Rt(Array.isArray(W.searches)?W.searches.join(`
|
||
`):"");const me=Array.isArray(W.options)?W.options:[];Me(me.map(le=>({name:le.name||"",value:le.value||""}))),N(!1)},[a]);const Bt=()=>w(x=>[...x,{key:"",value:""}]),Ot=x=>w(j=>j.filter((E,ee)=>ee!==x)),Ue=(x,j)=>w(E=>E.map((ee,re)=>re===x?{...ee,...j}:ee)),xs=async()=>{D(!0);try{const x=JSON.parse(JSON.stringify(I));x.spec=x.spec||{},x.spec.template=x.spec.template||{},x.spec.template.spec=x.spec.template.spec||{};const j=x.spec.template.spec;if(x.spec.strategy={type:V},V==="RollingUpdate"&&(x.spec.strategy.rollingUpdate={maxSurge:M,maxUnavailable:F}),U&&(x.spec.revisionHistoryLimit=Number(U)),S&&(x.spec.progressDeadlineSeconds=Number(S)),O==="nodeName"&&ne.trim())j.nodeName=ne.trim(),delete j.nodeSelector,j.affinity&&delete j.affinity.nodeAffinity;else if(O==="nodeSelector"){const W={};for(const{key:me,value:le}of l){const _e=me.trim();_e&&(W[_e]=le)}Object.keys(W).length>0?j.nodeSelector=W:delete j.nodeSelector,j.nodeName&&delete j.nodeName,j.affinity&&delete j.affinity.nodeAffinity}else if(O==="nodeAffinity"){const W=l.filter(me=>me.key.trim()).map(me=>({key:me.key.trim(),operator:"In",values:[me.value]}));W.length>0?(j.affinity=j.affinity||{},j.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:W}]}}):j.affinity&&delete j.affinity.nodeAffinity,delete j.nodeSelector,j.nodeName&&delete j.nodeName}const E=k.filter(W=>W.key||W.operator==="Exists").map(W=>{const me={};return W.key&&(me.key=W.key),W.operator&&(me.operator=W.operator),W.value&&W.operator!=="Exists"&&(me.value=W.value),W.effect&&(me.effect=W.effect),W.tolerationSeconds&&W.effect==="NoExecute"&&(me.tolerationSeconds=Number(W.tolerationSeconds)),me});E.length>0?j.tolerations=E:delete j.tolerations,J&&(j.dnsPolicy=J),$&&(j.restartPolicy=$),K&&(j.schedulerName=K),Ne&&(j.terminationGracePeriodSeconds=Number(Ne)),A&&(j.serviceAccountName=A);const ee={};ge&&(ee.fsGroup=Number(ge)),g&&(ee.runAsUser=Number(g)),je&&(ee.runAsGroup=Number(je)),We&&(ee.runAsNonRoot=!0),Object.keys(ee).length>0?j.securityContext=ee:delete j.securityContext,Je?j.hostNetwork=!0:delete j.hostNetwork,qe?j.hostIPC=!0:delete j.hostIPC,Ct?j.hostPID=!0:delete j.hostPID,Pt?j.shareProcessNamespace=!0:delete j.shareProcessNamespace;const re=dt.filter(W=>W.ip.trim()).map(W=>({ip:W.ip.trim(),hostnames:W.hostnames.split(/[,\s]+/).map(me=>me.trim()).filter(Boolean)})).filter(W=>W.hostnames.length>0);re.length>0?j.hostAliases=re:delete j.hostAliases;const ke={},ze=Vt.split(`
|
||
`).map(W=>W.trim()).filter(Boolean);ze.length>0&&(ke.nameservers=ze);const Ke=Tt.split(`
|
||
`).map(W=>W.trim()).filter(Boolean);Ke.length>0&&(ke.searches=Ke);const Ee=it.filter(W=>W.name.trim()).map(W=>{const me={name:W.name.trim()};return W.value.trim()&&(me.value=W.value.trim()),me});Ee.length>0&&(ke.options=Ee),Object.keys(ke).length>0?j.dnsConfig=ke:delete j.dnsConfig;const pt=JSON.stringify(x,null,2);await te.updateResourceYaml(t,s,"deployments",o,pt),i({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(x){i({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{D(!1)}};return h?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:328:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:329:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:330:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:331:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:348:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ct,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:356:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:359:15",type:"radio",checked:V==="RollingUpdate",onChange:()=>R("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:363:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:15",type:"radio",checked:V==="Recreate",onChange:()=>R("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),V==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:373:17",value:M,onChange:x=>z(x.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:376:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:377:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:378:17",value:F,onChange:x=>B(x.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:396:13",type:"number",value:U,onChange:x=>Y(x.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:399:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:400:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:401:13",type:"number",value:S,onChange:x=>Q(x.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:409:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:410:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:411:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:15",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:414:13",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[{key:"nodeName",label:"节点名称",desc:"指定节点"},{key:"nodeSelector",label:"标签选择器",desc:"key=value"},{key:"nodeAffinity",label:"节点亲和性",desc:"高级规则"}].map(x=>e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",onClick:()=>H(x.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${O===x.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:x.label},x.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:11",className:"text-xs text-slate-500 mt-1",children:[O==="nodeName"&&"Pod 将直接调度到指定节点",O==="nodeSelector"&&"Pod 将调度到匹配标签的节点",O==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:9",className:"pt-0",children:[O==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:440:13",className:"space-y-2",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:441:15",className:"text-slate-400 text-xs",children:"请选择节点"}),f?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:443:17",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:443:81",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:445:17",value:ne,onChange:x=>oe(x.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:447:19",value:"",children:"(不指定)"}),r.map(x=>e.jsxs("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:449:21",value:x.name,children:[x.name," ",x.ip?`(${x.ip})`:""]},x.name))]}),ne&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:454:17",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:455:24",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:ne})]})]}),O==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:463:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:464:15",className:"flex items-center justify-between",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:17",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:17",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:Bt,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:19",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:17",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):l.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:475:19",value:x.key,onChange:E=>Ue(j,{key:E.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:21",value:"",children:"选择标签"}),Object.entries(T).map(([E,ee])=>e.jsxs("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:479:23",value:E,children:[E," (",ee.length,")"]},E))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:483:19",value:x.value,onChange:E=>Ue(j,{value:E.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!x.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:21",value:"",children:"选择值"}),(T[x.key]||[]).map(E=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:488:23",value:E,children:E},E))]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Ot(j),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:21",className:"h-3 w-3"})})]},j))]}),O==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:501:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:502:15",className:"flex items-center justify-between",children:[e.jsxs(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:503:17",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:25",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:17",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:Bt,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:19",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:17",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):l.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:514:19",value:x.key,onChange:E=>Ue(j,{key:E.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:21",value:"",children:"选择标签"}),Object.entries(T).map(([E,ee])=>e.jsxs("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:23",value:E,children:[E," (",ee.length,")"]},E))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:19",value:x.value,onChange:E=>Ue(j,{value:E.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!x.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:524:21",value:"",children:"选择值"}),(T[x.key]||[]).map(E=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:23",value:E,children:E},E))]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:529:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Ot(j),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:530:21",className:"h-3 w-3"})})]},j))]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:541:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:542:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(vt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:546:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:547:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:548:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:13",value:J,onChange:x=>_(x.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:551:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:552:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:553:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:557:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:558:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:13",value:$,onChange:x=>be(x.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:561:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:562:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:563:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:566:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:568:13",value:K,onChange:x=>he(x.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:571:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:572:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:573:13",type:"number",value:Ne,onChange:x=>de(x.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:576:11",className:"col-span-2",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:577:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:578:13",value:A,onChange:x=>ce(x.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:585:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:586:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:587:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:588:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:591:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:592:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:593:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:594:13",type:"number",value:ge,onChange:x=>fe(x.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:597:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:598:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:599:13",type:"number",value:g,onChange:x=>ye(x.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:602:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:603:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:604:13",type:"number",value:je,onChange:x=>Ae(x.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:607:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:608:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:609:15",type:"checkbox",checked:We,onChange:x=>rt(x.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:618:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:619:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:620:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:621:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:624:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:625:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:626:13",type:"checkbox",checked:Je,onChange:x=>lt(x.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:630:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:631:13",type:"checkbox",checked:qe,onChange:x=>Ce(x.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:635:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:636:13",type:"checkbox",checked:Ct,onChange:x=>St(x.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:640:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:641:13",type:"checkbox",checked:Pt,onChange:x=>At(x.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:649:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:650:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:651:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ks,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:652:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:655:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:656:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:657:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:659:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:660:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:661:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:662:15",value:Vt,onChange:x=>Wt(x.target.value),placeholder:`8.8.8.8
|
||
114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:667:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:668:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:669:15",value:Tt,onChange:x=>Rt(x.target.value),placeholder:`svc.cluster.local
|
||
cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:675:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:676:13",className:"flex items-center justify-between mb-1",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:677:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:678:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>Me(x=>[...x,{name:"",value:""}]),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:680:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),it.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:684:15",className:"text-xs text-slate-600 italic",children:"未配置"}):it.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:686:15",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:687:17",value:x.name,onChange:E=>Me(ee=>ee.map((re,ke)=>ke===j?{...re,name:E.target.value}:re)),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:689:17",className:"text-slate-600",children:":"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:690:17",value:x.value,onChange:E=>Me(ee=>ee.map((re,ke)=>ke===j?{...re,value:E.target.value}:re)),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:692:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Me(E=>E.filter((ee,re)=>re!==j)),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:694:19",className:"h-3 w-3"})})]},j))]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:703:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:704:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:705:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(vs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:706:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:709:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:710:11",className:"flex items-center justify-between mb-1",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:711:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:712:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>Ie(x=>[...x,{ip:"",hostnames:""}]),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:714:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),dt.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:718:13",className:"text-xs text-slate-600 italic",children:"未配置"}):dt.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:720:13",className:"flex items-center gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:721:15",value:x.ip,onChange:E=>Ie(ee=>ee.map((re,ke)=>ke===j?{...re,ip:E.target.value}:re)),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:723:15",className:"text-slate-600",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:724:15",value:x.hostnames,onChange:E=>Ie(ee=>ee.map((re,ke)=>ke===j?{...re,hostnames:E.target.value}:re)),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:726:15",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Ie(E=>E.filter((ee,re)=>re!==j)),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:728:17",className:"h-3 w-3"})})]},j))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:736:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:737:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:738:9",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:xs,children:[p?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:739:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:739:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:339:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:340:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const sn=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Xt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function nn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!0),[h,N]=m.useState([]),[I,q]=m.useState([]),[V,R]=m.useState({}),[M,z]=m.useState(null),[F,B]=m.useState(null),[U,Y]=m.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[S,Q]=m.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),O=c=>{Y(k=>({...k,ports:[...k.ports,c?{name:c.name,port:String(c.port),targetPort:String(c.targetPort),protocol:c.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},H=(c,k,y)=>{Y(J=>({...J,ports:J.ports.map((_,$)=>$===c?{..._,[k]:y}:_)}))},ne=c=>{U.ports.length<=1||Y(k=>({...k,ports:k.ports.filter((y,J)=>J!==c)}))},oe=m.useCallback(async()=>{D(!0);try{const c=a?.spec?.selector?.matchLabels||a?.selector||{};R(c);const[k,y]=await Promise.all([te.getNamespaceServices(t,s).catch(()=>[]),te.getNamespaceIngresses(t,s).catch(()=>[])]),J=Xt(k),_=Xt(y),$=J.map(K=>{const he=K.spec||{},Ne=Array.isArray(he.ports)?he.ports.map(de=>({port:de.port,targetPort:de.targetPort,protocol:de.protocol||"TCP",nodePort:de.nodePort,name:de.name})):Array.isArray(K.portList)?K.portList.map(de=>({port:de.port,targetPort:de.targetPort,protocol:de.protocol||"TCP",nodePort:de.nodePort,name:de.name})):[];return{name:K.name||K.metadata?.name||"",type:he.type||K.type||"ClusterIP",clusterIP:he.clusterIP||K.cluster_ip||"<none>",externalIP:Array.isArray(he.externalIPs)?he.externalIPs.join(","):"",ports:Ne,selector:he.selector||K.selector||{},age:K.age||K.created_at||"",raw:K}}),be=_.map(K=>{const he=K.spec||{},de=(Array.isArray(he.rules)?he.rules:Array.isArray(K.rules)?K.rules:[]).map(A=>({host:A.host||"",paths:(A.http?.paths||A.paths||[]).map(ce=>({path:ce.path||"/",backend:{service:ce.backend?.service?.name||ce.backendService||"",port:ce.backend?.service?.port?.number||ce.backend?.service?.port?.name||ce.backendPort||""}}))}));return{name:K.name||K.metadata?.name||"",className:he.ingressClassName||K.ingressClass||"<none>",hosts:de.map(A=>A.host).filter(Boolean),rules:de,raw:K}});N($),q(be)}catch(c){console.error("M9 load error:",c)}finally{D(!1)}},[t,s,a]);m.useEffect(()=>{oe()},[oe]);const r=c=>Object.keys(c).length===0?!1:Object.entries(c).every(([k,y])=>V[k]===y),b=h.filter(c=>r(c.selector)),f=new Set(b.map(c=>c.name)),P=I.filter(c=>c.rules.some(k=>k.paths.some(y=>f.has(y.backend.service)))),l=async()=>{const c=U.name.trim()||`${o}-svc`,k=U.ports.map(_=>{const $={name:_.name||"http",port:Number(_.port)||80,targetPort:/^\d+$/.test(String(_.targetPort))?Number(_.targetPort):_.targetPort,protocol:_.protocol||"TCP"};return U.type==="NodePort"&&_.nodePort&&($.nodePort=Number(_.nodePort)),$}),y={apiVersion:"v1",kind:"Service",metadata:{name:c,namespace:s,labels:{app:o}},spec:{type:U.type,selector:V,ports:k}},J=JSON.stringify(y,null,2);try{await te.updateResourceYaml(t,s,"services",c,J),i({title:"Service 已创建",description:c}),B(null),oe()}catch(_){i({title:"创建失败",description:_?.message||String(_),variant:"destructive"})}},w=async()=>{const c=S.name.trim()||`${o}-ingress`,k=b[0]?.name||`${o}-svc`,y=Number(S.svcPort)||80,J={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:c,namespace:s,labels:{app:o}},spec:{ingressClassName:S.className||void 0,rules:[{host:S.host||void 0,http:{paths:[{path:S.path||"/",pathType:S.pathType||"Prefix",backend:{service:{name:k,port:{number:y}}}}]}}]}};S.className||delete J.spec.ingressClassName;const _=JSON.stringify(J,null,2);try{await te.updateResourceYaml(t,s,"ingresses",c,_),i({title:"Ingress 已创建",description:c}),B(null),oe()}catch($){i({title:"创建失败",description:$?.message||String($),variant:"destructive"})}},T=async(c,k)=>{if(window.confirm(`确认删除 ${c==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`))try{const y=c==="service"?"services":"ingresses";await te.deleteResourceYaml(t,s,y,k),i({title:"已删除",description:`${c==="service"?"Service":"Ingress"} ${k} 已删除`}),oe()}catch(y){i({title:"删除失败",description:y?.message||String(y),variant:"destructive"})}};return p?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:281:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:282:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:283:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:284:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:5",className:"space-y-4",children:[e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:295:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:296:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:297:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:298:13",className:"flex flex-wrap gap-1",children:[Object.entries(V).map(([c,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:300:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[c,"=",k]},c)),Object.keys(V).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:oe,children:[e.jsx(ct,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:314:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:315:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:318:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:320:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[b.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:322:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Y({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),B("service")},children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:9",className:"pt-0",children:[b.length===0&&F!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:334:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:335:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:339:13",className:"space-y-2",children:b.map(c=>{const k=r(c.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:343:19",className:`rounded-lg border p-3 ${k?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:346:23",className:"text-sm font-semibold text-slate-200",children:c.name}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:347:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:c.type}),k&&e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:348:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:23",className:"text-[11px] text-slate-500 ml-auto",children:c.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:350:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>z({kind:"service",name:c.name}),children:[e.jsx(Dt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:352:25",className:"h-3 w-3 mr-1"}),"YAML"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>T("service",c.name),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:c.ports.map((y,J)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[y.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:363:38",className:"text-slate-500",children:[y.name,": "]}),y.port,"→",y.targetPort,y.nodePort?`/NodePort:${y.nodePort}`:"","/",y.protocol]},J))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:369:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:23",className:"text-slate-600",children:"selector:"}),Object.entries(c.selector).map(([y,J])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"text-slate-500",children:[y,"=",J]},y))]})]},c.name)})}),F==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:383:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:384:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:385:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:389:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:390:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:391:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:392:19",value:U.name,onChange:c=>Y(k=>({...k,name:c.target.value})),placeholder:`${o}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:396:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:397:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:398:19",value:U.type,onChange:c=>Y(k=>({...k,type:c.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:409:17",className:"flex gap-1.5",children:sn.map(c=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",onClick:()=>O(c),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium
|
||
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:414:23",className:"h-2.5 w-2.5"}),c.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:416:23",className:"text-slate-500 text-[9px]",children:[c.protocol," ",c.port,":",c.targetPort]})]},c.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:423:15",className:"space-y-2",children:[e.jsxs(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:425:24",className:"text-slate-600",children:["(",U.ports.length," 个端口)"]})]}),U.ports.map((c,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:428:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:430:21",value:c.name,onChange:y=>H(k,"name",y.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:21",value:c.protocol,onChange:y=>H(k,"protocol",y.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:437:23",value:"UDP",children:"UDP"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:c.port,onChange:y=>H(k,"port",y.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:443:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:c.targetPort,onChange:y=>H(k,"targetPort",y.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),U.type==="NodePort"&&e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:449:23",value:c.nodePort,onChange:y=>H(k,"nodePort",y.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>ne(k),disabled:U.ports.length<=1,children:e.jsx(ft,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:456:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:461:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>O(),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:463:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:468:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(V).length>0?Object.entries(V).map(([c,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:472:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[c,"=",k]},c)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:475:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>B(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:481:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:l,children:"创建"})]})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:492:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:493:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:495:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[P.length,"/",I.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:497:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Q(c=>({...c,name:`${o}-ingress`,svcPort:String(b[0]?.ports[0]?.port||80)})),B("ingress")},children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:9",className:"pt-0",children:[I.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:509:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:510:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:514:13",className:"space-y-2",children:I.map(c=>{const k=P.includes(c);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:518:19",className:`rounded-lg border p-3 ${k?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:34",className:"h-4 w-4 text-purple-400"}):e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:521:23",className:"text-sm font-semibold text-slate-200",children:c.name}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:522:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:c.className}),k&&e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:523:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400 ml-auto",onClick:()=>z({kind:"ingress",name:c.name}),children:[e.jsx(Dt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:526:25",className:"h-3 w-3 mr-1"}),"YAML"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>T("ingress",c.name),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:21",className:"mt-2 space-y-1 text-[11px]",children:c.rules.map((y,J)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"flex items-start gap-1.5",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:537:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:27",className:"text-slate-300",children:y.host||"*"}),y.paths.map((_,$)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[_.path," → ",_.backend?.service,":",_.backend?.port]},$))]},J))})]},c.name)})}),F==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:555:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:556:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:557:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:559:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:560:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:561:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:562:19",value:S.name,onChange:c=>Q(k=>({...k,name:c.target.value})),placeholder:`${o}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:568:19",value:S.className,onChange:c=>Q(k=>({...k,className:c.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:573:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:574:19",value:S.host,onChange:c=>Q(k=>({...k,host:c.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:579:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:580:19",value:S.path,onChange:c=>Q(k=>({...k,path:c.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:17",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:585:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:586:19",type:"number",value:S.svcPort,onChange:c=>Q(k=>({...k,svcPort:c.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:591:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>B(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:592:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:w,children:"创建"})]})]})]})]}),M&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:9",className:"hidden"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:605:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:606:9",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:d,children:"完成"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:607:9",size:"sm",className:"h-7 bg-slate-600 text-xs",onClick:n,children:"保存并关闭"})]})]})}function on({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:d}){const i=as(),{toast:p}=Pe(),[D,h]=m.useState(null),[N,I]=m.useState(null),[q,V]=m.useState([]),[R,M]=m.useState([]),[z,F]=m.useState([]),[B,U]=m.useState(!0),[Y,S]=m.useState(""),[Q,O]=m.useState(null),[H,ne]=m.useState(""),[oe,r]=m.useState(0),[b,f]=m.useState(null),[P,l]=m.useState(null),w=D?.cluster_id||D?.clusterId||t,T=g=>Array.isArray(g)?g:g?.list||g?.items||g?.data||[],c=m.useCallback(async()=>{U(!0);try{const[g,ye,je,Ae]=await Promise.all([te.getDeployment(t,s,o).catch(()=>null),te.getNamespacePods(t,s).catch(()=>[]),te.getReplicaSets(t,s).catch(()=>[]),te.getDeploymentRevisions(t,s,o).catch(()=>[])]),We=g||(Array.isArray(g)?g[0]:null);h(We),r(We?.replicas||0),ne(We?.image||"");const Je=T(ye).filter(Ce=>Ce.namespace===s&&(Ce.name||"").startsWith(o));V(Je);const qe=T(je).filter(Ce=>Ce.namespace===s&&(Ce.owner_deployment===o||(Ce.name||"").startsWith(o)));M(qe),F(T(Ae))}catch(g){console.error("加载详情失败:",g)}finally{U(!1)}},[t,s,o]),k=m.useCallback(async()=>{try{const g=await te.getResourceYaml(t,s,"deployments",o);let ye=null;try{ye=JSON.parse(g)}catch{try{ye=(await gs(()=>import("./js-yaml-37NdyH6G.js"),[],import.meta.url)).load(g)}catch{ye=null}}I(ye||D)}catch(g){console.warn("加载 manifest 失败(编辑功能降级):",g),I(D)}},[t,s,o,D]);m.useEffect(()=>{c()},[c]),m.useEffect(()=>{a==="edit"&&!N&&k()},[a,N,k]);const y=async()=>{S("scale");try{await te.scaleDeployment(t,s,o,oe),p({title:"伸缩成功",description:`副本数已设置为 ${oe}`}),O(null),c()}catch(g){p({title:"操作失败",description:g?.message||String(g),variant:"destructive"})}finally{S("")}},J=async()=>{if(confirm(`确认滚动重启 Deployment "${o}"?`)){S("restart");try{await te.restartDeployment(t,s,o),p({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(c,1500)}catch(g){p({title:"重启失败",description:g?.message||String(g),variant:"destructive"})}finally{S("")}}},_=async()=>{const g=!!D?.paused,ye=g?"恢复":"暂停";if(confirm(`确认${ye} Deployment "${o}" 的滚动更新?`)){S(g?"resume":"pause");try{g?await te.resumeDeployment(t,s,o):await te.pauseDeployment(t,s,o),p({title:`${ye}成功`,description:`Deployment 滚动更新已${ye}`}),setTimeout(c,1e3)}catch(je){p({title:`${ye}失败`,description:je?.message||String(je),variant:"destructive"})}finally{S("")}}},$=()=>{O({kind:"cicd"})},be=async()=>{if(H.trim()){S("image");try{await te.updateDeploymentImage(t,s,o,H),p({title:"镜像更新成功",description:`正在滚动更新为 ${H}`}),O(null),c()}catch(g){p({title:"更新失败",description:g?.message||String(g),variant:"destructive"})}finally{S("")}}},K=async()=>{S("delete");try{const g=Nt.getState().token||"",je=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,Ae=await fetch(je,{method:"DELETE",headers:{Authorization:`Bearer ${g}`}});if(!Ae.ok)throw new Error(`HTTP ${Ae.status}`);p({title:"删除成功",description:`${o} 已删除`}),O(null),setTimeout(()=>i(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(g){p({title:"删除失败",description:g?.message||String(g),variant:"destructive"})}finally{S("")}},he=g=>O({kind:"podLogs",pod:g.name}),Ne=g=>O({kind:"podYaml",pod:g.name}),de=g=>{f(g.name)},A=g=>{l(g.name)};if(B)return e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:262:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!D)return e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:271:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:272:9",className:"p-12 text-center",children:[e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:274:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:275:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const ce=D.ready_replicas||D.readyReplicas||0,ge=D.replicas||0,fe=ce===ge&&ge>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:287:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:289:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:292:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:294:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:295:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:296:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:298:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(se,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:299:15",className:fe?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[fe?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:304:30",className:"h-3 w-3 mr-1"}):e.jsx(Mt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:304:73",className:"h-3 w-3 mr-1"}),ce,"/",ge]}),D?.paused&&e.jsxs(se,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:308:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:309:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:313:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:314:19",className:"text-slate-400",children:D.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:319:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:322:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>d("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:328:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>d("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>d("yaml"),children:"YAML"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:342:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:c,title:"刷新",children:e.jsx(ct,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:343:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:347:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:348:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>O({kind:"image"}),children:[e.jsx(Ms,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:349:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:351:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:J,children:[e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:352:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:354:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!Y,onClick:_,children:D?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:362:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:365:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:$,children:[e.jsx(Ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:366:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:368:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>O({kind:"delete"}),children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:369:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:377:9",clusterCode:t,namespace:s,deployment:D,pods:q,replicaSets:R,revisions:z,onRefresh:c,onShowPodLogs:he,onShowPodTerminal:de,onShowPodYaml:Ne,onShowPodFileBrowser:A}):a==="yaml"?e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:392:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:c,onClose:()=>d("view")}):e.jsx(an,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:404:9",clusterCode:t,namespace:s,deploymentName:o,manifest:N,onSaved:()=>{k(),c(),d("view")},onCancel:()=>d("view")}),Q?.kind==="yaml"&&e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:416:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>O(null),onSaved:c}),Q?.kind==="image"&&e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:429:9",title:"调整镜像版本",onClose:()=>O(null),children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:430:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:432:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:433:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:D.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:435:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:436:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:437:15",value:H,onChange:g=>ne(g.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:441:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:442:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:()=>O(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:443:15",className:"bg-blue-600 hover:bg-blue-700",disabled:Y==="image"||!H.trim(),onClick:be,children:Y==="image"?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:444:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),Q?.kind==="scale"&&e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:453:9",title:"伸缩 (Scale)",onClose:()=>O(null),children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:454:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:455:13",className:"text-xs text-slate-500",children:["当前副本: ",D.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:456:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:457:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:Y==="scale"||oe<=0,onClick:()=>r(g=>Math.max(0,g-1)),children:e.jsx(ft,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:460:17",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:462:15",type:"number",min:0,value:oe,onChange:g=>r(Math.max(0,Number(g.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:465:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:Y==="scale",onClick:()=>r(g=>g+1),children:e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:468:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:471:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:472:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:()=>O(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:473:15",className:"bg-blue-600 hover:bg-blue-700",disabled:Y==="scale",onClick:y,children:Y==="scale"?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:474:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),Q?.kind==="delete"&&e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:483:9",title:"删除 Deployment",onClose:()=>O(null),children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:484:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:485:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(Mt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:486:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:487:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:489:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:490:31",className:"text-slate-200 font-mono",children:[s,"/",o]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:493:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:494:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:()=>O(null),children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:495:15",variant:"destructive",disabled:Y==="delete",onClick:K,children:[Y==="delete"?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:496:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:496:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})}),Q?.kind==="cicd"&&e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:506:9",title:"CI/CD Webhook",onClose:()=>O(null),children:e.jsx(cn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:507:11",clusterCode:t,namespace:s,deploymentName:o})}),Q?.kind==="podLogs"&&e.jsx(rn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:513:9",clusterCode:t,namespace:s,podName:Q.pod,containers:(q.find(g=>g.name===Q.pod)?.containers||[]).map(g=>g.name).filter(Boolean),onClose:()=>O(null)}),e.jsx(Es,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:523:7",open:!!b,onOpenChange:g=>{g||f(null)},clusterId:w,namespace:s,podName:b||"",containers:(q.find(g=>g.name===b)?.containers||[]).map(g=>g.name).filter(Boolean)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:532:7",open:!!P,onOpenChange:g=>{g||l(null)},clusterCode:t,namespace:s,podName:P||"",containers:(q.find(g=>g.name===P)?.containers||[]).map(g=>g.name).filter(Boolean)})]})}function an({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const[i,p]=m.useState("basic"),D=[{key:"basic",label:"基本信息",icon:vt,available:!0},{key:"containers",label:"容器信息",icon:ot,available:!0},{key:"storage",label:"存储挂载",icon:tt,available:!0},{key:"advanced",label:"高级设置",icon:vt,available:!0},{key:"service",label:"服务/应用路由",icon:Se,available:!0}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:565:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:567:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:D.map(h=>{const N=i===h.key,I=h.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:572:13",disabled:!h.available,onClick:()=>h.available&&p(h.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap
|
||
${N?"border-blue-500 text-blue-400":h.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:584:15",className:"h-3.5 w-3.5"}),h.label,h.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:587:17",className:`text-[9px] px-1 py-0.5 rounded ${N?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:h.badge})]},h.key)})}),i==="basic"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:598:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="containers"?e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:608:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="storage"?e.jsx(en,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:618:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="advanced"?e.jsx(tn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:628:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="service"?e.jsx(nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:638:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):null]})}function cn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Pe(),n=Nt(D=>D.token)||localStorage.getItem("token")||"",d=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,i=`curl -X POST '${d}' \\
|
||
-H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\
|
||
-H 'Content-Type: application/json' \\
|
||
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,p=D=>{navigator.clipboard.writeText(D).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:666:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:667:7",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:668:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:669:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:670:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:d}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:671:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>p(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:674:7",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:675:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:676:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:677:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:i}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:678:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>p(i),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:681:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:682:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function et({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:693:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:694:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:695:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:696:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:100",className:"h-4 w-4"})})]}),s]})})}function rn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:d}=Pe(),[i,p]=m.useState(""),[D,h]=m.useState(200),[N,I]=m.useState(a[0]||""),[q,V]=m.useState(!1),[R,M]=m.useState(!1),z=async()=>{V(!0);try{const B=await te.getPodLogs(t,s,o,D,N||void 0);p(B?.data?.logs||B?.logs||B||"无日志")}catch{p("获取日志失败")}finally{V(!1)}};m.useEffect(()=>{z()},[N,D]);const F=async()=>{M(!0);const B=Nt.getState().token||"",U="",Y=N?`&container=${encodeURIComponent(N)}`:"",S=`${U}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${D}&stream=true${Y}`;try{const O=(await fetch(S,{headers:{Authorization:`Bearer ${B}`}})).body?.getReader();if(!O)return;const H=new TextDecoder;let ne="";for(;;){const{done:oe,value:r}=await O.read();if(oe)break;ne+=H.decode(r,{stream:!0}),p(ne)}}catch{d({title:"流式日志连接中断",variant:"destructive"})}finally{M(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:752:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:753:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:B=>B.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:754:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:755:11",className:"flex items-center gap-2",children:[e.jsx(Et,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:756:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:757:13",className:"text-sm font-semibold text-slate-200",children:o}),N&&e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:758:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:N})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:760:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:762:15",value:N,onChange:B=>I(B.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(B=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:764:38",value:B,children:B},B))}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:767:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:768:13",type:"number",value:D,onChange:B=>h(Number(B.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:770:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:771:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:z,disabled:q,children:q?e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:772:26",className:"h-3 w-3 animate-spin"}):e.jsx(ct,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:772:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:774:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:F,disabled:R,children:R?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:777:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:777:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:780:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:781:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:i||"无日志内容"})})]})})}function qn(){const t=js(),s=as(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",d=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",i=p=>{p!==d&&s(`/kubernetes/${o}/namespace/${a}/workload/${p}/Deployment/${n}`,{replace:!0})};return e.jsx(on,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:d,onBack:()=>s(-1),onModeChange:i})}export{qn as default};
|