21 lines
223 KiB
JavaScript
21 lines
223 KiB
JavaScript
import{i as Ve,j as e,r as x,B as h,W as Ut,o as Kt,H as Xt,L as he,N as Ee,A as Qt,C as Zt,R as ys,f as st,w as nt,aQ as es,p as vs,v as ts,E as Ze,S as kt,G as ks,M as gs,z as bt,Q as yt,V as it,a2 as gt,X as ss,T as ns,m as os,be as js,au as Ns,k as fs}from"./index-BTQygws6.js";import{C as F,a as Y,b as ie,c as pe}from"./card-D0oz3NII.js";import{B as te}from"./badge-BsIZhz7S.js";import{k as ee}from"./index-DSkkspoy.js";import{u as De}from"./use-toast-C8TQro77.js";import{S as Se,e as Ss,f as Fe,b as Cs,s as pt,Y as Bt,P as ws,a as Es}from"./PodFileBrowser-BYnKz8ea.js";import{I as b}from"./input-C6mE-wO9.js";import{F as jt}from"./file-text-B8e3PkIb.js";import{H as as}from"./hard-drive-zBn-z9Ht.js";import{T as Ie,a as Be,b as ke,c as K,d as Oe,e as X}from"./table-Dh5trM9F.js";import{E as vt}from"./external-link-DUvuGx7K.js";import{P as re}from"./plus-DOS6OUrq.js";import{H as Ds}from"./history-0zIbY_Ux.js";import{M as Nt}from"./minus-B61YKf1a.js";import{L as A}from"./label-8e-EC7mH.js";import{T as be}from"./trash-2-5oUve9eW.js";import{S as ot}from"./save-w9vZ9YyU.js";import{T as et}from"./textarea-DDxE7TMs.js";import{S as $e,a as We,b as tt,c as Ge,d as ye}from"./select-pPlmgAjn.js";import{S as ft}from"./switch-8l7ThrsD.js";import{Z as rs}from"./zap-72OjNvOL.js";import{F as Ps}from"./folder-open-B72Redy5.js";import{R as cs}from"./rotate-cw-ClBTsHWn.js";import{P as ls}from"./play-BAPO-6Xq.js";import{D as As}from"./disc-vNDYYr0z.js";import{a as Ts,F as mt}from"./folder-CQ5eyfNi.js";import{R as at}from"./refresh-cw-e9vbQhCy.js";import{C as Hs}from"./circle-x-CYoA2i-_.js";import{A as Ms}from"./arrow-left-C7utsRsB.js";import{P as Ot}from"./pause-5yiLcu-G.js";import"./copy-DRb4X68n.js";import"./sparkles-Bd2inR9e.js";import"./xterm-DSqgeKvr.js";import"./box-CHjdSJYg.js";import"./minimize-2-DBp9LGa2.js";import"./upload-DAFoufx2.js";import"./download-BSvsFf63.js";import"./index-WFeZT6kc.js";import"./chevron-up-Z8QjN8G2.js";const Rs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Is=Ve("hash",Rs);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Ve("heart",Bs);const zs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ls=Ve("image",zs);const _s=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],$s=Ve("key-round",_s);const Ws=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],zt=Ve("tags",Ws);function ds(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(l=>(l.type||l.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 Re({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 is({pod:t}){const s=ds(t),o=[{label:"已调度",ts:s.scheduled,color:Se.blue},{label:"已初始化",ts:s.initialized,color:Se.orange},{label:"容器已就绪",ts:s.containersReady,color:Se.green},{label:"容器组已就绪",ts:s.ready,color:Se.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 l=o[n-1],d=Ss(l?.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?Fe(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:d!=null?Cs(d):""})]})]},a.label)})})}function Gs({clusterCode:t,pods:s,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:n,expandedPod:l,setExpandedPod:d}){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(m=>{const w=ds(m),c=l===m.name,g=m.node_name||m.node;return e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(Y,{"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(h,{"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:()=>d(c?null:m.name),children:c?e.jsx(Ut,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"h-4 w-4"}):e.jsx(Kt,{"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:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(m.status)}22`,color:pt(m.status),border:`1px solid ${pt(m.status)}44`},children:m.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/${g}`,"_blank"),children:g||"-"})}),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:m.ip||m.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:["重启 ",m.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:Fe(w.startTime||m.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(h,{"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(m),children:[e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(h,{"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(m),children:[e.jsx(Xt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(h,{"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(m),children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),c&&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(is,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:m}),m.containers&&m.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:m.containers.map((N,H)=>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:N.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:N.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:N.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:N.image}),N.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: ",N.resources?.requests?.cpu||"0","/",N.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",N.resources?.requests?.memory||"0","/",N.resources?.limits?.memory||"-"]})]})]},H))})]})]})},m.name)})})}function Vs({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(he,{"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(Ee,{"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(Be,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(ke,{"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(te,{"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,l])=>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,"=",l]},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(vt,{"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(Be,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(a=>e.jsxs(ke,{"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(l=>l.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Fs({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(he,{"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(Be,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(ke,{"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(te,{"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 truncate",title:o.message,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:Fe(o.lastTimestamp)})]},a))})]})})}function Ys({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(he,{"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(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(Y,{"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(h,{"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(Be,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,l)=>{const d=n.spec?.minReplicas??n.minReplicas??1,m=n.spec?.maxReplicas??n.maxReplicas??10,w=n.spec?.metrics||n.metrics||[],c=n.status?.currentReplicas??n.currentReplicas??0,H=(n.status?.conditions||n.conditions||[]).find(y=>y.type==="AbleToScale")?.status==="True";return e.jsxs(ke,{"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:[d," → ",m]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:w.map((y,E)=>{const S=y.resource||y.object?.metric?.name||"",D=y.resource?.target?.averageUtilization||y.resource?.target?.averageValue||y.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[S?.name||S,": ",D,y.resource?.target?.averageUtilization?"%":""]},E)})}),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:c}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:H?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:H?"正常":"异常"})})]},n.name||l)})})]})})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(Y,{"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(h,{"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(Be,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,l)=>{const d=n.spec?.jobs||n.jobs||[],m=n.spec?.timezone||"UTC";return e.jsxs(ke,{"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:d.map(w=>w.targetSize||w.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:d.map(w=>w.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:m}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||l)})})]})})})]})]})}function Js({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(Be,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(ke,{"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(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,n)=>{const l=a.revision??a.revision_number??a.number??n+1,d=n===0;return e.jsxs(ke,{"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:["#",l]}),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:d?e.jsx(te,{"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(te,{"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:Fe(a.created_at||a.time)}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:d||s!==null,onClick:()=>o(a),children:[s===l?e.jsx(he,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(ys,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},l)})})]})})}function qs(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:l,onRefresh:d}=t,{toast:m}=De(),w=st(),[c,g]=x.useState("pods"),[N,H]=x.useState(null),[y,E]=x.useState(null),[S,D]=x.useState(a?.replicas||0),[z,B]=x.useState(!1),[ne,q]=x.useState([]),[L,G]=x.useState([]),[U,V]=x.useState([]),[Z,oe]=x.useState(""),[r,u]=x.useState([]),[j,I]=x.useState([]),p=a?.ready_replicas??a?.readyReplicas??0,P=a?.replicas??0,O=p===P&&P>0;x.useEffect(()=>{c==="services"&&(oe("services"),Promise.all([ee.getNamespaceServices(s,o).catch(()=>[]),ee.getNamespaceIngresses(s,o).catch(()=>[])]).then(([v,$])=>{const W=M=>Array.isArray(M)?M:M?.list||M?.items||M?.data||[],_=W(v),ue=W($),Q=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},me=_.filter(M=>{const ae=M.spec?.selector||M.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([ge,je])=>Q[ge]===je)}).map(M=>({name:M.name||M.metadata?.name,type:M.spec?.type||M.type||"ClusterIP",clusterIP:M.spec?.clusterIP||M.cluster_ip||"<none>",ports:(M.spec?.ports||M.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:M.spec?.selector||M.selector||{},age:M.age||""})),Ce=new Set(me.map(M=>M.name)),ce=ue.filter(M=>(M.spec?.rules||M.rules||[]).some(ge=>(ge.http?.paths||ge.paths||[]).some(je=>{const f=je.backend?.service?.name||je.backendService||"";return Ce.has(f)}))).map(M=>({name:M.name||M.metadata?.name,className:M.spec?.ingressClassName||M.ingressClass||"-",hosts:(M.spec?.rules||M.rules||[]).map(ae=>ae.host).filter(Boolean),rules:M.spec?.rules||M.rules||[],age:M.age||""}));q(me),G(ce)}).catch(()=>{}).finally(()=>oe("")))},[c,s,o,a]),x.useEffect(()=>{c==="events"&&(oe("events"),ee.getEvents(s,o,void 0).then(v=>{const W=(Array.isArray(v)?v:v?.list||v?.items||v?.data||[]).filter(_=>{const Q=(_.involvedObject||_.involved_object||{}).name||"";return Q===a?.name||Q.startsWith(a?.name+"-")}).map(_=>({type:_.type||"Normal",reason:_.reason||"",message:_.message||"",source:_.source?.component||_.sourceComponent||"-",firstTimestamp:_.firstTimestamp||_.first_timestamp||"",lastTimestamp:_.lastTimestamp||_.last_timestamp||"",count:_.count||1}));V(W)}).catch(()=>{}).finally(()=>oe("")))},[c,s,o,a?.name]),x.useEffect(()=>{c==="scale"&&(oe("scale"),Promise.all([ee.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([v])=>{const W=(ue=>Array.isArray(ue)?ue:ue?.list||ue?.items||ue?.data||[])(v),_=a?.name||"";u(W.filter(ue=>(ue.scaleTargetRef?.name||ue.targetRef?.name||"")===_)),I([])}).catch(()=>{}).finally(()=>oe("")))},[c,s,o,a?.name]);const J=async v=>{const $=v.revision??v.revision_number??v.number;if(await w({title:"回滚版本",description:`确认回滚到修订版本 #${$}?`,confirmText:"回滚",variant:"destructive"})){E($);try{await ee.rollbackDeployment(s,o,a.name,Number($)),m({title:"回滚已下发",description:`正在回滚到 #${$}`}),d()}catch(_){m({title:"回滚失败",description:_?.message||String(_),variant:"destructive"})}finally{E(null)}}},i=async()=>{B(!0);try{await ee.scaleDeployment(s,o,a.name,S),m({title:"伸缩已提交",description:`副本数 → ${S}`}),d()}catch(v){m({title:"伸缩失败",description:v?.message||String(v),variant:"destructive"})}finally{B(!1)}},k=[{key:"pods",label:"容器组",icon:nt,count:n.length},{key:"services",label:"访问方式",icon:Ee,count:ne.length},{key:"events",label:"事件",icon:Qt,count:U.length},{key:"scale",label:"容器伸缩",icon:re},{key:"history",label:"历史版本",icon:Ds,count:l.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:181:5",className:"space-y-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:183:7",className:"dg-card",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:185:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:13",label:"状态",value:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:15",style:{background:`${O?Se.green:Se.orange}22`,color:O?Se.green:Se.orange,border:`1px solid ${O?Se.green:Se.orange}44`},children:O?"Running":"Updating"})}),e.jsx(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:191:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:191:41",className:"font-mono",children:[p,"/",P]})}),e.jsx(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:192:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:196: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(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:200:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:200:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:13",label:"创建时间",value:Fe(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentView.tsx:207:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:214:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(v=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:216:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${c===v.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>g(v.key),children:[e.jsx(v.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:225:13",className:"h-4 w-4"}),v.label,v.key==="pods"&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:227:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:v.count})]},v.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentView.tsx:231:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z||S<=0,onClick:()=>D(v=>Math.max(0,v-1)),children:e.jsx(Nt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:13",className:"h-4 w-4"})}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentView.tsx:236:11",type:"number",min:0,value:S,onChange:v=>D(Math.max(0,Number(v.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentView.tsx:241:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z,onClick:()=>D(v=>v+1),children:e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:13",className:"h-4 w-4"})}),S!==P&&e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:z,onClick:i,children:z?e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentView.tsx:249:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),c==="pods"&&e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:256:26",...t,expandedPod:N,setExpandedPod:H}),c==="services"&&e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:257:30",services:ne,ingresses:L,loading:Z,namespace:o}),c==="events"&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:258:28",events:U,loading:Z}),c==="scale"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:9",hpas:r,cronHpas:j,loading:Z,replicas:P}),c==="history"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:267:29",revisions:l,rollbackLoading:y,onRollback:J})]})}function xt(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function ht(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Us({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const{toast:d}=De(),[m,w]=x.useState(!1),[c,g]=x.useState(!a),[N,H]=x.useState(a||{}),[y,E]=x.useState(1),[S,D]=x.useState([]),[z,B]=x.useState([]),[ne,q]=x.useState([]);x.useEffect(()=>{const p=a;if(!p){g(!1);return}H(p),E(p?.spec?.replicas??1),D(xt(p?.metadata?.labels)),B(xt(p?.metadata?.annotations)),q(xt(p?.spec?.selector?.matchLabels)),g(!1)},[a]);const L=(p,P)=>{D(O=>O.map((J,i)=>i===p?{...J,...P}:J))},G=()=>D(p=>[...p,{key:"",value:""}]),U=p=>D(P=>P.filter((O,J)=>J!==p)),V=(p,P)=>{B(O=>O.map((J,i)=>i===p?{...J,...P}:J))},Z=()=>B(p=>[...p,{key:"",value:""}]),oe=p=>B(P=>P.filter((O,J)=>J!==p)),r=(p,P)=>{q(O=>O.map((J,i)=>i===p?{...J,...P}:J))},u=()=>q(p=>[...p,{key:"",value:""}]),j=p=>q(P=>P.filter((O,J)=>J!==p)),I=async()=>{w(!0);try{const p=JSON.parse(JSON.stringify(N));p.spec=p.spec||{},p.spec.replicas=y;const P=ht(S);p.metadata=p.metadata||{},p.metadata.labels=Object.keys(P).length>0?P:void 0;const O=ht(z);p.metadata.annotations=Object.keys(O).length>0?O:void 0;const J=ht(ne);Object.keys(J).length>0&&(p.spec.selector=p.spec.selector||{},p.spec.selector.matchLabels=J,p.spec.template=p.spec.template||{},p.spec.template.metadata=p.spec.template.metadata||{},p.spec.template.metadata.labels={...p.spec.template.metadata.labels,...J});const i=JSON.stringify(p,null,2);await ee.updateResourceYaml(t,s,"deployments",o,i),d({title:"基本信息已保存",description:`${o} 更新已提交`}),n()}catch(p){d({title:"保存失败",description:p?.message||String(p),variant:"destructive"})}finally{w(!1)}};return c?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:124:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:125:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:126:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:143:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:145:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:146:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:147:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Is,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:148:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:11",className:"flex items-center gap-3",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:13",type:"number",min:0,value:y,onChange:p=>E(Math.max(0,Number(p.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:167:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:169:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(es,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:170:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:180:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:190:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:191:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:192:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:193:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:195:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:S.length})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:G,children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:9",className:"pt-0 space-y-1.5",children:[S.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:203:35",className:"text-[11px] text-slate-600",children:"无标签"}),S.map((p,P)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:206:15",value:p.key,placeholder:"app",onChange:O=>L(P,{key:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:15",value:p.value,placeholder:"nginx",onChange:O=>L(P,{value:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>U(P),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:48",className:"h-3.5 w-3.5"})})]},P))]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:221:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:222:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:223:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:224:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:226:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:u,children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:234:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),ne.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:43",className:"text-[11px] text-slate-600",children:"无选择器"}),ne.map((p,P)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:237:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:238:15",value:p.key,placeholder:"app",onChange:O=>r(P,{key:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:15",value:p.value,placeholder:"nginx",onChange:O=>r(P,{value:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>j(P),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:51",className:"h-3.5 w-3.5"})})]},P))]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:253:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:254:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:255:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:256:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:258:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:z.length})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Z,children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:265:9",className:"pt-0 space-y-1.5",children:[z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:40",className:"text-[11px] text-slate-600",children:"无注解"}),z.map((p,P)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:268:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:269:15",value:p.key,placeholder:"deployment.kubernetes.io/revision",onChange:O=>V(P,{key:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:272:15",value:p.value,placeholder:"1",onChange:O=>V(P,{value:O.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:275:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>oe(P),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:53",className:"h-3.5 w-3.5"})})]},P))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:283:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:285:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:9",className:"flex gap-2",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:289:11",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:I,children:[m?e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:290:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:290:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:134:7",className:"bg-slate-900 border-slate-800",children:e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:135:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function Lt(t){const s=n=>{if(!n)return null;let l="none";return n.httpGet?l="httpGet":n.tcpSocket?l="tcpSocket":n.exec&&(l="exec"),{type:l,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 l="none";return n.exec?l="exec":n.httpGet?l="httpGet":n.tcpSocket&&(l="tcpSocket"),{type:l,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 $t(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 Wt(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(c=>c.name.trim()).map(c=>{const g={name:c.name};return c.value!=null&&(g.value=c.value),g})),t.ports.length>0&&(s.ports=t.ports.filter(c=>c.containerPort!=="").map(c=>{const g={containerPort:typeof c.containerPort=="number"?c.containerPort:Number(c.containerPort)};return c.name&&(g.name=c.name),c.protocol&&(g.protocol=c.protocol),g}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(c=>c&&c.trim()),l=a&&Object.values(a).some(c=>c&&c.trim());(n||l)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),l&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ut(t.livenessProbe);d&&(s.livenessProbe=d);const m=ut(t.readinessProbe);m&&(s.readinessProbe=m);const w=ut(t.startupProbe);if(w&&(s.startupProbe=w),t.lifecycle){const c={},g=$t(t.lifecycle.postStart);g&&(c.postStart=g);const N=$t(t.lifecycle.preStop);N&&(c.preStop=N),Object.keys(c).length>0&&(s.lifecycle=c)}if(t.securityContext){const c=t.securityContext,g={};c.runAsUser!==""&&c.runAsUser!=null&&(g.runAsUser=Number(c.runAsUser)),c.runAsGroup!==""&&c.runAsGroup!=null&&(g.runAsGroup=Number(c.runAsGroup)),c.runAsNonRoot!=null&&(g.runAsNonRoot=c.runAsNonRoot),c.privileged!=null&&(g.privileged=c.privileged),c.readOnlyRootFilesystem!=null&&(g.readOnlyRootFilesystem=c.readOnlyRootFilesystem),c.allowPrivilegeEscalation!=null&&(g.allowPrivilegeEscalation=c.allowPrivilegeEscalation);const N=(c.capabilitiesAdd||[]).filter(Boolean),H=(c.capabilitiesDrop||[]).filter(Boolean);(N.length||H.length)&&(g.capabilities={},N.length&&(g.capabilities.add=N),H.length&&(g.capabilities.drop=H)),Object.keys(g).length>0&&(s.securityContext=g)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(c=>c.name.trim()&&c.mountPath.trim()).map(c=>{const g={name:c.name,mountPath:c.mountPath};return c.subPath&&(g.subPath=c.subPath),c.readOnly&&(g.readOnly=!0),g})),s}function Gt(t){return t.join(`
|
||
`)}function Vt(t){return t.split(`
|
||
`).map(s=>s.trim()).filter(Boolean)}function Ks({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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(b,{"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(A,{"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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ye,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(b,{"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(A,{"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:Gt(o.command),placeholder:`/bin/sh
|
||
-c`,onChange:n=>s({command:Vt(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(A,{"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:Gt(o.args),placeholder:`--config=/etc/app.yaml
|
||
--debug`,onChange:n=>s({args:Vt(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(Xt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(h,{"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(re,{"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,l)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const m=[...o.env];m[l]={...n,name:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const m=[...o.env];m[l]={...n,value:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"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((d,m)=>m!==l)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},l)),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(Ee,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(h,{"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(re,{"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,l)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const m=[...o.ports];m[l]={...n,name:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const m=[...o.ports];m[l]={...n,containerPort:d.target.value},s({ports:m})},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:d=>{const m=[...o.ports];m[l]={...n,protocol:d},s({ports:m})},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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(h,{"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((d,m)=>m!==l)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},l)),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(vs,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(b,{"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(Os,{"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(Xs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:o[n],onChange:l=>s({[n]:l})},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(rs,{"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(Ft,{"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(Ft,{"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(h,{"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(re,{"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(ts,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(b,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(b,{"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(l=>l.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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(b,{"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(l=>l.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(h,{"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(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(h,{"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(re,{"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(Ps,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(h,{"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(re,{"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,l)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:d=>{const m=[...o.volumeMounts];m[l]={...n,name:d.target.value},s({volumeMounts:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:284:15",value:n.mountPath,placeholder:"/data",onChange:d=>{const m=[...o.volumeMounts];m[l]={...n,mountPath:d.target.value},s({volumeMounts:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:d=>{const m=[...o.volumeMounts];m[l]={...n,subPath:d.target.value},s({volumeMounts:m})},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(ft,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:d=>{const m=[...o.volumeMounts];m[l]={...n,readOnly:d},s({volumeMounts:m})}}),"RO"]}),e.jsx(h,{"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((d,m)=>m!==l)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},l)),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 Xs({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},l=d=>o({...n,...d});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(ft,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:d=>o(d?{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:d=>l({type:d}),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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ye,{"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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:d=>l({httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:d=>l({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"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:d=>l({httpHost:d.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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:d=>l({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"})}),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:d=>l({execCommand:d.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(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:d=>l({initialDelaySeconds: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"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:d=>l({periodSeconds: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"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:d=>l({timeoutSeconds: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"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:d=>l({successThreshold: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"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:d=>l({failureThreshold: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 Ft({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:l=>o({...a,type:l==="__none"?"none":l}),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(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ye,{"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:l=>o({...a,execCommand:l.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(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:l=>o({...a,httpPath:l.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:l=>o({...a,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"})]}),a.type==="tcpSocket"&&e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:l=>o({...a,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"})]})}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(ft,{"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 Yt({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:l,onRemove:d,onUpdate:m,onDuplicate:w}){const c=st(),[g,N]=x.useState(new Set([0])),H=S=>{N(D=>{const z=new Set(D);return z.has(S)?z.delete(S):z.add(S),z})},y=n==="blue"?"border-blue-500/30":"border-purple-500/30",E=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"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(pe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(te,{"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(h,{"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:l,children:[e.jsx(re,{"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(Y,{"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((S,D)=>{const z=g.has(D)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${y} 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 ${E} cursor-pointer`,onClick:()=>H(D),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(Ut,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(Kt,{"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:S.name||"(未命名)"}),S.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:S.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:B=>B.stopPropagation(),children:[w&&e.jsx(h,{"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:()=>w(D),children:e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(h,{"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 c({title:"删除容器",description:`确认删除容器「${S.name}」?`,confirmText:"删除",variant:"destructive"})&&d(D)},children:e.jsx(be,{"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(Ks,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:S,onUpdate:B=>m(D,B)})})]},D)})]})]})}function Qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const{toast:d}=De(),[m,w]=x.useState(!1),[c,g]=x.useState(!a),[N,H]=x.useState(a||{}),[y,E]=x.useState([]),[S,D]=x.useState([]),[z,B]=x.useState([]);x.useEffect(()=>{if(!a){g(!1);return}H(a);const r=a?.spec?.template?.spec||{};E((Array.isArray(r.containers)?r.containers:[]).map(Lt)),D((Array.isArray(r.initContainers)?r.initContainers:[]).map(Lt)),B((Array.isArray(r.imagePullSecrets)?r.imagePullSecrets:[]).map(u=>u.name||"")),g(!1)},[a]);const ne=(r,u)=>{E(j=>j.map((I,p)=>p===r?{...I,...u}:I))},q=()=>{E(r=>[...r,_t(`container-${r.length+1}`)])},L=r=>{E(u=>u.filter((j,I)=>I!==r))},G=r=>{E(u=>{const j=JSON.parse(JSON.stringify(u[r]));j.name=`${j.name}-copy`;const I=[...u];return I.splice(r+1,0,j),I})},U=(r,u)=>{D(j=>j.map((I,p)=>p===r?{...I,...u}:I))},V=()=>{D(r=>[...r,_t(`init-${r.length+1}`)])},Z=r=>{D(u=>u.filter((j,I)=>I!==r))},oe=async()=>{for(const r of[...S,...y]){if(!r.name.trim()){d({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!r.image.trim()){d({title:"保存失败",description:`容器 ${r.name} 的镜像不能为空`,variant:"destructive"});return}}w(!0);try{const r=JSON.parse(JSON.stringify(N));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{},r.spec.template.spec.containers=y.map(Wt),r.spec.template.spec.initContainers=S.length>0?S.map(Wt):void 0,r.spec.template.spec.imagePullSecrets=z.filter(j=>j.trim()).length>0?z.filter(j=>j.trim()).map(j=>({name:j})):void 0;const u=JSON.stringify(r,null,2);await ee.updateResourceYaml(t,s,"deployments",o,u),d({title:"容器配置已保存",description:`${o} 更新已提交`}),n()}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{w(!1)}};return c?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:116:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:132:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:137:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:139:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:143:11",className:"flex items-center gap-2 flex-wrap",children:[z.map((r,u)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145: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:146:17",className:"text-xs text-slate-300 font-mono",children:r}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:17",onClick:()=>B(j=>j.filter((I,p)=>p!==u)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:148:68",className:"h-3 w-3"})})]},u)),z.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:151:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:11",className:"flex gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:154:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:r=>{if(r.key==="Enter"){const u=r.target.value.trim();u&&(B(j=>[...j,u]),r.target.value="")}}}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:161:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>B(r=>[...r,""]),children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:163:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Yt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:170:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:173:15",className:"h-4 w-4 text-purple-400"}),containers:S,accentColor:"purple",onAdd:V,onRemove:Z,onUpdate:U}),e.jsx(Yt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:182:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:185:15",className:"h-4 w-4 text-blue-400"}),containers:y,accentColor:"blue",onAdd:q,onRemove:L,onUpdate:ne,onDuplicate:G}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195: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:196:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:13",className:"text-slate-300 font-semibold",children:S.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:198:11",className:"text-slate-300 font-semibold ml-1",children:y.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:9",className:"flex gap-2",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:11",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:oe,children:[m?e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:203:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:203:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:124:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const Jt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:Ze,color:"text-emerald-400",desc:"PVC"},{key:"emptyDir",label:"临时目录",icon:As,color:"text-slate-400",desc:"EmptyDir"},{key:"hostPath",label:"HostPath",icon:as,color:"text-amber-400",desc:"主机路径"},{key:"nfs",label:"NFS",icon:kt,color:"text-purple-400",desc:"网络存储"},{key:"configMap",label:"配置字典",icon:Ts,color:"text-blue-400",desc:"ConfigMap"},{key:"secret",label:"密文",icon:es,color:"text-rose-400",desc:"Secret"}];function Zs(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.emptyDir?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||"Directory"}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:{name:s,type:"emptyDir"}}function en(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 tn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const{toast:d}=De(),[m,w]=x.useState(!1),[c,g]=x.useState(!a),[N,H]=x.useState(a||{}),[y,E]=x.useState([]),[S,D]=x.useState([]),[z,B]=x.useState([]);x.useEffect(()=>{const r=a;if(!r){g(!1);return}H(r);const u=r?.spec?.template?.spec||{},j=Array.isArray(u.volumes)?u.volumes:[];E(j.map(Zs));const I=[...u.containers||[],...u.initContainers||[]],p=I.map(O=>O.name||"(unnamed)");B(p);const P=[];for(const O of I){const J=O.name||"(unnamed)",i=Array.isArray(O.volumeMounts)?O.volumeMounts:[];for(const k of i)P.push({containerName:J,volumeName:k.name||"",mountPath:k.mountPath||"",subPath:k.subPath||"",readOnly:!!k.readOnly})}D(P),g(!1)},[a]);const ne=()=>E(r=>[...r,{name:"",type:"emptyDir"}]),q=r=>{const u=y[r]?.name;E(j=>j.filter((I,p)=>p!==r)),u&&D(j=>j.filter(I=>I.volumeName!==u))},L=(r,u)=>E(j=>j.map((I,p)=>p===r?{...I,...u}:I)),G=()=>D(r=>[...r,{containerName:z[0]||"",volumeName:"",mountPath:"",subPath:"",readOnly:!1}]),U=r=>D(u=>u.filter((j,I)=>I!==r)),V=(r,u)=>D(j=>j.map((I,p)=>p===r?{...I,...u}:I)),Z=async()=>{w(!0);try{const r=JSON.parse(JSON.stringify(N));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{};const u=r.spec.template.spec,j=y.map(en).filter(Boolean);j.length>0?u.volumes=j:delete u.volumes;const I=[...u.containers||[],...u.initContainers||[]];for(const P of I){const O=P.name||"(unnamed)",J=S.filter(i=>i.containerName===O&&i.volumeName&&i.mountPath).map(i=>{const k={name:i.volumeName,mountPath:i.mountPath,readOnly:i.readOnly};return i.subPath&&(k.subPath=i.subPath),k});J.length>0?P.volumeMounts=J:delete P.volumeMounts}u.containers=I.filter(P=>!(u.initContainers||[]).includes(P)),u.initContainers=u.initContainers||[];const p=JSON.stringify(r,null,2);await ee.updateResourceYaml(t,s,"deployments",o,p),d({title:"存储配置已保存",description:`${o} 更新已提交`}),n()}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{w(!1)}};if(c)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:193:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:194:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:195:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:196:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})});if(!a)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:204:7",className:"bg-slate-900 border-slate-800",children:e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:205:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})});const oe=y.map(r=>r.name).filter(Boolean);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:219:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:220:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:221:15",className:"h-4 w-4 text-emerald-400"}),"定义数据卷",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:222:15",variant:"outline",className:"border-slate-700 text-slate-400",children:y.length})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:224:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ne,children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:225:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:229:9",className:"pt-0 space-y-3",children:y.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:232:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷"]}):y.map((r,u)=>{const j=Jt.find(p=>p.key===r.type),I=j?.icon||mt;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:239:15",className:"bg-slate-950/50 border border-slate-800 rounded-lg p-3 space-y-2.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:241:17",className:"flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:242:19",className:`h-4 w-4 ${j?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:243:19",className:"text-[10px] text-slate-500 w-16 shrink-0",children:"数据卷名称"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:244:19",value:r.name,onChange:p=>L(u,{name:p.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:247:19",value:r.type,onValueChange:p=>L(u,{type:p}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:248:21",className:"h-7 w-[120px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:23",className:"flex items-center gap-1.5",children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:250:25",className:"h-3 w-3"}),j?.label||r.type]})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:253:21",children:Jt.map(p=>{const P=p.icon;return e.jsx(ye,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:257:27",value:p.key,children:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:258:29",className:"flex items-center gap-1.5 text-xs",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:31",className:"h-3 w-3"}),p.label]})},p.key)})})]}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:266:19",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>q(u),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:267:21",className:"h-3.5 w-3.5"})})]}),r.type==="persistentVolumeClaim"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:273:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:274:21",value:r.pvcName||"",onChange:p=>L(u,{pvcName:p.target.value}),placeholder:"PVC 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:276:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:23",type:"checkbox",checked:!!r.pvcReadOnly,onChange:p=>L(u,{pvcReadOnly:p.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="emptyDir"&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:285:19",className:"flex items-center gap-2 pl-[88px]",children:e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:286:21",value:r.sizeLimit||"",onChange:p=>L(u,{sizeLimit:p.target.value}),placeholder:"sizeLimit (如 512Mi, 可为空)",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})}),r.type==="hostPath"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:293:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:21",value:r.path||"",onChange:p=>L(u,{path:p.target.value}),placeholder:"主机路径 /data/app",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:297:21",value:r.pathType||"Directory",onChange:p=>L(u,{pathType:p.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:299:23",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:300:23",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:301:23",value:"",children:"(默认)"})]})]}),r.type==="nfs"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:307:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:308:21",value:r.nfsServer||"",onChange:p=>L(u,{nfsServer:p.target.value}),placeholder:"NFS Server IP",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:21",className:"text-slate-600 text-xs",children:":"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:312:21",value:r.nfsPath||"",onChange:p=>L(u,{nfsPath:p.target.value}),placeholder:"/export/path",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:315:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:316:23",type:"checkbox",checked:!!r.nfsReadOnly,onChange:p=>L(u,{nfsReadOnly:p.target.checked}),className:"accent-blue-500"}),"只读"]})]}),r.type==="configMap"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:324:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:325:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"ConfigMap"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:326:21",value:r.configMapName||"",onChange:p=>L(u,{configMapName:p.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:329:21",value:r.cmItems||"",onChange:p=>L(u,{cmItems:p.target.value}),placeholder:"KeyToPath (可为空)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),r.type==="secret"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:336:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:337:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"密文"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:338:21",value:r.secretName||"",onChange:p=>L(u,{secretName:p.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:341:21",value:r.secItems||"",onChange:p=>L(u,{secItems:p.target.value}),placeholder:"KeyToPath (可为空)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]},u)})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:353:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:354:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:355:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:356:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:357:15",className:"h-4 w-4 text-blue-400"}),"将数据卷挂载到容器",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:358:15",variant:"outline",className:"border-slate-700 text-slate-400",children:S.length})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:360:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:G,disabled:oe.length===0||z.length===0,children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:362:15",className:"h-3 w-3 mr-1"}),"添加挂载"]})]})}),e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:366:9",className:"pt-0 space-y-2",children:S.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:368:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:369:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),oe.length===0?"请先定义数据卷":"未配置挂载点"]}):S.map((r,u)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:373:13",className:"flex items-center gap-2 bg-slate-950/50 border border-slate-800 rounded-lg p-2.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:375:15",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"容器:"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:376:15",value:r.containerName,onChange:j=>V(u,{containerName:j.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:378:45",value:"",children:"(无容器)"}),z.map(j=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:379:39",value:j,children:j},j))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:382:15",value:r.volumeName,onChange:j=>V(u,{volumeName:j.target.value}),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[100px]",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:384:17",value:"",children:"选择数据卷"}),oe.map(j=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:385:40",value:j,children:j},j))]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:388:15",value:r.mountPath,onChange:j=>V(u,{mountPath:j.target.value}),placeholder:"挂载路径 /app/data",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:392:15",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:393:17",onClick:()=>V(u,{readOnly:!1}),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${r.readOnly?"text-slate-500":"bg-blue-500/20 text-blue-300"}`,children:"读写"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:397:17",onClick:()=>V(u,{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(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:402:15",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(u),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:403:17",className:"h-3.5 w-3.5"})})]},u))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:411:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:412:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:413:9",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:Z,children:[m?e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:414:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:414:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]})}const sn=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function nn({scheduleMode:t,onScheduleModeChange:s,nodeName:o,onNodeNameChange:a,availableNodes:n,nodesLoading:l,labelSelectorKv:d,onAddLabelSelector:m,onRemoveLabelSelector:w,onUpdateLabelSelector:c,nodeLabels:g}){return e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"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(pe,{"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(kt,{"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:sn.map(N=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(N.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===N.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:N.label},N.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(Y,{"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(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),l?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(he,{"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:N=>a(N.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(N=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:N.name,children:[N.name," ",N.ip?`(${N.ip})`:""]},N.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(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(h,{"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:m,children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.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:"未配置标签选择器"}):d.map((N,H)=>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:N.key,onChange:y=>c(H,{key:y.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(g).map(([y,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:y,children:[y," (",E.length,")"]},y))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:N.value,onChange:y=>c(H,{value:y.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!N.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(g[N.key]||[]).map(y=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:y,children:y},y))]}),e.jsx(h,{"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:()=>w(H),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},H))]}),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(A,{"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(h,{"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:m,children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.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:"未配置亲和性规则"}):d.map((N,H)=>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:N.key,onChange:y=>c(H,{key:y.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(g).map(([y,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:y,children:[y," (",E.length,")"]},y))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:N.value,onChange:y=>c(H,{value:y.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!N.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(g[N.key]||[]).map(y=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:y,children:y},y))]}),e.jsx(h,{"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:()=>w(H),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},H))]})]})]})}function on({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:n,onDnsOptionsChange:l,hostAliases:d,onHostAliasesChange:m}){const w=()=>l([...n,{name:"",value:""}]),c=(E,S)=>l(n.map((D,z)=>z===E?{...D,...S}:D)),g=E=>l(n.filter((S,D)=>D!==E)),N=()=>m([...d,{ip:"",hostnames:""}]),H=(E,S)=>m(d.map((D,z)=>z===E?{...D,...S}:D)),y=E=>m(d.filter((S,D)=>D!==E));return e.jsxs(e.Fragment,{children:[e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(pe,{"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(ks,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(Y,{"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(A,{"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:E=>s(E.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(A,{"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:E=>a(E.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(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(h,{"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:w,children:[e.jsx(re,{"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((E,S)=>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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:D=>c(S,{name:D.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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:D=>c(S,{value:D.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"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:()=>g(S),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},S))]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(pe,{"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(gs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(Y,{"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(A,{"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(h,{"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:N,children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.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:"未配置"}):d.map((E,S)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:D=>H(S,{ip:D.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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:D=>H(S,{hostnames:D.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(h,{"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:()=>y(S),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},S))]})]})]})}function an({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const{toast:d}=De(),[m,w]=x.useState(!1),[c,g]=x.useState(!a),[N,H]=x.useState(a||{}),[y,E]=x.useState("RollingUpdate"),[S,D]=x.useState("25%"),[z,B]=x.useState("25%"),[ne,q]=x.useState("10"),[L,G]=x.useState("600"),[U,V]=x.useState("nodeSelector"),[Z,oe]=x.useState(""),[r,u]=x.useState([]),[j,I]=x.useState(!1),[p,P]=x.useState([]),[O,J]=x.useState({}),[i,k]=x.useState([]),[v,$]=x.useState("ClusterFirst"),[W,_]=x.useState("Always"),[ue,Q]=x.useState("default-scheduler"),[me,Ce]=x.useState("30"),[ce,M]=x.useState(""),[ae,ge]=x.useState(""),[je,f]=x.useState(""),[de,Pe]=x.useState(""),[Ne,Me]=x.useState(!1),[rt,Ye]=x.useState(!1),[ct,Je]=x.useState(!1),[we,St]=x.useState(!1),[Ct,wt]=x.useState(!1),[Et,Dt]=x.useState([]),[Pt,At]=x.useState(""),[Tt,Ht]=x.useState(""),[Mt,Rt]=x.useState([]);x.useEffect(()=>{const C=a;if(!C){g(!1);return}H(C);const T=C?.spec||{},se=T?.template?.spec||{},ve=T.strategy||{};E(ve.type||"RollingUpdate");const Ae=ve.rollingUpdate||{};D(String(Ae.maxSurge??"25%")),B(String(Ae.maxUnavailable??"25%")),q(T.revisionHistoryLimit!=null?String(T.revisionHistoryLimit):"10"),G(T.progressDeadlineSeconds!=null?String(T.progressDeadlineSeconds):"600");const Te=se.nodeSelector||{},ze=Object.entries(Te).map(([le,Le])=>({key:le,value:String(Le)}));P(ze),oe(se.nodeName||""),se.nodeName?V("nodeName"):se.affinity?.nodeAffinity?V("nodeAffinity"):ze.length>0&&V("nodeSelector"),t&&(I(!0),ee.getClusterNodes(t).then(le=>{const It=(Array.isArray(le)?le:le?.items||le?.list||[]).map(Ue=>{const He=Ue.metadata||{},Ke=Ue.status||{},us=(Array.isArray(Ke.addresses)?Ke.addresses:[]).find(bs=>bs.type==="InternalIP")?.address||"";return{name:He.name||"",ip:us,labels:He.labels||{}}});u(It);const _e={};for(const Ue of It)for(const[He,Ke]of Object.entries(Ue.labels)){const dt=String(Ke);_e[He]||(_e[He]=[]),_e[He].includes(dt)||_e[He].push(dt)}J(_e)}).catch(()=>{}).finally(()=>I(!1)));const qe=Array.isArray(se.tolerations)?se.tolerations:[];k(qe.map(le=>({key:le.key||"",operator:le.operator||"Equal",value:le.value||"",effect:le.effect||"",tolerationSeconds:le.tolerationSeconds!=null?String(le.tolerationSeconds):""}))),$(se.dnsPolicy||"ClusterFirst"),_(se.restartPolicy||"Always"),Q(se.schedulerName||"default-scheduler"),Ce(se.terminationGracePeriodSeconds!=null?String(se.terminationGracePeriodSeconds):"30"),M(se.serviceAccountName||"");const fe=se.securityContext||{};ge(fe.fsGroup!=null?String(fe.fsGroup):""),f(fe.runAsUser!=null?String(fe.runAsUser):""),Pe(fe.runAsGroup!=null?String(fe.runAsGroup):""),Me(!!fe.runAsNonRoot),Ye(!!se.hostNetwork),Je(!!se.hostIPC),St(!!se.hostPID),wt(!!se.shareProcessNamespace);const lt=Array.isArray(se.hostAliases)?se.hostAliases:[];Dt(lt.map(le=>({ip:le.ip||"",hostnames:Array.isArray(le.hostnames)?le.hostnames.join(", "):""})));const R=se.dnsConfig||{};At(Array.isArray(R.nameservers)?R.nameservers.join(`
|
||
`):""),Ht(Array.isArray(R.searches)?R.searches.join(`
|
||
`):"");const xe=Array.isArray(R.options)?R.options:[];Rt(xe.map(le=>({name:le.name||"",value:le.value||""}))),g(!1)},[a]);const ps=()=>P(C=>[...C,{key:"",value:""}]),ms=C=>P(T=>T.filter((se,ve)=>ve!==C)),xs=(C,T)=>P(se=>se.map((ve,Ae)=>Ae===C?{...ve,...T}:ve)),hs=async()=>{w(!0);try{const C=JSON.parse(JSON.stringify(N));C.spec=C.spec||{},C.spec.template=C.spec.template||{},C.spec.template.spec=C.spec.template.spec||{};const T=C.spec.template.spec;if(C.spec.strategy={type:y},y==="RollingUpdate"&&(C.spec.strategy.rollingUpdate={maxSurge:S,maxUnavailable:z}),ne&&(C.spec.revisionHistoryLimit=Number(ne)),L&&(C.spec.progressDeadlineSeconds=Number(L)),U==="nodeName"&&Z.trim())T.nodeName=Z.trim(),delete T.nodeSelector,T.affinity&&delete T.affinity.nodeAffinity;else if(U==="nodeSelector"){const R={};for(const{key:xe,value:le}of p){const Le=xe.trim();Le&&(R[Le]=le)}Object.keys(R).length>0?T.nodeSelector=R:delete T.nodeSelector,T.nodeName&&delete T.nodeName,T.affinity&&delete T.affinity.nodeAffinity}else if(U==="nodeAffinity"){const R=p.filter(xe=>xe.key.trim()).map(xe=>({key:xe.key.trim(),operator:"In",values:[xe.value]}));R.length>0?(T.affinity=T.affinity||{},T.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:R}]}}):T.affinity&&delete T.affinity.nodeAffinity,delete T.nodeSelector,T.nodeName&&delete T.nodeName}const se=i.filter(R=>R.key||R.operator==="Exists").map(R=>{const xe={};return R.key&&(xe.key=R.key),R.operator&&(xe.operator=R.operator),R.value&&R.operator!=="Exists"&&(xe.value=R.value),R.effect&&(xe.effect=R.effect),R.tolerationSeconds&&R.effect==="NoExecute"&&(xe.tolerationSeconds=Number(R.tolerationSeconds)),xe});se.length>0?T.tolerations=se:delete T.tolerations,v&&(T.dnsPolicy=v),W&&(T.restartPolicy=W),ue&&(T.schedulerName=ue),me&&(T.terminationGracePeriodSeconds=Number(me)),ce&&(T.serviceAccountName=ce);const ve={};ae&&(ve.fsGroup=Number(ae)),je&&(ve.runAsUser=Number(je)),de&&(ve.runAsGroup=Number(de)),Ne&&(ve.runAsNonRoot=!0),Object.keys(ve).length>0?T.securityContext=ve:delete T.securityContext,rt?T.hostNetwork=!0:delete T.hostNetwork,ct?T.hostIPC=!0:delete T.hostIPC,we?T.hostPID=!0:delete T.hostPID,Ct?T.shareProcessNamespace=!0:delete T.shareProcessNamespace;const Ae=Et.filter(R=>R.ip.trim()).map(R=>({ip:R.ip.trim(),hostnames:R.hostnames.split(/[,\s]+/).map(xe=>xe.trim()).filter(Boolean)})).filter(R=>R.hostnames.length>0);Ae.length>0?T.hostAliases=Ae:delete T.hostAliases;const Te={},ze=Pt.split(`
|
||
`).map(R=>R.trim()).filter(Boolean);ze.length>0&&(Te.nameservers=ze);const qe=Tt.split(`
|
||
`).map(R=>R.trim()).filter(Boolean);qe.length>0&&(Te.searches=qe);const fe=Mt.filter(R=>R.name.trim()).map(R=>{const xe={name:R.name.trim()};return R.value.trim()&&(xe.value=R.value.trim()),xe});fe.length>0&&(Te.options=fe),Object.keys(Te).length>0?T.dnsConfig=Te:delete T.dnsConfig;const lt=JSON.stringify(C,null,2);await ee.updateResourceYaml(t,s,"deployments",o,lt),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(C){d({title:"保存失败",description:C?.message||String(C),variant:"destructive"})}finally{w(!1)}};return c?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(he,{"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(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(pe,{"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(Y,{"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:y==="RollingUpdate",onChange:()=>E("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:y==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),y==="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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:S,onChange:C=>D(C.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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:C=>B(C.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(Y,{"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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"number",value:ne,onChange:C=>q(C.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(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:L,onChange:C=>G(C.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsx(nn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:401:7",scheduleMode:U,onScheduleModeChange:V,nodeName:Z,onNodeNameChange:oe,availableNodes:r,nodesLoading:j,labelSelectorKv:p,onAddLabelSelector:ps,onRemoveLabelSelector:ms,onUpdateLabelSelector:xs,nodeLabels:O}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:417:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:419:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:422:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:424:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:425:13",value:v,onChange:C=>$(C.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:427:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:434:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:435:13",value:W,onChange:C=>_(C.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:437:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:438:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:439:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:442:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:443:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:13",value:ue,onChange:C=>Q(C.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:447:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:448:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:449:13",type:"number",value:me,onChange:C=>Ce(C.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:452:11",className:"col-span-2",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:453:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:454:13",value:ce,onChange:C=>M(C.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:463:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ts,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:464:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:469:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:13",type:"number",value:ae,onChange:C=>ge(C.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:473:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:474:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:475:13",type:"number",value:je,onChange:C=>f(C.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:478:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:479:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:13",type:"number",value:de,onChange:C=>Pe(C.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:483:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:484: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:485:15",type:"checkbox",checked:Ne,onChange:C=>Me(C.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:494:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:500:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:501: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:502:13",type:"checkbox",checked:rt,onChange:C=>Ye(C.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506: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:507:13",type:"checkbox",checked:ct,onChange:C=>Je(C.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511: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:512:13",type:"checkbox",checked:we,onChange:C=>St(C.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516: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:517:13",type:"checkbox",checked:Ct,onChange:C=>wt(C.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(on,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:524:7",dnsNameservers:Pt,onDnsNameserversChange:At,dnsSearches:Tt,onDnsSearchesChange:Ht,dnsOptions:Mt,onDnsOptionsChange:Rt,hostAliases:Et,onHostAliasesChange:Dt}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:536:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:hs,children:[m?e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const rn=[{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"}],qt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function cn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const{toast:d}=De(),m=st(),[w,c]=x.useState(!0),[g,N]=x.useState([]),[H,y]=x.useState([]),[E,S]=x.useState({}),[D,z]=x.useState(null),[B,ne]=x.useState(null),[q,L]=x.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[G,U]=x.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),V=i=>{L(k=>({...k,ports:[...k.ports,i?{name:i.name,port:String(i.port),targetPort:String(i.targetPort),protocol:i.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},Z=(i,k,v)=>{L($=>({...$,ports:$.ports.map((W,_)=>_===i?{...W,[k]:v}:W)}))},oe=i=>{q.ports.length<=1||L(k=>({...k,ports:k.ports.filter((v,$)=>$!==i)}))},r=x.useCallback(async()=>{c(!0);try{const i=a?.spec?.selector?.matchLabels||a?.selector||{};S(i);const[k,v]=await Promise.all([ee.getNamespaceServices(t,s).catch(()=>[]),ee.getNamespaceIngresses(t,s).catch(()=>[])]),$=qt(k),W=qt(v),_=$.map(Q=>{const me=Q.spec||{},Ce=Array.isArray(me.ports)?me.ports.map(ce=>({port:ce.port,targetPort:ce.targetPort,protocol:ce.protocol||"TCP",nodePort:ce.nodePort,name:ce.name})):Array.isArray(Q.portList)?Q.portList.map(ce=>({port:ce.port,targetPort:ce.targetPort,protocol:ce.protocol||"TCP",nodePort:ce.nodePort,name:ce.name})):[];return{name:Q.name||Q.metadata?.name||"",type:me.type||Q.type||"ClusterIP",clusterIP:me.clusterIP||Q.cluster_ip||"<none>",externalIP:Array.isArray(me.externalIPs)?me.externalIPs.join(","):"",ports:Ce,selector:me.selector||Q.selector||{},age:Q.age||Q.created_at||"",raw:Q}}),ue=W.map(Q=>{const me=Q.spec||{},ce=(Array.isArray(me.rules)?me.rules:Array.isArray(Q.rules)?Q.rules:[]).map(M=>({host:M.host||"",paths:(M.http?.paths||M.paths||[]).map(ae=>({path:ae.path||"/",backend:{service:ae.backend?.service?.name||ae.backendService||"",port:ae.backend?.service?.port?.number||ae.backend?.service?.port?.name||ae.backendPort||""}}))}));return{name:Q.name||Q.metadata?.name||"",className:me.ingressClassName||Q.ingressClass||"<none>",hosts:ce.map(M=>M.host).filter(Boolean),rules:ce,raw:Q}});N(_),y(ue)}catch(i){console.error("M9 load error:",i)}finally{c(!1)}},[t,s,a]);x.useEffect(()=>{r()},[r]);const u=i=>Object.keys(i).length===0?!1:Object.entries(i).every(([k,v])=>E[k]===v),j=g.filter(i=>u(i.selector)),I=new Set(j.map(i=>i.name)),p=H.filter(i=>i.rules.some(k=>k.paths.some(v=>I.has(v.backend.service)))),P=async()=>{const i=q.name.trim()||`${o}-svc`,k=q.ports.map(W=>{const _={name:W.name||"http",port:Number(W.port)||80,targetPort:/^\d+$/.test(String(W.targetPort))?Number(W.targetPort):W.targetPort,protocol:W.protocol||"TCP"};return q.type==="NodePort"&&W.nodePort&&(_.nodePort=Number(W.nodePort)),_}),v={apiVersion:"v1",kind:"Service",metadata:{name:i,namespace:s,labels:{app:o}},spec:{type:q.type,selector:E,ports:k}},$=JSON.stringify(v,null,2);try{await ee.updateResourceYaml(t,s,"services",i,$),d({title:"Service 已创建",description:i}),ne(null),r()}catch(W){d({title:"创建失败",description:W?.message||String(W),variant:"destructive"})}},O=async()=>{const i=G.name.trim()||`${o}-ingress`,k=j[0]?.name||`${o}-svc`,v=Number(G.svcPort)||80,$={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:i,namespace:s,labels:{app:o}},spec:{ingressClassName:G.className||void 0,rules:[{host:G.host||void 0,http:{paths:[{path:G.path||"/",pathType:G.pathType||"Prefix",backend:{service:{name:k,port:{number:v}}}}]}}]}};G.className||delete $.spec.ingressClassName;const W=JSON.stringify($,null,2);try{await ee.updateResourceYaml(t,s,"ingresses",i,W),d({title:"Ingress 已创建",description:i}),ne(null),r()}catch(_){d({title:"创建失败",description:_?.message||String(_),variant:"destructive"})}},J=async(i,k)=>{if(await m({title:"删除资源",description:`确认删除 ${i==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const $=i==="service"?"services":"ingresses";await ee.deleteResourceYaml(t,s,$,k),d({title:"已删除",description:`${i==="service"?"Service":"Ingress"} ${k} 已删除`}),r()}catch($){d({title:"删除失败",description:$?.message||String($),variant:"destructive"})}};return w?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:289:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:290:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:299:5",className:"space-y-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(Y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:302:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"flex flex-wrap gap-1",children:[Object.entries(E).map(([i,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[i,"=",k]},i)),Object.keys(E).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:311:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:314: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:315:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:322:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:323:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[j.length," 个关联"]})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{L({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),ne("service")},children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:335:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:338:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:9",className:"pt-0",children:[j.length===0&&B!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:343:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:347:13",className:"space-y-2",children:j.map(i=>{const k=u(i.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:351: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:352:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ee,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:23",className:"text-sm font-semibold text-slate-200",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:i.type}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356: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:357:23",className:"text-[11px] text-slate-500 ml-auto",children:i.clusterIP}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>z({kind:"service",name:i.name}),children:[e.jsx(vt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:25",className:"h-3 w-3 mr-1"}),"YAML"]}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>J("service",i.name),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:368:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:i.ports.map((v,$)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[v.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:371:38",className:"text-slate-500",children:[v.name,": "]}),v.port,"→",v.targetPort,v.nodePort?`/NodePort:${v.nodePort}`:"","/",v.protocol]},$))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:377:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:378:23",className:"text-slate-600",children:"selector:"}),Object.entries(i.selector).map(([v,$])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:25",className:"text-slate-500",children:[v,"=",$]},v))]})]},i.name)})}),B==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:391: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:392:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:397:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:398:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:19",value:q.name,onChange:i=>L(k=>({...k,name:i.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:404:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:405:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:19",value:q.type,onChange:i=>L(k=>({...k,type:i.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:408:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:409:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:415:15",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:416:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:17",className:"flex gap-1.5",children:rn.map(i=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:21",onClick:()=>V(i),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(rs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:422:23",className:"h-2.5 w-2.5"}),i.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"text-slate-500 text-[9px]",children:[i.protocol," ",i.port,":",i.targetPort]})]},i.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:431:15",className:"space-y-2",children:[e.jsxs(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:432:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((i,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:21",value:i.name,onChange:v=>Z(k,"name",v.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:442:21",value:i.protocol,onChange:v=>Z(k,"protocol",v.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:444:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:445:23",value:"UDP",children:"UDP"})]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:448:21",value:i.port,onChange:v=>Z(k,"port",v.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:451:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:452:21",value:i.targetPort,onChange:v=>Z(k,"targetPort",v.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),q.type==="NodePort"&&e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:457:23",value:i.nodePort,onChange:v=>Z(k,"nodePort",v.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(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:462:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>oe(k),disabled:q.ports.length<=1,children:e.jsx(Nt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:23",className:"h-3 w-3"})})]},k)),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>V(),children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:476: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:477:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([i,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[i,"=",k]},i)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:483:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:487:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:488:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ne(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:P,children:"创建"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:497:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:498:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:11",className:"flex items-center justify-between",children:[e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(it,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:501:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[p.length,"/",H.length]})]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{U(i=>({...i,name:`${o}-ingress`,svcPort:String(j[0]?.ports[0]?.port||80)})),ne("ingress")},children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:510:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:513:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:9",className:"pt-0",children:[H.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(it,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:518:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:522:13",className:"space-y-2",children:H.map(i=>{const k=p.includes(i);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:526: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:527:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:34",className:"h-4 w-4 text-purple-400"}):e.jsx(it,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:23",className:"text-sm font-semibold text-slate-200",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:i.className}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400 ml-auto",onClick:()=>z({kind:"ingress",name:i.name}),children:[e.jsx(vt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:25",className:"h-3 w-3 mr-1"}),"YAML"]}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>J("ingress",i.name),children:e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:542:21",className:"mt-2 space-y-1 text-[11px]",children:i.rules.map((v,$)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:25",className:"flex items-start gap-1.5",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:545:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:27",className:"text-slate-300",children:v.host||"*"}),v.paths.map((W,_)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[W.path," → ",W.backend?.service,":",W.backend?.port]},_))]},$))})]},i.name)})}),B==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:563: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:564:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(re,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:568:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:19",value:G.name,onChange:i=>U(k=>({...k,name:i.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:574:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:575:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:19",value:G.className,onChange:i=>U(k=>({...k,className:i.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:580:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:581:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:19",value:G.host,onChange:i=>U(k=>({...k,host:i.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:586:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:587:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:19",value:G.path,onChange:i=>U(k=>({...k,path:i.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:592:17",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:593:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:19",type:"number",value:G.svcPort,onChange:i=>U(k=>({...k,svcPort:i.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:598:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:599:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ne(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:O,children:"创建"})]})]})]})]}),D&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:609:9",className:"hidden"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:613:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:614:9",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:l,children:"完成"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:615:9",size:"sm",className:"h-7 bg-slate-600 text-xs",onClick:n,children:"保存并关闭"})]})]})}function ln({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}){const[d,m]=x.useState("basic"),w=[{key:"basic",label:"基本信息",icon:bt,available:!0},{key:"containers",label:"容器信息",icon:nt,available:!0},{key:"storage",label:"存储挂载",icon:Ze,available:!0},{key:"advanced",label:"高级设置",icon:bt,available:!0},{key:"service",label:"服务/应用路由",icon:Ee,available:!0}];return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:33:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:35:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:w.map(c=>{const g=d===c.key,N=c.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:40:13",disabled:!c.available,onClick:()=>c.available&&m(c.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap
|
||
${g?"border-blue-500 text-blue-400":c.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(N,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:15",className:"h-3.5 w-3.5"}),c.label,c.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:55:17",className:`text-[9px] px-1 py-0.5 rounded ${g?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:c.badge})]},c.key)})}),d==="basic"?e.jsx(Us,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:66:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="containers"?e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:76:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="storage"?e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:86:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="advanced"?e.jsx(an,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:96:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="service"?e.jsx(cn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:106:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):null]})}function dn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=De(),n=gt(w=>w.token)||localStorage.getItem("token")||"",l=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${l}' \\
|
||
-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"}'`,m=w=>{navigator.clipboard.writeText(w).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(A,{"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:l}),e.jsx(h,{"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:()=>m(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(A,{"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:d}),e.jsx(h,{"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:()=>m(d),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(h,{"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(ss,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function pn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:l}=De(),[d,m]=x.useState(""),[w,c]=x.useState(200),[g,N]=x.useState(a[0]||""),[H,y]=x.useState(!1),[E,S]=x.useState(!1),D=async()=>{y(!0);try{const B=await ee.getPodLogs(t,s,o,w,g||void 0);m(B?.data?.logs||B?.logs||B||"无日志")}catch{m("获取日志失败")}finally{y(!1)}};x.useEffect(()=>{D()},[g,w]);const z=async()=>{S(!0);const B=gt.getState().token||"",ne="",q=g?`&container=${encodeURIComponent(g)}`:"",L=`${ne}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${w}&stream=true${q}`;try{const U=(await fetch(L,{headers:{Authorization:`Bearer ${B}`}})).body?.getReader();if(!U)return;const V=new TextDecoder;let Z="";for(;;){const{done:oe,value:r}=await U.read();if(oe)break;Z+=V.decode(r,{stream:!0}),m(Z)}}catch{l({title:"流式日志连接中断",variant:"destructive"})}finally{S(!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:B=>B.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(jt,{"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}),g&&e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:g})]}),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:g,onChange:B=>N(B.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(B=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:B,children:B},B))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:w,onChange:B=>c(Number(B.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(h,{"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:D,disabled:H,children:H?e.jsx(he,{"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(h,{"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:E,children:E?"流中...":"实时流"}),e.jsx(h,{"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(ss,{"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:d||"无日志内容"})})]})})}function mn({modal:t,deployment:s,namespace:o,deploymentName:a,newImage:n,setNewImage:l,scaleValue:d,setScaleValue:m,actionLoading:w,onClose:c,onUpdateImage:g,onScaleTo:N,onDelete:H}){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:c,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(A,{"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(A,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:y=>l(y.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(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:w==="image"||!n.trim(),onClick:g,children:w==="image"?e.jsx(he,{"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:c,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(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:w==="scale"||d<=0,onClick:()=>m(y=>Math.max(0,y-1)),children:e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:d,onChange:y=>m(Math.max(0,Number(y.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:w==="scale",onClick:()=>m(y=>y+1),children:e.jsx(re,{"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(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:w==="scale",onClick:N,children:w==="scale"?e.jsx(he,{"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:c,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(ns,{"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(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:w==="delete",onClick:H,children:[w==="delete"?e.jsx(he,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function xn({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:l}){const d=os(),{toast:m}=De(),w=st(),[c,g]=x.useState(null),[N,H]=x.useState(null),[y,E]=x.useState([]),[S,D]=x.useState([]),[z,B]=x.useState([]),[ne,q]=x.useState(!0),[L,G]=x.useState(""),[U,V]=x.useState(null),[Z,oe]=x.useState(""),[r,u]=x.useState(0),[j,I]=x.useState(null),[p,P]=x.useState(null),O=c?.cluster_id||c?.clusterId||t,J=f=>Array.isArray(f)?f:f?.list||f?.items||f?.data||[],i=x.useCallback(async()=>{q(!0);try{const[f,de,Pe,Ne]=await Promise.all([ee.getDeployment(t,s,o).catch(()=>null),ee.getNamespacePods(t,s).catch(()=>[]),ee.getReplicaSets(t,s).catch(()=>[]),ee.getDeploymentRevisions(t,s,o).catch(()=>[])]),Me=f||(Array.isArray(f)?f[0]:null);g(Me),u(Me?.replicas||0),oe(Me?.image||"");const Ye=J(de).filter(we=>we.namespace===s&&(we.name||"").startsWith(o));E(Ye);const Je=J(Pe).filter(we=>we.namespace===s&&(we.owner_deployment===o||(we.name||"").startsWith(o)));D(Je),B(J(Ne))}catch(f){console.error("加载详情失败:",f)}finally{q(!1)}},[t,s,o]),k=x.useCallback(async()=>{try{const f=await ee.getResourceYaml(t,s,"deployments",o);let de=null;try{de=JSON.parse(f)}catch{try{de=(await js(()=>import("./js-yaml-37NdyH6G.js"),[])).load(f)}catch{de=null}}H(de||c)}catch(f){console.warn("加载 manifest 失败(编辑功能降级):",f),H(c)}},[t,s,o,c]);x.useEffect(()=>{i()},[i]),x.useEffect(()=>{a==="edit"&&!N&&k()},[a,N,k]);const v=async()=>{G("scale");try{await ee.scaleDeployment(t,s,o,r),m({title:"伸缩成功",description:`副本数已设置为 ${r}`}),V(null),i()}catch(f){m({title:"操作失败",description:f?.message||String(f),variant:"destructive"})}finally{G("")}},$=async()=>{if(await w({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){G("restart");try{await ee.restartDeployment(t,s,o),m({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(i,1500)}catch(de){m({title:"重启失败",description:de?.message||String(de),variant:"destructive"})}finally{G("")}}},W=async()=>{const f=!!c?.paused,de=f?"恢复":"暂停";if(await w({title:`${de}滚动更新`,description:`确认${de} Deployment "${o}" 的滚动更新?`,confirmText:de})){G(f?"resume":"pause");try{f?await ee.resumeDeployment(t,s,o):await ee.pauseDeployment(t,s,o),m({title:`${de}成功`,description:`Deployment 滚动更新已${de}`}),setTimeout(i,1e3)}catch(Ne){m({title:`${de}失败`,description:Ne?.message||String(Ne),variant:"destructive"})}finally{G("")}}},_=()=>{V({kind:"cicd"})},ue=async()=>{if(Z.trim()){G("image");try{await ee.updateDeploymentImage(t,s,o,Z),m({title:"镜像更新成功",description:`正在滚动更新为 ${Z}`}),V(null),i()}catch(f){m({title:"更新失败",description:f?.message||String(f),variant:"destructive"})}finally{G("")}}},Q=async()=>{G("delete");try{const f=gt.getState().token||"",Pe=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,Ne=await fetch(Pe,{method:"DELETE",headers:{Authorization:`Bearer ${f}`}});if(!Ne.ok)throw new Error(`HTTP ${Ne.status}`);m({title:"删除成功",description:`${o} 已删除`}),V(null),setTimeout(()=>d(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(f){m({title:"删除失败",description:f?.message||String(f),variant:"destructive"})}finally{G("")}},me=f=>V({kind:"podLogs",pod:f.name}),Ce=f=>V({kind:"podYaml",pod:f.name}),ce=f=>{I(f.name)},M=f=>{P(f.name)};if(ne)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:239:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:9",className:"p-12 text-center",children:[e.jsx(he,{"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(!c)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:250:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:251:9",className:"p-12 text-center",children:[e.jsx(Hs,{"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(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:254:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const ae=c.ready_replicas||c.readyReplicas||0,ge=c.replicas||0,je=ae===ge&&ge>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(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:270:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ms,{"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(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:276:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:15",className:je?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[je?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:30",className:"h-3 w-3 mr-1"}):e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:73",className:"h-3 w-3 mr-1"}),ae,"/",ge]}),c?.paused&&e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:287:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(Ot,{"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:c.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:()=>l("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:()=>l("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:()=>l("yaml"),children:"YAML"})]}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:i,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(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:327:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>V({kind:"image"}),children:[e.jsx(Ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:328:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:$,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:333:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!L,onClick:W,children:c?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ls,{"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(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:341:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:344:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:_,children:[e.jsx(Ns,{"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(h,{"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:()=>V({kind:"delete"}),children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:348:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:356:9",clusterCode:t,namespace:s,deployment:c,pods:y,replicaSets:S,revisions:z,onRefresh:i,onShowPodLogs:me,onShowPodTerminal:ce,onShowPodYaml:Ce,onShowPodFileBrowser:M}):a==="yaml"?e.jsx(Bt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:371:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:i,onClose:()=>l("view")}):e.jsx(ln,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:383:9",clusterCode:t,namespace:s,deploymentName:o,manifest:N,onSaved:()=>{k(),i(),l("view")},onCancel:()=>l("view")}),U?.kind==="yaml"&&e.jsx(Bt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:395:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>V(null),onSaved:i}),e.jsx(mn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:406:7",modal:U,deployment:c,namespace:s,deploymentName:o,newImage:Z,setNewImage:oe,scaleValue:r,setScaleValue:u,actionLoading:L,onClose:()=>V(null),onUpdateImage:ue,onScaleTo:v,onDelete:Q}),U?.kind==="cicd"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:424:9",title:"CI/CD Webhook",onClose:()=>V(null),children:e.jsx(dn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:425:11",clusterCode:t,namespace:s,deploymentName:o})}),U?.kind==="podLogs"&&e.jsx(pn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:9",clusterCode:t,namespace:s,podName:U.pod,containers:(y.find(f=>f.name===U.pod)?.containers||[]).map(f=>f.name).filter(Boolean),onClose:()=>V(null)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:441:7",open:!!j,onOpenChange:f=>{f||I(null)},clusterId:O,namespace:s,podName:j||"",containers:(y.find(f=>f.name===j)?.containers||[]).map(f=>f.name).filter(Boolean)}),e.jsx(Es,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:450:7",open:!!p,onOpenChange:f=>{f||P(null)},clusterCode:t,namespace:s,podName:p||"",containers:(y.find(f=>f.name===p)?.containers||[]).map(f=>f.name).filter(Boolean)})]})}function Zn(){const t=fs(),s=os(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",l=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",d=m=>{m!==l&&s(`/kubernetes/${o}/namespace/${a}/workload/${m}/Deployment/${n}`,{replace:!0})};return e.jsx(xn,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:l,onBack:()=>s(-1),onModeChange:d})}export{Zn as default};
|