- 先解析原始 YAML 再对象级剥离,避免 cleanYAML 破坏结构 - managedFields 从 METADATA_LINE_KEYS 移除,改整块删除含数组项 - YamlViewer 同步使用 parseEditableManifest
20 lines
227 KiB
JavaScript
20 lines
227 KiB
JavaScript
import{j as e,r as x}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as st,o as vt,i as Kt,a8 as vs,g as ks}from"./index-BBDEBVET.js";import{C as V,a as F,b as me,c as xe}from"./card-D4L46nh3.js";import{B as Z}from"./badge-D4cmFHTS.js";import{k as de}from"./index-CoT9mL1C.js";import{u as Ae}from"./use-toast-CkA38LVP.js";import{S as Ce,g as gs,f as Ve,h as js,s as pt,e as Ns,d as It,Y as Ot,P as fs,a as Ss}from"./PodFileBrowser-D_SJAX96.js";import{I as y}from"./input-e2KnvZus.js";import{Q as Xt,f as Qt,F as kt,r as Zt,H as es,L as ve,N as Pe,E as Es,A as ts,b as ss,n as Cs,k as nt,P as te,aq as Ds,s as gt,b8 as ws,aN as ns,b9 as mt,T as ye,$ as ot,g as Ps,ba as As,a4 as os,j as as,am as Ts,aK as cs,bb as Hs,z as rs,D as Ze,b2 as Ms,h as jt,aM as Bs,aL as xt,G as Rs,M as Is,R as at,p as bt,y as yt,d as Lt,J as ht,X as ls,l as ds,a as Os,m as Ls,aD as zt,bc as zs,ar as _s}from"./vendor-icons-Aso0-eeY.js";import{T as Ie,a as Oe,b as je,c as K,d as Le,e as X}from"./table-BHSiRRpd.js";import{L as H}from"./label-J75lkt_x.js";import{T as et}from"./textarea-Bhm4J_66.js";import{S as $e,a as We,b as tt,c as Ge,d as ge}from"./select-B_wPmYeS.js";import{S as Nt}from"./switch-CBAUQyOA.js";import{R as $s}from"./ResourceVisualEditor-CSC75r5p.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function is(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 Be({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:25:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:26:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:27:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function ps({pod:t}){const s=is(t),o=[{label:"已调度",ts:s.scheduled,color:Ce.blue},{label:"已初始化",ts:s.initialized,color:Ce.orange},{label:"容器已就绪",ts:s.containersReady,color:Ce.green},{label:"容器组已就绪",ts:s.ready,color:Ce.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,n)=>{const d=o[n-1],l=gs(d?.ts,a.ts);return e.jsxs(x.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50: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/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ve(a.ts):"-"})]}),n<o.length-1&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:54:15",className:"flex flex-col items-center mx-0.5 min-w-[30px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:55:17",className:"h-0.5 w-8 bg-[var(--dg-border)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:56:17",className:"text-[9px] text-[var(--dg-text-muted)] mt-0.5",children:l!=null?js(l):""})]})]},a.label)})})}function Ws({clusterCode:t,pods:s,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:n,expandedPod:d,setExpandedPod:l}){return s.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:17:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无容器组"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:20:5",className:"space-y-2",children:s.map(p=>{const A=is(p),i=d===p.name,j=p.node_name||p.node;return e.jsx(V,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>l(i?null:p.name),children:i?e.jsx(Xt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"h-4 w-4"}):e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:p.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(p.status)}22`,color:pt(p.status),border:`1px solid ${pt(p.status)}44`},children:p.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${j}`,"_blank"),children:j||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42: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/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",p.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(A.startTime||p.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(p),children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(p),children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>n(p),children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),i&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:58:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(ps,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:p}),p.containers&&p.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:p.containers.map((f,M)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:64:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:66:29",className:"font-medium text-[var(--dg-text-primary)]",children:f.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:f.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:f.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:27",className:"text-[var(--dg-text-muted)] mt-1",children:f.image}),f.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:71:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:31",children:["CPU: ",f.resources?.requests?.cpu||"0","/",f.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",f.resources?.requests?.memory||"0","/",f.resources?.limits?.memory||"-"]})]})]},M))})]})]})},p.name)})})}function Gs({services:t,ingresses:s,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41: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/deployment-view/ServicesTab.tsx:43: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/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Es,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(a=>e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78: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 Vs({events:t,loading:s}){return s==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:15:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:18:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:19:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:21:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:24:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:25:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:26:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:27:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:32:13",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:33:15",children:e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:34: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(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:38:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:39:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md whitespace-normal break-words",children:o.message}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:40:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:41:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:42:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(o.lastTimestamp)})]},a))})]})})}function Fs({hpas:t,cronHpas:s,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,d)=>{const l=n.spec?.minReplicas??n.minReplicas??1,p=n.spec?.maxReplicas??n.maxReplicas??10,A=n.spec?.metrics||n.metrics||[],i=n.status?.currentReplicas??n.currentReplicas??0,M=(n.status?.conditions||n.conditions||[]).find(b=>b.type==="AbleToScale")?.status==="True";return e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[l," → ",p]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:A.map((b,w)=>{const C=b.resource||b.object?.metric?.name||"",P=b.resource?.target?.averageUtilization||b.resource?.target?.averageValue||b.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[C?.name||C,": ",P,b.resource?.target?.averageUtilization?"%":""]},w)})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:i}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:M?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:M?"正常":"异常"})})]},n.name||d)})})]})})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,d)=>{const l=n.spec?.jobs||n.jobs||[],p=n.spec?.timezone||"UTC";return e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:l.map(A=>A.targetSize||A.targetReplicas||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:l.map(A=>A.schedule||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:p}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||d)})})]})})})]})]})}function qs({revisions:t,rollbackLoading:s,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,n)=>{const d=a.revision??a.revision_number??a.number??n+1,l=n===0;return e.jsxs(je,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",d]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:l?e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(a.created_at||a.time)}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:l||s!==null,onClick:()=>o(a),children:[s===d?e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Cs,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},d)})})]})})}function Us(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:d,onRefresh:l}=t,{toast:p}=Ae(),A=st(),[i,j]=x.useState("pods"),[f,M]=x.useState(null),[b,w]=x.useState(null),[C,P]=x.useState(a?.replicas||0),[z,O]=x.useState(!1),[ee,Y]=x.useState([]),[W,$]=x.useState([]),[U,q]=x.useState([]),[Q,se]=x.useState(""),[r,v]=x.useState([]),[E,I]=x.useState([]),N=a?.ready_replicas??a?.readyReplicas??0,ne=a?.replicas??0,ue=N===ne&&ne>0;x.useEffect(()=>{i==="services"&&(se("services"),Promise.all([de.getNamespaceServices(s,o).catch(()=>[]),de.getNamespaceIngresses(s,o).catch(()=>[])]).then(([c,h])=>{const S=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],L=S(c),B=S(h),J=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},ie=L.filter(R=>{const re=R.spec?.selector||R.selector||{};return Object.keys(re).length===0?!1:Object.entries(re).every(([Ne,fe])=>J[Ne]===fe)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"<none>",ports:(R.spec?.ports||R.ports||[]).map(re=>`${re.port}${re.targetPort?":"+re.targetPort:""}/${re.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),De=new Set(ie.map(R=>R.name)),he=B.filter(R=>(R.spec?.rules||R.rules||[]).some(Ne=>(Ne.http?.paths||Ne.paths||[]).some(fe=>{const D=fe.backend?.service?.name||fe.backendService||"";return De.has(D)}))).map(R=>({name:R.name||R.metadata?.name,className:R.spec?.ingressClassName||R.ingressClass||"-",hosts:(R.spec?.rules||R.rules||[]).map(re=>re.host).filter(Boolean),rules:R.spec?.rules||R.rules||[],age:R.age||""}));Y(ie),$(he)}).catch(()=>{}).finally(()=>se("")))},[i,s,o,a]),x.useEffect(()=>{i==="events"&&(se("events"),de.getEvents(s,o,void 0).then(c=>{const h=Array.isArray(c)?c:c?.list||c?.items||c?.data||[],S=a?.name||"",L=h.filter(B=>{const J=String(B.object||"");if(!S||!J)return!1;if(J.endsWith(`/${S}`))return!0;const ie=J.split("/").pop()||"";return ie===S||ie.startsWith(`${S}-`)}).map(B=>({type:B.type||"Normal",reason:B.reason||"",message:B.message||"",source:B.object||B.source?.component||B.sourceComponent||"-",firstTimestamp:B.first_time||B.firstTimestamp||B.first_timestamp||"",lastTimestamp:B.last_time||B.lastTimestamp||B.last_timestamp||"",count:B.count||1}));q(L)}).catch(()=>{}).finally(()=>se("")))},[i,s,o,a?.name]),x.useEffect(()=>{i==="scale"&&(se("scale"),Promise.all([de.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([c])=>{const S=(B=>Array.isArray(B)?B:B?.list||B?.items||B?.data||[])(c),L=a?.name||"";v(S.filter(B=>(B.scaleTargetRef?.name||B.targetRef?.name||"")===L)),I([])}).catch(()=>{}).finally(()=>se("")))},[i,s,o,a?.name]);const ce=async c=>{const h=c.revision??c.revision_number??c.number;if(await A({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){w(h);try{await de.rollbackDeployment(s,o,a.name,Number(h)),p({title:"回滚已下发",description:`正在回滚到 #${h}`}),l()}catch(L){p({title:"回滚失败",description:L?.message||String(L),variant:"destructive"})}finally{w(null)}}},m=async()=>{O(!0);try{await de.scaleDeployment(s,o,a.name,C),p({title:"伸缩已提交",description:`副本数 → ${C}`}),l()}catch(c){p({title:"伸缩失败",description:c?.message||String(c),variant:"destructive"})}finally{O(!1)}},k=[{key:"pods",label:"容器组",icon:nt,count:n.length},{key:"services",label:"访问方式",icon:Pe,count:ee.length},{key:"events",label:"事件",icon:ts,count:U.length},{key:"scale",label:"容器伸缩",icon:te},{key:"history",label:"历史版本",icon:Ds,count:d.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:7",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:189:13",label:"状态",value:e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:190:15",style:{background:`${ue?Ce.green:Ce.orange}22`,color:ue?Ce.green:Ce.orange,border:`1px solid ${ue?Ce.green:Ce.orange}44`},children:ue?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:41",className:"font-mono",children:[N,"/",ne]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:198:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:199: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(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",label:"创建时间",value:Ve(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:209:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(ps,{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:217:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(c=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:219:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${i===c.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>j(c.key),children:[e.jsx(c.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:13",className:"h-4 w-4"}),c.label,c.key==="pods"&&e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:c.count})]},c.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:233:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z||C<=0,onClick:()=>P(c=>Math.max(0,c-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:13",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:11",type:"number",min:0,value:C,onChange:c=>P(Math.max(0,Number(c.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:244:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z,onClick:()=>P(c=>c+1),children:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",className:"h-4 w-4"})}),C!==ne&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:250:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:z,onClick:m,children:z?e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),i==="pods"&&e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:26",...t,expandedPod:f,setExpandedPod:M}),i==="services"&&e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:30",services:ee,ingresses:W,loading:Q,namespace:o}),i==="events"&&e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:28",events:U,loading:Q}),i==="scale"&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:9",hpas:r,cronHpas:E,loading:Q,replicas:ne}),i==="history"&&e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:29",revisions:d,rollbackLoading:b,onRollback:ce})]})}async function ct(t,s,o,a){const n=await Ns(a);await de.updateResourceYaml(t,s,"deployments",o,n)}function Ke(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function Re(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Ys({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:l}=Ae(),[p,A]=x.useState(!1),[i,j]=x.useState(!a),[f,M]=x.useState(a||{}),[b,w]=x.useState(1),[C,P]=x.useState([]),[z,O]=x.useState([]),[ee,Y]=x.useState([]),[W,$]=x.useState([]);x.useEffect(()=>{const c=a;if(!c){j(!1);return}M(c),w(c?.spec?.replicas??1),P(Ke(c?.metadata?.labels)),O(Ke(c?.metadata?.annotations)),Y(Ke(c?.spec?.selector?.matchLabels)),$(Ke(c?.spec?.template?.metadata?.labels)),j(!1)},[a]);const U=(c,h)=>{P(S=>S.map((L,B)=>B===c?{...L,...h}:L))},q=()=>P(c=>[...c,{key:"",value:""}]),Q=c=>P(h=>h.filter((S,L)=>L!==c)),se=(c,h)=>{O(S=>S.map((L,B)=>B===c?{...L,...h}:L))},r=()=>O(c=>[...c,{key:"",value:""}]),v=c=>O(h=>h.filter((S,L)=>L!==c)),E=(c,h)=>{Y(S=>S.map((L,B)=>B===c?{...L,...h}:L))},I=()=>Y(c=>[...c,{key:"",value:""}]),N=c=>Y(h=>h.filter((S,L)=>L!==c)),ne=(c,h)=>{$(S=>S.map((L,B)=>B===c?{...L,...h}:L))},ue=()=>$(c=>[...c,{key:"",value:""}]),ce=c=>$(h=>h.filter((S,L)=>L!==c)),m=()=>{const c=Re(ee);$(h=>{const S={...Re(h),...c};return Object.entries(S).map(([L,B])=>({key:L,value:B}))}),l({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},k=async()=>{A(!0);try{const c=JSON.parse(JSON.stringify(f));c.spec=c.spec||{},c.spec.replicas=b;const h=Re(C);c.metadata=c.metadata||{},c.metadata.labels=Object.keys(h).length>0?h:void 0;const S=Re(z);c.metadata.annotations=Object.keys(S).length>0?S:void 0;const L=Re(ee);Object.keys(L).length>0&&(c.spec.selector=c.spec.selector||{},c.spec.selector.matchLabels=L);const B=Re(W);c.spec.template=c.spec.template||{},c.spec.template.metadata=c.spec.template.metadata||{},Object.keys(B).length>0?c.spec.template.metadata.labels=B:delete c.spec.template.metadata.labels,await ct(t,s,o,c),l({title:"基本信息已保存",description:`${o} 更新已提交`}),n(c)}catch(c){l({title:"保存失败",description:c?.message||String(c),variant:"destructive"})}finally{A(!1)}};return i?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:b,onChange:c=>w(Math.max(0,Number(c.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:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184: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:187:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189: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(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:C.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:q,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[C.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),C.map((c,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:c.key,placeholder:"app",onChange:S=>U(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:c.value,placeholder:"nginx",onChange:S=>U(h,{value:S.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:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>Q(h),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:I,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),ee.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),ee.map((c,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:c.key,placeholder:"app",onChange:S=>E(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:c.value,placeholder:"nginx",onChange:S=>E(h,{value:S.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:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>N(h),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:m,children:"从 Selector 同步"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ue,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),W.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),W.map((c,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:c.key,placeholder:"app",onChange:S=>ne(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:c.value,placeholder:"nginx",onChange:S=>ne(h,{value:S.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:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ce(h),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:z.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:r,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),z.map((c,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:c.key,placeholder:"deployment.kubernetes.io/revision",onChange:S=>se(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:c.value,placeholder:"1",onChange:S=>se(h,{value:S.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:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>v(h),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326: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:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:k,children:[p?e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function _t(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 $t(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 ut(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 Wt(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 Gt(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(i=>i.name.trim()).map(i=>{const j={name:i.name};return i.value!=null&&(j.value=i.value),j})),t.ports.length>0&&(s.ports=t.ports.filter(i=>i.containerPort!=="").map(i=>{const j={containerPort:typeof i.containerPort=="number"?i.containerPort:Number(i.containerPort)};return i.name&&(j.name=i.name),i.protocol&&(j.protocol=i.protocol),j}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(i=>i&&i.trim()),d=a&&Object.values(a).some(i=>i&&i.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 l=ut(t.livenessProbe);l&&(s.livenessProbe=l);const p=ut(t.readinessProbe);p&&(s.readinessProbe=p);const A=ut(t.startupProbe);if(A&&(s.startupProbe=A),t.lifecycle){const i={},j=Wt(t.lifecycle.postStart);j&&(i.postStart=j);const f=Wt(t.lifecycle.preStop);f&&(i.preStop=f),Object.keys(i).length>0&&(s.lifecycle=i)}if(t.securityContext){const i=t.securityContext,j={};i.runAsUser!==""&&i.runAsUser!=null&&(j.runAsUser=Number(i.runAsUser)),i.runAsGroup!==""&&i.runAsGroup!=null&&(j.runAsGroup=Number(i.runAsGroup)),i.runAsNonRoot!=null&&(j.runAsNonRoot=i.runAsNonRoot),i.privileged!=null&&(j.privileged=i.privileged),i.readOnlyRootFilesystem!=null&&(j.readOnlyRootFilesystem=i.readOnlyRootFilesystem),i.allowPrivilegeEscalation!=null&&(j.allowPrivilegeEscalation=i.allowPrivilegeEscalation);const f=(i.capabilitiesAdd||[]).filter(Boolean),M=(i.capabilitiesDrop||[]).filter(Boolean);(f.length||M.length)&&(j.capabilities={},f.length&&(j.capabilities.add=f),M.length&&(j.capabilities.drop=M)),Object.keys(j).length>0&&(s.securityContext=j)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(i=>i.name.trim()&&i.mountPath.trim()).map(i=>{const j={name:i.name,mountPath:i.mountPath};return i.subPath&&(j.subPath=i.subPath),i.readOnly&&(j.readOnly=!0),j})),s}function Vt(t){return t.join(`
|
||
`)}function Ft(t){return t.split(`
|
||
`).map(s=>s.trim()).filter(Boolean)}function Js({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/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39: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/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45: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/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:51:11",value:o.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:52:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65: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/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Vt(o.command),placeholder:`/bin/sh
|
||
-c`,onChange:n=>s({command:Ft(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/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Vt(o.args),placeholder:`--config=/etc/app.yaml
|
||
--debug`,onChange:n=>s({args:Ft(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/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91: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(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:93:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:96:9",className:"space-y-1.5",children:[o.env.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:l=>{const p=[...o.env];p[d]={...n,name:l.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:l=>{const p=[...o.env];p[d]={...n,value:l.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/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((l,p)=>p!==d)}),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},d)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:a,children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119: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(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:121:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:124:9",className:"space-y-1.5",children:[o.ports.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:l=>{const p=[...o.ports];p[d]={...n,name:l.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:l=>{const p=[...o.ports];p[d]={...n,containerPort:l.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:l=>{const p=[...o.ports];p[d]={...n,protocol:l},s({ports:p})},children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:134:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:o.ports.filter((l,p)=>p!==d)}),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},d)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:a,children:[e.jsx(Ps,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159: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/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165: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/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171: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/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177: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/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:a,children:[e.jsx(As,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(Ks,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189: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/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:a,children:[e.jsx(os,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:n=>s({lifecycle:{...o.lifecycle,postStart:n}})}),e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204: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/deployment-edit/ContainerEditor.tsx:208: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(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:a,children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219: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/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223: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/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229: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/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235: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/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241: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/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...o.securityContext,runAsNonRoot:n}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!o.securityContext.privileged,onChange:n=>s({securityContext:{...o.securityContext,privileged:n}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...o.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...o.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262: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(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:a,children:[e.jsx(Ts,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273: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(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[o.volumeMounts.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:l=>{const p=[...o.volumeMounts];p[d]={...n,name:l.target.value},s({volumeMounts:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:284:15",value:n.mountPath,placeholder:"/data",onChange:l=>{const p=[...o.volumeMounts];p[d]={...n,mountPath:l.target.value},s({volumeMounts:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:l=>{const p=[...o.volumeMounts];p[d]={...n,subPath:l.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/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:l=>{const p=[...o.volumeMounts];p[d]={...n,readOnly:l},s({volumeMounts:p})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:o.volumeMounts.filter((l,p)=>p!==d)}),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},d)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function Ks({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},d=l=>o({...n,...l});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:l=>o(l?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:n.type||"httpGet",onValueChange:l=>d({type:l}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:l=>d({httpPath:l.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:l=>d({httpPort:l.target.value===""?void 0:Number(l.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:l=>d({httpHost:l.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/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:l=>d({tcpPort:l.target.value===""?void 0:Number(l.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/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:l=>d({execCommand:l.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/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:l=>d({initialDelaySeconds:l.target.value===""?void 0:Number(l.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/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:l=>d({periodSeconds:l.target.value===""?void 0:Number(l.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/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:l=>d({timeoutSeconds:l.target.value===""?void 0:Number(l.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/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:l=>d({successThreshold:l.target.value===""?void 0:Number(l.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/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:l=>d({failureThreshold:l.target.value===""?void 0:Number(l.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function qt({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/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:n,onValueChange:d=>o({...a,type:d==="__none"?"none":d}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423: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/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429: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(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432: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(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438: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 Xe({label:t,value:s,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:s,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Ut({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:d,onRemove:l,onUpdate:p,onDuplicate:A}){const i=st(),[j,f]=x.useState(new Set([0])),M=C=>{f(P=>{const z=new Set(P);return z.has(C)?z.delete(C):z.add(C),z})},b=n==="blue"?"border-blue-500/30":"border-purple-500/30",w=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[o,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:d,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((C,P)=>{const z=j.has(P)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${b} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${w} cursor-pointer`,onClick:()=>M(P),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[z?e.jsx(Xt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx(nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:C.name||"(未命名)"}),C.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:C.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:O=>O.stopPropagation(),children:[A&&e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>A(P),children:e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await i({title:"删除容器",description:`确认删除容器「${C.name}」?`,confirmText:"删除",variant:"destructive"})&&l(P)},children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),z&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Js,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:C,onUpdate:O=>p(P,O)})})]},P)})]})]})}function Xs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:l}=Ae(),[p,A]=x.useState(!1),[i,j]=x.useState(!a),[f,M]=x.useState(a||{}),[b,w]=x.useState([]),[C,P]=x.useState([]),[z,O]=x.useState([]);x.useEffect(()=>{if(!a){j(!1);return}M(a);const r=a?.spec?.template?.spec||{};w((Array.isArray(r.containers)?r.containers:[]).map(_t)),P((Array.isArray(r.initContainers)?r.initContainers:[]).map(_t)),O((Array.isArray(r.imagePullSecrets)?r.imagePullSecrets:[]).map(v=>v.name||"")),j(!1)},[a]);const ee=(r,v)=>{w(E=>E.map((I,N)=>N===r?{...I,...v}:I))},Y=()=>{w(r=>[...r,$t(`container-${r.length+1}`)])},W=r=>{w(v=>v.filter((E,I)=>I!==r))},$=r=>{w(v=>{const E=JSON.parse(JSON.stringify(v[r]));E.name=`${E.name}-copy`;const I=[...v];return I.splice(r+1,0,E),I})},U=(r,v)=>{P(E=>E.map((I,N)=>N===r?{...I,...v}:I))},q=()=>{P(r=>[...r,$t(`init-${r.length+1}`)])},Q=r=>{P(v=>v.filter((E,I)=>I!==r))},se=async()=>{for(const r of[...C,...b]){if(!r.name.trim()){l({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!r.image.trim()){l({title:"保存失败",description:`容器 ${r.name} 的镜像不能为空`,variant:"destructive"});return}}A(!0);try{const r=JSON.parse(JSON.stringify(f));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{},r.spec.template.spec.containers=b.map(Gt),r.spec.template.spec.initContainers=C.length>0?C.map(Gt):void 0,r.spec.template.spec.imagePullSecrets=z.filter(v=>v.trim()).length>0?z.filter(v=>v.trim()).map(v=>({name:v})):void 0,await ct(t,s,o,r),l({title:"容器配置已保存",description:`${o} 更新已提交`}),n(r)}catch(r){l({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{A(!1)}};return i?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Hs,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[z.map((r,v)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144: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:145:17",className:"text-xs text-slate-300 font-mono",children:r}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>O(E=>E.filter((I,N)=>N!==v)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},v)),z.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:r=>{if(r.key==="Enter"){const v=r.target.value.trim();v&&(O(E=>[...E,v]),r.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>O(r=>[...r,""]),children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:C,accentColor:"purple",onAdd:q,onRemove:Q,onUpdate:U}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:b,accentColor:"blue",onAdd:Y,onRemove:W,onUpdate:ee,onDuplicate:$}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194: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:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:C.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:b.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:se,children:[p?e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const Yt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:Ze,color:"text-emerald-400",desc:"PVC"},{key:"emptyDir",label:"临时目录",icon:Ms,color:"text-slate-400",desc:"EmptyDir"},{key:"hostPath",label:"HostPath",icon:es,color:"text-amber-400",desc:"主机路径"},{key:"nfs",label:"NFS",icon:jt,color:"text-purple-400",desc:"网络存储"},{key:"configMap",label:"配置字典",icon:Bs,color:"text-blue-400",desc:"ConfigMap"},{key:"secret",label:"密文",icon:ns,color:"text-rose-400",desc:"Secret"}];function Qs(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 Zs(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:l}=Ae(),[p,A]=x.useState(!1),[i,j]=x.useState(!a),[f,M]=x.useState(a||{}),[b,w]=x.useState([]),[C,P]=x.useState([]),[z,O]=x.useState([]);x.useEffect(()=>{const r=a;if(!r){j(!1);return}M(r);const v=r?.spec?.template?.spec||{},E=Array.isArray(v.volumes)?v.volumes:[];w(E.map(Qs));const I=[...v.containers||[],...v.initContainers||[]],N=I.map(ue=>ue.name||"(unnamed)");O(N);const ne=[];for(const ue of I){const ce=ue.name||"(unnamed)",m=Array.isArray(ue.volumeMounts)?ue.volumeMounts:[];for(const k of m)ne.push({containerName:ce,volumeName:k.name||"",mountPath:k.mountPath||"",subPath:k.subPath||"",readOnly:!!k.readOnly})}P(ne),j(!1)},[a]);const ee=()=>w(r=>[...r,{name:"",type:"emptyDir"}]),Y=r=>{const v=b[r]?.name;w(E=>E.filter((I,N)=>N!==r)),v&&P(E=>E.filter(I=>I.volumeName!==v))},W=(r,v)=>w(E=>E.map((I,N)=>N===r?{...I,...v}:I)),$=()=>P(r=>[...r,{containerName:z[0]||"",volumeName:"",mountPath:"",subPath:"",readOnly:!1}]),U=r=>P(v=>v.filter((E,I)=>I!==r)),q=(r,v)=>P(E=>E.map((I,N)=>N===r?{...I,...v}:I)),Q=async()=>{A(!0);try{const r=JSON.parse(JSON.stringify(f));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{};const v=r.spec.template.spec,E=b.map(Zs).filter(Boolean);E.length>0?v.volumes=E:delete v.volumes;const I=N=>{const ne=N.name||"(unnamed)",ue=C.filter(ce=>ce.containerName===ne&&ce.volumeName&&ce.mountPath).map(ce=>{const m={name:ce.volumeName,mountPath:ce.mountPath,readOnly:ce.readOnly};return ce.subPath&&(m.subPath=ce.subPath),m});ue.length>0?N.volumeMounts=ue:delete N.volumeMounts};(v.containers||[]).forEach(I),(v.initContainers||[]).forEach(I),await ct(t,s,o,r),l({title:"存储配置已保存",description:`${o} 更新已提交`}),n(r)}catch(r){l({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{A(!1)}};if(i)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:189:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:190:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:191:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:192:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})});if(!a)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:200:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})});const se=b.map(r=>r.name).filter(Boolean);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:211:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:213:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:214:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:216:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:15",className:"h-4 w-4 text-emerald-400"}),"定义数据卷",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:15",variant:"outline",className:"border-slate-700 text-slate-400",children:b.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:220:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ee,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:221:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:225:9",className:"pt-0 space-y-3",children:b.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:227:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:228:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷"]}):b.map((r,v)=>{const E=Yt.find(N=>N.key===r.type),I=E?.icon||xt;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:235: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:237:17",className:"flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:238:19",className:`h-4 w-4 ${E?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:239:19",className:"text-[10px] text-slate-500 w-16 shrink-0",children:"数据卷名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:240:19",value:r.name,onChange:N=>W(v,{name:N.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($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:243:19",value:r.type,onValueChange:N=>W(v,{type:N}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:244: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:245:23",className:"flex items-center gap-1.5",children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:246:25",className:"h-3 w-3"}),E?.label||r.type]})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:21",children:Yt.map(N=>{const ne=N.icon;return e.jsx(ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:253:27",value:N.key,children:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:254:29",className:"flex items-center gap-1.5 text-xs",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:255:31",className:"h-3 w-3"}),N.label]})},N.key)})})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:262:19",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>Y(v),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:263:21",className:"h-3.5 w-3.5"})})]}),r.type==="persistentVolumeClaim"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:269:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:270:21",value:r.pvcName||"",onChange:N=>W(v,{pvcName:N.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:272: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:273:23",type:"checkbox",checked:!!r.pvcReadOnly,onChange:N=>W(v,{pvcReadOnly:N.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="emptyDir"&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:281:19",className:"flex items-center gap-2 pl-[88px]",children:e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:282:21",value:r.sizeLimit||"",onChange:N=>W(v,{sizeLimit:N.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:289:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:290:21",value:r.path||"",onChange:N=>W(v,{path:N.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:293:21",value:r.pathType||"Directory",onChange:N=>W(v,{pathType:N.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:295:23",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:296:23",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:297:23",value:"",children:"(默认)"})]})]}),r.type==="nfs"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:303:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:304:21",value:r.nfsServer||"",onChange:N=>W(v,{nfsServer:N.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:307:21",className:"text-slate-600 text-xs",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:308:21",value:r.nfsPath||"",onChange:N=>W(v,{nfsPath:N.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:311: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:312:23",type:"checkbox",checked:!!r.nfsReadOnly,onChange:N=>W(v,{nfsReadOnly:N.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="configMap"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:320:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:321:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"ConfigMap"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:322:21",value:r.configMapName||"",onChange:N=>W(v,{configMapName:N.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:325:21",value:r.cmItems||"",onChange:N=>W(v,{cmItems:N.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:332:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:333:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"密文"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:334:21",value:r.secretName||"",onChange:N=>W(v,{secretName:N.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:337:21",value:r.secItems||"",onChange:N=>W(v,{secItems:N.target.value}),placeholder:"KeyToPath (可为空)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]},v)})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:349:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:350:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:351:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:352:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:353:15",className:"h-4 w-4 text-blue-400"}),"将数据卷挂载到容器",e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:354:15",variant:"outline",className:"border-slate-700 text-slate-400",children:C.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:356:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:$,disabled:se.length===0||z.length===0,children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:358:15",className:"h-3 w-3 mr-1"}),"添加挂载"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:362:9",className:"pt-0 space-y-2",children:C.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:364:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:365:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),se.length===0?"请先定义数据卷":"未配置挂载点"]}):C.map((r,v)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:369: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:371:15",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"容器:"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:372:15",value:r.containerName,onChange:E=>q(v,{containerName:E.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:[z.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:374:45",value:"",children:"(无容器)"}),z.map(E=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:375:39",value:E,children:E},E))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:378:15",value:r.volumeName,onChange:E=>q(v,{volumeName:E.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:380:17",value:"",children:"选择数据卷"}),se.map(E=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:381:40",value:E,children:E},E))]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:384:15",value:r.mountPath,onChange:E=>q(v,{mountPath:E.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:388: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:389:17",onClick:()=>q(v,{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:393:17",onClick:()=>q(v,{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:398:15",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(v),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:399:17",className:"h-3.5 w-3.5"})})]},v))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:407:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:408:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:409:9",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:Q,children:[p?e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:410:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:410:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]})}const tn=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function sn({scheduleMode:t,onScheduleModeChange:s,nodeName:o,onNodeNameChange:a,availableNodes:n,nodesLoading:d,labelSelectorKv:l,onAddLabelSelector:p,onRemoveLabelSelector:A,onUpdateLabelSelector:i,nodeLabels:j}){return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:tn.map(f=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(f.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===f.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:f.label},f.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),d?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:o,onChange:f=>a(f.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/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),n.map(f=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:f.name,children:[f.name," ",f.ip?`(${f.ip})`:""]},f.name))]}),o&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:o})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:p,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):l.map((f,M)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:f.key,onChange:b=>i(M,{key:b.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/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(j).map(([b,w])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:b,children:[b," (",w.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:f.value,onChange:b=>i(M,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!f.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(j[f.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>A(M),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},M))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:p,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):l.map((f,M)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:f.key,onChange:b=>i(M,{key:b.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/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(j).map(([b,w])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:b,children:[b," (",w.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:f.value,onChange:b=>i(M,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!f.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(j[f.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>A(M),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},M))]})]})]})}function nn({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:n,onDnsOptionsChange:d,hostAliases:l,onHostAliasesChange:p}){const A=()=>d([...n,{name:"",value:""}]),i=(w,C)=>d(n.map((P,z)=>z===w?{...P,...C}:P)),j=w=>d(n.filter((C,P)=>P!==w)),f=()=>p([...l,{ip:"",hostnames:""}]),M=(w,C)=>p(l.map((P,z)=>z===w?{...P,...C}:P)),b=w=>p(l.filter((C,P)=>P!==w));return e.jsxs(e.Fragment,{children:[e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:w=>s(w.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/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:w=>a(w.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/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:A,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:89:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),n.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:93:15",className:"text-xs text-slate-600 italic",children:"未配置"}):n.map((w,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:w.name,onChange:P=>i(C,{name:P.target.value}),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/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:w.value,onChange:P=>i(C,{value:P.target.value}),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/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>j(C),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},C))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Is,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:f,children:[e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),l.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:134:13",className:"text-xs text-slate-600 italic",children:"未配置"}):l.map((w,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:w.ip,onChange:P=>M(C,{ip:P.target.value}),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/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:w.hostnames,onChange:P=>M(C,{hostnames:P.target.value}),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/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>b(C),children:e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},C))]})]})]})}function on({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:l}=Ae(),[p,A]=x.useState(!1),[i,j]=x.useState(!a),[f,M]=x.useState(a||{}),[b,w]=x.useState("RollingUpdate"),[C,P]=x.useState("25%"),[z,O]=x.useState("25%"),[ee,Y]=x.useState("10"),[W,$]=x.useState("600"),[U,q]=x.useState("nodeSelector"),[Q,se]=x.useState(""),[r,v]=x.useState([]),[E,I]=x.useState(!1),[N,ne]=x.useState([]),[ue,ce]=x.useState({}),[m,k]=x.useState([]),[c,h]=x.useState("ClusterFirst"),[S,L]=x.useState("Always"),[B,J]=x.useState("default-scheduler"),[ie,De]=x.useState("30"),[he,R]=x.useState(""),[re,Ne]=x.useState(""),[fe,D]=x.useState(""),[be,Te]=x.useState(""),[Se,Me]=x.useState(!1),[rt,Fe]=x.useState(!1),[lt,qe]=x.useState(!1),[we,ft]=x.useState(!1),[St,Et]=x.useState(!1),[Ct,Dt]=x.useState([]),[wt,Pt]=x.useState(""),[At,Tt]=x.useState(""),[Ht,Mt]=x.useState([]);x.useEffect(()=>{const g=a;if(!g){j(!1);return}M(g);const T=g?.spec||{},G=T?.template?.spec||{},oe=T.strategy||{};w(oe.type||"RollingUpdate");const le=oe.rollingUpdate||{};P(String(le.maxSurge??"25%")),O(String(le.maxUnavailable??"25%")),Y(T.revisionHistoryLimit!=null?String(T.revisionHistoryLimit):"10"),$(T.progressDeadlineSeconds!=null?String(T.progressDeadlineSeconds):"600");const ke=G.nodeSelector||{},ze=Object.entries(ke).map(([pe,Bt])=>({key:pe,value:String(Bt)}));ne(ze),se(G.nodeName||""),G.nodeName?q("nodeName"):G.affinity?.nodeAffinity?q("nodeAffinity"):ze.length>0&&q("nodeSelector"),t&&(I(!0),de.getClusterNodes(t).then(pe=>{const Rt=(Array.isArray(pe)?pe:pe?.items||pe?.list||[]).map(Ye=>{const He=Ye.metadata||{},Je=Ye.status||{},bs=(Array.isArray(Je.addresses)?Je.addresses:[]).find(ys=>ys.type==="InternalIP")?.address||"";return{name:He.name||"",ip:bs,labels:He.labels||{}}});v(Rt);const _e={};for(const Ye of Rt)for(const[He,Je]of Object.entries(Ye.labels)){const it=String(Je);_e[He]||(_e[He]=[]),_e[He].includes(it)||_e[He].push(it)}ce(_e)}).catch(()=>{}).finally(()=>I(!1)));const Ue=Array.isArray(G.tolerations)?G.tolerations:[];k(Ue.map(pe=>({key:pe.key||"",operator:pe.operator||"Equal",value:pe.value||"",effect:pe.effect||"",tolerationSeconds:pe.tolerationSeconds!=null?String(pe.tolerationSeconds):""}))),h(G.dnsPolicy||"ClusterFirst"),L(G.restartPolicy||"Always"),J(G.schedulerName||"default-scheduler"),De(G.terminationGracePeriodSeconds!=null?String(G.terminationGracePeriodSeconds):"30"),R(G.serviceAccountName||"");const Ee=G.securityContext||{};Ne(Ee.fsGroup!=null?String(Ee.fsGroup):""),D(Ee.runAsUser!=null?String(Ee.runAsUser):""),Te(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),Me(!!Ee.runAsNonRoot),Fe(!!G.hostNetwork),qe(!!G.hostIPC),ft(!!G.hostPID),Et(!!G.shareProcessNamespace);const _=Array.isArray(G.hostAliases)?G.hostAliases:[];Dt(_.map(pe=>({ip:pe.ip||"",hostnames:Array.isArray(pe.hostnames)?pe.hostnames.join(", "):""})));const ae=G.dnsConfig||{};Pt(Array.isArray(ae.nameservers)?ae.nameservers.join(`
|
||
`):""),Tt(Array.isArray(ae.searches)?ae.searches.join(`
|
||
`):"");const dt=Array.isArray(ae.options)?ae.options:[];Mt(dt.map(pe=>({name:pe.name||"",value:pe.value||""}))),j(!1)},[a]);const ms=()=>ne(g=>[...g,{key:"",value:""}]),xs=g=>ne(T=>T.filter((G,oe)=>oe!==g)),hs=(g,T)=>ne(G=>G.map((oe,le)=>le===g?{...oe,...T}:oe)),us=async()=>{A(!0);try{const g=JSON.parse(JSON.stringify(f));g.spec=g.spec||{},g.spec.template=g.spec.template||{},g.spec.template.spec=g.spec.template.spec||{};const T=g.spec.template.spec;if(g.spec.strategy={type:b},b==="RollingUpdate"&&(g.spec.strategy.rollingUpdate={maxSurge:C,maxUnavailable:z}),ee&&(g.spec.revisionHistoryLimit=Number(ee)),W&&(g.spec.progressDeadlineSeconds=Number(W)),U==="nodeName"&&Q.trim())T.nodeName=Q.trim(),delete T.nodeSelector,T.affinity&&delete T.affinity.nodeAffinity;else if(U==="nodeSelector"){const _={};for(const{key:ae,value:dt}of N){const pe=ae.trim();pe&&(_[pe]=dt)}Object.keys(_).length>0?T.nodeSelector=_:delete T.nodeSelector,T.nodeName&&delete T.nodeName,T.affinity&&delete T.affinity.nodeAffinity}else if(U==="nodeAffinity"){const _=N.filter(ae=>ae.key.trim()).map(ae=>({key:ae.key.trim(),operator:"In",values:[ae.value]}));_.length>0?(T.affinity=T.affinity||{},T.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:_}]}}):T.affinity&&delete T.affinity.nodeAffinity,delete T.nodeSelector,T.nodeName&&delete T.nodeName}const G=m.filter(_=>_.key||_.operator==="Exists").map(_=>{const ae={};return _.key&&(ae.key=_.key),_.operator&&(ae.operator=_.operator),_.value&&_.operator!=="Exists"&&(ae.value=_.value),_.effect&&(ae.effect=_.effect),_.tolerationSeconds&&_.effect==="NoExecute"&&(ae.tolerationSeconds=Number(_.tolerationSeconds)),ae});G.length>0?T.tolerations=G:delete T.tolerations,c&&(T.dnsPolicy=c),S&&(T.restartPolicy=S),B&&(T.schedulerName=B),ie&&(T.terminationGracePeriodSeconds=Number(ie)),he&&(T.serviceAccountName=he);const oe={};re&&(oe.fsGroup=Number(re)),fe&&(oe.runAsUser=Number(fe)),be&&(oe.runAsGroup=Number(be)),Se&&(oe.runAsNonRoot=!0),Object.keys(oe).length>0?T.securityContext=oe:delete T.securityContext,rt?T.hostNetwork=!0:delete T.hostNetwork,lt?T.hostIPC=!0:delete T.hostIPC,we?T.hostPID=!0:delete T.hostPID,St?T.shareProcessNamespace=!0:delete T.shareProcessNamespace;const le=Ct.filter(_=>_.ip.trim()).map(_=>({ip:_.ip.trim(),hostnames:_.hostnames.split(/[,\s]+/).map(ae=>ae.trim()).filter(Boolean)})).filter(_=>_.hostnames.length>0);le.length>0?T.hostAliases=le:delete T.hostAliases;const ke={},ze=wt.split(`
|
||
`).map(_=>_.trim()).filter(Boolean);ze.length>0&&(ke.nameservers=ze);const Ue=At.split(`
|
||
`).map(_=>_.trim()).filter(Boolean);Ue.length>0&&(ke.searches=Ue);const Ee=Ht.filter(_=>_.name.trim()).map(_=>{const ae={name:_.name.trim()};return _.value.trim()&&(ae.value=_.value.trim()),ae});Ee.length>0&&(ke.options=Ee),Object.keys(ke).length>0?T.dnsConfig=ke:delete T.dnsConfig,await ct(t,s,o,g),l({title:"高级设置已保存",description:`${o} 更新已提交`}),n(g)}catch(g){l({title:"保存失败",description:g?.message||String(g),variant:"destructive"})}finally{A(!1)}};return i?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352: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:353:15",type:"radio",checked:b==="RollingUpdate",onChange:()=>w("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357: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:358:15",type:"radio",checked:b==="Recreate",onChange:()=>w("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),b==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:C,onChange:g=>P(g.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:370:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:g=>O(g.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"number",value:ee,onChange:g=>Y(g.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:393:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:W,onChange:g=>$(g.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>k(g=>[...g,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[m.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),m.map((g,T)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:g.key,placeholder:"key",onChange:G=>k(oe=>oe.map((le,ke)=>ke===T?{...le,key:G.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:g.operator,onChange:G=>k(oe=>oe.map((le,ke)=>ke===T?{...le,operator:G.target.value}:le)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:g.value,placeholder:"value",disabled:g.operator==="Exists",onChange:G=>k(oe=>oe.map((le,ke)=>ke===T?{...le,value:G.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:g.effect,onChange:G=>k(oe=>oe.map((le,ke)=>ke===T?{...le,effect:G.target.value}:le)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:g.tolerationSeconds,placeholder:"秒",disabled:g.effect!=="NoExecute",onChange:G=>k(oe=>oe.map((le,ke)=>ke===T?{...le,tolerationSeconds:G.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>k(G=>G.filter((oe,le)=>le!==T)),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},T))]})]}),e.jsx(sn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:U,onScheduleModeChange:q,nodeName:Q,onNodeNameChange:se,availableNodes:r,nodesLoading:E,labelSelectorKv:N,onAddLabelSelector:ms,onRemoveLabelSelector:xs,onUpdateLabelSelector:hs,nodeLabels:ue}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:c,onChange:g=>h(g.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:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:S,onChange:g=>L(g.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:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:B,onChange:g=>J(g.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:490:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:ie,onChange:g=>De(g.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:495:11",className:"col-span-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:he,onChange:g=>R(g.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:re,onChange:g=>Ne(g.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:516:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:fe,onChange:g=>D(g.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:521:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:be,onChange:g=>Te(g.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:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527: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:528:15",type:"checkbox",checked:Se,onChange:g=>Me(g.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544: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:545:13",type:"checkbox",checked:rt,onChange:g=>Fe(g.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549: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:550:13",type:"checkbox",checked:lt,onChange:g=>qe(g.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554: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:555:13",type:"checkbox",checked:we,onChange:g=>ft(g.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559: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:560:13",type:"checkbox",checked:St,onChange:g=>Et(g.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(nn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:wt,onDnsNameserversChange:Pt,dnsSearches:At,onDnsSearchesChange:Tt,dnsOptions:Ht,onDnsOptionsChange:Mt,hostAliases:Ct,onHostAliasesChange:Dt}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:p,onClick:us,children:[p?e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const an=[{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"}],Jt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function cn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:l}=Ae(),p=st(),[A,i]=x.useState(!0),[j,f]=x.useState([]),[M,b]=x.useState([]),[w,C]=x.useState({}),[P,z]=x.useState(null),[O,ee]=x.useState(null),[Y,W]=x.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[$,U]=x.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),q=m=>{W(k=>({...k,ports:[...k.ports,m?{name:m.name,port:String(m.port),targetPort:String(m.targetPort),protocol:m.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},Q=(m,k,c)=>{W(h=>({...h,ports:h.ports.map((S,L)=>L===m?{...S,[k]:c}:S)}))},se=m=>{Y.ports.length<=1||W(k=>({...k,ports:k.ports.filter((c,h)=>h!==m)}))},r=x.useCallback(async()=>{i(!0);try{const m=a?.spec?.selector?.matchLabels||a?.selector||{};C(m);const[k,c]=await Promise.all([de.getNamespaceServices(t,s).catch(()=>[]),de.getNamespaceIngresses(t,s).catch(()=>[])]),h=Jt(k),S=Jt(c),L=h.map(J=>{const ie=J.spec||{},De=Array.isArray(ie.ports)?ie.ports.map(he=>({port:he.port,targetPort:he.targetPort,protocol:he.protocol||"TCP",nodePort:he.nodePort,name:he.name})):Array.isArray(J.portList)?J.portList.map(he=>({port:he.port,targetPort:he.targetPort,protocol:he.protocol||"TCP",nodePort:he.nodePort,name:he.name})):[];return{name:J.name||J.metadata?.name||"",type:ie.type||J.type||"ClusterIP",clusterIP:ie.clusterIP||J.cluster_ip||"<none>",externalIP:Array.isArray(ie.externalIPs)?ie.externalIPs.join(","):"",ports:De,selector:ie.selector||J.selector||{},age:J.age||J.created_at||"",raw:J}}),B=S.map(J=>{const ie=J.spec||{},he=(Array.isArray(ie.rules)?ie.rules:Array.isArray(J.rules)?J.rules:[]).map(R=>({host:R.host||"",paths:(R.http?.paths||R.paths||[]).map(re=>({path:re.path||"/",backend:{service:re.backend?.service?.name||re.backendService||"",port:re.backend?.service?.port?.number||re.backend?.service?.port?.name||re.backendPort||""}}))}));return{name:J.name||J.metadata?.name||"",className:ie.ingressClassName||J.ingressClass||"<none>",hosts:he.map(R=>R.host).filter(Boolean),rules:he,raw:J}});f(L),b(B)}catch(m){console.error("M9 load error:",m)}finally{i(!1)}},[t,s,a]);x.useEffect(()=>{r()},[r]);const v=m=>Object.keys(m).length===0?!1:Object.entries(m).every(([k,c])=>w[k]===c),E=j.filter(m=>v(m.selector)),I=new Set(E.map(m=>m.name)),N=M.filter(m=>m.rules.some(k=>k.paths.some(c=>I.has(c.backend.service)))),ne=async()=>{const m=Y.name.trim()||`${o}-svc`,k=Y.ports.map(h=>{const S={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return Y.type==="NodePort"&&h.nodePort&&(S.nodePort=Number(h.nodePort)),S}),c={apiVersion:"v1",kind:"Service",metadata:{name:m,namespace:s,labels:{app:o}},spec:{type:Y.type,selector:w,ports:k}};try{const h=await It(c);await de.applyYAML(t,h),l({title:"Service 已创建",description:m}),ee(null),r()}catch(h){l({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},ue=async()=>{const m=$.name.trim()||`${o}-ingress`,k=E[0]?.name||`${o}-svc`,c=Number($.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:m,namespace:s,labels:{app:o}},spec:{ingressClassName:$.className||void 0,rules:[{host:$.host||void 0,http:{paths:[{path:$.path||"/",pathType:$.pathType||"Prefix",backend:{service:{name:k,port:{number:c}}}}]}}]}};$.className||delete h.spec.ingressClassName;try{const S=await It(h);await de.applyYAML(t,S),l({title:"Ingress 已创建",description:m}),ee(null),r()}catch(S){l({title:"创建失败",description:S?.message||String(S),variant:"destructive"})}},ce=async(m,k)=>{if(await p({title:"删除资源",description:`确认删除 ${m==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=m==="service"?"services":"ingresses";await de.deleteResourceYaml(t,s,h,k),l({title:"已删除",description:`${m==="service"?"Service":"Ingress"} ${k} 已删除`}),r()}catch(h){l({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return A?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(w).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[m,"=",k]},m)),Object.keys(w).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:r,children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[E.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{W({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),ee("service")},children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[E.length===0&&O!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:E.map(m=>{const k=v(m.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353: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:354:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.type}),k&&e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358: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:359:23",className:"text-[11px] text-slate-500 ml-auto",children:m.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>z({resource:"services",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>ce("service",m.name),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:m.ports.map((c,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[c.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[c.name,": "]}),c.port,"→",c.targetPort,c.nodePort?`/NodePort:${c.nodePort}`:"","/",c.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(m.selector).map(([c,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[c,"=",h]},c))]})]},m.name)})}),O==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393: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:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:Y.name,onChange:m=>W(k=>({...k,name:m.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:406:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:Y.type,onChange:m=>W(k=>({...k,type:m.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:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:an.map(m=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>q(m),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(os,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"h-2.5 w-2.5"}),m.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[m.protocol," ",m.port,":",m.targetPort]})]},m.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",Y.ports.length," 个端口)"]})]}),Y.ports.map((m,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:m.name,onChange:c=>Q(k,"name",c.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:444:21",value:m.protocol,onChange:c=>Q(k,"protocol",c.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:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:m.port,onChange:c=>Q(k,"port",c.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:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:m.targetPort,onChange:c=>Q(k,"targetPort",c.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),Y.type==="NodePort"&&e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:c=>Q(k,"nodePort",c.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:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>se(k),disabled:Y.ports.length<=1,children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>q(),children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478: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:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(w).length>0?Object.entries(w).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[m,"=",k]},m)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ee(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:ne,children:"创建"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[N.length,"/",M.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{U(m=>({...m,name:`${o}-ingress`,svcPort:String(E[0]?.ports[0]?.port||80)})),ee("ingress")},children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[M.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:M.map(m=>{const k=N.includes(m);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528: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:529:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.className}),k&&e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533: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:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>z({resource:"ingresses",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>ce("ingress",m.name),children:e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:m.rules.map((c,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:c.host||"*"}),c.paths.map((S,L)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[S.path," → ",S.backend?.service,":",S.backend?.port]},L))]},h))})]},m.name)})}),O==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565: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:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:$.name,onChange:m=>U(k=>({...k,name:m.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:576:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:$.className,onChange:m=>U(k=>({...k,className:m.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:582:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:$.host,onChange:m=>U(k=>({...k,host:m.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:588:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:$.path,onChange:m=>U(k=>({...k,path:m.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:594:17",children:[e.jsx(H,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:$.svcPort,onChange:m=>U(k=>({...k,svcPort:m.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:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ee(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:ue,children:"创建"})]})]})]})]}),P&&e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:s,resource:P.resource,name:P.name,onClose:()=>z(null),onSaved:()=>{z(null),r()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:d,children:"返回查看"})})]})}function rn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const[l,p]=x.useState("basic"),[A,i]=x.useState(a);x.useEffect(()=>{a&&i(a)},[a]);const j=b=>{b&&i(b),n()},f=[{key:"basic",label:"基本信息",icon:bt},{key:"containers",label:"容器信息",icon:nt},{key:"storage",label:"存储挂载",icon:Ze},{key:"advanced",label:"高级设置",icon:bt},{key:"service",label:"服务/应用路由",icon:Pe}],M={clusterCode:t,namespace:s,deploymentName:o,manifest:A,onSaved:j,onCancel:d};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:f.map(b=>{const w=l===b.key,C=b.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>p(b.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${w?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(C,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),b.label]},b.key)})}),l==="basic"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...M}),l==="containers"&&e.jsx(Xs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...M}),l==="storage"&&e.jsx(en,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...M}),l==="advanced"&&e.jsx(on,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...M}),l==="service"&&e.jsx(cn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...M})]})}function ln({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Ae(),n=vt(A=>A.token)||localStorage.getItem("token")||"",d=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,l=`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=A=>{navigator.clipboard.writeText(A).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:28:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:29:7",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:30:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:31:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:32: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/deployment-workload/CICDWebhookContent.tsx:33: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/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:37:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:38:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:39:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:l}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>p(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:43:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:44:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Qe({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14: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/deployment-workload/ModalShell.tsx:15: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/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ls,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function dn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:d}=Ae(),[l,p]=x.useState(""),[A,i]=x.useState(200),[j,f]=x.useState(a[0]||""),[M,b]=x.useState(!1),[w,C]=x.useState(!1),P=async()=>{b(!0);try{const O=await de.getPodLogs(t,s,o,A,j||void 0);p(O?.data?.logs||O?.logs||O||"无日志")}catch{p("获取日志失败")}finally{b(!1)}};x.useEffect(()=>{P()},[j,A]);const z=async()=>{C(!0);const O=vt.getState().token||"",ee="",Y=j?`&container=${encodeURIComponent(j)}`:"",W=`${ee}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${A}&stream=true${Y}`;try{const U=(await fetch(W,{headers:{Authorization:`Bearer ${O}`}})).body?.getReader();if(!U)return;const q=new TextDecoder;let Q="";for(;;){const{done:se,value:r}=await U.read();if(se)break;Q+=q.decode(r,{stream:!0}),p(Q)}}catch{d({title:"流式日志连接中断",variant:"destructive"})}finally{C(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:64: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/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:O=>O.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:o}),j&&e.jsx(Z,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:j})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:j,onChange:O=>f(O.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(O=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:O,children:O},O))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:A,onChange:O=>i(Number(O.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/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:P,disabled:M,children:M?e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(at,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:z,disabled:w,children:w?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(ls,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:l||"无日志内容"})})]})})}function pn({modal:t,deployment:s,namespace:o,deploymentName:a,newImage:n,setNewImage:d,scaleValue:l,setScaleValue:p,actionLoading:A,onClose:i,onUpdateImage:j,onScaleTo:f,onDelete:M}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:i,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:s.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(H,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:b=>d(b.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/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:i,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:A==="image"||!n.trim(),onClick:j,children:A==="image"?e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:i,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",s.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:A==="scale"||l<=0,onClick:()=>p(b=>Math.max(0,b-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:l,onChange:b=>p(Math.max(0,Number(b.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/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:A==="scale",onClick:()=>p(b=>b+1),children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:i,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:A==="scale",onClick:f,children:A==="scale"?e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:i,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[o,"/",a]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:i,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:A==="delete",onClick:M,children:[A==="delete"?e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function mn({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:d}){const l=Kt(),{toast:p}=Ae(),A=st(),[i,j]=x.useState(null),[f,M]=x.useState(null),[b,w]=x.useState([]),[C,P]=x.useState([]),[z,O]=x.useState([]),[ee,Y]=x.useState(!0),[W,$]=x.useState(""),[U,q]=x.useState(null),[Q,se]=x.useState(""),[r,v]=x.useState(0),[E,I]=x.useState(null),[N,ne]=x.useState(null),ue=i?.cluster_id||i?.clusterId||t,ce=D=>Array.isArray(D)?D:D?.list||D?.items||D?.data||[],m=x.useCallback(async()=>{Y(!0);try{const[D,be,Te,Se]=await Promise.all([de.getDeployment(t,s,o).catch(()=>null),de.getNamespacePods(t,s).catch(()=>[]),de.getReplicaSets(t,s).catch(()=>[]),de.getDeploymentRevisions(t,s,o).catch(()=>[])]),Me=D||(Array.isArray(D)?D[0]:null);j(Me),v(Me?.replicas||0),se(Me?.image||"");const Fe=ce(be).filter(we=>we.namespace===s&&(we.name||"").startsWith(o));w(Fe);const qe=ce(Te).filter(we=>we.namespace===s&&(we.owner_deployment===o||(we.name||"").startsWith(o)));P(qe),O(ce(Se))}catch(D){console.error("加载详情失败:",D)}finally{Y(!1)}},[t,s,o]),k=x.useCallback(async()=>{try{const D=await de.getResourceYaml(t,s,"deployments",o);let be=null;try{be=JSON.parse(D)}catch{try{be=(await vs(()=>import("./js-yaml-37NdyH6G.js"),[])).load(D)}catch{be=null}}M(be||i)}catch(D){console.warn("加载 manifest 失败(编辑功能降级):",D),M(i)}},[t,s,o,i]);x.useEffect(()=>{m()},[m]),x.useEffect(()=>{a==="edit"&&!f&&k()},[a,f,k]);const c=async()=>{$("scale");try{await de.scaleDeployment(t,s,o,r),p({title:"伸缩成功",description:`副本数已设置为 ${r}`}),q(null),m()}catch(D){p({title:"操作失败",description:D?.message||String(D),variant:"destructive"})}finally{$("")}},h=async()=>{if(await A({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){$("restart");try{await de.restartDeployment(t,s,o),p({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(m,1500)}catch(be){p({title:"重启失败",description:be?.message||String(be),variant:"destructive"})}finally{$("")}}},S=async()=>{const D=!!i?.paused,be=D?"恢复":"暂停";if(await A({title:`${be}滚动更新`,description:`确认${be} Deployment "${o}" 的滚动更新?`,confirmText:be})){$(D?"resume":"pause");try{D?await de.resumeDeployment(t,s,o):await de.pauseDeployment(t,s,o),p({title:`${be}成功`,description:`Deployment 滚动更新已${be}`}),setTimeout(m,1e3)}catch(Se){p({title:`${be}失败`,description:Se?.message||String(Se),variant:"destructive"})}finally{$("")}}},L=()=>{q({kind:"cicd"})},B=async()=>{if(Q.trim()){$("image");try{await de.updateDeploymentImage(t,s,o,Q),p({title:"镜像更新成功",description:`正在滚动更新为 ${Q}`}),q(null),m()}catch(D){p({title:"更新失败",description:D?.message||String(D),variant:"destructive"})}finally{$("")}}},J=async()=>{$("delete");try{const D=vt.getState().token||"",Te=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,Se=await fetch(Te,{method:"DELETE",headers:{Authorization:`Bearer ${D}`}});if(!Se.ok)throw new Error(`HTTP ${Se.status}`);p({title:"删除成功",description:`${o} 已删除`}),q(null),setTimeout(()=>l(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(D){p({title:"删除失败",description:D?.message||String(D),variant:"destructive"})}finally{$("")}},ie=D=>q({kind:"podLogs",pod:D.name}),De=D=>q({kind:"podYaml",pod:D.name}),he=D=>{I(D.name)},R=D=>{ne(D.name)};if(ee)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:239:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:9",className:"p-12 text-center",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!i)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:250:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:251:9",className:"p-12 text-center",children:[e.jsx(Os,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:252:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:253:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:254:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const re=i.ready_replicas||i.readyReplicas||0,Ne=i.replicas||0,fe=re===Ne&&Ne>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:269:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:270:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:271:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:274:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:275:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:276:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(Z,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278: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(yt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:30",className:"h-3 w-3 mr-1"}):e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:73",className:"h-3 w-3 mr-1"}),re,"/",Ne]}),i?.paused&&e.jsxs(Z,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:287:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:292:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:293:19",className:"text-slate-400",children:i.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:298:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:300:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:301: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:307: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:313: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:321:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:m,title:"刷新",children:e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:322:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:326:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:327:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q({kind:"image"}),children:[e.jsx(zs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:328:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:333:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!W,onClick:S,children:i?.paused?e.jsxs(e.Fragment,{children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:340:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:341:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:344:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:L,children:[e.jsx(_s,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:345: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:347:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>q({kind:"delete"}),children:[e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:348:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:356:9",clusterCode:t,namespace:s,deployment:i,pods:b,replicaSets:C,revisions:z,onRefresh:m,onShowPodLogs:ie,onShowPodTerminal:he,onShowPodYaml:De,onShowPodFileBrowser:R}):a==="yaml"?e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:371:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:m,onClose:()=>d("view")}):e.jsx(rn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:383:9",clusterCode:t,namespace:s,deploymentName:o,manifest:f,onSaved:()=>{k(),m()},onCancel:()=>d("view")}),U?.kind==="yaml"&&e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:395:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>q(null),onSaved:m}),e.jsx(pn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:406:7",modal:U,deployment:i,namespace:s,deploymentName:o,newImage:Q,setNewImage:se,scaleValue:r,setScaleValue:v,actionLoading:W,onClose:()=>q(null),onUpdateImage:B,onScaleTo:c,onDelete:J}),U?.kind==="cicd"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:424:9",title:"CI/CD Webhook",onClose:()=>q(null),children:e.jsx(ln,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:425:11",clusterCode:t,namespace:s,deploymentName:o})}),U?.kind==="podLogs"&&e.jsx(dn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:9",clusterCode:t,namespace:s,podName:U.pod,containers:(b.find(D=>D.name===U.pod)?.containers||[]).map(D=>D.name).filter(Boolean),onClose:()=>q(null)}),e.jsx(fs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:441:7",open:!!E,onOpenChange:D=>{D||I(null)},clusterId:ue,namespace:s,podName:E||"",containers:(b.find(D=>D.name===E)?.containers||[]).map(D=>D.name).filter(Boolean)}),e.jsx(Ss,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:450:7",open:!!N,onOpenChange:D=>{D||ne(null)},clusterCode:t,namespace:s,podName:N||"",containers:(b.find(D=>D.name===N)?.containers||[]).map(D=>D.name).filter(Boolean)})]})}function An(){const t=ks(),s=Kt(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",d=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",l=p=>{p!==d&&s(`/kubernetes/${o}/namespace/${a}/workload/${p}/Deployment/${n}`,{replace:!0})};return e.jsx(mn,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:d,onBack:()=>s(-1),onModeChange:l})}export{An as default};
|