feat(k8s): Deployment 存储挂载改 Kuboard 一卷一卡布局

每张数据卷同屏展示卷定义与容器挂载(容器/只读读写/路径/subPath)。
This commit is contained in:
Logan.Li committed 2026-06-26 15:00:09 +08:00
1 parent a8305de0f5
commit 025e74ff4d
98 files changed
+386 -345

No files matched your search

@@ -1,4 +1,4 @@
import{j as s,r as l}from"./vendor-codemirror-C7mXSpXt.js";import{C as b,b as v,c as w,a as C}from"./card-BVNSlZ0C.js";import{B as y}from"./badge-BodqHT_V.js";import{q as z,B as A,D as O,a as U,b as B,c as J,d as E}from"./index-EF2TDvxx.js";import{a as L}from"./alert-B4v9izj6.js";import{a as G}from"./ai-CEIZUoip.js";import{ay as R,av as g,L as $,ab as D,aa as F,y as f,F as H,r as S,z as P,w as K,aF as q,l as _,h as X,b as Q,a as W}from"./vendor-icons-Aso0-eeY.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash
import{j as s,r as l}from"./vendor-codemirror-C7mXSpXt.js";import{C as b,b as v,c as w,a as C}from"./card-B-RtdR4H.js";import{B as y}from"./badge-B0F5ZNtn.js";import{q as z,B as A,D as O,a as U,b as B,c as J,d as E}from"./index-LZWfu62c.js";import{a as L}from"./alert-C4MMKcUL.js";import{a as G}from"./ai-BMSiZ3PN.js";import{ay as R,av as g,L as $,ab as D,aa as F,y as f,F as H,r as S,z as P,w as K,aF as q,l as _,h as X,b as Q,a as W}from"./vendor-icons-Aso0-eeY.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash
# CPU 高负载诊断脚本 - ${t}
echo "===== CPU TOP 10 进程 ====="
ps aux --sort=-%cpu | head -11
@@ -1,4 +1,4 @@
import{r as x,j as s,b as _s}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,b as T,c as Z,a as q}from"./card-BVNSlZ0C.js";import{a7 as ks,_ as Es,W as H,m as ds,B as N,q as Ls,D as Rs,a as Ms,b as Ps,c as Ds,d as Ts,e as qs,t as w}from"./index-EF2TDvxx.js";import{I as C}from"./input--Xdj49es.js";import{B as k}from"./badge-BodqHT_V.js";import{L as y}from"./label-DZckFZd3.js";import{S as ss,a as ts,b as es,c as as,d as ns}from"./select-DbRZUnPK.js";import{S as Us}from"./switch-DYISEUSP.js";import{d as U}from"./dashboard-BNyMEfo2.js";import{a as Bs}from"./alert-B4v9izj6.js";import{a as Fs}from"./agent-D_rvbJT8.js";import{a as $}from"./ai-CEIZUoip.js";import{av as zs,C as Hs,p as os,l as ms,A as xs,F as hs,aa as Vs,L as E,r as Ks,b3 as cs,aK as Gs,aj as Ws,U as Qs,b4 as Js,at as Xs,aR as Ys}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Zs(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function I(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,I]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,st(o,...n)]}function st(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var tt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=tt.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},F={};var rs;function et(){if(rs)return F;rs=1;var e=_s();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var I=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:I,F}var is;function at(){return is||(is=1,B.exports=et()),B.exports}var nt=at();function ot(){return nt.useSyncExternalStore(ct,()=>!0,()=>!1)}function ct(){return()=>{}}var K="Avatar",[rt]=Zs(K),[it,us]=rt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(it,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",pt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=lt(r,a),l=Es(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});pt.displayName=fs;var gs="AvatarFallback",vs=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});vs.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lt(e,{referrerPolicy:n,crossOrigin:i}){const r=ot(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),I=l("error");return a.addEventListener("load",g),a.addEventListener("error",I),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=i),()=>{a.removeEventListener("load",g),a.removeEventListener("error",I)}},[a,i,n]),d}var dt=As,mt=vs;function xt({className:e,...n}){return s.jsx(dt,{"code-path":"src/components/ui/avatar.tsx:11:5","data-slot":"avatar",className:ds("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...n})}function ht({className:e,...n}){return s.jsx(mt,{"code-path":"src/components/ui/avatar.tsx:40:5","data-slot":"avatar-fallback",className:ds("bgLine truncated
import{r as x,j as s,b as _s}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,b as T,c as Z,a as q}from"./card-B-RtdR4H.js";import{a7 as ks,_ as Es,W as H,m as ds,B as N,q as Ls,D as Rs,a as Ms,b as Ps,c as Ds,d as Ts,e as qs,t as w}from"./index-LZWfu62c.js";import{I as C}from"./input-BdDauX3U.js";import{B as k}from"./badge-B0F5ZNtn.js";import{L as y}from"./label-u-lNUbKh.js";import{S as ss,a as ts,b as es,c as as,d as ns}from"./select-4xU_9B3_.js";import{S as Us}from"./switch-C4PJnJ9I.js";import{d as U}from"./dashboard-7Sl2aero.js";import{a as Bs}from"./alert-C4MMKcUL.js";import{a as Fs}from"./agent-g0Vk8FYK.js";import{a as $}from"./ai-BMSiZ3PN.js";import{av as zs,C as Hs,p as os,l as ms,A as xs,F as hs,aa as Vs,L as E,r as Ks,b3 as cs,aK as Gs,aj as Ws,U as Qs,b4 as Js,at as Xs,aR as Ys}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Zs(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function I(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,I]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,st(o,...n)]}function st(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var tt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=tt.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},F={};var rs;function et(){if(rs)return F;rs=1;var e=_s();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var I=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:I,F}var is;function at(){return is||(is=1,B.exports=et()),B.exports}var nt=at();function ot(){return nt.useSyncExternalStore(ct,()=>!0,()=>!1)}function ct(){return()=>{}}var K="Avatar",[rt]=Zs(K),[it,us]=rt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(it,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",pt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=lt(r,a),l=Es(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});pt.displayName=fs;var gs="AvatarFallback",vs=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});vs.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lt(e,{referrerPolicy:n,crossOrigin:i}){const r=ot(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),I=l("error");return a.addEventListener("load",g),a.addEventListener("error",I),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=i),()=>{a.removeEventListener("load",g),a.removeEventListener("error",I)}},[a,i,n]),d}var dt=As,mt=vs;function xt({className:e,...n}){return s.jsx(dt,{"code-path":"src/components/ui/avatar.tsx:11:5","data-slot":"avatar",className:ds("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...n})}function ht({className:e,...n}){return s.jsx(mt,{"code-path":"src/components/ui/avatar.tsx:40:5","data-slot":"avatar-fallback",className:ds("bgLine truncated
${i.join(`
`)}`}async function ls(){const e=await Fs.getLatest(),n=Array.isArray(e)?e:e?.list||[];if(!n.length)return"(当前无 Agent 上报数据,可能未部署监控 Agent)";const i=n.slice(0,20).map((a,d)=>{const m=a.cpu_usage??"-",l=a.mem_usage??"-";return`${d+1}. ${a.hostname||"-"} | CPU:${m}% | 内存:${l}% (${a.mem_used??"-"}/${a.mem_total??"-"}GB) | 核数:${a.cpu_cores??"-"} | 上报:${(a.report_time||"").slice(0,16)}`}),r=n.filter(a=>(a.cpu_usage??0)>=80||(a.mem_usage??0)>=80),o=r.length?`
⚠️ 高负载主机 ${r.length} 台:${r.map(a=>`${a.hostname}(CPU${a.cpu_usage}%/MEM${a.mem_usage}%)`).join("、")}`:"";return`Agent 监控的 ${n.length} 台主机实时指标:
@@ -1 +1 @@
import{j as e,r as g}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,b as B,c as K,a as z}from"./card-BVNSlZ0C.js";import{S as Z}from"./stat-strip-TlkYcldq.js";import{B as q}from"./index-EF2TDvxx.js";import{B as G}from"./badge-BodqHT_V.js";import{T as J,a as Q,b as D,c as $}from"./tabs-dobHN7aQ.js";import{S as ee,a as se,b as te,c as ae,d as M}from"./select-DbRZUnPK.js";import{d as ce}from"./dashboard-BNyMEfo2.js";import{s as ie}from"./server-rQ-8Frwb.js";import{a as H}from"./alert-B4v9izj6.js";import{H as X,L as _,D as ne,a4 as Y,av as re,aw as oe,A as le,ax as de,u as pe,l as L,aa as W,ay as me,g as xe,az as he,N as ye,s as ve,aA as Ae}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ue({forecasts:c,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):c.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:c.map((a,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:a.resource})]}),e.jsx(G,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:a.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":a.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:a.daysUntilThreshold<=7?"紧急":a.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:a.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[a.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${a.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,a.predictedUsage-a.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",Line truncated
import{j as e,r as g}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,b as B,c as K,a as z}from"./card-B-RtdR4H.js";import{S as Z}from"./stat-strip-BPzU38xY.js";import{B as q}from"./index-LZWfu62c.js";import{B as G}from"./badge-B0F5ZNtn.js";import{T as J,a as Q,b as D,c as $}from"./tabs-kmtfM2I-.js";import{S as ee,a as se,b as te,c as ae,d as M}from"./select-4xU_9B3_.js";import{d as ce}from"./dashboard-7Sl2aero.js";import{s as ie}from"./server-BUAZv7ZV.js";import{a as H}from"./alert-C4MMKcUL.js";import{H as X,L as _,D as ne,a4 as Y,av as re,aw as oe,A as le,ax as de,u as pe,l as L,aa as W,ay as me,g as xe,az as he,N as ye,s as ve,aA as Ae}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ue({forecasts:c,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):c.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:c.map((a,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:a.resource})]}),e.jsx(G,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:a.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":a.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:a.daysUntilThreshold<=7?"紧急":a.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:a.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[a.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${a.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,a.predictedUsage-a.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",Line truncated
@@ -1 +1 @@
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{G as ct,D as Q,a as J,b as V,c as U,d as Y,e as ie,B as m,t as d,f as Oe}from"./index-EF2TDvxx.js";import{I as _}from"./input--Xdj49es.js";import{B as A}from"./badge-BodqHT_V.js";import{C as W,a as K,b as Te,c as _e}from"./card-BVNSlZ0C.js";import{S as at}from"./stat-strip-TlkYcldq.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-DbRZUnPK.js";import{T as lt,a as it,b as F,c as B}from"./tabs-dobHN7aQ.js";import{S as Le}from"./switch-DYISEUSP.js";import{a as R}from"./alert-B4v9izj6.js";import{a as E}from"./alert-center-C2gx2r-S.js";import{u as ze,q as ae,b as Ge,a as mt}from"./unwrap-oA0ekUAt.js";import{u as $}from"./useMutation-BLuCS56f.js";import{a as Ce}from"./agent-D_rvbJT8.js";import{I as dt,l as Me,ab as pt,aX as le,y as $e,U as xt,a4 as ht,w as Ie,f as ut,R as te,P as re,b as gt,aY as jt,aw as Ct,aE as ft,T as vt,S as At,x as Nt,ar as yt}from"./vendor-icons-Aso0-eeY.js";import{L as j}from"./label-DZckFZd3.js";import{A as wt}from"./AlertRuleDialog-B_V4xcKa.js";import{T as bt}from"./textarea-JgdELMPr.js";import"./index-CYARH0Cq.js";function St(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(pt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(dt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function Dt(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ht,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(xt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx($e,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function kt(t){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信",webhook:"Webhook"}[t]||t}function Tt(t){return{firing:t.filter(s=>s.status==="firing").length,critical:t.filter(s=>s.severity==="critical"&&s.status==="firing").length,warning:t.filter(s=>s.severity==="warning"&&s.status==="firing").length,resolved:t.filter(s=>s.status==="resolved").length}}function _t(){return ze({queryKey:ae.agentAlertRules(),queryFn:async()=>{const t=await Ce.listRules();return Ge(t).map(n=>({id:n.id,name:String(n.name||""),description:`${n.metric} ${n.operator} ${n.threshold}%`,enabled:!!n.enabled,severity:"warning",type:String(n.metric||""),hostname:String(n.hostname||"全部主机"),threshold:Number(n.threshold||0)}))},staleTime:3e4})}function Rt(Line truncated
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{G as ct,D as Q,a as J,b as V,c as U,d as Y,e as ie,B as m,t as d,f as Oe}from"./index-LZWfu62c.js";import{I as _}from"./input-BdDauX3U.js";import{B as A}from"./badge-B0F5ZNtn.js";import{C as W,a as K,b as Te,c as _e}from"./card-B-RtdR4H.js";import{S as at}from"./stat-strip-BPzU38xY.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-4xU_9B3_.js";import{T as lt,a as it,b as F,c as B}from"./tabs-kmtfM2I-.js";import{S as Le}from"./switch-C4PJnJ9I.js";import{a as R}from"./alert-C4MMKcUL.js";import{a as E}from"./alert-center-dJk4LGZM.js";import{u as ze,q as ae,b as Ge,a as mt}from"./unwrap-BmWy-KM2.js";import{u as $}from"./useMutation-Bp3lz5hm.js";import{a as Ce}from"./agent-g0Vk8FYK.js";import{I as dt,l as Me,ab as pt,aX as le,y as $e,U as xt,a4 as ht,w as Ie,f as ut,R as te,P as re,b as gt,aY as jt,aw as Ct,aE as ft,T as vt,S as At,x as Nt,ar as yt}from"./vendor-icons-Aso0-eeY.js";import{L as j}from"./label-u-lNUbKh.js";import{A as wt}from"./AlertRuleDialog-BsJX7bok.js";import{T as bt}from"./textarea-BdtIagjy.js";import"./index-CYARH0Cq.js";function St(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(pt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(dt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function Dt(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ht,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(xt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx($e,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function kt(t){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信",webhook:"Webhook"}[t]||t}function Tt(t){return{firing:t.filter(s=>s.status==="firing").length,critical:t.filter(s=>s.severity==="critical"&&s.status==="firing").length,warning:t.filter(s=>s.severity==="warning"&&s.status==="firing").length,resolved:t.filter(s=>s.status==="resolved").length}}function _t(){return ze({queryKey:ae.agentAlertRules(),queryFn:async()=>{const t=await Ce.listRules();return Ge(t).map(n=>({id:n.id,name:String(n.name||""),description:`${n.metric} ${n.operator} ${n.threshold}%`,enabled:!!n.enabled,severity:"warning",type:String(n.metric||""),hostname:String(n.hostname||"全部主机"),threshold:Number(n.threshold||0)}))},staleTime:3e4})}function Rt(Line truncated
@@ -1 +1 @@
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as w,a as M,b as ee,c as te,d as se}from"./card-BVNSlZ0C.js";import{f as _,B as A,t as E,D as oe,a as ae,b as ne,c as re,d as ce,e as le}from"./index-EF2TDvxx.js";import{T as ie,a as me,b as H,c as I}from"./tabs-dobHN7aQ.js";import{a as g}from"./alert-B4v9izj6.js";import{I as Y}from"./input--Xdj49es.js";import{B as f}from"./badge-BodqHT_V.js";import{T as $,a as Q,b as R,c as i,d as X,e as c}from"./table-CUnn2-lp.js";import{S as de,L as O,y as J,t as V,l as z,T as B,p as q,P as U,b as xe}from"./vendor-icons-Aso0-eeY.js";import{S as P}from"./switch-DYISEUSP.js";import{C as G}from"./checkbox-CY3XhE_w.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-B_V4xcKa.js";import{L as D}from"./label-DZckFZd3.js";import{T as be}from"./textarea-JgdELMPr.js";import{R as Ae,A as je,C as ue,X as Ne,Y as ve,T as fe,a as W}from"./AreaChart-B9PyJ8Di.js";import"./index-CYARH0Cq.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(V,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(de,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertEventsTab.tsx:133:9",className:Line truncated
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as w,a as M,b as ee,c as te,d as se}from"./card-B-RtdR4H.js";import{f as _,B as A,t as E,D as oe,a as ae,b as ne,c as re,d as ce,e as le}from"./index-LZWfu62c.js";import{T as ie,a as me,b as H,c as I}from"./tabs-kmtfM2I-.js";import{a as g}from"./alert-C4MMKcUL.js";import{I as Y}from"./input-BdDauX3U.js";import{B as f}from"./badge-B0F5ZNtn.js";import{T as $,a as Q,b as R,c as i,d as X,e as c}from"./table-BPFYQwjr.js";import{S as de,L as O,y as J,t as V,l as z,T as B,p as q,P as U,b as xe}from"./vendor-icons-Aso0-eeY.js";import{S as P}from"./switch-C4PJnJ9I.js";import{C as G}from"./checkbox-DL3onEGv.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-BsJX7bok.js";import{L as D}from"./label-u-lNUbKh.js";import{T as be}from"./textarea-BdtIagjy.js";import{R as Ae,A as je,C as ue,X as Ne,Y as ve,T as fe,a as W}from"./AreaChart-Czgv4pNk.js";import"./index-CYARH0Cq.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(V,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(de,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertEventsTab.tsx:133:9",className:Line truncated
@@ -1,4 +1,4 @@
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{D as R,a as v,b as w,c as k,d as S,e as _,B as g}from"./index-EF2TDvxx.js";import{I as x}from"./input--Xdj49es.js";import{L as n}from"./label-DZckFZd3.js";import{T as C}from"./textarea-JgdELMPr.js";import{S as L}from"./switch-DYISEUSP.js";import{a as A}from"./alert-B4v9izj6.js";import{t as E,aj as P,ak as T,al as I,L as B}from"./vendor-icons-Aso0-eeY.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const z=[{key:"dingtalk",label:"钉钉",placeholder:`{
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{D as R,a as v,b as w,c as k,d as S,e as _,B as g}from"./index-LZWfu62c.js";import{I as x}from"./input-BdDauX3U.js";import{L as n}from"./label-u-lNUbKh.js";import{T as C}from"./textarea-BdtIagjy.js";import{S as L}from"./switch-C4PJnJ9I.js";import{a as A}from"./alert-C4MMKcUL.js";import{t as E,aj as P,ak as T,al as I,L as B}from"./vendor-icons-Aso0-eeY.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const z=[{key:"dingtalk",label:"钉钉",placeholder:`{
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=***",
"secret": "SECxxx"
}`},{key:"wechat",label:"企业微信",placeholder:`{
@@ -1 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as t}from"./ApprovalCategoryPage-KY6ryxLb.js";import"./card-BVNSlZ0C.js";import"./index-EF2TDvxx.js";import"./vendor-icons-Aso0-eeY.js";import"./input--Xdj49es.js";import"./badge-BodqHT_V.js";import"./label-DZckFZd3.js";import"./table-CUnn2-lp.js";import"./select-DbRZUnPK.js";import"./index-CYARH0Cq.js";import"./approval-DPMUbhSE.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function g(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{g as ApprovalAppPage};
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as t}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function g(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{g as ApprovalAppPage};
@@ -1 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as de,a as xe}from"./card-BVNSlZ0C.js";import{B as x,D as Q,a as W,b as Y,c as Z,d as ee,t as l}from"./index-EF2TDvxx.js";import{I as H}from"./input--Xdj49es.js";import{B as z}from"./badge-BodqHT_V.js";import{L as ne}from"./label-DZckFZd3.js";import{T as he,a as ie,b as q,c as N,d as ve,e as f}from"./table-CUnn2-lp.js";import{S as J,a as U,b as X,c as K,d as w}from"./select-DbRZUnPK.js";import{b as h}from"./approval-DPMUbhSE.js";import{P as me,S as ye,R as ue,L as G,F as Ce,X as I,w as B,x as je,b as Pe,a as Ae,y as be,U as Ne,z as fe,f as we}from"./vendor-icons-Aso0-eeY.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(be,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function M(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function Re({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),R=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{R()},[R]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},O=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:O,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(me,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(ye,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:168:11",placeholdeLine truncated
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as de,a as xe}from"./card-B-RtdR4H.js";import{B as x,D as Q,a as W,b as Y,c as Z,d as ee,t as l}from"./index-LZWfu62c.js";import{I as H}from"./input-BdDauX3U.js";import{B as z}from"./badge-B0F5ZNtn.js";import{L as ne}from"./label-u-lNUbKh.js";import{T as he,a as ie,b as q,c as N,d as ve,e as f}from"./table-BPFYQwjr.js";import{S as J,a as U,b as X,c as K,d as w}from"./select-4xU_9B3_.js";import{b as h}from"./approval-DmGRfKd6.js";import{P as me,S as ye,R as ue,L as G,F as Ce,X as I,w as B,x as je,b as Pe,a as Ae,y as be,U as Ne,z as fe,f as we}from"./vendor-icons-Aso0-eeY.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(be,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function M(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function Re({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),R=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{R()},[R]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},O=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:O,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(me,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(ye,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:168:11",placeholdeLine truncated
@@ -1 +1 @@
import{j as e,r as v}from"./vendor-codemirror-C7mXSpXt.js";import{m as b,B as i,D as M,a as V,b as q,c as H,d as Q,e as G,t as T}from"./index-EF2TDvxx.js";import{C as u,a as j,b as ye,c as Ne,d as we}from"./card-BVNSlZ0C.js";import{B as C}from"./badge-BodqHT_V.js";import{T as pe}from"./textarea-JgdELMPr.js";import{b as k}from"./approval-DPMUbhSE.js";import{I as le}from"./input--Xdj49es.js";import{h as fe,aQ as Te,F as _,C as D,a as F,L as $,S as De,x as Fe,af as Ce,J as oe,aE as Pe,ae as Se,b as ce,P as ke}from"./vendor-icons-Aso0-eeY.js";import{L as _e}from"./label-DZckFZd3.js";import{S as Le,a as Oe,b as Ie,c as $e,d as Re}from"./select-DbRZUnPK.js";import"./index-CYARH0Cq.js";function ze(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}function I(a){if(!a)return[];const r=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return r?Array.isArray(r.fields)?r.fields:[]:[]}function Ee(a,r){if(!a)return null;let s;try{s=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!s||typeof s!="object")return null;const o=I(r?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(s).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const R=[{value:"server_apply",label:"云服务器申请",icon:fe,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Te,color:"var(--dg-blue)"}],Y=a=>R.find(r=>r.value===a)?.label||a||"通用审批",L=a=>R.find(r=>r.value===a)?.color||"var(--dg-text-secondary)",Be=a=>R.find(r=>r.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const r=ze(a.steps),s=a.current_step??0,o=r.length,n=r.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:r,currentIndex:s,total:o,completed:n,percentage:m}}function X(a){const{steps:r,currentIndex:s}=U(a);return r.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:r.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===s,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<r.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function Me(a){const r={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(--dg-blue)]/10",dot:"bg-[var(--dg-blue)]"},completed:{label:"已完成",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",dot:"bg-[var(--dg-text-secondary)]"}},s=r[a]||r.pending;return e.jsxs(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:64:5",variant:"outline",className:s.className,children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:65:7",clLine truncated
import{j as e,r as v}from"./vendor-codemirror-C7mXSpXt.js";import{m as b,B as i,D as M,a as V,b as q,c as H,d as Q,e as G,t as T}from"./index-LZWfu62c.js";import{C as u,a as j,b as ye,c as Ne,d as we}from"./card-B-RtdR4H.js";import{B as C}from"./badge-B0F5ZNtn.js";import{T as pe}from"./textarea-BdtIagjy.js";import{b as k}from"./approval-DmGRfKd6.js";import{I as le}from"./input-BdDauX3U.js";import{h as fe,aQ as Te,F as _,C as D,a as F,L as $,S as De,x as Fe,af as Ce,J as oe,aE as Pe,ae as Se,b as ce,P as ke}from"./vendor-icons-Aso0-eeY.js";import{L as _e}from"./label-u-lNUbKh.js";import{S as Le,a as Oe,b as Ie,c as $e,d as Re}from"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";function ze(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}function I(a){if(!a)return[];const r=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return r?Array.isArray(r.fields)?r.fields:[]:[]}function Ee(a,r){if(!a)return null;let s;try{s=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!s||typeof s!="object")return null;const o=I(r?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(s).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const R=[{value:"server_apply",label:"云服务器申请",icon:fe,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Te,color:"var(--dg-blue)"}],Y=a=>R.find(r=>r.value===a)?.label||a||"通用审批",L=a=>R.find(r=>r.value===a)?.color||"var(--dg-text-secondary)",Be=a=>R.find(r=>r.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const r=ze(a.steps),s=a.current_step??0,o=r.length,n=r.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:r,currentIndex:s,total:o,completed:n,percentage:m}}function X(a){const{steps:r,currentIndex:s}=U(a);return r.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:r.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===s,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<r.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function Me(a){const r={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(--dg-blue)]/10",dot:"bg-[var(--dg-blue)]"},completed:{label:"已完成",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",dot:"bg-[var(--dg-text-secondary)]"}},s=r[a]||r.pending;return e.jsxs(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:64:5",variant:"outline",className:s.className,children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:65:7",clLine truncated
@@ -1 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-KY6ryxLb.js";import"./card-BVNSlZ0C.js";import"./index-EF2TDvxx.js";import"./vendor-icons-Aso0-eeY.js";import"./input--Xdj49es.js";import"./badge-BodqHT_V.js";import"./label-DZckFZd3.js";import"./table-CUnn2-lp.js";import"./select-DbRZUnPK.js";import"./index-CYARH0Cq.js";import"./approval-DPMUbhSE.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function P(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{P as ApprovalPermissionPage};
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function P(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{P as ApprovalPermissionPage};
@@ -1 +1 @@
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-KY6ryxLb.js";import"./card-BVNSlZ0C.js";import"./index-EF2TDvxx.js";import"./vendor-icons-Aso0-eeY.js";import"./input--Xdj49es.js";import"./badge-BodqHT_V.js";import"./label-DZckFZd3.js";import"./table-CUnn2-lp.js";import"./select-DbRZUnPK.js";import"./index-CYARH0Cq.js";import"./approval-DPMUbhSE.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{b as ApprovalResourcePage};
import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{b as ApprovalResourcePage};
@@ -1 +1 @@
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as Q}from"./card-BVNSlZ0C.js";import{f as V,u as X,t as C,B as $}from"./index-EF2TDvxx.js";import{a as S}from"./approval-DPMUbhSE.js";import{L as D,P as R,J as H,K as z,O as Z,Q as Y,z as J,c as ee,T as F,X as G,j as q,V as se,W as ae,Y as te,y as re}from"./vendor-icons-Aso0-eeY.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:se,audit:q,execute:J},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:y,onClear:A,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:A,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(re,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const y=!!i,[A,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({name:s.name,step_type:s.step_type==="serial"||s.step_type==="parallel"?"audit":s.step_type,approver_ids:T(s.approver_ids)}))):h([{name:"提交申请",Line truncated
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as Q}from"./card-B-RtdR4H.js";import{f as V,u as X,t as C,B as $}from"./index-LZWfu62c.js";import{a as S}from"./approval-DmGRfKd6.js";import{L as D,P as R,J as H,K as z,O as Z,Q as Y,z as J,c as ee,T as F,X as G,j as q,V as se,W as ae,Y as te,y as re}from"./vendor-icons-Aso0-eeY.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:se,audit:q,execute:J},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:y,onClear:A,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:A,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(re,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const y=!!i,[A,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({name:s.name,step_type:s.step_type==="serial"||s.step_type==="parallel"?"audit":s.step_type,approver_ids:T(s.approver_ids)}))):h([{name:"提交申请",Line truncated
@@ -1,4 +1,4 @@
import{au as ee}from"./index-EF2TDvxx.js";import{d as ti,g as ue,r as N,a as T}from"./vendor-codemirror-C7mXSpXt.js";var Wa,vh;function Re(){if(vh)return Wa;vh=1;var e=Array.isArray;return Wa=e,Wa}var Ua,yh;function Zg(){if(yh)return Ua;yh=1;var e=typeof ti=="object"&&ti&&ti.Object===Object&&ti;return Ua=e,Ua}var Ha,mh;function ot(){if(mh)return Ha;mh=1;var e=Zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ha=r,Ha}var Ga,gh;function Gn(){if(gh)return Ga;gh=1;var e=ot(),t=e.Symbol;return Ga=t,Ga}var Ka,bh;function sw(){if(bh)return Ka;bh=1;var e=Gn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Ka=a,Ka}var Va,xh;function lw(){if(xh)return Va;xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Va=r,Va}var Xa,wh;function xt(){if(wh)return Xa;wh=1;var e=Gn(),t=sw(),r=lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return Xa=o,Xa}var Ya,Oh;function wt(){if(Oh)return Ya;Oh=1;function e(t){return t!=null&&typeof t=="object"}return Ya=e,Ya}var Za,_h;function Nr(){if(_h)return Za;_h=1;var e=xt(),t=wt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Za=n,Za}var Ja,Sh;function uf(){if(Sh)return Ja;Sh=1;var e=Re(),t=Nr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ja=i,Ja}var Qa,Ah;function Ct(){if(Ah)return Qa;Ah=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Qa=e,Qa}var eo,Ph;function cf(){if(Ph)return eo;Ph=1;var e=xt(),t=Ct(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return eo=o,eo}var to,Th;function fw(){if(Th)return to;Th=1;var e=ot(),t=e["__core-js_shared__"];return to=t,to}var ro,Eh;function hw(){if(Eh)return ro;Eh=1;var e=fw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return ro=r,ro}var no,jh;function Jg(){if(jh)return no;jh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return no=r,no}var io,Mh;function pw(){if(Mh)return io;Mh=1;var e=cf(),t=hw(),r=Ct(),n=Jg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return io=l,io}var ao,Ch;function dw(){if(Ch)return ao;Ch=1;function e(t,r){return t?.[r]}return ao=e,ao}var oo,$h;function Qt(){if($h)return oo;$h=1;var e=pw(),t=dw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return oo=r,oo}var uo,Ih;function ha(){if(Ih)return uo;Ih=1;var e=Qt(),t=e(Object,"create");return uo=t,uo}var co,Rh;function vw(){if(Rh)return co;Rh=1;var e=ha();function t(){this.__data__=e?e(null):{},this.size=0}return co=t,co}var so,kh;function yw(){if(kh)return so;kh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return so=e,so}var lo,Dh;function mw(){if(Dh)return lo;Dh=1;var e=ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return lo=i,lo}var fo,Nh;function gw(){if(Nh)return fo;Nh=1;var e=ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return fo=n,fo}var ho,qh;function bw(){if(qh)return ho;qh=1;var e=ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ho=r,ho}var po,Bh;function xw(){if(Bh)return po;Bh=1;var e=vw(),t=yw(),r=mw(),n=gw(),i=bw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,po=a,po}var vo,Lh;function ww(){if(Lh)return vo;Lh=1;function e(){this.__data__=[],this.size=0}return vo=e,vo}var yo,Fh;function sf(){if(Fh)return yo;Fh=1;function e(t,r){return t===r||t!==t&&r!==r}return yo=e,yo}var mo,zh;function pa(){if(zh)return mo;zh=1;var e=sf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return mo=t,mo}var go,Wh;function Ow(){if(Wh)return go;Wh=1;var e=pa(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)retLine truncated
import{au as ee}from"./index-LZWfu62c.js";import{d as ti,g as ue,r as N,a as T}from"./vendor-codemirror-C7mXSpXt.js";var Wa,vh;function Re(){if(vh)return Wa;vh=1;var e=Array.isArray;return Wa=e,Wa}var Ua,yh;function Zg(){if(yh)return Ua;yh=1;var e=typeof ti=="object"&&ti&&ti.Object===Object&&ti;return Ua=e,Ua}var Ha,mh;function ot(){if(mh)return Ha;mh=1;var e=Zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ha=r,Ha}var Ga,gh;function Gn(){if(gh)return Ga;gh=1;var e=ot(),t=e.Symbol;return Ga=t,Ga}var Ka,bh;function sw(){if(bh)return Ka;bh=1;var e=Gn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Ka=a,Ka}var Va,xh;function lw(){if(xh)return Va;xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Va=r,Va}var Xa,wh;function xt(){if(wh)return Xa;wh=1;var e=Gn(),t=sw(),r=lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return Xa=o,Xa}var Ya,Oh;function wt(){if(Oh)return Ya;Oh=1;function e(t){return t!=null&&typeof t=="object"}return Ya=e,Ya}var Za,_h;function Nr(){if(_h)return Za;_h=1;var e=xt(),t=wt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Za=n,Za}var Ja,Sh;function uf(){if(Sh)return Ja;Sh=1;var e=Re(),t=Nr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ja=i,Ja}var Qa,Ah;function Ct(){if(Ah)return Qa;Ah=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Qa=e,Qa}var eo,Ph;function cf(){if(Ph)return eo;Ph=1;var e=xt(),t=Ct(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return eo=o,eo}var to,Th;function fw(){if(Th)return to;Th=1;var e=ot(),t=e["__core-js_shared__"];return to=t,to}var ro,Eh;function hw(){if(Eh)return ro;Eh=1;var e=fw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return ro=r,ro}var no,jh;function Jg(){if(jh)return no;jh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return no=r,no}var io,Mh;function pw(){if(Mh)return io;Mh=1;var e=cf(),t=hw(),r=Ct(),n=Jg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return io=l,io}var ao,Ch;function dw(){if(Ch)return ao;Ch=1;function e(t,r){return t?.[r]}return ao=e,ao}var oo,$h;function Qt(){if($h)return oo;$h=1;var e=pw(),t=dw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return oo=r,oo}var uo,Ih;function ha(){if(Ih)return uo;Ih=1;var e=Qt(),t=e(Object,"create");return uo=t,uo}var co,Rh;function vw(){if(Rh)return co;Rh=1;var e=ha();function t(){this.__data__=e?e(null):{},this.size=0}return co=t,co}var so,kh;function yw(){if(kh)return so;kh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return so=e,so}var lo,Dh;function mw(){if(Dh)return lo;Dh=1;var e=ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return lo=i,lo}var fo,Nh;function gw(){if(Nh)return fo;Nh=1;var e=ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return fo=n,fo}var ho,qh;function bw(){if(qh)return ho;qh=1;var e=ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ho=r,ho}var po,Bh;function xw(){if(Bh)return po;Bh=1;var e=vw(),t=yw(),r=mw(),n=gw(),i=bw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u<c;){var s=o[u];this.set(s[0],s[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,po=a,po}var vo,Lh;function ww(){if(Lh)return vo;Lh=1;function e(){this.__data__=[],this.size=0}return vo=e,vo}var yo,Fh;function sf(){if(Fh)return yo;Fh=1;function e(t,r){return t===r||t!==t&&r!==r}return yo=e,yo}var mo,zh;function pa(){if(zh)return mo;zh=1;var e=sf();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return mo=t,mo}var go,Wh;function Ow(){if(Wh)return go;Wh=1;var e=pa(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)retLine truncated
A`).concat(o,",").concat(o,",0,1,1,").concat(2*u,",").concat(a,`
H`).concat(ze,"M").concat(2*u,",").concat(a,`
A`).concat(o,",").concat(o,",0,1,1,").concat(u,",").concat(a),className:"recharts-legend-icon"});if(n.type==="rect")return T.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(ze/8,"h").concat(ze,"v").concat(ze*3/4,"h").concat(-ze,"z"),className:"recharts-legend-icon"});if(T.isValidElement(n.legendIcon)){var s=d1({},n);return delete s.legendIcon,T.cloneElement(n.legendIcon,s)}return T.createElement(bf,{fill:c,cx:a,cy:a,size:ze,sizeType:"diameter",type:n.type})}},{key:"renderItems",value:function(){var n=this,i=this.props,a=i.payload,o=i.iconSize,u=i.layout,c=i.formatter,s=i.inactiveColor,f={x:0,y:0,width:ze,height:ze},l={display:u==="horizontal"?"inline-block":"block",marginRight:10},h={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(d,m){var v=d.formatter||c,p=ee(fn(fn({"recharts-legend-item":!0},"legend-item-".concat(m),!0),"inactive",d.inactive));if(d.type==="none")return null;var b=V(d.value)?null:d.value;dt(!V(d.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var x=d.inactive?s:d.color;return T.createElement("li",tl({className:p,style:l,key:"legend-item-".concat(m)},mi(n.props,d,m)),T.createElement(Vs,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),T.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(b,d,m):b))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);fn(xf,"displayName","Legend");fn(xf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var au,Fp;function _1(){if(Fp)return au;Fp=1;var e=da();function t(){this.__data__=new e,this.size=0}return au=t,au}var ou,zp;function S1(){if(zp)return ou;zp=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return ou=e,ou}var uu,Wp;function A1(){if(Wp)return uu;Wp=1;function e(t){return this.__data__.get(t)}return uu=e,uu}var cu,Up;function P1(){if(Up)return cu;Up=1;function e(t){return this.__data__.has(t)}return cu=e,cu}var su,Hp;function T1(){if(Hp)return su;Hp=1;var e=da(),t=lf(),r=ff(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.length<n-1)return c.push([a,o]),this.size=++u.size,this;u=this.__data__=new r(c)}return u.set(a,o),this.size=u.size,this}return su=i,su}var lu,Gp;function Sb(){if(Gp)return lu;Gp=1;var e=da(),t=_1(),r=S1(),n=A1(),i=P1(),a=T1();function o(u){var c=this.__data__=new e(u);this.size=c.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,lu=o,lu}var fu,Kp;function E1(){if(Kp)return fu;Kp=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return fu=t,fu}var hu,Vp;function j1(){if(Vp)return hu;Vp=1;function e(t){return this.__data__.has(t)}return hu=e,hu}var pu,Xp;function Ab(){if(Xp)return pu;Xp=1;var e=ff(),t=E1(),r=j1();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new e;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,pu=n,pu}var du,Yp;function Pb(){if(Yp)return du;Yp=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(t[n],n,t))return!0;return!1}return du=e,du}var vu,Zp;function Tb(){if(Zp)return vu;Zp=1;function e(t,r){return t.has(r)}return vu=e,vu}var yu,Jp;function Eb(){if(Jp)return yu;Jp=1;var e=Ab(),t=Pb(),r=Tb(),n=1,i=2;function a(o,u,c,s,f,l){var h=c&n,d=o.length,m=u.length;if(d!=m&&!(h&&m>d))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var b=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++b<d;){var O=o[b],y=u[b];if(s)var g=h?s(y,O,b,u,o,l):s(O,y,b,o,u,l);if(g!==void 0){if(g)continue;x=!1;break}if(w){if(!t(u,function(_,S){if(!r(w,S)&&(O===_||f(O,_,c,s,l)))return w.push(S)})){x=!1;break}}else if(!(O===y||f(O,y,c,s,l))){x=!1;break}}return l.delete(o),l.delete(u),x}return yu=a,yu}var mu,Qp;function M1(){if(Qp)return mu;Qp=1;var e=ot(),t=e.Uint8Array;return mu=t,mu}var gu,ed;function C1(){if(ed)return gu;ed=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i,a){n[++r]=[a,i]}),n}return gu=e,gu}var bu,td;function wf(){if(td)return bu;td=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i){n[++r]=i}),n}return bu=e,bu}var xu,rd;function $1(){if(rd)return xu;rd=1;var e=Gn(),t=M1(),r=sf(),n=Eb(),i=C1(),a=wf(),o=1,u=2,c="[object Boolean]",s="[object Date]",f="[object Error]",l="[object Map]",h="[object Number]",d="[object RegExp]",m="[object Set]",v="[object String]",p="[object Symbol]",b="[object ArrayBuffer]",x="[object DataView]",w=e?e.prototype:void 0,O=w?w.valueOf:void 0;function y(g,_,S,P,M,A,E){switch(S){case x:if(g.byteLength!=_.byteLength||g.byteOffset!=_.byteOffset)re Line truncated
@@ -1 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as q,a as P}from"./card-BVNSlZ0C.js";import{f as K,B as x}from"./index-EF2TDvxx.js";import{I as H}from"./input--Xdj49es.js";import{B as b}from"./badge-BodqHT_V.js";import{T as Q,a as U,b as O,c as p,d as X,e as n}from"./table-CUnn2-lp.js";import{a as m}from"./audit-Z4oPE2dM.js";import{u as $,q as G,a as J,b as V}from"./unwrap-oA0ekUAt.js";import{S as v,R as W,v as Y,x as Z,X as f}from"./vendor-icons-Aso0-eeY.js";function ee(s={page:1,page_size:50}){return $({queryKey:G.auditLogs(s),queryFn:async()=>{const a=await m.getLogs(s);return{list:V(a),total:J(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function be(){K();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(W,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(q,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(P,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:17",className:"w-8 h-8 bLine truncated
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as q,a as P}from"./card-B-RtdR4H.js";import{f as K,B as x}from"./index-LZWfu62c.js";import{I as H}from"./input-BdDauX3U.js";import{B as b}from"./badge-B0F5ZNtn.js";import{T as Q,a as U,b as O,c as p,d as X,e as n}from"./table-BPFYQwjr.js";import{a as m}from"./audit-BiL35K5G.js";import{u as $,q as G,a as J,b as V}from"./unwrap-BmWy-KM2.js";import{S as v,R as W,v as Y,x as Z,X as f}from"./vendor-icons-Aso0-eeY.js";function ee(s={page:1,page_size:50}){return $({queryKey:G.auditLogs(s),queryFn:async()=>{const a=await m.getLogs(s);return{list:V(a),total:J(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function be(){K();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(W,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(q,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(P,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:17",className:"w-8 h-8 bLine truncated
@@ -1 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as E,a as L}from"./card-BVNSlZ0C.js";import{g as H,i as M,L as k,B as j}from"./index-EF2TDvxx.js";import{B as D}from"./badge-BodqHT_V.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-DbRZUnPK.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-CUnn2-lp.js";import{k as p}from"./index-CYw3SC6I.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapaLine truncated
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as E,a as L}from"./card-B-RtdR4H.js";import{g as H,i as M,L as k,B as j}from"./index-LZWfu62c.js";import{B as D}from"./badge-B0F5ZNtn.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-4xU_9B3_.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-BPFYQwjr.js";import{k as p}from"./index-Z0O8nAcG.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapaLine truncated
@@ -1 +1 @@
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as R,a as W,b as Q,c as V,d as $,e as G}from"./index-EF2TDvxx.js";import{I as h}from"./input--Xdj49es.js";import{L as u}from"./label-DZckFZd3.js";import{C as N,a as y}from"./card-BVNSlZ0C.js";import{B as A}from"./badge-BodqHT_V.js";import{c as v}from"./account-DwPCbdbn.js";import{R as _,P as F,S as X,ag as S,C as Z,a as q,d as k,T as J,i as U,L as Y}from"./vendor-icons-Aso0-eeY.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",color:"#006EFF",paths:[{fill:"#006EFF",d:"M685.3,188.5c-24.7-66.3-88-110.4-158.8-110.5c-84.8,0-152.2,62.8-165.3,140.8c6.5,0,13.1-2.1,21.8-2.1c8.7,0,19.6,2.1,28.3,2.1c10.Line truncated
import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as R,a as W,b as Q,c as V,d as $,e as G}from"./index-LZWfu62c.js";import{I as h}from"./input-BdDauX3U.js";import{L as u}from"./label-u-lNUbKh.js";import{C as N,a as y}from"./card-B-RtdR4H.js";import{B as A}from"./badge-B0F5ZNtn.js";import{c as v}from"./account-Dzyhyahe.js";import{R as _,P as F,S as X,ag as S,C as Z,a as q,d as k,T as J,i as U,L as Y}from"./vendor-icons-Aso0-eeY.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",color:"#006EFF",paths:[{fill:"#006EFF",d:"M685.3,188.5c-24.7-66.3-88-110.4-158.8-110.5c-84.8,0-152.2,62.8-165.3,140.8c6.5,0,13.1-2.1,21.8-2.1c8.7,0,19.6,2.1,28.3,2.1c10.Line truncated
@@ -1 +1 @@
import{j as e,r as c}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,t as p,f as ve}from"./index-EF2TDvxx.js";import{I as j}from"./input--Xdj49es.js";import{L as r}from"./label-DZckFZd3.js";import{C as H,a as T}from"./card-BVNSlZ0C.js";import{B as Ne}from"./badge-BodqHT_V.js";import{S as oe}from"./switch-DYISEUSP.js";import{S as R,a as w,b as S,c as k,d as x}from"./select-DbRZUnPK.js";import{b as h}from"./billing-CoX12im7.js";import{S as fe}from"./stat-strip-TlkYcldq.js";import{L as _,R as q,P as G,t as O,aB as be,d as J,T as K}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},V={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function De({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function ye({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:102:17",children:Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:104:21",value:l,children:f},l))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:109:13",children:[e.jsx(r,{"codeLine truncated
import{j as e,r as c}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,t as p,f as ve}from"./index-LZWfu62c.js";import{I as j}from"./input-BdDauX3U.js";import{L as r}from"./label-u-lNUbKh.js";import{C as H,a as T}from"./card-B-RtdR4H.js";import{B as Ne}from"./badge-B0F5ZNtn.js";import{S as oe}from"./switch-C4PJnJ9I.js";import{S as R,a as w,b as S,c as k,d as x}from"./select-4xU_9B3_.js";import{b as h}from"./billing-9Cbmzl6K.js";import{S as fe}from"./stat-strip-BPzU38xY.js";import{L as _,R as q,P as G,t as O,aB as be,d as J,T as K}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},V={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function De({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function ye({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:102:17",children:Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:104:21",value:l,children:f},l))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:109:13",children:[e.jsx(r,{"codeLine truncated
@@ -1 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as u}from"./card-BVNSlZ0C.js";import{g as F,i as K,L as w,B as G}from"./index-EF2TDvxx.js";import{B as A}from"./badge-BodqHT_V.js";import{T as H,a as z,b as x,c as n,d as D,e as a}from"./table-CUnn2-lp.js";import{k as C}from"./index-CYw3SC6I.js";import{u as q}from"./use-toast-CkA38LVP.js";import{f as k,L as R,R as J,g as j,B as M,h as T,i as Q,A as V,j as W,k as X}from"./vendor-icons-Aso0-eeY.js";const Y={"kube-system":T,"kube-public":W,"kube-node-lease":V,default:Q};function oe(){const{clusterCode:r}=F(),B=K(),{toast:E}=q(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await C.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([C.getNodes(r).catch(()=>[]),C.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(J,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold tLine truncated
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as u}from"./card-B-RtdR4H.js";import{g as F,i as K,L as w,B as G}from"./index-LZWfu62c.js";import{B as A}from"./badge-B0F5ZNtn.js";import{T as H,a as z,b as x,c as n,d as D,e as a}from"./table-BPFYQwjr.js";import{k as C}from"./index-Z0O8nAcG.js";import{u as q}from"./use-toast-CkA38LVP.js";import{f as k,L as R,R as J,g as j,B as M,h as T,i as Q,A as V,j as W,k as X}from"./vendor-icons-Aso0-eeY.js";const Y={"kube-system":T,"kube-public":W,"kube-node-lease":V,default:Q};function oe(){const{clusterCode:r}=F(),B=K(),{toast:E}=q(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await C.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([C.getNodes(r).catch(()=>[]),C.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(J,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold tLine truncated
@@ -1 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as na,D as ze,a as Be,b as Ge,c as Ue,e as Qe,B as N,t as S,d as ca,f as da}from"./index-EF2TDvxx.js";import{I as p}from"./input--Xdj49es.js";import{B as w}from"./badge-BodqHT_V.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-DbRZUnPK.js";import{u as $e,q as Ye,b as la}from"./unwrap-oA0ekUAt.js";import{u as V}from"./useMutation-BLuCS56f.js";import{c as P}from"./credential-BFQGM5tX.js";import{F as ia,G as pa,D as ma,i as xa,j as Ze,k as ga,h as ha,ag as z,C as We,a as Xe,l as ya,aF as Re,aN as va,aO as Je,x as ea,R as Ca,P as Ve,S as ua,a4 as Da,b as ba,d as ja,T as Na}from"./vendor-icons-Aso0-eeY.js";import{L as i}from"./label-DZckFZd3.js";import"./index-CYARH0Cq.js";function fa(c={page_size:100}){return $e({queryKey:Ye.credentials(c),queryFn:async()=>{const d=await P.list(c);return la(d)},staleTime:3e4})}function Fa(c,d=!0){return $e({queryKey:Ye.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:ha,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ga,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:Ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:xa,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:ma,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:pa,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:ia,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(va,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>_(String(y)),children:e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:60:15",className:"h-3 w-3"})})]})]})]})},l=v;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:71:5",open:c,onOpenChangLine truncated
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as na,D as ze,a as Be,b as Ge,c as Ue,e as Qe,B as N,t as S,d as ca,f as da}from"./index-LZWfu62c.js";import{I as p}from"./input-BdDauX3U.js";import{B as w}from"./badge-B0F5ZNtn.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-4xU_9B3_.js";import{u as $e,q as Ye,b as la}from"./unwrap-BmWy-KM2.js";import{u as V}from"./useMutation-Bp3lz5hm.js";import{c as P}from"./credential-CwQY-4Ba.js";import{F as ia,G as pa,D as ma,i as xa,j as Ze,k as ga,h as ha,ag as z,C as We,a as Xe,l as ya,aF as Re,aN as va,aO as Je,x as ea,R as Ca,P as Ve,S as ua,a4 as Da,b as ba,d as ja,T as Na}from"./vendor-icons-Aso0-eeY.js";import{L as i}from"./label-u-lNUbKh.js";import"./index-CYARH0Cq.js";function fa(c={page_size:100}){return $e({queryKey:Ye.credentials(c),queryFn:async()=>{const d=await P.list(c);return la(d)},staleTime:3e4})}function Fa(c,d=!0){return $e({queryKey:Ye.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:ha,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ga,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:Ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:xa,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:ma,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:pa,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:ia,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(va,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>_(String(y)),children:e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:60:15",className:"h-3 w-3"})})]})]})]})},l=v;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:71:5",open:c,onOpenChangLine truncated
@@ -1,2 +1,2 @@
import{j as t,r as n}from"./vendor-codemirror-C7mXSpXt.js";import{C as lt,a as dt}from"./card-BVNSlZ0C.js";import{S as mt}from"./stat-strip-TlkYcldq.js";import{D as X,a as G,b as K,c as U,d as W,e as xt,B as p,t as l,f as pt}from"./index-EF2TDvxx.js";import{I as P}from"./input--Xdj49es.js";import{B as C}from"./badge-BodqHT_V.js";import{C as I}from"./checkbox-CY3XhE_w.js";import{s as $,c as y,t as ht}from"./automation-_t6YTgo2.js";import{L as k,a as gt,y as ut,aq as Y,r as Z,R as bt,P as vt,S as yt,T as z,aC as Ct,b as jt,o as Jt,z as B,aD as Nt,aE as ft}from"./vendor-icons-Aso0-eeY.js";import{S as O,a as R,b as A,c as V,d as J}from"./select-DbRZUnPK.js";import{T as q}from"./textarea-JgdELMPr.js";import{L as N}from"./label-DZckFZd3.js";import{T as Dt,a as Ft,b as L,c as w,d as Mt,e as f}from"./table-CUnn2-lp.js";import"./index-CYARH0Cq.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(ut,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(gt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const Q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,d]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,m]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(d({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{m(e)}).catch(()=>m(null)):m(null)):(d({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),m(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(m(x),d(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{d(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),m(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:157:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:158:13",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),t.jsx(P,{"code-paLine truncated
import{j as t,r as n}from"./vendor-codemirror-C7mXSpXt.js";import{C as lt,a as dt}from"./card-B-RtdR4H.js";import{S as mt}from"./stat-strip-BPzU38xY.js";import{D as X,a as G,b as K,c as U,d as W,e as xt,B as p,t as l,f as pt}from"./index-LZWfu62c.js";import{I as P}from"./input-BdDauX3U.js";import{B as C}from"./badge-B0F5ZNtn.js";import{C as I}from"./checkbox-DL3onEGv.js";import{s as $,c as y,t as ht}from"./automation-BrmX02Sx.js";import{L as k,a as gt,y as ut,aq as Y,r as Z,R as bt,P as vt,S as yt,T as z,aC as Ct,b as jt,o as Jt,z as B,aD as Nt,aE as ft}from"./vendor-icons-Aso0-eeY.js";import{S as O,a as R,b as A,c as V,d as J}from"./select-4xU_9B3_.js";import{T as q}from"./textarea-BdtIagjy.js";import{L as N}from"./label-u-lNUbKh.js";import{T as Dt,a as Ft,b as L,c as w,d as Mt,e as f}from"./table-BPFYQwjr.js";import"./index-CYARH0Cq.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(ut,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(gt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const Q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,d]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,m]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(d({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{m(e)}).catch(()=>m(null)):m(null)):(d({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),m(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(m(x),d(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{d(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),m(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:157:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:158:13",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),t.jsx(P,{"code-paLine truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>d({...a,content:e.target.value}),placeholder:"/scripts/backup.sh arg1 arg2",rows:4,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1 font-mono"})]})]}),t.jsxs(xt,{"code-path":"src/components/automation/CronJobFormDialog.tsx:294:9",children:[t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:295:11",variant:"outline",onClick:()=>g(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:298:11",className:"bg-blue-600 hover:bg-blue-700",onClick:H,disabled:S,children:S?"保存中...":s?"保存修改":"创建任务"})]})]})})}function Et({open:i,onOpenChange:g}){const[s,D]=n.useState([]),[a,d]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{d(!0);const m=await ht.getExecutions({task_type:"cron",page_size:50});D(m.list||[])}catch(m){console.error("Failed to load executions:",m)}finally{d(!1)}})()},[i]),t.jsx(X,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:51:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:52:7",className:"max-w-4xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] max-h-[85vh] overflow-y-auto",children:[t.jsxs(K,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:53:9",children:[t.jsx(U,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:54:11",children:"执行历史"}),t.jsx(W,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:55:11",className:"text-[var(--dg-text-secondary)]",children:"定时任务执行记录与输出日志"})]}),t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:57:9",className:"mt-4",children:a?t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:59:13",className:"flex items-center justify-center py-8",children:t.jsx(k,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:60:15",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):s.length===0?t.jsxs("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:63:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-secondary)]",children:[t.jsx(Y,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:64:15",className:"h-10 w-10 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:65:15",className:"text-sm",children:"暂无执行记录"})]}):t.jsxs(Dt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ft,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:70:17",className:"border-[var(--dg-border)]",children:[t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:71:19",className:"text-[var(--dg-text-secondary)]",children:"任务"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:72:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:73:19",className:"text-[var(--dg-text-secondary)]",children:"耗时"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:74:19",className:"text-[var(--dg-text-secondary)]",children:"执行时间"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:75:19",className:"text-[var(--dg-text-secondary)]",children:"输出"})]})}),t.jsx(Mt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:78:15",children:s.map(r=>t.jsxs(n.Fragment,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:80:19",children:[t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
@@ -1,4 +1,4 @@
import{a as m,g as st,r as R,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{au as K,m as u,i as ie,B as se,q as rt}from"./index-EF2TDvxx.js";import{d as he}from"./dashboard-BNyMEfo2.js";import{s as Ct}from"./server-rQ-8Frwb.js";import{k as kt}from"./index-CYw3SC6I.js";import{S as At}from"./stat-strip-TlkYcldq.js";import{C as B,b as U,c as z,d as V,a as q}from"./card-BVNSlZ0C.js";import{B as L}from"./badge-BodqHT_V.js";import{g as ot,A as Rt,H as wt,az as St,D as Ot,ae as le,l as nt,j as Me,ar as Ke,aG as Pt,h as ct,i as Be,b as _t}from"./vendor-icons-Aso0-eeY.js";import{f as C,r as dt,b as Et,c as it,d as Tt,i as X,e as Ee,p as I,L as T,g as lt,h as Te,j as ht,D as Lt,k as It,l as ae,m as J,S as $t,n as Ft,o as Mt,q as Ue,s as Kt,t as Q,u as Bt,v as Ut,G as zt,w as me,x as Vt,y as pt,z as qt,E as pe,F as ze,H as mt,I as ut,X as Le,Y as Ie,J as Wt,K as Gt,R as Ae,A as Ht,C as xt,T as Re,a as Ne}from"./AreaChart-B9PyJ8Di.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ve(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
import{a as m,g as st,r as R,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{au as K,m as u,i as ie,B as se,q as rt}from"./index-LZWfu62c.js";import{d as he}from"./dashboard-7Sl2aero.js";import{s as Ct}from"./server-BUAZv7ZV.js";import{k as kt}from"./index-Z0O8nAcG.js";import{S as At}from"./stat-strip-BPzU38xY.js";import{C as B,b as U,c as z,d as V,a as q}from"./card-B-RtdR4H.js";import{B as L}from"./badge-B0F5ZNtn.js";import{g as ot,A as Rt,H as wt,az as St,D as Ot,ae as le,l as nt,j as Me,ar as Ke,aG as Pt,h as ct,i as Be,b as _t}from"./vendor-icons-Aso0-eeY.js";import{f as C,r as dt,b as Et,c as it,d as Tt,i as X,e as Ee,p as I,L as T,g as lt,h as Te,j as ht,D as Lt,k as It,l as ae,m as J,S as $t,n as Ft,o as Mt,q as Ue,s as Kt,t as Q,u as Bt,v as Ut,G as zt,w as me,x as Vt,y as pt,z as qt,E as pe,F as ze,H as mt,I as ut,X as Le,Y as Ie,J as Wt,K as Gt,R as Ae,A as Ht,C as xt,T as Re,a as Ne}from"./AreaChart-Czgv4pNk.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ve(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var qe=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){qe(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),qe(a[0])&&r[r.length-1].push(a[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},ce=function(a,r){var e=aa(a);r&&(e=[e.reduce(function(n,c){return[].concat(Ve(n),Ve(c))},[])]);var o=e.map(function(n){return n.reduce(function(c,d,l){return"".concat(c).concat(l===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return e.length===1?"".concat(o,"Z"):o},sa=function(a,r,e){var o=ce(a,e);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(ce(r.reverse(),e).slice(1))},ra=function(a){var r=a.points,e=a.className,o=a.baseLinePoints,n=a.connectNulls,c=Xt(a,Zt);if(!r||!r.length)return null;var d=K("recharts-polygon",e);if(o&&o.length){var l=c.stroke&&c.stroke!=="none",i=sa(r,o,n);return m.createElement("g",{className:d},m.createElement("path",ee({},C(c,!0),{fill:i.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:i})),l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(r,n)})):null,l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(o,n)})):null)}var p=ce(r,n);return m.createElement("path",ee({},C(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",className:d,d:p}))},Ce,We;function oa(){if(We)return Ce;We=1;var t=dt(),a=Et(),r=it();function e(o,n){return o&&o.length?t(o,r(n,2),a):void 0}return Ce=e,Ce}var na=oa();const ca=st(na);var ke,Ge;function da(){if(Ge)return ke;Ge=1;var t=dt(),a=it(),r=Tt();function e(o,n){return o&&o.length?t(o,a(n,2),r):void 0}return ke=e,ke}var ia=da();const la=st(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function He(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function H(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?He(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):He(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Ze(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Xe(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,ft(e.key),e)}}function xa(t,a,r){return a&&Xe(t.prototype,a),r&&Xe(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,bt()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function bt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bt=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(ze(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),W=J(D,p,M),G=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var A=E+me(h)*((O!==0?N:0)+G*S),$e=(E+A)/2,Fe=(f.innerRadius+f.outerRadius)/2,Dt=[{name:W,value:O,payload:D,dataKey:y,type:b}],Nt=I(f.cx,f.cy,Fe,$e);return F=g(g(g({percent:G,cornerRadius:n,name:W,tooltipPayload:Dt,midAngle:$e,middleRadius:Fe,tooltipPosition:Nt},D),f),{},{value:J(D,y),startAngle:E,endAngle:A,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=mt({chartName:"BarChart",GraphicalChild:ut,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Le},{axisType:"yAxis",AxisComp:Ie}],formatAxisMap:Wt}),$a=mt({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:Gt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Fa={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},at=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Ma(t){if(!t||t.length<2)return{pct:0,label:"暂无数据",direction:"neutral"};const a=Number(t[t.length-1].cost??0),r=Number(t[t.length-2].cost??0);if(r===0)return{pct:0,label:a>0?"新增费用":"持平",direction:"neutral"};const e=(a-r)/r*100,o=e>.05?"up":e<-.05?"down":"neutral",n=`${e>0?"+":""}${e.toFixed(1)}% 较上月`;return{pct:e,label:n,direction:o}}function Ka(t,a,r,e=24){const o=[];for(let n=e-1;n>=0;n--){const c=new Date(Date.now()-n*60*60*1e3);o.push({time:`${c.getHours().toString().padStart(2,"0")}:00`,cpu:Number(Math.max(0,Math.min(100,t+(Math.random()-.5)*15)).toFixed(1)),memory:Number(Math.max(0,Math.min(100,a+(Math.random()-.5)*10)).toFixed(1)),disk:Number(Math.max(0,Math.min(100,r+(Math.random()-.5)*5)).toFixed(1))})}return o}function Ba(t,a){if(!t||t.length===0)return[];const r={};for(const e of t){const o=e.timestamp;if(!o)continue;const c=`${new Date(o).getHours().toString().padStart(2,"0")}:00`;r[c]||(r[c]={}),e.name==="cpu"&&(r[c].cpu=Number(e.value)||0),e.name==="memory"&&(r[c].memory=Number(e.value)||0)}return Object.entries(r).sort((e,o)=>e[0].localeCompare(o[0])).map(([e,o])=>({time:e,cpu:Number((o.cpu??0).toFixed(1)),memory:Number((o.memory??0).toFixed(1)),disk:Number(a.toFixed(1))}))}function _e({active:t,payload:a,label:r}){return!t||!a?null:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:94:5",className:"chart-tooltip px-3 py-2",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:95:7",className:"text-xs font-medium mb-1.5",style:{color:"var(--dg-text-secondary)"},children:r}),a.map((e,o)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:97:9",className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:98:11",className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:99:11",style:{color:"var(--dg-text-muted)"},children:[e.name,":"]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:100:11",className:"font-medium",style:{color:"var(--dg-text-primary)"},children:typeof e.value=="number"?`${e.value}%`:e.value})]},o))]})}function Ua({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:Fa[d.cloud]||at[l%at.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Ma(r);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:123:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:124:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:125:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:126:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:127:13",className:"text-[var(--dg-text-primary)]",children:"云成本概览"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:128:13",className:"text-[var(--dg-text-muted)]",children:"本月各云平台费用支出"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:130:11",className:"text-right",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:131:13",c Line truncated
@@ -1 +1 @@
import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{T as ye,a as Me,b as ce,c as ne}from"./tabs-dobHN7aQ.js";import{G as we,t as n,D as ie,a as le,b as ue,c as pe,d as he,B as h,e as xe,f as ge}from"./index-EF2TDvxx.js";import{B as P}from"./badge-BodqHT_V.js";import{C as se,b as Fe,c as Ze,a as ae}from"./card-BVNSlZ0C.js";import{u as Ce,q as ke,b as Se}from"./unwrap-oA0ekUAt.js";import{u as O}from"./useMutation-BLuCS56f.js";import{p as q,z as T}from"./datasource-C4Fvm0Oq.js";import{I as x}from"./input--Xdj49es.js";import{L as m}from"./label-DZckFZd3.js";import{S as j}from"./switch-DYISEUSP.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-DbRZUnPK.js";import{D as L,G as be,j as De,O as z,Q as E,a6 as Te,P as B,X as Ae,l as qe,b as te,p as je,y as ze,a as ve,R as oe,aW as re,ag as Ee,K as $,aE as _e,T as Ne,C as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Ie(){return Ce({queryKey:ke.promDatasources(),queryFn:async()=>{const a=await q.list();return Se(a)},staleTime:3e4})}function fe(){const a=we(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>q.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>q.update(l,t),onSuccess:o}),M=O({mutationFn:l=>q.delete(l),onSuccess:o}),w=O({mutationFn:l=>q.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Re(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function He(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Oe(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await q.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function Be(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function $e({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Re(p)),v(He(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},U=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,K)=>K!==s))},H=(s,u,D)=>{v(K=>{const W=[...K];return W[s]={...W[s],[u]:D},W})},V=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Oe(t,r);try{l?(await w.mutateAsync({id:l,data:s}),n.success("数据源更新成功")):(await M.mutateAsync(s),n.success("数据源创建成功")),o(!1)}catch(u){const D=u instanceof Error?u.message:"操作失败";n.error(D)}},G=async()=>{if(!t.url.trim()){n.error("请先输入 URL");return}k(!0),_(null);try{const s=await Pe({url:t.url,basic_auth:t.basic_auth,basic_auth_user:t.basic_auth_user,basic_auth_pass:t.basic_auth_pass,skip_tls_verify:t.skip_tls_verify});_(s)}catch(s){const u=s instanceof ErLine truncated
import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{T as ye,a as Me,b as ce,c as ne}from"./tabs-kmtfM2I-.js";import{G as we,t as n,D as ie,a as le,b as ue,c as pe,d as he,B as h,e as xe,f as ge}from"./index-LZWfu62c.js";import{B as P}from"./badge-B0F5ZNtn.js";import{C as se,b as Fe,c as Ze,a as ae}from"./card-B-RtdR4H.js";import{u as Ce,q as ke,b as Se}from"./unwrap-BmWy-KM2.js";import{u as O}from"./useMutation-Bp3lz5hm.js";import{p as q,z as T}from"./datasource-DuIT0c1H.js";import{I as x}from"./input-BdDauX3U.js";import{L as m}from"./label-u-lNUbKh.js";import{S as j}from"./switch-C4PJnJ9I.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-4xU_9B3_.js";import{D as L,G as be,j as De,O as z,Q as E,a6 as Te,P as B,X as Ae,l as qe,b as te,p as je,y as ze,a as ve,R as oe,aW as re,ag as Ee,K as $,aE as _e,T as Ne,C as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Ie(){return Ce({queryKey:ke.promDatasources(),queryFn:async()=>{const a=await q.list();return Se(a)},staleTime:3e4})}function fe(){const a=we(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>q.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>q.update(l,t),onSuccess:o}),M=O({mutationFn:l=>q.delete(l),onSuccess:o}),w=O({mutationFn:l=>q.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Re(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function He(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Oe(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await q.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function Be(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function $e({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Re(p)),v(He(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},U=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,K)=>K!==s))},H=(s,u,D)=>{v(K=>{const W=[...K];return W[s]={...W[s],[u]:D},W})},V=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Oe(t,r);try{l?(await w.mutateAsync({id:l,data:s}),n.success("数据源更新成功")):(await M.mutateAsync(s),n.success("数据源创建成功")),o(!1)}catch(u){const D=u instanceof Error?u.message:"操作失败";n.error(D)}},G=async()=>{if(!t.url.trim()){n.error("请先输入 URL");return}k(!0),_(null);try{const s=await Pe({url:t.url,basic_auth:t.basic_auth,basic_auth_user:t.basic_auth_user,basic_auth_pass:t.basic_auth_pass,skip_tls_verify:t.skip_tls_verify});_(s)}catch(s){const u=s instanceof ErLine truncated
@@ -1 +1 @@
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as A,a as H,b as J,c as K,e as te,B as d,t as r,d as oe,f as ae}from"./index-EF2TDvxx.js";import{I as z}from"./input--Xdj49es.js";import{B as w}from"./badge-BodqHT_V.js";import{T as ne,a as le,b as O,c as B}from"./tabs-dobHN7aQ.js";import{L as _}from"./label-DZckFZd3.js";import{S as M,a as Q,b as W,c as X,d as E}from"./select-DbRZUnPK.js";import{d as i}from"./config-DLOuMLhF.js";import{c as ce}from"./credential-BFQGM5tX.js";import{G as Y,k as Z,ag as de,P as G,R as ee,L as k,y as re,a as pe,b as ie,v as I,Q as xe,au as me,J as ye,a6 as he,d as P,T as U}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ge({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),F=async()=>{try{const a=await ce.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(F(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(J,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(K,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",value:String(D),onValueChange:a=>T(a==="__none"?"":a),children:[e.jsx(Q,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:116:15",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:117:17",placeholder:c?"选择凭据(API/密码Line truncated
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as A,a as H,b as J,c as K,e as te,B as d,t as r,d as oe,f as ae}from"./index-LZWfu62c.js";import{I as z}from"./input-BdDauX3U.js";import{B as w}from"./badge-B0F5ZNtn.js";import{T as ne,a as le,b as O,c as B}from"./tabs-kmtfM2I-.js";import{L as _}from"./label-u-lNUbKh.js";import{S as M,a as Q,b as W,c as X,d as E}from"./select-4xU_9B3_.js";import{d as i}from"./config-DAXaHuse.js";import{c as ce}from"./credential-CwQY-4Ba.js";import{G as Y,k as Z,ag as de,P as G,R as ee,L as k,y as re,a as pe,b as ie,v as I,Q as xe,au as me,J as ye,a6 as he,d as P,T as U}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ge({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),F=async()=>{try{const a=await ce.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(F(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(J,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(K,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",value:String(D),onValueChange:a=>T(a==="__none"?"":a),children:[e.jsx(Q,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:116:15",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:117:17",placeholder:c?"选择凭据(API/密码Line truncated
@@ -1 +1 @@
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,a as g}from"./card-BVNSlZ0C.js";import{f as Ne,B as a,u as ve,t as c}from"./index-EF2TDvxx.js";import{I as h}from"./input--Xdj49es.js";import{B as m}from"./badge-BodqHT_V.js";import{S as N,a as v,b as f,c as w,d as r}from"./select-DbRZUnPK.js";import{L as i}from"./label-DZckFZd3.js";import{p as fe}from"./pipeline-CvSxTj00.js";import{d as x}from"./config-DLOuMLhF.js";import{L as T,j as ae,P as le,J as b,a8 as pe,$ as ne,w as we,X as de,T as be,a3 as re,V as Se}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Je(){const[p,xe]=o.useState([]),[me,F]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[J,ye]=o.useState([]),[I,_]=o.useState([]),[l,he]=o.useState(""),[j,M]=o.useState(""),[G,X]=o.useState(!1),[q,z]=o.useState(!1),[P,H]=o.useState(""),[E,K]=o.useState(""),[C,O]=o.useState(""),[Q,W]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[$,ee]=o.useState(""),[se,te]=o.useState(""),Re=Ne(),R=async()=>{F(!0);try{const[s,t,d]=await Promise.all([x.getItemRoles(),fe.getPipelines({page_size:200}),ve.getUsers({page_size:500})]);xe(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{F(!1)}};o.useEffect(()=>{R()},[]);const L=async()=>{if(!l){_([]);return}try{const s=await x.getUserItemRoles(Number(l));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{L()},[l]);const B=o.useMemo(()=>{const s={};return p.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[p,y]),oe=(n?p.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await x.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:Q,description:Y}),c.success("已创建"),z(!1),H(""),K(""),O(""),W("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!$.trim()){c.error("正则不能为空");return}A(!0);try{await x.updateItemRole(s,{pattern:$,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await x.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await x.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!l||!j){c.error("请选择用户和角色");return}X(!0);try{await x.assignItemRole(Number(l),{user_id:Number(l),item_role_id:Number(j)}),c.success("已分配"),M(""),L()}catch(s){c.error(s?.message||"分配失败")}finally{X(!1)}},ge=async s=>{try{await x.removeItemRole(Number(l),s),c.success("已撤销"),L()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=J.find(s=>String(s.id)===l);return me?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:q,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:188:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:189:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:190:13",claLine truncated
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,a as g}from"./card-B-RtdR4H.js";import{f as Ne,B as a,u as ve,t as c}from"./index-LZWfu62c.js";import{I as h}from"./input-BdDauX3U.js";import{B as m}from"./badge-B0F5ZNtn.js";import{S as N,a as v,b as f,c as w,d as r}from"./select-4xU_9B3_.js";import{L as i}from"./label-u-lNUbKh.js";import{p as fe}from"./pipeline-Lgvc2XUS.js";import{d as x}from"./config-DAXaHuse.js";import{L as T,j as ae,P as le,J as b,a8 as pe,$ as ne,w as we,X as de,T as be,a3 as re,V as Se}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Je(){const[p,xe]=o.useState([]),[me,F]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[J,ye]=o.useState([]),[I,_]=o.useState([]),[l,he]=o.useState(""),[j,M]=o.useState(""),[G,X]=o.useState(!1),[q,z]=o.useState(!1),[P,H]=o.useState(""),[E,K]=o.useState(""),[C,O]=o.useState(""),[Q,W]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[$,ee]=o.useState(""),[se,te]=o.useState(""),Re=Ne(),R=async()=>{F(!0);try{const[s,t,d]=await Promise.all([x.getItemRoles(),fe.getPipelines({page_size:200}),ve.getUsers({page_size:500})]);xe(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{F(!1)}};o.useEffect(()=>{R()},[]);const L=async()=>{if(!l){_([]);return}try{const s=await x.getUserItemRoles(Number(l));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{L()},[l]);const B=o.useMemo(()=>{const s={};return p.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[p,y]),oe=(n?p.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await x.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:Q,description:Y}),c.success("已创建"),z(!1),H(""),K(""),O(""),W("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!$.trim()){c.error("正则不能为空");return}A(!0);try{await x.updateItemRole(s,{pattern:$,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await x.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await x.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!l||!j){c.error("请选择用户和角色");return}X(!0);try{await x.assignItemRole(Number(l),{user_id:Number(l),item_role_id:Number(j)}),c.success("已分配"),M(""),L()}catch(s){c.error(s?.message||"分配失败")}finally{X(!1)}},ge=async s=>{try{await x.removeItemRole(Number(l),s),c.success("已撤销"),L()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=J.find(s=>String(s.id)===l);return me?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:q,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:188:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:189:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:190:13",claLine truncated
@@ -0,0 +1,20 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PodFileBrowser-Bs6KRfHw.js","assets/vendor-codemirror-C7mXSpXt.js","assets/index-LZWfu62c.js","assets/vendor-icons-Aso0-eeY.js","assets/index-BzYDIT5o.css","assets/use-toast-CkA38LVP.js","assets/index-Z0O8nAcG.js","assets/select-4xU_9B3_.js","assets/index-CYARH0Cq.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/badge-B0F5ZNtn.js"])))=>i.map(i=>d[i]);
import{j as e,r as p}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as nt,o as vt,i as Xt,a8 as js,g as Ns}from"./index-LZWfu62c.js";import{C as V,a as F,b as me,c as xe}from"./card-B-RtdR4H.js";import{B as te}from"./badge-B0F5ZNtn.js";import{k as ce}from"./index-Z0O8nAcG.js";import{u as Te}from"./use-toast-CkA38LVP.js";import{S as we,g as fs,f as Ve,h as Ss,s as pt,e as Es,d as It,Y as Ot,P as ws,a as Cs}from"./PodFileBrowser-Bs6KRfHw.js";import{I as y}from"./input-BdDauX3U.js";import{Q as Qt,f as Zt,F as kt,r as es,H as ts,L as ue,N as Ae,E as Ds,A as ss,b as ns,n as Ps,k as Fe,P as oe,aq as As,s as gt,b8 as Ts,aN as os,b9 as mt,T as he,$ as ot,g as Hs,ba as Ms,a4 as as,j as rs,am as Bs,aK as cs,bb as Rs,z as ls,D as et,b2 as Is,h as jt,aM as Os,aL as Ls,G as _s,M as zs,R as at,p as ut,y as bt,d as Lt,J as xt,X as ds,l as is,a as $s,m as Ws,aD as _t,bc as Gs,ar as Vs}from"./vendor-icons-Aso0-eeY.js";import{T as Ie,a as Oe,b as Ne,c as K,d as Le,e as X}from"./table-BPFYQwjr.js";import{L as T}from"./label-u-lNUbKh.js";import{T as tt}from"./textarea-BdtIagjy.js";import{S as $e,a as We,b as st,c as Ge,d as ve}from"./select-4xU_9B3_.js";import{S as Nt}from"./switch-C4PJnJ9I.js";import{R as Fs}from"./ResourceVisualEditor-CXyg-7xn.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function ps(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(c=>(c.type||c.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Be({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:25:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:26:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:27:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function ms({pod:t}){const s=ps(t),o=[{label:"已调度",ts:s.scheduled,color:we.blue},{label:"已初始化",ts:s.initialized,color:we.orange},{label:"容器已就绪",ts:s.containersReady,color:we.green},{label:"容器组已就绪",ts:s.ready,color:we.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,n)=>{const c=o[n-1],d=fs(c?.ts,a.ts);return e.jsxs(p.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50:15",className:"text-[10px] mt-1 font-medium",style:{color:a.ts?a.color:"#475569"},children:a.label}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ve(a.ts):"-"})]}),n<o.length-1&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:54:15",className:"flex flex-col items-center mx-0.5 min-w-[30px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:55:17",className:"h-0.5 w-8 bg-[var(--dg-border)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:56:17",className:"text-[9px] text-[var(--dg-text-muted)] mt-0.5",children:d!=null?Ss(d):""})]})]},a.label)})})}function qs({clusterCode:t,pods:s,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:n,expandedPod:c,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(i=>{const S=ps(i),l=c===i.name,v=i.node_name||i.node;return e.jsx(V,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>d(l?null:i.name),children:l?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:Line truncated
`):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 c="none";return n.exec?c="exec":n.httpGet?c="httpGet":n.tcpSocket&&(c="tcpSocket"),{type:c,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 ht(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function Wt(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Gt(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(l=>l.name.trim()).map(l=>{const v={name:l.name};return l.value!=null&&(v.value=l.value),v})),t.ports.length>0&&(s.ports=t.ports.filter(l=>l.containerPort!=="").map(l=>{const v={containerPort:typeof l.containerPort=="number"?l.containerPort:Number(l.containerPort)};return l.name&&(v.name=l.name),l.protocol&&(v.protocol=l.protocol),v}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(l=>l&&l.trim()),c=a&&Object.values(a).some(l=>l&&l.trim());(n||c)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),c&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ht(t.livenessProbe);d&&(s.livenessProbe=d);const i=ht(t.readinessProbe);i&&(s.readinessProbe=i);const S=ht(t.startupProbe);if(S&&(s.startupProbe=S),t.lifecycle){const l={},v=Wt(t.lifecycle.postStart);v&&(l.postStart=v);const g=Wt(t.lifecycle.preStop);g&&(l.preStop=g),Object.keys(l).length>0&&(s.lifecycle=l)}if(t.securityContext){const l=t.securityContext,v={};l.runAsUser!==""&&l.runAsUser!=null&&(v.runAsUser=Number(l.runAsUser)),l.runAsGroup!==""&&l.runAsGroup!=null&&(v.runAsGroup=Number(l.runAsGroup)),l.runAsNonRoot!=null&&(v.runAsNonRoot=l.runAsNonRoot),l.privileged!=null&&(v.privileged=l.privileged),l.readOnlyRootFilesystem!=null&&(v.readOnlyRootFilesystem=l.readOnlyRootFilesystem),l.allowPrivilegeEscalation!=null&&(v.allowPrivilegeEscalation=l.allowPrivilegeEscalation);const g=(l.capabilitiesAdd||[]).filter(Boolean),A=(l.capabilitiesDrop||[]).filter(Boolean);(g.length||A.length)&&(v.capabilities={},g.length&&(v.capabilities.add=g),A.length&&(v.capabilities.drop=A)),Object.keys(v).length>0&&(s.securityContext=v)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(l=>l.name.trim()&&l.mountPath.trim()).map(l=>{const v={name:l.name,mountPath:l.mountPath};return l.subPath&&(v.subPath=l.subPath),l.readOnly&&(v.readOnly=!0),v})),s}function Vt(t){return t.join(`
`)}function Ft(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function Zs({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(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(T,{"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(st,{"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(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ve,{"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(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Vt(o.command),placeholder:`/bin/sh
-c`,onChange:n=>s({command:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Vt(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:n=>s({args:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(oe,{"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,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const i=[...o.env];i[c]={...n,name:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const i=[...o.env];i[c]={...n,value:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},c)),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(Ae,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(oe,{"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,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const i=[...o.ports];i[c]={...n,name:d.target.value},s({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const i=[...o.ports];i[c]={...n,containerPort:d.target.value},s({ports:i})},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 i=[...o.ports];i[c]={...n,protocol:d},s({ports:i})},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(st,{"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(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
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(T,{"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(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:S,children:[e.jsx(oe,{"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,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:w=>l(f,{name:w.target.value}),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:w=>l(f,{value:w.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(f),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},f))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:g,children:[e.jsx(oe,{"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,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:w=>A(f,{ip:w.target.value}),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:w=>A(f,{hostnames:w.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>b(f),children:e.jsx(he,{"code-path":"src/compone Line truncated
`):""),Tt(Array.isArray(ne.searches)?ne.searches.join(`
`):"");const dt=Array.isArray(ne.options)?ne.options:[];Mt(dt.map(ie=>({name:ie.name||"",value:ie.value||""}))),v(!1)},[a]);const us=()=>le(j=>[...j,{key:"",value:""}]),bs=j=>le(D=>D.filter((W,se)=>se!==j)),ys=(j,D)=>le(W=>W.map((se,re)=>re===j?{...se,...D}:se)),vs=async()=>{S(!0);try{const j=JSON.parse(JSON.stringify(g));j.spec=j.spec||{},j.spec.template=j.spec.template||{},j.spec.template.spec=j.spec.template.spec||{};const D=j.spec.template.spec;if(j.spec.strategy={type:b},b==="RollingUpdate"&&(j.spec.strategy.rollingUpdate={maxSurge:f,maxUnavailable:_}),Z&&(j.spec.revisionHistoryLimit=Number(Z)),Q&&(j.spec.progressDeadlineSeconds=Number(Q)),U==="nodeName"&&P.trim())D.nodeName=P.trim(),delete D.nodeSelector,D.affinity&&delete D.affinity.nodeAffinity;else if(U==="nodeSelector"){const L={};for(const{key:ne,value:dt}of ee){const ie=ne.trim();ie&&(L[ie]=dt)}Object.keys(L).length>0?D.nodeSelector=L:delete D.nodeSelector,D.nodeName&&delete D.nodeName,D.affinity&&delete D.affinity.nodeAffinity}else if(U==="nodeAffinity"){const L=ee.filter(ne=>ne.key.trim()).map(ne=>({key:ne.key.trim(),operator:"In",values:[ne.value]}));L.length>0?(D.affinity=D.affinity||{},D.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:L}]}}):D.affinity&&delete D.affinity.nodeAffinity,delete D.nodeSelector,D.nodeName&&delete D.nodeName}const W=m.filter(L=>L.key||L.operator==="Exists").map(L=>{const ne={};return L.key&&(ne.key=L.key),L.operator&&(ne.operator=L.operator),L.value&&L.operator!=="Exists"&&(ne.value=L.value),L.effect&&(ne.effect=L.effect),L.tolerationSeconds&&L.effect==="NoExecute"&&(ne.tolerationSeconds=Number(L.tolerationSeconds)),ne});W.length>0?D.tolerations=W:delete D.tolerations,r&&(D.dnsPolicy=r),N&&(D.restartPolicy=N),B&&(D.schedulerName=B),de&&(D.terminationGracePeriodSeconds=Number(de)),pe&&(D.serviceAccountName=pe);const se={};ae&&(se.fsGroup=Number(ae)),Se&&(se.runAsUser=Number(Se)),be&&(se.runAsGroup=Number(be)),je&&(se.runAsNonRoot=!0),Object.keys(se).length>0?D.securityContext=se:delete D.securityContext,ct?D.hostNetwork=!0:delete D.hostNetwork,lt?D.hostIPC=!0:delete D.hostIPC,Pe?D.hostPID=!0:delete D.hostPID,St?D.shareProcessNamespace=!0:delete D.shareProcessNamespace;const re=wt.filter(L=>L.ip.trim()).map(L=>({ip:L.ip.trim(),hostnames:L.hostnames.split(/[,\s]+/).map(ne=>ne.trim()).filter(Boolean)})).filter(L=>L.hostnames.length>0);re.length>0?D.hostAliases=re:delete D.hostAliases;const ye={},_e=Dt.split(`
`).map(L=>L.trim()).filter(Boolean);_e.length>0&&(ye.nameservers=_e);const Ye=At.split(`
`).map(L=>L.trim()).filter(Boolean);Ye.length>0&&(ye.searches=Ye);const Ee=Ht.filter(L=>L.name.trim()).map(L=>{const ne={name:L.name.trim()};return L.value.trim()&&(ne.value=L.value.trim()),ne});Ee.length>0&&(ye.options=Ee),Object.keys(ye).length>0?D.dnsConfig=ye:delete D.dnsConfig,await rt(t,s,o,j),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n(j)}catch(j){d({title:"保存失败",description:j?.message||String(j),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:b==="RollingUpdate",onChange:()=>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:b==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),b==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:f,onChange:j=>w(j.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(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:_,onChange:j=>I(j.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"numbe Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"h-2.5 w-2.5"}),m.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[m.protocol," ",m.port,":",m.targetPort]})]},m.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((m,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:m.name,onChange:r=>P(k,"name",r.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:m.protocol,onChange:r=>P(k,"protocol",r.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:m.port,onChange:r=>P(k,"port",r.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:m.targetPort,onChange:r=>P(k,"targetPort",r.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(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:r=>P(k,"nodePort",r.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>z(k),disabled:q.ports.length<=1,children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>Y(),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[m,"=",k]},m)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:le,children:"创建"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kube Line truncated
-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"}'`,i=S=>{navigator.clipboard.writeText(S).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(T,{"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:c}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>i(c),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(T,{"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(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>i(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 Ze({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:15:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function fn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:c}=Te(),[d,i]=p.useState(""),[S,l]=p.useState(200),[v,g]=p.useState(a[0]||""),[A,b]=p.useState(!1),[E,f]=p.useState(!1),w=async()=>{b(!0);try{const I=await ce.getPodLogs(t,s,o,S,v||void 0);i(I?.data?.logs||I?.logs||I||"无日志")}catch{i("获取日志失败")}finally{b(!1)}};p.useEffect(()=>{w()},[v,S]);const _=async()=>{f(!0);const I=vt.getState().token||"",Z="",q=v?`&container=${encodeURIComponent(v)}`:"",Q=`${Z}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${S}&stream=true${q}`;try{const U=(await fetch(Q,{headers:{Authorization:`Bearer ${I}`}})).body?.getReader();if(!U)return;const Y=new TextDecoder;let P="";for(;;){const{done:z,value:x}=await U.read();if(z)break;P+=Y.decode(x,{stream:!0}),i(P)}}catch{c({title:"流式日志连接中断",variant:"destructive"})}finally{f(!1)}};return e.jsx("div",{"code-path":"src/components/kubern Line truncated
@@ -1,20 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PodFileBrowser-BPio7wxi.js","assets/vendor-codemirror-C7mXSpXt.js","assets/index-EF2TDvxx.js","assets/vendor-icons-Aso0-eeY.js","assets/index-7YeEJX-w.css","assets/use-toast-CkA38LVP.js","assets/index-CYw3SC6I.js","assets/select-DbRZUnPK.js","assets/index-CYARH0Cq.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/badge-BodqHT_V.js"])))=>i.map(i=>d[i]);
import{j as e,r as p}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as st,o as kt,i as Qt,a8 as Ns,g as fs}from"./index-EF2TDvxx.js";import{C as F,a as q,b as me,c as xe}from"./card-BVNSlZ0C.js";import{B as te}from"./badge-BodqHT_V.js";import{k as de}from"./index-CYw3SC6I.js";import{u as Te}from"./use-toast-CkA38LVP.js";import{S as Ce,g as Ss,f as Ve,h as Es,s as pt,e as Cs,d as Ot,Y as Lt,P as Ds,a as ws}from"./PodFileBrowser-BPio7wxi.js";import{I as y}from"./input--Xdj49es.js";import{Q as Zt,f as es,F as gt,r as ts,H as ss,L as be,N as Ae,E as Ps,A as ns,b as os,n as As,k as nt,P as ne,aq as Ts,s as jt,b8 as Hs,aN as as,b9 as mt,T as ue,$ as ot,g as Ms,ba as Bs,a4 as rs,j as cs,am as Rs,aK as ls,bb as Is,z as ds,D as Ze,b2 as Os,h as Nt,aM as Ls,aL as xt,G as _s,M as zs,R as at,p as bt,y as yt,d as _t,J as ht,X as is,l as ps,a as $s,m as Ws,aD as zt,bc as Gs,ar as Vs}from"./vendor-icons-Aso0-eeY.js";import{T as Ie,a as Oe,b as Ne,c as X,d as Le,e as Q}from"./table-CUnn2-lp.js";import{L as M}from"./label-DZckFZd3.js";import{T as et}from"./textarea-JgdELMPr.js";import{S as $e,a as We,b as tt,c as Ge,d as ke}from"./select-DbRZUnPK.js";import{S as ft}from"./switch-DYISEUSP.js";import{R as Fs}from"./ResourceVisualEditor-BXksS6e2.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function ms(t){const n=t.conditions||t.pod_conditions||[],o=s=>n.find(c=>(c.type||c.Type)===s),a=s=>s?.lastTransitionTime||s?.LastTransitionTime||s?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Be({label:t,value:n}){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:n})]})}function xs({pod:t}){const n=ms(t),o=[{label:"已调度",ts:n.scheduled,color:Ce.blue},{label:"已初始化",ts:n.initialized,color:Ce.orange},{label:"容器已就绪",ts:n.containersReady,color:Ce.green},{label:"容器组已就绪",ts:n.ready,color:Ce.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,s)=>{const c=o[s-1],d=Ss(c?.ts,a.ts);return e.jsxs(p.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50:15",className:"text-[10px] mt-1 font-medium",style:{color:a.ts?a.color:"#475569"},children:a.label}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ve(a.ts):"-"})]}),s<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?Es(d):""})]})]},a.label)})})}function qs({clusterCode:t,pods:n,onShowPodLogs:o,onShowPodTerminal:a,onShowPodFileBrowser:s,expandedPod:c,setExpandedPod:d}){return n.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:n.map(i=>{const D=ms(i),l=c===i.name,v=i.node_name||i.node;return e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(q,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>d(l?null:i.name),children:l?e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:Line truncated
`):s.exec?.command||"",initialDelaySeconds:s.initialDelaySeconds,periodSeconds:s.periodSeconds,timeoutSeconds:s.timeoutSeconds,successThreshold:s.successThreshold,failureThreshold:s.failureThreshold}},o=s=>{if(!s)return{type:"none"};let c="none";return s.exec?c="exec":s.httpGet?c="httpGet":s.tcpSocket&&(c="tcpSocket"),{type:c,execCommand:Array.isArray(s.exec?.command)?s.exec.command.join(`
`):"",httpPath:s.httpGet?.path||"",httpPort:s.httpGet?.port??"",tcpPort:s.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(s=>({name:s.name||"",value:s.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(s=>({name:s.name||"",containerPort:s.containerPort??"",protocol:s.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:n(t.livenessProbe),readinessProbe:n(t.readinessProbe),startupProbe:n(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(s=>({name:s.name||"",mountPath:s.mountPath||"",subPath:s.subPath||"",readOnly:s.readOnly||!1}))}}function Wt(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 n={};if(t.type==="httpGet")n.httpGet={},t.httpPath&&(n.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(n.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(n.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")n.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(n.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&&(n.exec={command:o})}return t.initialDelaySeconds!=null&&(n.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(n.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(n.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(n.successThreshold=t.successThreshold),t.failureThreshold!=null&&(n.failureThreshold=t.failureThreshold),Object.keys(n).length>0?n:void 0}function Gt(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const n=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return n.length?{exec:{command:n}}:void 0}if(t.type==="httpGet"){const n={httpGet:{}};return t.httpPath&&(n.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(n.httpGet.port=Number(t.httpPort)),n}if(t.type==="tcpSocket"){const n={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(n.tcpSocket.port=Number(t.tcpPort)),n}}}function Vt(t){const n={name:t.name};t.image&&(n.image=t.image),t.imagePullPolicy&&(n.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(n.workingDir=t.workingDir),t.command.length>0&&(n.command=t.command),t.args.length>0&&(n.args=t.args),t.env.length>0&&(n.env=t.env.filter(l=>l.name.trim()).map(l=>{const v={name:l.name};return l.value!=null&&(v.value=l.value),v})),t.ports.length>0&&(n.ports=t.ports.filter(l=>l.containerPort!=="").map(l=>{const v={containerPort:typeof l.containerPort=="number"?l.containerPort:Number(l.containerPort)};return l.name&&(v.name=l.name),l.protocol&&(v.protocol=l.protocol),v}));const o=t.resources.requests,a=t.resources.limits,s=o&&Object.values(o).some(l=>l&&l.trim()),c=a&&Object.values(a).some(l=>l&&l.trim());(s||c)&&(n.resources={},s&&(n.resources.requests={},o.cpu?.trim()&&(n.resources.requests.cpu=o.cpu),o.memory?.trim()&&(n.resources.requests.memory=o.memory)),c&&(n.resources.limits={},a.cpu?.trim()&&(n.resources.limits.cpu=a.cpu),a.memory?.trim()&&(n.resources.limits.memory=a.memory)));const d=ut(t.livenessProbe);d&&(n.livenessProbe=d);const i=ut(t.readinessProbe);i&&(n.readinessProbe=i);const D=ut(t.startupProbe);if(D&&(n.startupProbe=D),t.lifecycle){const l={},v=Gt(t.lifecycle.postStart);v&&(l.postStart=v);const j=Gt(t.lifecycle.preStop);j&&(l.preStop=j),Object.keys(l).length>0&&(n.lifecycle=l)}if(t.securityContext){const l=t.securityContext,v={};l.runAsUser!==""&&l.runAsUser!=null&&(v.runAsUser=Number(l.runAsUser)),l.runAsGroup!==""&&l.runAsGroup!=null&&(v.runAsGroup=Number(l.runAsGroup)),l.runAsNonRoot!=null&&(v.runAsNonRoot=l.runAsNonRoot),l.privileged!=null&&(v.privileged=l.privileged),l.readOnlyRootFilesystem!=null&&(v.readOnlyRootFilesystem=l.readOnlyRootFilesystem),l.allowPrivilegeEscalation!=null&&(v.allowPrivilegeEscalation=l.allowPrivilegeEscalation);const j=(l.capabilitiesAdd||[]).filter(Boolean),T=(l.capabilitiesDrop||[]).filter(Boolean);(j.length||T.length)&&(v.capabilities={},j.length&&(v.capabilities.add=j),T.length&&(v.capabilities.drop=T)),Object.keys(v).length>0&&(n.securityContext=v)}return t.volumeMounts.length>0&&(n.volumeMounts=t.volumeMounts.filter(l=>l.name.trim()&&l.mountPath.trim()).map(l=>{const v={name:l.name,mountPath:l.mountPath};return l.subPath&&(v.subPath=l.subPath),l.readOnly&&(v.readOnly=!0),v})),n}function Ft(t){return t.join(`
`)}function qt(t){return t.split(`
`).map(n=>n.trim()).filter(Boolean)}function Zs({container:t,onUpdate:n}){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(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:s=>n({name:s.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(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:s=>n({image:s.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(M,{"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:s=>n({imagePullPolicy:s==="__none"?"":s}),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(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ke,{"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(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:s=>n({workingDir:s.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(M,{"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:Ft(o.command),placeholder:`/bin/sh
-c`,onChange:s=>n({command:qt(s.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(M,{"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:Ft(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:s=>n({args:qt(s.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(ts,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>n({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(ne,{"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((s,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:s.name,placeholder:"KEY",onChange:d=>{const i=[...o.env];i[c]={...s,name:d.target.value},n({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:s.value||"",placeholder:"value",onChange:d=>{const i=[...o.env];i[c]={...s,value:d.target.value},n({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>n({env:o.env.filter((d,i)=>i!==c)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},c)),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(Ae,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>n({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(ne,{"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((s,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:s.name||"",placeholder:"http",onChange:d=>{const i=[...o.ports];i[c]={...s,name:d.target.value},n({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:s.containerPort,placeholder:"8080",onChange:d=>{const i=[...o.ports];i[c]={...s,containerPort:d.target.value},n({ports:i})},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:s.protocol||"TCP",onValueChange:d=>{const i=[...o.ports];i[c]={...s,protocol:d},n({ports:i})},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(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
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(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:w=>a(w.target.value),placeholder:`svc.cluster.local
cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:D,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:89:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),s.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:"未配置"}):s.map((w,E)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:w.name,onChange:C=>l(E,{name:C.target.value}),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:w.value,onChange:C=>l(E,{value:C.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(E),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},E))]})]})]}),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(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(q,{"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(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:j,children:[e.jsx(ne,{"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((w,E)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:w.ip,onChange:C=>T(E,{ip:C.target.value}),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:w.hostnames,onChange:C=>T(E,{hostnames:C.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>b(E),children:e.jsx(ue,{"code-path":"src/compone Line truncated
`):""),Ht(Array.isArray(re.searches)?re.searches.join(`
`):"");const dt=Array.isArray(re.options)?re.options:[];Bt(dt.map(pe=>({name:pe.name||"",value:pe.value||""}))),v(!1)},[a]);const bs=()=>U(N=>[...N,{key:"",value:""}]),ys=N=>U(A=>A.filter((V,ae)=>ae!==N)),vs=(N,A)=>U(V=>V.map((ae,le)=>le===N?{...ae,...A}:ae)),ks=async()=>{D(!0);try{const N=JSON.parse(JSON.stringify(j));N.spec=N.spec||{},N.spec.template=N.spec.template||{},N.spec.template.spec=N.spec.template.spec||{};const A=N.spec.template.spec;if(N.spec.strategy={type:b},b==="RollingUpdate"&&(N.spec.strategy.rollingUpdate={maxSurge:E,maxUnavailable:z}),se&&(N.spec.revisionHistoryLimit=Number(se)),oe&&(N.spec.progressDeadlineSeconds=Number(oe)),O==="nodeName"&&ee.trim())A.nodeName=ee.trim(),delete A.nodeSelector,A.affinity&&delete A.affinity.nodeAffinity;else if(O==="nodeSelector"){const $={};for(const{key:re,value:dt}of B){const pe=re.trim();pe&&($[pe]=dt)}Object.keys($).length>0?A.nodeSelector=$:delete A.nodeSelector,A.nodeName&&delete A.nodeName,A.affinity&&delete A.affinity.nodeAffinity}else if(O==="nodeAffinity"){const $=B.filter(re=>re.key.trim()).map(re=>({key:re.key.trim(),operator:"In",values:[re.value]}));$.length>0?(A.affinity=A.affinity||{},A.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:$}]}}):A.affinity&&delete A.affinity.nodeAffinity,delete A.nodeSelector,A.nodeName&&delete A.nodeName}const V=m.filter($=>$.key||$.operator==="Exists").map($=>{const re={};return $.key&&(re.key=$.key),$.operator&&(re.operator=$.operator),$.value&&$.operator!=="Exists"&&(re.value=$.value),$.effect&&(re.effect=$.effect),$.tolerationSeconds&&$.effect==="NoExecute"&&(re.tolerationSeconds=Number($.tolerationSeconds)),re});V.length>0?A.tolerations=V:delete A.tolerations,r&&(A.dnsPolicy=r),S&&(A.restartPolicy=S),R&&(A.schedulerName=R),ie&&(A.terminationGracePeriodSeconds=Number(ie)),he&&(A.serviceAccountName=he);const ae={};ce&&(ae.fsGroup=Number(ce)),Se&&(ae.runAsUser=Number(Se)),ye&&(ae.runAsGroup=Number(ye)),je&&(ae.runAsNonRoot=!0),Object.keys(ae).length>0?A.securityContext=ae:delete A.securityContext,ct?A.hostNetwork=!0:delete A.hostNetwork,lt?A.hostIPC=!0:delete A.hostIPC,Pe?A.hostPID=!0:delete A.hostPID,Et?A.shareProcessNamespace=!0:delete A.shareProcessNamespace;const le=Dt.filter($=>$.ip.trim()).map($=>({ip:$.ip.trim(),hostnames:$.hostnames.split(/[,\s]+/).map(re=>re.trim()).filter(Boolean)})).filter($=>$.hostnames.length>0);le.length>0?A.hostAliases=le:delete A.hostAliases;const ve={},_e=Pt.split(`
`).map($=>$.trim()).filter(Boolean);_e.length>0&&(ve.nameservers=_e);const Ue=Tt.split(`
`).map($=>$.trim()).filter(Boolean);Ue.length>0&&(ve.searches=Ue);const Ee=Mt.filter($=>$.name.trim()).map($=>{const re={name:$.name.trim()};return $.value.trim()&&(re.value=$.value.trim()),re});Ee.length>0&&(ve.options=Ee),Object.keys(ve).length>0?A.dnsConfig=ve:delete A.dnsConfig,await rt(t,n,o,N),d({title:"高级设置已保存",description:`${o} 更新已提交`}),s(N)}catch(N){d({title:"保存失败",description:N?.message||String(N),variant:"destructive"})}finally{D(!1)}};return l?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(be,{"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(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:b==="RollingUpdate",onChange:()=>w("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:15",type:"radio",checked:b==="Recreate",onChange:()=>w("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),b==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:E,onChange:N=>C(N.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(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:N=>L(N.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(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(q,{"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(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"numbe Line truncated
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:424:23",className:"h-2.5 w-2.5"}),m.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[m.protocol," ",m.port,":",m.targetPort]})]},m.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",Y.ports.length," 个端口)"]})]}),Y.ports.map((m,g)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:m.name,onChange:r=>ee(g,"name",r.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:m.protocol,onChange:r=>ee(g,"protocol",r.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:m.port,onChange:r=>ee(g,"port",r.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:m.targetPort,onChange:r=>ee(g,"targetPort",r.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),Y.type==="NodePort"&&e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:r=>ee(g,"nodePort",r.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>Z(g),disabled:Y.ports.length<=1,children:e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},g)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>J(),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(w).length>0?Object.entries(w).map(([m,g])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[m,"=",g]},m)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>se(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:U,children:"创建"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components Line truncated
-H 'Authorization: Bearer ${s?s.substring(0,16)+"...":"YOUR_TOKEN"}' \\
-H 'Content-Type: application/json' \\
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,i=D=>{navigator.clipboard.writeText(D).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(M,{"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:c}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>i(c),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(M,{"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(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>i(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:n,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:15:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(is,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),n]})})}function kn({clusterCode:t,namespace:n,podName:o,containers:a,onClose:s}){const{toast:c}=Te(),[d,i]=p.useState(""),[D,l]=p.useState(200),[v,j]=p.useState(a[0]||""),[T,b]=p.useState(!1),[w,E]=p.useState(!1),C=async()=>{b(!0);try{const L=await de.getPodLogs(t,n,o,D,v||void 0);i(L?.data?.logs||L?.logs||L||"无日志")}catch{i("获取日志失败")}finally{b(!1)}};p.useEffect(()=>{C()},[v,D]);const z=async()=>{E(!0);const L=kt.getState().token||"",se="",Y=v?`&container=${encodeURIComponent(v)}`:"",oe=`${se}/api/v1/kubernetes/${t}/namespace/${n}/pods/${o}/logs?tail=${D}&stream=true${Y}`;try{const O=(await fetch(oe,{headers:{Authorization:`Bearer ${L}`}})).body?.getReader();if(!O)return;const J=new TextDecoder;let ee="";for(;;){const{done:Z,value:k}=await O.read();if(Z)break;ee+=J.decode(k,{stream:!0}),i(ee)}}catch{c({title:"流式日志连接中断",variant:"destructive"})}finally{E(!1)}};return e.jsx("div",{"code-path":"src/components Line truncated
@@ -1 +1 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as m,D as U,a as A,b as H,c as X,d as q,e as J}from"./index-EF2TDvxx.js";import{I as l}from"./input--Xdj49es.js";import{L as d}from"./label-DZckFZd3.js";import{C as j,a as M}from"./card-BVNSlZ0C.js";import{B as h}from"./badge-BodqHT_V.js";import{c as u}from"./account-DwPCbdbn.js";import{R as E,P as L,S as K,G as k,C as P,a as V,b as W,c as O,T as Y,L as Z}from"./vendor-icons-Aso0-eeY.js";function le(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const c=o=>o?o.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(c){console.error("删除域名失败:",c)}},w=i.filter(s=>{const c=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),o=D==="all"||s.status===D;return c&&o});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(K,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:200:11",value:"pending",children:"待审核"})]})]}),N?e.jsx(j,{"code-path":"src/components/cloud/DomaiLine truncated
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as m,D as U,a as A,b as H,c as X,d as q,e as J}from"./index-LZWfu62c.js";import{I as l}from"./input-BdDauX3U.js";import{L as d}from"./label-u-lNUbKh.js";import{C as j,a as M}from"./card-B-RtdR4H.js";import{B as h}from"./badge-B0F5ZNtn.js";import{c as u}from"./account-Dzyhyahe.js";import{R as E,P as L,S as K,G as k,C as P,a as V,b as W,c as O,T as Y,L as Z}from"./vendor-icons-Aso0-eeY.js";function le(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const c=o=>o?o.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(c){console.error("删除域名失败:",c)}},w=i.filter(s=>{const c=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),o=D==="all"||s.status===D;return c&&o});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(K,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:200:11",value:"pending",children:"待审核"})]})]}),N?e.jsx(j,{"code-path":"src/components/cloud/DomaiLine truncated
@@ -1 +1 @@
import{r as s,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as W}from"./card-BVNSlZ0C.js";import{g as ce,i as oe,L as q,B as de}from"./index-EF2TDvxx.js";import{S,a as C,b as T,c as _,d as x}from"./select-DbRZUnPK.js";import{T as xe,a as le,b as L,c as v,d as me,e as i}from"./table-CUnn2-lp.js";import{k as $}from"./index-CYw3SC6I.js";import{f as G,t as pe,R as J,X as O,l as ie}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function F({title:b,items:m,selected:p,onSelect:N,emptyText:l}){const f=Math.max(...m.map(d=>d.count),1);return e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:28:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:29:7",className:"p-4",children:[e.jsx("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:30:9",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3",children:b}),m.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:32:11",className:"text-xs text-[var(--dg-text-muted)] py-6 text-center",children:l||"暂无数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:34:11",className:"space-y-1.5 max-h-[220px] overflow-y-auto pr-1",children:m.map(d=>{const k=p===d.name;return e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:38:17",type:"button",className:`w-full flex items-center gap-2 rounded px-2 py-1.5 text-left transition-colors ${k?"bg-[var(--dg-bg-tertiary)]":"hover:bg-[var(--dg-bg-tertiary)]/60"}`,onClick:()=>N?.(k?"":d.name),children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:46:19",className:"w-[88px] shrink-0 truncate text-xs text-[var(--dg-text-secondary)]",title:d.name,children:d.name}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:49:19",className:"flex-1 h-1.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:50:21",className:`h-full rounded-full ${k?"bg-[var(--dg-accent)]":"bg-[var(--dg-text-muted)]/50"}`,style:{width:`${d.count/f*100}%`}})}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:55:19",className:"w-8 text-right text-xs tabular-nums text-[var(--dg-text-muted)]",children:d.count})]},d.name)})})]})})}function R({label:b,value:m,hint:p}){return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:68:5",className:"px-4 py-3 border-r border-[var(--dg-border)] last:border-r-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:69:7",className:"text-xs text-[var(--dg-text-muted)]",children:b}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:70:7",className:"text-xl font-semibold tabular-nums text-[var(--dg-text-primary)] mt-0.5",children:m}),p&&e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:71:16",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:p})]})}function Pe(){const{clusterCode:b}=ce(),m=oe(),[p,N]=s.useState(!1),[l,f]=s.useState([]),[d,k]=s.useState([]),[Q,Y]=s.useState([]),[u,Z]=s.useState("all"),[y,ee]=s.useState("all"),[E,te]=s.useState("0"),[r,H]=s.useState(b||""),[o,U]=s.useState(null),[g,A]=s.useState(""),[h,D]=s.useState(""),[se,ne]=s.useState(null);s.useEffect(()=>{$.getClusters().then(t=>{const a=t?.list||[];if(k(a),!r&&a.length>0){const n=a[0].code||String(a[0].id);H(n),m(`/kubernetes/${n}/events`,{replace:!0})}}).catch(()=>{})},[]),s.useEffect(()=>{r&&$.getNamespaces(r).then(t=>{Y(Array.isArray(t)?t:t?.list||t?.data||[])}).catch(()=>{})},[r]);const V=s.useCallback(async()=>{if(r){N(!0);try{const t=u==="all"?void 0:u,a=y==="all"?void 0:y,n=await $.getEvents(r,t,a);f(Array.isArray(n)?n:n?.list||[])}catch{f([])}finally{N(!1)}}},[r,u,y]),B=s.useCallback(async()=>{if(r)try{const t=u==="all"?void 0:u,a=parseInt(E)||void 0,n=await $.getEventsSummary(r,t,a);U(n||null)}catch{U(null)}},[r,u,E]);s.useEffect(()=>{V()},[V]),s.useEffect(()=>{B()},[B]);const j=s.useMemo(()=>{let t=l;const a=parseInt(E,10);if(a>0){const n=Date.now()-a*3600*1e3;t=t.filter(c=>{const P=c.last_time||c.lastTime||c.last_timestamp;return!P||new Date(P).getTime()>=n})}return g&&(t=t.filter(n=>n.reason===g)),h&&(t=t.filter(n=>(n.object||"").startsWith(`${h}/`))),t},[l,g,h,E]),ae=s.useMemo(()=>l.filter(t=>t.type==="Warning").length,[l]),re=s.useMemo(()=>l.filter(t=>t.type==="Normal").length,[l]),I=s.useMemo(()=>(o?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[o]),z=s.useMemo(()=>(o?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[o]),X=s.useMemo(()=>(o?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[o]),K=t=>t?t.replace("T"," ").substring(0,19):"-",w=t=>{if(!t)return"";const a=Date.now()-new Date(t).getTime();if(a<0)return"";const n=Math.floor(a/6e4);if(n<1)return"刚刚";if(n<60)return`${n}分钟前`;const c=Math.floor(n/60);return c<24?`${c}小时前`:`${Math.floor(c/Line truncated
import{r as s,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as W}from"./card-B-RtdR4H.js";import{g as ce,i as oe,L as q,B as de}from"./index-LZWfu62c.js";import{S,a as C,b as T,c as _,d as x}from"./select-4xU_9B3_.js";import{T as xe,a as le,b as L,c as v,d as me,e as i}from"./table-BPFYQwjr.js";import{k as $}from"./index-Z0O8nAcG.js";import{f as G,t as pe,R as J,X as O,l as ie}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function F({title:b,items:m,selected:p,onSelect:N,emptyText:l}){const f=Math.max(...m.map(d=>d.count),1);return e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:28:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:29:7",className:"p-4",children:[e.jsx("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:30:9",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3",children:b}),m.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:32:11",className:"text-xs text-[var(--dg-text-muted)] py-6 text-center",children:l||"暂无数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:34:11",className:"space-y-1.5 max-h-[220px] overflow-y-auto pr-1",children:m.map(d=>{const k=p===d.name;return e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:38:17",type:"button",className:`w-full flex items-center gap-2 rounded px-2 py-1.5 text-left transition-colors ${k?"bg-[var(--dg-bg-tertiary)]":"hover:bg-[var(--dg-bg-tertiary)]/60"}`,onClick:()=>N?.(k?"":d.name),children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:46:19",className:"w-[88px] shrink-0 truncate text-xs text-[var(--dg-text-secondary)]",title:d.name,children:d.name}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:49:19",className:"flex-1 h-1.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:50:21",className:`h-full rounded-full ${k?"bg-[var(--dg-accent)]":"bg-[var(--dg-text-muted)]/50"}`,style:{width:`${d.count/f*100}%`}})}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:55:19",className:"w-8 text-right text-xs tabular-nums text-[var(--dg-text-muted)]",children:d.count})]},d.name)})})]})})}function R({label:b,value:m,hint:p}){return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:68:5",className:"px-4 py-3 border-r border-[var(--dg-border)] last:border-r-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:69:7",className:"text-xs text-[var(--dg-text-muted)]",children:b}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:70:7",className:"text-xl font-semibold tabular-nums text-[var(--dg-text-primary)] mt-0.5",children:m}),p&&e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:71:16",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:p})]})}function Pe(){const{clusterCode:b}=ce(),m=oe(),[p,N]=s.useState(!1),[l,f]=s.useState([]),[d,k]=s.useState([]),[Q,Y]=s.useState([]),[u,Z]=s.useState("all"),[y,ee]=s.useState("all"),[E,te]=s.useState("0"),[r,H]=s.useState(b||""),[o,U]=s.useState(null),[g,A]=s.useState(""),[h,D]=s.useState(""),[se,ne]=s.useState(null);s.useEffect(()=>{$.getClusters().then(t=>{const a=t?.list||[];if(k(a),!r&&a.length>0){const n=a[0].code||String(a[0].id);H(n),m(`/kubernetes/${n}/events`,{replace:!0})}}).catch(()=>{})},[]),s.useEffect(()=>{r&&$.getNamespaces(r).then(t=>{Y(Array.isArray(t)?t:t?.list||t?.data||[])}).catch(()=>{})},[r]);const V=s.useCallback(async()=>{if(r){N(!0);try{const t=u==="all"?void 0:u,a=y==="all"?void 0:y,n=await $.getEvents(r,t,a);f(Array.isArray(n)?n:n?.list||[])}catch{f([])}finally{N(!1)}}},[r,u,y]),B=s.useCallback(async()=>{if(r)try{const t=u==="all"?void 0:u,a=parseInt(E)||void 0,n=await $.getEventsSummary(r,t,a);U(n||null)}catch{U(null)}},[r,u,E]);s.useEffect(()=>{V()},[V]),s.useEffect(()=>{B()},[B]);const j=s.useMemo(()=>{let t=l;const a=parseInt(E,10);if(a>0){const n=Date.now()-a*3600*1e3;t=t.filter(c=>{const P=c.last_time||c.lastTime||c.last_timestamp;return!P||new Date(P).getTime()>=n})}return g&&(t=t.filter(n=>n.reason===g)),h&&(t=t.filter(n=>(n.object||"").startsWith(`${h}/`))),t},[l,g,h,E]),ae=s.useMemo(()=>l.filter(t=>t.type==="Warning").length,[l]),re=s.useMemo(()=>l.filter(t=>t.type==="Normal").length,[l]),I=s.useMemo(()=>(o?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[o]),z=s.useMemo(()=>(o?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[o]),X=s.useMemo(()=>(o?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[o]),K=t=>t?t.replace("T"," ").substring(0,19):"-",w=t=>{if(!t)return"";const a=Date.now()-new Date(t).getTime();if(a<0)return"";const n=Math.floor(a/6e4);if(n<1)return"刚刚";if(n<60)return`${n}分钟前`;const c=Math.floor(n/60);return c<24?`${c}小时前`:`${Math.floor(c/Line truncated
@@ -1,3 +1,3 @@
import{j as a,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{B as D,o as za,D as oa,a as ra,b as na,c as da,d as ka,t as u,f as Ya,i as Qa,e as Na}from"./index-EF2TDvxx.js";import{I as X}from"./input--Xdj49es.js";import{B as O}from"./badge-BodqHT_V.js";import{C as U,b as ya,c as Ga,a as H}from"./card-BVNSlZ0C.js";import{S as xa,a as pa,b as ba,c as ua,d as B}from"./select-DbRZUnPK.js";import{L}from"./label-DZckFZd3.js";import{s as Wa}from"./server-rQ-8Frwb.js";import{d as ga}from"./grafana-DTc3taUi.js";import{z as Xa,p as as}from"./datasource-C4Fvm0Oq.js";import{a as fa}from"./agent-D_rvbJT8.js";import{aa as ss,A as J,R as ca,L as aa,l as va,h as Q,aR as _a,aJ as $a,W as Za,Y as Fa,k as es,a4 as ta,g as Ta,r as ja,w as ts,aF as os,j as rs,v as ns,p as ds,z as cs,an as hs,ao as ms,_ as Ia,ar as is,aC as Pa,T as ls,I as xs,aS as ps,u as Ba,D as Oa,E as Ma,P as Aa}from"./vendor-icons-Aso0-eeY.js";import{z as bs,p as Sa}from"./metrics-BCZ7fIl4.js";import{S as Ea}from"./stat-strip-TlkYcldq.js";import{T as Ua,a as Ha,b as R,c as K}from"./tabs-dobHN7aQ.js";import{C as Da}from"./checkbox-CY3XhE_w.js";import"./index-CYARH0Cq.js";function us(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function gs({panel:s}){const r=us();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(ss,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:70:11",className:"flex justify-between text-xs text-muted-foreground px-2 pt-2",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:71:13",children:r[0].time}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:72:13",children:r[r.length-1].time})]})]})}}const fs=({dsUrl:s,dsUsername:r,dsPassword:e})=>{const[c,i]=o.useState(!1),[x,b]=o.useState(!1),[g,N]=o.useState([]),[w,m]=o.useState(""),[P,y]=o.useState(""),[z,v]=o.useState("cpu_usage"),[h,A]=o.useState("desc");o.useEffect(()=>{s&&r&&e&&W(s,r,e)},[s,r,e]);const W=async(n,l,S)=>{b(!0),y("");try{const j=await bs.connect(n,l,S);N(j.hosts||[]),m(j.version||""),i(!0)}catch(j){i(!1),y(j.message||"连接失败")}finally{b(!1)}},Z=()=>{s&&r&&e&&W(s,r,e)Line truncated
import{j as a,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{B as D,o as za,D as oa,a as ra,b as na,c as da,d as ka,t as u,f as Ya,i as Qa,e as Na}from"./index-LZWfu62c.js";import{I as X}from"./input-BdDauX3U.js";import{B as O}from"./badge-B0F5ZNtn.js";import{C as U,b as ya,c as Ga,a as H}from"./card-B-RtdR4H.js";import{S as xa,a as pa,b as ba,c as ua,d as B}from"./select-4xU_9B3_.js";import{L}from"./label-u-lNUbKh.js";import{s as Wa}from"./server-BUAZv7ZV.js";import{d as ga}from"./grafana-DTc3taUi.js";import{z as Xa,p as as}from"./datasource-DuIT0c1H.js";import{a as fa}from"./agent-g0Vk8FYK.js";import{aa as ss,A as J,R as ca,L as aa,l as va,h as Q,aR as _a,aJ as $a,W as Za,Y as Fa,k as es,a4 as ta,g as Ta,r as ja,w as ts,aF as os,j as rs,v as ns,p as ds,z as cs,an as hs,ao as ms,_ as Ia,ar as is,aC as Pa,T as ls,I as xs,aS as ps,u as Ba,D as Oa,E as Ma,P as Aa}from"./vendor-icons-Aso0-eeY.js";import{z as bs,p as Sa}from"./metrics-Dj4l07HZ.js";import{S as Ea}from"./stat-strip-BPzU38xY.js";import{T as Ua,a as Ha,b as R,c as K}from"./tabs-kmtfM2I-.js";import{C as Da}from"./checkbox-DL3onEGv.js";import"./index-CYARH0Cq.js";function us(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function gs({panel:s}){const r=us();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(ss,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:70:11",className:"flex justify-between text-xs text-muted-foreground px-2 pt-2",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:71:13",children:r[0].time}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:72:13",children:r[r.length-1].time})]})]})}}const fs=({dsUrl:s,dsUsername:r,dsPassword:e})=>{const[c,i]=o.useState(!1),[x,b]=o.useState(!1),[g,N]=o.useState([]),[w,m]=o.useState(""),[P,y]=o.useState(""),[z,v]=o.useState("cpu_usage"),[h,A]=o.useState("desc");o.useEffect(()=>{s&&r&&e&&W(s,r,e)},[s,r,e]);const W=async(n,l,S)=>{b(!0),y("");try{const j=await bs.connect(n,l,S);N(j.hosts||[]),m(j.version||""),i(!0)}catch(j){i(!1),y(j.message||"连接失败")}finally{b(!1)}},Z=()=>{s&&r&&e&&W(s,r,e)Line truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:I,disabled:y,className:"w-full bg-blue-600 hover:bg-blue-700 text-white",children:y?a.jsxs(a.Fragment,{children:[a.jsx(aa,{"code-path":"src/components/agent/AgentWizard.tsx:352:23",className:"h-4 w-4 mr-2 animate-spin"}),"SSH 连接中,正在安装..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:357:23",className:"h-4 w-4 mr-2"}),n?"连接并安装 Agent(凭据将自动保存)":"一键安装 Agent"]})})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:363:15",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:364:17",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:365:17",children:["系统将通过 SSH 连接 ",e.ip,",执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。"]})]})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:373:11",value:"manual",className:"mt-4 space-y-4",children:[a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:374:13",className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:ha.map(d=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:376:17",className:"rounded-lg bg-slate-950 border border-slate-800 overflow-hidden",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:377:19",className:"flex items-center gap-2 px-4 py-2.5 bg-slate-800/50",children:[a.jsx(d.icon,{"code-path":"src/components/agent/AgentWizard.tsx:378:21",className:"h-4 w-4 text-blue-400"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:379:21",className:"text-sm font-medium text-slate-200",children:d.title})]}),a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:381:19",className:"p-3 space-y-1",children:d.commands.map((_,sa)=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:383:23",className:"flex items-start gap-2",children:[a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:384:25",className:"text-slate-600 font-mono text-xs select-none mt-0.5",children:"$"}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:385:25",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all flex-1",children:_})]},sa))})]},d.title))}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:394:13",className:"text-xs text-slate-500",children:"完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。"})]})]})]})})}const zs=[{id:"agent",label:"Agent 主机",icon:a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:51:43",className:"w-3.5 h-3.5"})},{id:"zabbix",label:"Zabbix",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:52:42",className:"w-3.5 h-3.5"})},{id:"prometheus",label:"Prometheus",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:53:50",className:"w-3.5 h-3.5"})},{id:"dashboard",label:"自定义",icon:a.jsx(Ia,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],ks=()=>{const s=Ya(),r=Qa(),[e,c]=o.useState([]),[i,x]=o.useState(!0),[b,g]=o.useState("cpu_usage"),[N,w]=o.useState("desc"),[m,P]=o.useState(1),[y,z]=o.useState(10),[v,h]=o.useState(new Set),[A,W]=o.useState(!1),[Z,F]=o.useState(null),[T,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,I]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),I(new Set(ea));try{await fa.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}catch{u.error("提交失败"),I(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(As(await fa.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice( Line truncated
@@ -1 +1 @@
import{j as t,r as H}from"./vendor-codemirror-C7mXSpXt.js";import{f as Bt,G as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,as as Kt}from"./index-EF2TDvxx.js";import{a as E}from"./agent-D_rvbJT8.js";import{u as ct,q as K,b as pt}from"./unwrap-oA0ekUAt.js";import{C,a as k}from"./card-BVNSlZ0C.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-DbRZUnPK.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-dobHN7aQ.js";import{B as Q}from"./badge-BodqHT_V.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-B9PyJ8Di.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aE as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b0 as _t,I as Jt,b1 as Yt,g as Zt,b2 as lt}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await E.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await E.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await E.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((M,F)=>M+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],B=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),B.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(B,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=nuLine truncated
import{j as t,r as H}from"./vendor-codemirror-C7mXSpXt.js";import{f as Bt,G as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,as as Kt}from"./index-LZWfu62c.js";import{a as E}from"./agent-g0Vk8FYK.js";import{u as ct,q as K,b as pt}from"./unwrap-BmWy-KM2.js";import{C,a as k}from"./card-B-RtdR4H.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-4xU_9B3_.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-kmtfM2I-.js";import{B as Q}from"./badge-B0F5ZNtn.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-Czgv4pNk.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aE as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b0 as _t,I as Jt,b1 as Yt,g as Zt,b2 as lt}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await E.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await E.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await E.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((M,F)=>M+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],B=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),B.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(B,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=nuLine truncated
@@ -1 +1 @@
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{i as a}from"./index-EF2TDvxx.js";import{k as i}from"./index-CYw3SC6I.js";import{L as u}from"./vendor-icons-Aso0-eeY.js";function x({target:r}){const e=a();return n.useEffect(()=>{i.getClusters().then(c=>{const t=c?.list||[];if(t.length>0){const o=t[0].code||String(t[0].id);e(`/kubernetes/${o}/${r}`,{replace:!0})}else e("/kubernetes",{replace:!0})}).catch(()=>e("/kubernetes",{replace:!0}))},[e,r]),s.jsxs("div",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:30:5",className:"flex flex-col items-center justify-center py-24 text-slate-500 gap-2",children:[s.jsx(u,{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:31:7",className:"h-6 w-6 animate-spin"}),s.jsx("span",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:32:7",className:"text-sm",children:"正在跳转..."})]})}export{x as default};
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{i as a}from"./index-LZWfu62c.js";import{k as i}from"./index-Z0O8nAcG.js";import{L as u}from"./vendor-icons-Aso0-eeY.js";function x({target:r}){const e=a();return n.useEffect(()=>{i.getClusters().then(c=>{const t=c?.list||[];if(t.length>0){const o=t[0].code||String(t[0].id);e(`/kubernetes/${o}/${r}`,{replace:!0})}else e("/kubernetes",{replace:!0})}).catch(()=>e("/kubernetes",{replace:!0}))},[e,r]),s.jsxs("div",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:30:5",className:"flex flex-col items-center justify-center py-24 text-slate-500 gap-2",children:[s.jsx(u,{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:31:7",className:"h-6 w-6 animate-spin"}),s.jsx("span",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:32:7",className:"text-sm",children:"正在跳转..."})]})}export{x as default};
@@ -1,4 +1,4 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as T,M as ae,J as _e,v as Re,r as ce,R as Pe,s as $,w as X,N as Te,x as H,P as Ee,y as Ae,m as E,D as oe,a as le,b as Me,c as ue,d as de,e as Ie,t as I,o as Fe,a9 as Ge,aa as Oe,ab as Be,ac as Le,ad as Q,ae as F}from"./index-EF2TDvxx.js";import{C as G,b as U,c as z,d as ie,a as O}from"./card-BVNSlZ0C.js";import{I as L}from"./input--Xdj49es.js";import{B as y}from"./badge-BodqHT_V.js";import{k as w}from"./index-CYw3SC6I.js";import{T as Ue,a as ze,b as A,c as M}from"./tabs-dobHN7aQ.js";import{i as xe,a as pe,aG as $e,r as We,L as Ve,an as qe,ao as He,X as Xe,R as q,P as Je,S as Ye,aP as Ze,x as Qe,p as et,k as tt,v as st,T as rt,l as nt,y as at}from"./vendor-icons-Aso0-eeY.js";import{R as ct,A as ot,C as lt,X as ut,Y as dt,T as it,a as ee}from"./AreaChart-B9PyJ8Di.js";import{T as te}from"./textarea-JgdELMPr.js";import{L as P}from"./label-DZckFZd3.js";import{u as xt}from"./index-CYARH0Cq.js";import{x as pt,a as mt}from"./vendor-xterm-20M9KZE1.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(ie,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ue,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(ze,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:["Service (",k.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:123:13",value:"ingresses",className:"data-[state=active]:bg-slate-700",children:["Ingress (",b.length,")"]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tLine truncated
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as T,M as ae,J as _e,v as Re,r as ce,R as Pe,s as $,w as X,N as Te,x as H,P as Ee,y as Ae,m as E,D as oe,a as le,b as Me,c as ue,d as de,e as Ie,t as I,o as Fe,a9 as Ge,aa as Oe,ab as Be,ac as Le,ad as Q,ae as F}from"./index-LZWfu62c.js";import{C as G,b as U,c as z,d as ie,a as O}from"./card-B-RtdR4H.js";import{I as L}from"./input-BdDauX3U.js";import{B as y}from"./badge-B0F5ZNtn.js";import{k as w}from"./index-Z0O8nAcG.js";import{T as Ue,a as ze,b as A,c as M}from"./tabs-kmtfM2I-.js";import{i as xe,a as pe,aG as $e,r as We,L as Ve,an as qe,ao as He,X as Xe,R as q,P as Je,S as Ye,aP as Ze,x as Qe,p as et,k as tt,v as st,T as rt,l as nt,y as at}from"./vendor-icons-Aso0-eeY.js";import{R as ct,A as ot,C as lt,X as ut,Y as dt,T as it,a as ee}from"./AreaChart-Czgv4pNk.js";import{T as te}from"./textarea-BdtIagjy.js";import{L as P}from"./label-u-lNUbKh.js";import{u as xt}from"./index-CYARH0Cq.js";import{x as pt,a as mt}from"./vendor-xterm-20M9KZE1.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(ie,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ue,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(ze,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:["Service (",k.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:123:13",value:"ingresses",className:"data-[state=active]:bg-slate-700",children:["Ingress (",b.length,")"]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tLine truncated
kind: Config
clusters:
- cluster:
@@ -1 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,a as I}from"./card-BVNSlZ0C.js";import{B as A}from"./index-EF2TDvxx.js";import{I as P}from"./input--Xdj49es.js";import{B as l}from"./badge-BodqHT_V.js";import{S as w,a as y,b as C,c as S,d as x}from"./select-DbRZUnPK.js";import{T as V,a as H,b as u,c as o,d as U,e as n}from"./table-CUnn2-lp.js";import{k as B}from"./index-CYw3SC6I.js";import{L as T,R as W,S as z,h as G}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await B.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await B.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(W,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(F,{"code-path":"src/components/kuberneLine truncated
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,a as I}from"./card-B-RtdR4H.js";import{B as A}from"./index-LZWfu62c.js";import{I as P}from"./input-BdDauX3U.js";import{B as l}from"./badge-B0F5ZNtn.js";import{S as w,a as y,b as C,c as S,d as x}from"./select-4xU_9B3_.js";import{T as V,a as H,b as u,c as o,d as U,e as n}from"./table-BPFYQwjr.js";import{k as B}from"./index-Z0O8nAcG.js";import{L as T,R as W,S as z,h as G}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await B.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await B.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(W,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(F,{"code-path":"src/components/kuberneLine truncated
@@ -1 +1 @@
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{C as N,a as v}from"./card-BVNSlZ0C.js";import{B as h}from"./index-EF2TDvxx.js";import{I as _}from"./input--Xdj49es.js";import{B as i}from"./badge-BodqHT_V.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-CUnn2-lp.js";import{l as S}from"./terminal-CLsFzYYz.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-Aso0-eeY.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.Line truncated
import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{C as N,a as v}from"./card-B-RtdR4H.js";import{B as h}from"./index-LZWfu62c.js";import{I as _}from"./input-BdDauX3U.js";import{B as i}from"./badge-B0F5ZNtn.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-BPFYQwjr.js";import{l as S}from"./terminal-BchqP-zB.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-Aso0-eeY.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.Line truncated
@@ -1 +1 @@
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as u,a as b}from"./card-BVNSlZ0C.js";import{S as I,a as z,b as P,c as B,d as V}from"./select-DbRZUnPK.js";import{B as q}from"./index-EF2TDvxx.js";import{I as F}from"./input--Xdj49es.js";import{m as M}from"./metrics-BCZ7fIl4.js";import{S as H,af as K,u as G,A as y,P as Q,D as U,N as W,H as v,g as J}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const N={cpu:{label:"CPU",icon:e.jsx(J,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(W,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function ce(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),D=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),D()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const L=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),R=L.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),d={};k.forEach(s=>{d[s.timestamp]||(d[s.timestamp]={}),d[s.timestamp][s.metric_name]=s.value});const p=Object.keys(d).map(Number).sort((s,t)=>s-t),$=Math.max(1,...Object.values(d).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(I,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:168:15",className:"space-y-4 max-h-[60vh] overflow-y-auto",children:OLine truncated
import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as u,a as b}from"./card-B-RtdR4H.js";import{S as I,a as z,b as P,c as B,d as V}from"./select-4xU_9B3_.js";import{B as q}from"./index-LZWfu62c.js";import{I as F}from"./input-BdDauX3U.js";import{m as M}from"./metrics-Dj4l07HZ.js";import{S as H,af as K,u as G,A as y,P as Q,D as U,N as W,H as v,g as J}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const N={cpu:{label:"CPU",icon:e.jsx(J,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(W,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function ce(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),D=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),D()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const L=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),R=L.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),d={};k.forEach(s=>{d[s.timestamp]||(d[s.timestamp]={}),d[s.timestamp][s.metric_name]=s.value});const p=Object.keys(d).map(Number).sort((s,t)=>s-t),$=Math.max(1,...Object.values(d).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(I,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:168:15",className:"space-y-4 max-h-[60vh] overflow-y-auto",children:OLine truncated
@@ -1 +1 @@
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,j as ue,B as w,a as J,b as K,c as W,d as Y,e as Z,f as Ne,t as C,m as ve}from"./index-EF2TDvxx.js";import{HostMonitor as je}from"./HostMonitor-BVQwXwZu.js";import{C as h,a as M}from"./card-BVNSlZ0C.js";import{B as u}from"./badge-BodqHT_V.js";import{m as be,s as H}from"./metrics-BCZ7fIl4.js";import{L as O,A as R,D as B,h as ee,aG as Se,aH as z,H as ye,aI as te,P as se,T as ae,G as L,aJ as fe,R as we,b as Pe,a as Ce,C as _e,g as Te}from"./vendor-icons-Aso0-eeY.js";import{I as y}from"./input--Xdj49es.js";import{L as j}from"./label-DZckFZd3.js";import{S as re,a as oe,b as ce,c as de,d as A}from"./select-DbRZUnPK.js";import{T as ie,a as ne,b as $,c as l,d as xe,e as p}from"./table-CUnn2-lp.js";import{S as De}from"./switch-DYISEUSP.js";import{s as I}from"./site-Cjg78WIa.js";import"./agent-D_rvbJT8.js";import"./unwrap-oA0ekUAt.js";import"./tabs-dobHN7aQ.js";import"./AreaChart-B9PyJ8Di.js";import"./index-CYARH0Cq.js";function Fe(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function E(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function F(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function ke(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function Ie(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function Le(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await be.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Redis / MySQL 连接信息后启用采集"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:125:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:126:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:127:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:128:13",className:"h-4 w-4 text-red-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:129:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"Redis 监控"}),x&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:131:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[x.name," (",x.ip,")"]})]}),x?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:139:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,Line truncated
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,j as ue,B as w,a as J,b as K,c as W,d as Y,e as Z,f as Ne,t as C,m as ve}from"./index-LZWfu62c.js";import{HostMonitor as je}from"./HostMonitor-D4f8NRVg.js";import{C as h,a as M}from"./card-B-RtdR4H.js";import{B as u}from"./badge-B0F5ZNtn.js";import{m as be,s as H}from"./metrics-Dj4l07HZ.js";import{L as O,A as R,D as B,h as ee,aG as Se,aH as z,H as ye,aI as te,P as se,T as ae,G as L,aJ as fe,R as we,b as Pe,a as Ce,C as _e,g as Te}from"./vendor-icons-Aso0-eeY.js";import{I as y}from"./input-BdDauX3U.js";import{L as j}from"./label-u-lNUbKh.js";import{S as re,a as oe,b as ce,c as de,d as A}from"./select-4xU_9B3_.js";import{T as ie,a as ne,b as $,c as l,d as xe,e as p}from"./table-BPFYQwjr.js";import{S as De}from"./switch-C4PJnJ9I.js";import{s as I}from"./site-B-pRndoi.js";import"./agent-g0Vk8FYK.js";import"./unwrap-BmWy-KM2.js";import"./tabs-kmtfM2I-.js";import"./AreaChart-Czgv4pNk.js";import"./index-CYARH0Cq.js";function Fe(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function E(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function F(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function ke(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function Ie(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function Le(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await be.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Redis / MySQL 连接信息后启用采集"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:125:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:126:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:127:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:128:13",className:"h-4 w-4 text-red-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:129:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"Redis 监控"}),x&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:131:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[x.name," (",x.ip,")"]})]}),x?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:139:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,Line truncated
@@ -1 +1 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as p,a as l}from"./card-BVNSlZ0C.js";import{g as Z,i as ee,L as A,B as m,D as L,j as se,a as O,b as B,c as E,e as R,t as q}from"./index-EF2TDvxx.js";import{B as H}from"./badge-BodqHT_V.js";import{I as $}from"./input--Xdj49es.js";import{L as ae}from"./label-DZckFZd3.js";import{T as te,a as ne,b as i,c,d as ce,e as a}from"./table-CUnn2-lp.js";import{k as j}from"./index-CYw3SC6I.js";import{f as z,B as P,L as N,R as re,P as me,k as oe,A as pe,N as le,j as I,C as xe,l as Q,T as de}from"./vendor-icons-Aso0-eeY.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function fe(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await j.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await j.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){q.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await j.deleteNamespace(t,g),h(null),await x()}catch(s){q.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(me,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:144:17",className:"space-y-2",children:[e.jsx(ae,{"code-path":Line truncated
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as p,a as l}from"./card-B-RtdR4H.js";import{g as Z,i as ee,L as A,B as m,D as L,j as se,a as O,b as B,c as E,e as R,t as q}from"./index-LZWfu62c.js";import{B as H}from"./badge-B0F5ZNtn.js";import{I as $}from"./input-BdDauX3U.js";import{L as ae}from"./label-u-lNUbKh.js";import{T as te,a as ne,b as i,c,d as ce,e as a}from"./table-BPFYQwjr.js";import{k as j}from"./index-Z0O8nAcG.js";import{f as z,B as P,L as N,R as re,P as me,k as oe,A as pe,N as le,j as I,C as xe,l as Q,T as de}from"./vendor-icons-Aso0-eeY.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function fe(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await j.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await j.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){q.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await j.deleteNamespace(t,g),h(null),await x()}catch(s){q.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(me,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:144:17",className:"space-y-2",children:[e.jsx(ae,{"code-path":Line truncated
@@ -1 +1 @@
import{r,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{g,L as l}from"./index-EF2TDvxx.js";import{k as o}from"./index-CYw3SC6I.js";import{f as i,i as h,B as b,k as N,b as f,N as u,F as k,j as w,A as j}from"./vendor-icons-Aso0-eeY.js";const P=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:k,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:j,desc:"水平自动伸缩策略"}];function A(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([o.getNamespaceDeployments(t,a),o.getNamespacePods(t,a),o.getNamespaceServices(t,a),o.getNamespaceIngresses(t,a),o.getNamespaceConfigMaps(t,a),o.getNamespaceSecrets(t,a),o.getHPAs(t,a),o.getCronJobs(t,a)]),c=n=>Array.isArray(n)?n:n?.list||n?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{A as default};
import{r,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{g,L as l}from"./index-LZWfu62c.js";import{k as o}from"./index-Z0O8nAcG.js";import{f as i,i as h,B as b,k as N,b as f,N as u,F as k,j as w,A as j}from"./vendor-icons-Aso0-eeY.js";const P=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:k,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:j,desc:"水平自动伸缩策略"}];function A(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([o.getNamespaceDeployments(t,a),o.getNamespacePods(t,a),o.getNamespaceServices(t,a),o.getNamespaceIngresses(t,a),o.getNamespaceConfigMaps(t,a),o.getNamespaceSecrets(t,a),o.getHPAs(t,a),o.getCronJobs(t,a)]),c=n=>Array.isArray(n)?n:n?.list||n?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{A as default};
@@ -1 +1 @@
import{r as u,j as e,R as le,y as pe,o as xe}from"./vendor-codemirror-C7mXSpXt.js";import{C as ue,a as ie}from"./card-BVNSlZ0C.js";import{B as p,g as de,k as he,i as be,L as I}from"./index-EF2TDvxx.js";import{I as ge}from"./input--Xdj49es.js";import{B as m}from"./badge-BodqHT_V.js";import{S as U,a as J,b as G,c as X,d as q}from"./select-DbRZUnPK.js";import{T as Ne,a as ke,b as i,c as je,d as Re,e as t}from"./table-CUnn2-lp.js";import{Y as Pe,P as ve,a as fe}from"./PodFileBrowser-BPio7wxi.js";import{R as we}from"./ResourceVisualEditor-BXksS6e2.js";import{u as Z}from"./use-toast-CkA38LVP.js";import{k as l}from"./index-CYw3SC6I.js";import{ah as B,X as Ce,L as E,j as w,B as C,b as Se,A as ye,F as Ye,N as K,k as $e,f as _,R as De,v as Q,P as Ae,S as Ie,o as N,d as M,r as _e,H as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";import"./label-DZckFZd3.js";import"./textarea-JgdELMPr.js";function Be({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=Z(),[n,x]=u.useState(""),[h,k]=u.useState(!1),S=async()=>{if(!n.trim()){r({title:"请输入 YAML",variant:"destructive"});return}k(!0);try{await l.applyYAML(s,n),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(b){r({title:"导入失败",description:b.message,variant:"destructive"})}finally{k(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:40:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:11",className:"flex items-center gap-2",children:[e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:49:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Ce,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:9",className:"flex-1 overflow-auto p-4",children:e.jsx(le,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:55:11",value:n,height:"420px",theme:xe,extensions:[pe()],onChange:x,placeholder:"粘贴 YAML 内容...",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},style:{fontSize:"12px"}})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:66:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:67:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:68:11",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:h,children:[h?e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const W=["services","ingresses","configmaps","secrets","pvcs"],R=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:36:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:37:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),L={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",iLine truncated
import{r as u,j as e,R as le,y as pe,o as xe}from"./vendor-codemirror-C7mXSpXt.js";import{C as ue,a as ie}from"./card-B-RtdR4H.js";import{B as p,g as de,k as he,i as be,L as I}from"./index-LZWfu62c.js";import{I as ge}from"./input-BdDauX3U.js";import{B as m}from"./badge-B0F5ZNtn.js";import{S as U,a as J,b as G,c as X,d as q}from"./select-4xU_9B3_.js";import{T as Ne,a as ke,b as i,c as je,d as Re,e as t}from"./table-BPFYQwjr.js";import{Y as Pe,P as ve,a as fe}from"./PodFileBrowser-Bs6KRfHw.js";import{R as we}from"./ResourceVisualEditor-CXyg-7xn.js";import{u as Z}from"./use-toast-CkA38LVP.js";import{k as l}from"./index-Z0O8nAcG.js";import{ah as B,X as Ce,L as E,j as w,B as C,b as Se,A as ye,F as Ye,N as K,k as $e,f as _,R as De,v as Q,P as Ae,S as Ie,o as N,d as M,r as _e,H as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";import"./label-u-lNUbKh.js";import"./textarea-BdtIagjy.js";function Be({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=Z(),[n,x]=u.useState(""),[h,k]=u.useState(!1),S=async()=>{if(!n.trim()){r({title:"请输入 YAML",variant:"destructive"});return}k(!0);try{await l.applyYAML(s,n),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(b){r({title:"导入失败",description:b.message,variant:"destructive"})}finally{k(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:40:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:11",className:"flex items-center gap-2",children:[e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:49:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Ce,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:9",className:"flex-1 overflow-auto p-4",children:e.jsx(le,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:55:11",value:n,height:"420px",theme:xe,extensions:[pe()],onChange:x,placeholder:"粘贴 YAML 内容...",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},style:{fontSize:"12px"}})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:66:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:67:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:68:11",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:h,children:[h?e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const W=["services","ingresses","configmaps","secrets","pvcs"],R=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:36:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:37:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),L={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",iLine truncated
@@ -1 +1 @@
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as c,a as o}from"./card-BVNSlZ0C.js";import{g as R,i as M,L as g,B as q}from"./index-EF2TDvxx.js";import{B as l}from"./badge-BodqHT_V.js";import{T as B,a as L,b as k,c as n,d as S,e as r}from"./table-CUnn2-lp.js";import{k as F}from"./index-CYw3SC6I.js";import{f as j,h as U,L as P,R as A,l as D,I as E,A as I,C as f,N as z,k as H}from"./vendor-icons-Aso0-eeY.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await F.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(U,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-Line truncated
import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as c,a as o}from"./card-B-RtdR4H.js";import{g as R,i as M,L as g,B as q}from"./index-LZWfu62c.js";import{B as l}from"./badge-B0F5ZNtn.js";import{T as B,a as L,b as k,c as n,d as S,e as r}from"./table-BPFYQwjr.js";import{k as F}from"./index-Z0O8nAcG.js";import{f as j,h as U,L as P,R as A,l as D,I as E,A as I,C as f,N as z,k as H}from"./vendor-icons-Aso0-eeY.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await F.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(U,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-Line truncated
@@ -1 +1 @@
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as P,a as E}from"./card-BVNSlZ0C.js";import{g as Qe,f as Xe,t as m,B as p,D as Ye,a as Ze,b as qe,c as es}from"./index-EF2TDvxx.js";import{I as u}from"./input--Xdj49es.js";import{B as j}from"./badge-BodqHT_V.js";import{T as ss,a as ts,b as C,c as k}from"./tabs-dobHN7aQ.js";import{S as $,a as O,b as V,c as B,d as h}from"./select-DbRZUnPK.js";import{T as os}from"./textarea-JgdELMPr.js";import{S as G}from"./switch-DYISEUSP.js";import{L as y}from"./label-DZckFZd3.js";import{p as g}from"./pipeline-CvSxTj00.js";import{d as ns}from"./config-DLOuMLhF.js";import{L as H,J as R,$ as cs,z as ds,j as je,P as D,Q as Pe,f as Ee,O as is,T as S,b as ue,a0 as ve,a1 as Ne,w as rs,X as as,a2 as be,F as ps,a3 as ls,V as xs,k as ms,o as hs,r as ys,a4 as gs,a5 as js,h as Ps,a6 as fe,a7 as Es}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const us={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},we={GitBranch:R,Wrench:fe,Server:Ps,FlaskConical:js,Zap:gs,Terminal:ys,FileCode:hs,Container:ms};function vs(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Ns({task:r,selected:d,onSelect:c,onDelete:v}){const a=we[r.icon]||fe;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),v()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function bs({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",children:"类型"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:11",value:r.type,onValueChange:c=>d({...r,type:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:128"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:28",value:"build",children:"构建"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:69",value:"deploy",children:"部署"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:111",value:"test",children:"测试"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:151",value:"custom",children:"自定义"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:106:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:106:36",className:"text-xs",children:"图标"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:11",value:r.icon,onValueChange:c=>d({...r,icon:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:128"})}),e.jsx(B,{"code-path":"src/components/deploy/PipLine truncated
import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as P,a as E}from"./card-B-RtdR4H.js";import{g as Qe,f as Xe,t as m,B as p,D as Ye,a as Ze,b as qe,c as es}from"./index-LZWfu62c.js";import{I as u}from"./input-BdDauX3U.js";import{B as j}from"./badge-B0F5ZNtn.js";import{T as ss,a as ts,b as C,c as k}from"./tabs-kmtfM2I-.js";import{S as $,a as O,b as V,c as B,d as h}from"./select-4xU_9B3_.js";import{T as os}from"./textarea-BdtIagjy.js";import{S as G}from"./switch-C4PJnJ9I.js";import{L as y}from"./label-u-lNUbKh.js";import{p as g}from"./pipeline-Lgvc2XUS.js";import{d as ns}from"./config-DAXaHuse.js";import{L as H,J as R,$ as cs,z as ds,j as je,P as D,Q as Pe,f as Ee,O as is,T as S,b as ue,a0 as ve,a1 as Ne,w as rs,X as as,a2 as be,F as ps,a3 as ls,V as xs,k as ms,o as hs,r as ys,a4 as gs,a5 as js,h as Ps,a6 as fe,a7 as Es}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const us={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},we={GitBranch:R,Wrench:fe,Server:Ps,FlaskConical:js,Zap:gs,Terminal:ys,FileCode:hs,Container:ms};function vs(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Ns({task:r,selected:d,onSelect:c,onDelete:v}){const a=we[r.icon]||fe;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),v()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function bs({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",children:"类型"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:11",value:r.type,onValueChange:c=>d({...r,type:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:128"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:28",value:"build",children:"构建"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:69",value:"deploy",children:"部署"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:111",value:"test",children:"测试"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:151",value:"custom",children:"自定义"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:106:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:106:36",className:"text-xs",children:"图标"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:11",value:r.icon,onValueChange:c=>d({...r,icon:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:128"})}),e.jsx(B,{"code-path":"src/components/deploy/PipLine truncated
@@ -1 +1 @@
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as Ge,B as v,D as Me,a as Ee,b as Be,c as Te,t as N,i as Oe,f as Qe}from"./index-EF2TDvxx.js";import{I as f}from"./input--Xdj49es.js";import{p as L}from"./pipeline-CvSxTj00.js";import{u as Ve,q as We,b as Je}from"./unwrap-oA0ekUAt.js";import{u as ce}from"./useMutation-BLuCS56f.js";import{C as Ke,a as Ie}from"./card-BVNSlZ0C.js";import{B as D}from"./badge-BodqHT_V.js";import{L as H,a as Y,y as ae,J as U,ad as He,k as ie,ar as Z,as as Le,a2 as de,F as _e,b as ee,ae as I,aT as Ue,N as he,h as ye,G as ue,z as Xe,aq as Ye,Q as Ze,f as me,T as Fe,q as ea,P as xe,S as aa,aU as na,ac as sa,aV as ta}from"./vendor-icons-Aso0-eeY.js";import{T as oa}from"./textarea-JgdELMPr.js";import{L as h}from"./label-DZckFZd3.js";import{S as se,a as te,b as oe,c as re,d as T}from"./select-DbRZUnPK.js";import{d as ra}from"./config-DLOuMLhF.js";import{c as la}from"./credential-BFQGM5tX.js";import"./index-CYARH0Cq.js";function ia(n={page:1,page_size:100}){return Ve({queryKey:We.pipelines(n),queryFn:async()=>{const p=await L.getPipelines(n);return Je(p)},staleTime:2e4})}function pa(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>L.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>L.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>L.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function ca(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function da(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const le=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:He,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:ie,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Z,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Le,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ma(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function xa({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const i=await L.getQueue(d);P(i?.data||i)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const i=setInterval(y,1e4);return()=>clearInterval(i)},[d]);const M=async i=>{try{await L.removeFromQueue(d,i),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2,t=p?.pending_runs||[];return b&&!p||w===0&&u===0?null:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:69:5",className:"px-4 py-2 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:70:7",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:71:9",className:"text-[var(--dg-text-secondary)]",children:"构建执行状态"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:72:9",className:"font-bold text-[var(--dg-text-primary)]",children:[w,"/",R]}),u>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:74:11",className:"text-[var(--dg-text-secondary)] ml-2",children:["构建队列 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PLine truncated
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as Ge,B as v,D as Me,a as Ee,b as Be,c as Te,t as N,i as Oe,f as Qe}from"./index-LZWfu62c.js";import{I as f}from"./input-BdDauX3U.js";import{p as L}from"./pipeline-Lgvc2XUS.js";import{u as Ve,q as We,b as Je}from"./unwrap-BmWy-KM2.js";import{u as ce}from"./useMutation-Bp3lz5hm.js";import{C as Ke,a as Ie}from"./card-B-RtdR4H.js";import{B as D}from"./badge-B0F5ZNtn.js";import{L as H,a as Y,y as ae,J as U,ad as He,k as ie,ar as Z,as as Le,a2 as de,F as _e,b as ee,ae as I,aT as Ue,N as he,h as ye,G as ue,z as Xe,aq as Ye,Q as Ze,f as me,T as Fe,q as ea,P as xe,S as aa,aU as na,ac as sa,aV as ta}from"./vendor-icons-Aso0-eeY.js";import{T as oa}from"./textarea-BdtIagjy.js";import{L as h}from"./label-u-lNUbKh.js";import{S as se,a as te,b as oe,c as re,d as T}from"./select-4xU_9B3_.js";import{d as ra}from"./config-DAXaHuse.js";import{c as la}from"./credential-CwQY-4Ba.js";import"./index-CYARH0Cq.js";function ia(n={page:1,page_size:100}){return Ve({queryKey:We.pipelines(n),queryFn:async()=>{const p=await L.getPipelines(n);return Je(p)},staleTime:2e4})}function pa(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>L.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>L.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>L.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function ca(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function da(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const le=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:He,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:ie,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Z,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Le,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ma(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function xa({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const i=await L.getQueue(d);P(i?.data||i)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const i=setInterval(y,1e4);return()=>clearInterval(i)},[d]);const M=async i=>{try{await L.removeFromQueue(d,i),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2,t=p?.pending_runs||[];return b&&!p||w===0&&u===0?null:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:69:5",className:"px-4 py-2 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:70:7",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:71:9",className:"text-[var(--dg-text-secondary)]",children:"构建执行状态"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:72:9",className:"font-bold text-[var(--dg-text-primary)]",children:[w,"/",R]}),u>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:74:11",className:"text-[var(--dg-text-secondary)] ml-2",children:["构建队列 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PLine truncated
@@ -1,3 +1,3 @@
import{r as n,j as e,a as me}from"./vendor-codemirror-C7mXSpXt.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-EF2TDvxx.js";import{B as A}from"./badge-BodqHT_V.js";import{C as je,b as Ne,c as ve,a as we}from"./card-BVNSlZ0C.js";import{p as C}from"./pipeline-CvSxTj00.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-Aso0-eeY.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."})Line truncated
import{r as n,j as e,a as me}from"./vendor-codemirror-C7mXSpXt.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-LZWfu62c.js";import{B as A}from"./badge-B0F5ZNtn.js";import{C as je,b as Ne,c as ve,a as we}from"./card-B-RtdR4H.js";import{p as C}from"./pipeline-Lgvc2XUS.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-Aso0-eeY.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."})Line truncated
${g?"ring-1 ring-offset-0 scale-[1.02]":"hover:brightness-110"}`,style:{backgroundColor:U,borderColor:M,color:D,borderRadius:xe},children:[pe,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:393:17",children:t.label})]}),!Y&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:396:17",className:"flex items-center justify-center w-5 h-5 -mx-px z-10",children:e.jsx(ee,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:397:19",className:"h-3.5 w-3.5",style:{color:D+"99"}})})]},t.key)}),a&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:404:11",className:"ml-auto text-[10px] text-[var(--dg-text-secondary)] opacity-40 shrink-0 pl-3 whitespace-nowrap",children:i?j.find(t=>t.key===i)?.label:"全阶段"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:411:7",className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:413:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden mb-4",children:L&&c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:415:13",className:"text-center py-12",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:416:15",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-text-muted)]"}),"加载中..."]}):c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:420:13",className:"text-center py-12 border border-dashed border-[var(--dg-border)] rounded-lg m-4",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:421:15",className:"w-10 h-10 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:422:15",className:"text-[var(--dg-text-secondary)]",children:'暂无执行记录,点击"立即执行"触发构建'})]}):e.jsxs("table",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:425:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:426:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:427:17",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:428:19",className:"px-2 py-2.5 w-10",children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:429:21",type:"checkbox",checked:y.size===c.length&&c.length>0,onChange:de,className:"rounded"})}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:432:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-16",children:"构建"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:433:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-20",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:434:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:435:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"用户"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:436:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:437:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:438:19",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)] w-32",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:441:15",children:c.map(t=>{const d=He[t.status]||te;return e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:445:21",className:`border-b border-[var(--dg-border)] cursor-pointer transition-colors
${a?.id===t.id?"bg-[var(--dg-blue)]/10":"hover:bg-[var(--dg-bg-tertiary)]/50"}`,onClick:()=>{P(t)},children:[e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:449:23",className:"px-2 py-2.5",onClick:l=>l.stopPropagation(),children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:450:25",type:"checkbox",checked:y.has(t.id),onChange:()=>ie(t.id),className:"rounded"})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:453:23",className:"px-3 py-2.5 font-mono font-semibold text-[var(--dg-text-primary)]",children:["#",t.build_number]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:456:23",className:"px-3 py-2.5",children:e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:457:25",className:`text-xs ${Ge[t.status]||""} flex items-center gap-1 w-fit`,children:[e.jsx(d,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:458:27",className:`w-3 h-3 ${t.status==="running"?"animate-spin":""}`}),t.status==="success"?"成功":t.status==="failed"?"失败":t.status==="running"?"执行中":t.status==="cancelled"?"已取消":"待执行"]})}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:466:23",className:"px-3 py-2.5",children:e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:467:25",variant:"outline",className:"text-xs",children:K(t)})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:469:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] flex items-center gap-1",children:[e.jsx(Ue,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:470:25",className:"w-3 h-3"}),t.triggered_by||"admin"]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:473:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] font-mono text-xs",children:t.status==="running"?e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:475:27",className:"flex items-center gap-1 text-blue-400",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:476:29",className:"w-3 h-3 animate-spin"}),"执行中..."]}):qe(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:480:23",className:"px-3 py-2.5 text-[var(--dg-text-muted)] text-xs hidden md:table-cell",children:Xe(t.created_at)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:483:23",className:"px-3 py-2.5 text-right",onClick:l=>l.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:484:25",className:"flex justify-end gap-1",children:[e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:485:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>P(t),children:"日志"}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:489:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{oe({id:t.id,buildNumber:t.build_number}),H(!0)},children:[e.jsx(J,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:491:29",className:"w-3.5 h-3.5 mr-1"}),"浏览"]}),t.status==="running"&&e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:494:29",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>ce(t.id),children:e.jsx(Me,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:496:31",className:"w-3.5 h-3.5"})})]})})]},t.id)})})]})}),a&&e.jsxs(je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:511:11",className:"flex-1 flex flex-col min-h-0 border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsxs(Ne,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:512:13",className:"py-3 px-4 flex flex-row items-center justify-between border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:513:15",className:"flex items-center gap-3",children:[e.jsxs(ve,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:514:17",className:"text-sm font-mono",children:[o?.name||`#${s}`," #",a.build_number]}),a.status==="running"&&e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:518:19",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:519:21",className:"w-3 h-3 animate-spin mr-1"}),"实时"]}),i&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:523:19",className:"text-xs border-[var(--dg-border)]",variant:"outline",children:j.find(t=>t.key===i)?.label||i})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:528:15",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:529:17",children:["触发: ",K(a)," (",a.triggered_by||"admin",")"]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:530:17",className:"opacity-40",children:"|"}),e.jsxs("span",{"code-path Line truncated
@@ -1 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as k,a as L,b as E,c as I,d as T,e as B}from"./index-EF2TDvxx.js";import{I as m}from"./input--Xdj49es.js";import{L as r}from"./label-DZckFZd3.js";import{B as j}from"./badge-BodqHT_V.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-DbRZUnPK.js";import{p as x}from"./platform-C7N_g8dz.js";import{S as K,P as U,L as O,e as V,E as W,d as Y,T as Z,C as $,a as ee}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function ie(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:174:19",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(V,{"Line truncated
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as k,a as L,b as E,c as I,d as T,e as B}from"./index-LZWfu62c.js";import{I as m}from"./input-BdDauX3U.js";import{L as r}from"./label-u-lNUbKh.js";import{B as j}from"./badge-B0F5ZNtn.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-4xU_9B3_.js";import{p as x}from"./platform-g_u95ryi.js";import{S as K,P as U,L as O,e as V,E as W,d as Y,T as Z,C as $,a as ee}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function ie(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:174:19",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(V,{"Line truncated
@@ -1,4 +1,4 @@
import{r as u,y as le,E as G,j as e,R as J,o as K}from"./vendor-codemirror-C7mXSpXt.js";import{a8 as re,B as j,D as de,a as me,m as H,c as ue,d as xe}from"./index-EF2TDvxx.js";import{u as ae}from"./use-toast-CkA38LVP.js";import{k as D}from"./index-CYw3SC6I.js";import{w as q,aF as X,ay as L,L as _,$ as Z,X as O,r as he,ad as pe,aK as fe,an as be,ao as we,H as ke,m as ge,f as je,ah as ve,R as Ne,aL as Pe,aM as ye,v as Se}from"./vendor-icons-Aso0-eeY.js";import{S as Q,a as ee,b as te,c as se,d as ne}from"./select-DbRZUnPK.js";import{x as Ee,a as Fe}from"./vendor-xterm-20M9KZE1.js";import{B as Be}from"./badge-BodqHT_V.js";function oe(r){if(!r)return"";const s=r.replace(/\r\n/g,`
import{r as u,y as le,E as G,j as e,R as J,o as K}from"./vendor-codemirror-C7mXSpXt.js";import{a8 as re,B as j,D as de,a as me,m as H,c as ue,d as xe}from"./index-LZWfu62c.js";import{u as ae}from"./use-toast-CkA38LVP.js";import{k as D}from"./index-Z0O8nAcG.js";import{w as q,aF as X,ay as L,L as _,$ as Z,X as O,r as he,ad as pe,aK as fe,an as be,ao as we,H as ke,m as ge,f as je,ah as ve,R as Ne,aL as Pe,aM as ye,v as Se}from"./vendor-icons-Aso0-eeY.js";import{S as Q,a as ee,b as te,c as se,d as ne}from"./select-4xU_9B3_.js";import{x as Ee,a as Fe}from"./vendor-xterm-20M9KZE1.js";import{B as Be}from"./badge-B0F5ZNtn.js";function oe(r){if(!r)return"";const s=r.replace(/\r\n/g,`
`).split(`
`),o=[];let n=0;const g=new Set(["uid","resourceVersion","creationTimestamp","generation","selfLink","clusterName","generateName"]),A=new Set(["managedFields","ownerReferences"]),R={dnsPolicy:["ClusterFirst"],restartPolicy:["Always"],schedulerName:["default-scheduler"],terminationGracePeriodSeconds:["30"],serviceAccountName:["default"],enableServiceLinks:["true"],progressDeadlineSeconds:["600"],revisionHistoryLimit:["10"]},E={imagePullPolicy:["Always","IfNotPresent"],terminationMessagePath:["/dev/termination-log"],terminationMessagePolicy:["File"]},M=new Set(["kubectl.kubernetes.io/last-applied-configuration","deployment.kubernetes.io/revision","kubectl.kubernetes.io/restartedAt","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions"]),h=["kube-api-access-","default-token-","kube-"];let b=!1,S=!1,F=!1,Y=!1,w=!1,B=!1,v=!1,T=!1,N=0;function f(x){return x.length-x.trimStart().length}function P(x){const a=x.trimStart().match(/^([a-zA-Z_][a-zA-Z0-9_./-]*)\s*:/);return a?a[1]:null}function V(x){const a=x.trim().split(":").slice(1).join(":").trim();return a!==""&&!/^[>|]/.test(a)}function C(x){for(n++;n<s.length;){const a=s[n],i=a.trimStart();if(i===""||i.startsWith("#")){n++;continue}if(f(a)<=x)break;n++}}function k(x){const a=P(x);return a?h.some(i=>a.startsWith(i)):!1}for(;n<s.length;){const x=s[n],a=x.trimStart(),i=f(x),c=P(x);if(a===""||a.startsWith("#")){o.push(x),n++;continue}if(i===0&&c==="status"){C(0);continue}if(i===0&&c==="metadata"){b=!0,o.push(x),n++;continue}if(i===0&&c!=="metadata"&&(b=!1,S=!1),i===0&&c==="spec"){F=!0,o.push(x),n++;continue}if(i===0&&c!=="spec"&&(F=!1,Y=!1,w=!1,B=!1,T=!1),b){if(i===2&&c==="annotations"){S=!0,o.push(x),n++;continue}if(i<=2&&c!=="annotations"&&(S=!1),i>=2&&i<=4&&a.startsWith("pod-template-hash")&&a.includes(":")){n++;continue}if(i===2&&c&&g.has(c)){V(x)?n++:C(2);continue}if(i===2&&c&&A.has(c)){for(n++;n<s.length;){const l=s[n],t=l.trimStart();if(t===""||t.startsWith("#")){n++;continue}const d=f(l);if(d>2||d===2&&t.startsWith("-")){n++;continue}break}continue}if(S&&i>2&&c&&M.has(c)){if(V(x))n++;else{const l=a.split(":").slice(1).join(":").trim();/^[>|]/.test(l)?C(i):n++}continue}}if(F){if(i===2&&c==="template"){o.push(x),n++;continue}if(i===2&&c&&R[c]){const p=a.split(":").slice(1).join(":").trim();if(R[c].includes(p)){n++;continue}}if(i===2&&c==="nodeName"){n++;continue}if(i===2&&c==="spec"){Y=!0,N=i,o.push(x),n++;continue}}if(Y&&i>N){if(c==="containers"){w=!0,B=!1,o.push(x),n++;continue}if(c==="initContainers"){B=!0,w=!1,o.push(x),n++;continue}if(c==="volumes"){T=!0,o.push(x),n++;continue}if(c&&R[c]){const p=a.split(":").slice(1).join(":").trim();if(R[c].includes(p)){n++;continue}}if(c==="nodeName"){n++;continue}if(c==="serviceAccount"&&a.endsWith(":")){V(x)?n++:C(i);continue}}if((w||B)&&i>=6){if(c&&E[c]){const p=a.split(":").slice(1).join(":").trim();if(E[c].includes(p)){n++;continue}}if(c==="volumeMounts"&&(v=!0),v&&a.startsWith("- name:")){let p=[x],l=n+1,t=!1;for(;l<s.length;){const d=s[l].trimStart();if(d===""||d.startsWith("#")){p.push(s[l]),l++;continue}if(f(s[l])<=i)break;Te(d)&&(t=!0),p.push(s[l]),l++}if(t){n=l;continue}v=!1}}if(T&&i>=4&&a.startsWith("- name:")&&k(a)){const p=i;for(n++;n<s.length;){const l=s[n],t=l.trimStart();if(t===""||t.startsWith("#")){n++;continue}if(f(l)<=p)break;n++}continue}if(a===""&&o.length>0&&o[o.length-1].trim()===""){n++;continue}o.push(x),n++}return o.join(`
`).replace(/\n{3,}/g,`
@@ -1 +1 @@
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as x}from"./card-BVNSlZ0C.js";import{g as H,i as L,L as N,B as U}from"./index-EF2TDvxx.js";import{B as V}from"./badge-BodqHT_V.js";import{S as f,a as v,b as C,c as y,d as P}from"./select-DbRZUnPK.js";import{T as W,a as F,b as u,c as d,d as z,e as n}from"./table-CUnn2-lp.js";import{k as b}from"./index-CYw3SC6I.js";import{f as S,A as D,R as G,g as K,H as q}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:w}=H(),g=L(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(G,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"src/components/kubernetes/PLine truncated
import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as x}from"./card-B-RtdR4H.js";import{g as H,i as L,L as N,B as U}from"./index-LZWfu62c.js";import{B as V}from"./badge-B0F5ZNtn.js";import{S as f,a as v,b as C,c as y,d as P}from"./select-4xU_9B3_.js";import{T as W,a as F,b as u,c as d,d as z,e as n}from"./table-BPFYQwjr.js";import{k as b}from"./index-Z0O8nAcG.js";import{f as S,A as D,R as G,g as K,H as q}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:w}=H(),g=L(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(G,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"src/components/kubernetes/PLine truncated
@@ -1 +1 @@
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-EF2TDvxx.js";import{I as j}from"./input--Xdj49es.js";import{L as i}from"./label-DZckFZd3.js";import{B as O}from"./badge-BodqHT_V.js";import{C as A}from"./checkbox-CY3XhE_w.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-CUnn2-lp.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-DbRZUnPK.js";import{r as M}from"./region-DScARMXs.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:222:11",className:"flex items-center gap-2",chilLine truncated
import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-LZWfu62c.js";import{I as j}from"./input-BdDauX3U.js";import{L as i}from"./label-u-lNUbKh.js";import{B as O}from"./badge-B0F5ZNtn.js";import{C as A}from"./checkbox-DL3onEGv.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-BPFYQwjr.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-4xU_9B3_.js";import{r as M}from"./region-BZBRxF2X.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:222:11",className:"flex items-center gap-2",chilLine truncated
@@ -1 +1 @@
import{r as v,j as e,R as H,y as J,o as X}from"./vendor-codemirror-C7mXSpXt.js";import{B as R}from"./index-EF2TDvxx.js";import{I as k}from"./input--Xdj49es.js";import{L as w}from"./label-DZckFZd3.js";import{T as K}from"./textarea-JgdELMPr.js";import{S as D,a as B,b as G,c as W,d as T}from"./select-DbRZUnPK.js";import{u as Q}from"./use-toast-CkA38LVP.js";import{k as I}from"./index-CYw3SC6I.js";import{p as Z,c as $,b as ee,d as se,e as te}from"./PodFileBrowser-BPio7wxi.js";import{D as re,f as oe,N as ae,j as ce,F as ne,X as de,L as z,$ as O,P as L,T as Y}from"./vendor-icons-Aso0-eeY.js";function ie(d,h,c){switch(d){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:c,namespace:h},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:c,namespace:h},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:c,namespace:h},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:c,namespace:h},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:c,namespace:h},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:c,namespace:h}}}}function Ne({clusterCode:d,namespace:h,resource:c,name:V,onClose:g,onSaved:N,isCreate:b=!1}){const{toast:i}=Q(),[f,x]=v.useState(!0),[m,y]=v.useState(!1),[S,r]=v.useState(""),[t,u]=v.useState(null),[j,P]=v.useState("visual"),[l,o]=v.useState(""),p=v.useCallback(async()=>{x(!0);try{if(b){const F=ie(c,h,V||"");u(F),o(JSON.stringify(F,null,2)),r("");return}const E=await I.getResourceYaml(d,h,c,V);r(E);const{manifest:M,yaml:A}=await Z(E);o(A),u(M),M||(P("yaml"),i({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(E){i({title:"加载失败",description:E.message,variant:"destructive"})}finally{x(!1)}},[d,h,c,V,b]);v.useEffect(()=>{p()},[p]);const s=async E=>{y(!0);try{const M=await te(E),A=E?.metadata?.name||V;if(b){if(!A?.trim()){i({title:"请填写名称",variant:"destructive"});return}await I.applyYAML(d,M),i({title:"创建成功",description:`${c}/${A}`})}else await I.updateResourceYaml(d,h,c,V,M),i({title:"保存成功",description:`${c}/${V} 已更新`});N?.(),g()}catch(M){i({title:b?"创建失败":"保存失败",description:M.message,variant:"destructive"})}finally{y(!1)}},a=async()=>{y(!0);try{const E=$(l);b?(await I.applyYAML(d,E),i({title:"创建成功",description:"YAML 已应用"})):(await I.updateResourceYaml(d,h,c,V,E),i({title:"YAML 已应用",description:`${c}/${V} 更新成功`})),N?.(),g()}catch(E){i({title:"保存失败",description:E.message,variant:"destructive"})}finally{y(!1)}},n=async()=>{const E=await ee(l);if(!E){i({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}u(E),P("visual")},C=async()=>{if(t){const E=await se(t);o($(E))}P("yaml")},q={configmaps:{title:"ConfigMap",icon:ne,color:"text-blue-400"},secrets:{title:"Secret",icon:ce,color:"text-amber-400"},services:{title:"Service",icon:ae,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:oe,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:re,color:"text-emerald-400"}},_=q[c]||q.configmaps,U=_.icon;return e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:135:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:136:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl",onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:139:11",className:"flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:140:13",className:`h-5 w-5 ${_.color}`}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:141:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:142:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:b?`新建 ${_.title}`:`${_.title} 编辑`}),e.jsxs("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:143:15",className:"text-xs text-[var(--dg-text-muted)]",children:[b?h:V," · ",h," · ",d]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:146:11",className:"flex items-center gaLine truncated
import{r as v,j as e,R as H,y as J,o as X}from"./vendor-codemirror-C7mXSpXt.js";import{B as R}from"./index-LZWfu62c.js";import{I as k}from"./input-BdDauX3U.js";import{L as w}from"./label-u-lNUbKh.js";import{T as K}from"./textarea-BdtIagjy.js";import{S as D,a as B,b as G,c as W,d as T}from"./select-4xU_9B3_.js";import{u as Q}from"./use-toast-CkA38LVP.js";import{k as I}from"./index-Z0O8nAcG.js";import{p as Z,c as $,b as ee,d as se,e as te}from"./PodFileBrowser-Bs6KRfHw.js";import{D as re,f as oe,N as ae,j as ce,F as ne,X as de,L as z,$ as O,P as L,T as Y}from"./vendor-icons-Aso0-eeY.js";function ie(d,h,c){switch(d){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:c,namespace:h},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:c,namespace:h},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:c,namespace:h},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:c,namespace:h},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:c,namespace:h},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:c,namespace:h}}}}function Ne({clusterCode:d,namespace:h,resource:c,name:V,onClose:g,onSaved:N,isCreate:b=!1}){const{toast:i}=Q(),[f,x]=v.useState(!0),[m,y]=v.useState(!1),[S,r]=v.useState(""),[t,u]=v.useState(null),[j,P]=v.useState("visual"),[l,o]=v.useState(""),p=v.useCallback(async()=>{x(!0);try{if(b){const F=ie(c,h,V||"");u(F),o(JSON.stringify(F,null,2)),r("");return}const E=await I.getResourceYaml(d,h,c,V);r(E);const{manifest:M,yaml:A}=await Z(E);o(A),u(M),M||(P("yaml"),i({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(E){i({title:"加载失败",description:E.message,variant:"destructive"})}finally{x(!1)}},[d,h,c,V,b]);v.useEffect(()=>{p()},[p]);const s=async E=>{y(!0);try{const M=await te(E),A=E?.metadata?.name||V;if(b){if(!A?.trim()){i({title:"请填写名称",variant:"destructive"});return}await I.applyYAML(d,M),i({title:"创建成功",description:`${c}/${A}`})}else await I.updateResourceYaml(d,h,c,V,M),i({title:"保存成功",description:`${c}/${V} 已更新`});N?.(),g()}catch(M){i({title:b?"创建失败":"保存失败",description:M.message,variant:"destructive"})}finally{y(!1)}},a=async()=>{y(!0);try{const E=$(l);b?(await I.applyYAML(d,E),i({title:"创建成功",description:"YAML 已应用"})):(await I.updateResourceYaml(d,h,c,V,E),i({title:"YAML 已应用",description:`${c}/${V} 更新成功`})),N?.(),g()}catch(E){i({title:"保存失败",description:E.message,variant:"destructive"})}finally{y(!1)}},n=async()=>{const E=await ee(l);if(!E){i({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}u(E),P("visual")},C=async()=>{if(t){const E=await se(t);o($(E))}P("yaml")},q={configmaps:{title:"ConfigMap",icon:ne,color:"text-blue-400"},secrets:{title:"Secret",icon:ce,color:"text-amber-400"},services:{title:"Service",icon:ae,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:oe,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:re,color:"text-emerald-400"}},_=q[c]||q.configmaps,U=_.icon;return e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:135:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:136:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl",onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:139:11",className:"flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:140:13",className:`h-5 w-5 ${_.color}`}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:141:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:142:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:b?`新建 ${_.title}`:`${_.title} 编辑`}),e.jsxs("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:143:15",className:"text-xs text-[var(--dg-text-muted)]",children:[b?h:V," · ",h," · ",d]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:146:11",className:"flex items-center gaLine truncated
@@ -1,4 +1,4 @@
import{j as t,r as i}from"./vendor-codemirror-C7mXSpXt.js";import{D as $,a as B,b as P,c as O,d as A,e as I,B as p,q as Z,f as Lt,t as l}from"./index-EF2TDvxx.js";import{I as D}from"./input--Xdj49es.js";import{S as tt,a as et,b as ot,c as st,d as z}from"./select-DbRZUnPK.js";import{T as _t,a as zt,b as J,c as K}from"./tabs-dobHN7aQ.js";import{C as at}from"./checkbox-CY3XhE_w.js";import{s as j,t as $t}from"./automation-_t6YTgo2.js";import{B as N}from"./badge-BodqHT_V.js";import{a as Bt,y as ct,L as V,b as Pt,o as nt,aE as rt,x as Ot,z as At,aF as It,T as it,n as pt,r as Vt,S as qt,P as Rt}from"./vendor-icons-Aso0-eeY.js";import{L as v}from"./label-DZckFZd3.js";import{T as Ht}from"./textarea-JgdELMPr.js";import{C as lt,b as Qt,c as Ut,d as Xt,a as mt}from"./card-BVNSlZ0C.js";import"./index-CYARH0Cq.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash
import{j as t,r as i}from"./vendor-codemirror-C7mXSpXt.js";import{D as $,a as B,b as P,c as O,d as A,e as I,B as p,q as Z,f as Lt,t as l}from"./index-LZWfu62c.js";import{I as D}from"./input-BdDauX3U.js";import{S as tt,a as et,b as ot,c as st,d as z}from"./select-4xU_9B3_.js";import{T as _t,a as zt,b as J,c as K}from"./tabs-kmtfM2I-.js";import{C as at}from"./checkbox-DL3onEGv.js";import{s as j,t as $t}from"./automation-BrmX02Sx.js";import{B as N}from"./badge-B0F5ZNtn.js";import{a as Bt,y as ct,L as V,b as Pt,o as nt,aE as rt,x as Ot,z as At,aF as It,T as it,n as pt,r as Vt,S as qt,P as Rt}from"./vendor-icons-Aso0-eeY.js";import{L as v}from"./label-u-lNUbKh.js";import{T as Ht}from"./textarea-BdtIagjy.js";import{C as lt,b as Qt,c as Ut,d as Xt,a as mt}from"./card-B-RtdR4H.js";import"./index-CYARH0Cq.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash
# 系统巡检脚本
echo "===== 系统信息 ====="
uname -a
@@ -1,5 +1,5 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BlowzRFW.js","assets/index-EF2TDvxx.js","assets/vendor-codemirror-C7mXSpXt.js","assets/vendor-icons-Aso0-eeY.js","assets/index-7YeEJX-w.css","assets/dashboard-BNyMEfo2.js","assets/server-rQ-8Frwb.js","assets/region-DScARMXs.js","assets/index-CYw3SC6I.js","assets/pipeline-CvSxTj00.js","assets/config-DLOuMLhF.js","assets/credential-BFQGM5tX.js","assets/automation-_t6YTgo2.js","assets/alert-B4v9izj6.js","assets/alert-center-C2gx2r-S.js","assets/site-Cjg78WIa.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-C4Fvm0Oq.js","assets/metrics-BCZ7fIl4.js","assets/agent-D_rvbJT8.js","assets/account-DwPCbdbn.js","assets/platform-C7N_g8dz.js","assets/billing-CoX12im7.js","assets/audit-Z4oPE2dM.js","assets/terminal-CLsFzYYz.js","assets/approval-DPMUbhSE.js","assets/ai-CEIZUoip.js"])))=>i.map(i=>d[i]);
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as ir,a8 as $r,D as Te,a as _e,b as Ke,c as Re,d as Me,B as j,e as Qe,o as vr,m as ie,t as G,v as Or,r as Lr,K as zr,s as Je,x as Hr,P as Ur,w as Dr,W as Vr,at as hr,a9 as gr,aa as ur,ab as br,ac as Sr,ad as qe,ae as he,f as Wr}from"./index-EF2TDvxx.js";import{C as Fe,a as ke}from"./card-BVNSlZ0C.js";import{I as W}from"./input--Xdj49es.js";import{C as ge}from"./checkbox-CY3XhE_w.js";import{b as Oe,e as Z,T as qr,a as Gr,c as ne,d as Kr}from"./table-CUnn2-lp.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-DbRZUnPK.js";import{u as Qr,q as jr,a as Jr,b as Xr}from"./unwrap-oA0ekUAt.js";import{u as $e}from"./useMutation-BLuCS56f.js";import{s as ee}from"./server-rQ-8Frwb.js";import{S as Yr}from"./stat-strip-TlkYcldq.js";import{B as O}from"./badge-BodqHT_V.js";import{c as ye}from"./account-DwPCbdbn.js";import{i as Nr,ag as Le,M as We,y as cr,w as ue,f as Ee,R as de,S as yr,ab as ze,h as He,b5 as Xe,an as fr,ao as wr,X as be,j as Cr,am as Ir,L as Ue,ah as Ye,b6 as Zr,ap as es,aL as nr,m as rs,aM as ss,v as Ze,T as er,b7 as Ge,Q as ts,$ as os,N as as,H as cs,r as dr,aP as ns,aE as ds,P as ls}from"./vendor-icons-Aso0-eeY.js";import{x as ps,a as ms}from"./vendor-xterm-20M9KZE1.js";import{m as xs,a as is,f as vs}from"./xterm-utils-slbfdUHf.js";import{c as rr,s as hs}from"./credential-BFQGM5tX.js";import{r as gs}from"./region-DScARMXs.js";import{L as V}from"./label-DZckFZd3.js";import{T as lr}from"./textarea-JgdELMPr.js";import"./index-CYARH0Cq.js";function us(r={page:1,page_size:100}){return Qr({queryKey:jr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:Xr(p),total:Jr(p)}},staleTime:3e4})}function bs(){const r=ir(),p=()=>r.invalidateQueries({queryKey:["servers"]}),c=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),a=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:c,updateMutation:t,deleteMutation:a,batchDeleteMutation:v,invalidate:p}}function Ss({servers:r}){const p=r.filter(a=>a.status==="running").length,c=r.filter(a=>a.status==="maintenance").length,t=r.filter(a=>a.status==="stopped").length;return e.jsx(Yr,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:c,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const js=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Ns({open:r,onClose:p}){const[c,t]=o.useState([]),[a,v]=o.useState(1),[u,g]=o.useState(""),[x,_]=o.useState(null),[S,E]=o.useState([]),[n,y]=o.useState([]),[f,R]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[L,N]=o.useState(!1),[z,m]=o.useState([]),[b,M]=o.useState(!1),[F,A]=o.useState(null),[Y,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await ye.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),$r(async()=>{const{credentialApi:s}=await import("./index-BlowzRFW.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({credentialApi:s})=>{s.list().then(T=>l(T?.list||[])).catch(()=>l([]))}))},[r]);const B=c.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await ye.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await ye.syncRegions(s);const T=await X(s);E(T)}catch(T){throw console.error("同步区域失败:",T),T}finally{i(!1)}},[X]),P=o.useCallback(async()=>{if(!x)return;const s=await X(x.id);if(E(s),s.length===0)try{await K(x.id)}catch{}},[x,X,K]),me=o.useCallback(async()=>{if(!(!x||n.length===0)){N(!0),m([]),C([]),D([]);try{const s=await ye.discoverInstances(x.id,n);C(s?.list||[]),m(s?.errors||[])}catch(s){console.error("发现主机失败:",s),m([s?.message||"发现主机失败"])}finally{N(!1)}}},[x,n]),se=async()=>{if(!(!x||I.length===0)){M(!0);try{const s=h.filter(ae=>I.includes(ae.instance_id)),T=await ye.importInstances(x.id,s,{default_port:Number(Y)||22,credential_id:$?Number($):void 0});A(T||{imported:0,skipped:0})}catch(s){console.error("导入失败:",s)}finally{M(!1)}}},H=()=>{a===2&&x&&a<4?(v(3),P()):a<4&&v(a+1)},Se=()=>{a>1&&v(a-1)},Be=()=>{n.length===S.length&&S.length>0?y([]):y(S.map(s=>s.code))},Ve=s=>{D(T=>T.includes(s)?T.filter(ae=>ae!==s):[...T,s])},Pe=()=>{I.length===h.length&&h.length>0?D([]):D(h.map(s=>s.instance_id))},je=()=>{p(),v(1),g(""),_(null),y([]),E([]),C([]),D([]),R(""),m([]),A(null),q("22"),Q("")},Line truncated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D1_Nt40_.js","assets/index-LZWfu62c.js","assets/vendor-codemirror-C7mXSpXt.js","assets/vendor-icons-Aso0-eeY.js","assets/index-BzYDIT5o.css","assets/dashboard-7Sl2aero.js","assets/server-BUAZv7ZV.js","assets/region-BZBRxF2X.js","assets/index-Z0O8nAcG.js","assets/pipeline-Lgvc2XUS.js","assets/config-DAXaHuse.js","assets/credential-CwQY-4Ba.js","assets/automation-BrmX02Sx.js","assets/alert-C4MMKcUL.js","assets/alert-center-dJk4LGZM.js","assets/site-B-pRndoi.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-DuIT0c1H.js","assets/metrics-Dj4l07HZ.js","assets/agent-g0Vk8FYK.js","assets/account-Dzyhyahe.js","assets/platform-g_u95ryi.js","assets/billing-9Cbmzl6K.js","assets/audit-BiL35K5G.js","assets/terminal-BchqP-zB.js","assets/approval-DmGRfKd6.js","assets/ai-BMSiZ3PN.js"])))=>i.map(i=>d[i]);
import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as ir,a8 as $r,D as Te,a as _e,b as Ke,c as Re,d as Me,B as j,e as Qe,o as vr,m as ie,t as G,v as Or,r as Lr,K as zr,s as Je,x as Hr,P as Ur,w as Dr,W as Vr,at as hr,a9 as gr,aa as ur,ab as br,ac as Sr,ad as qe,ae as he,f as Wr}from"./index-LZWfu62c.js";import{C as Fe,a as ke}from"./card-B-RtdR4H.js";import{I as W}from"./input-BdDauX3U.js";import{C as ge}from"./checkbox-DL3onEGv.js";import{b as Oe,e as Z,T as qr,a as Gr,c as ne,d as Kr}from"./table-BPFYQwjr.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-4xU_9B3_.js";import{u as Qr,q as jr,a as Jr,b as Xr}from"./unwrap-BmWy-KM2.js";import{u as $e}from"./useMutation-Bp3lz5hm.js";import{s as ee}from"./server-BUAZv7ZV.js";import{S as Yr}from"./stat-strip-BPzU38xY.js";import{B as O}from"./badge-B0F5ZNtn.js";import{c as ye}from"./account-Dzyhyahe.js";import{i as Nr,ag as Le,M as We,y as cr,w as ue,f as Ee,R as de,S as yr,ab as ze,h as He,b5 as Xe,an as fr,ao as wr,X as be,j as Cr,am as Ir,L as Ue,ah as Ye,b6 as Zr,ap as es,aL as nr,m as rs,aM as ss,v as Ze,T as er,b7 as Ge,Q as ts,$ as os,N as as,H as cs,r as dr,aP as ns,aE as ds,P as ls}from"./vendor-icons-Aso0-eeY.js";import{x as ps,a as ms}from"./vendor-xterm-20M9KZE1.js";import{m as xs,a as is,f as vs}from"./xterm-utils-slbfdUHf.js";import{c as rr,s as hs}from"./credential-CwQY-4Ba.js";import{r as gs}from"./region-BZBRxF2X.js";import{L as V}from"./label-u-lNUbKh.js";import{T as lr}from"./textarea-BdtIagjy.js";import"./index-CYARH0Cq.js";function us(r={page:1,page_size:100}){return Qr({queryKey:jr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:Xr(p),total:Jr(p)}},staleTime:3e4})}function bs(){const r=ir(),p=()=>r.invalidateQueries({queryKey:["servers"]}),c=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),a=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:c,updateMutation:t,deleteMutation:a,batchDeleteMutation:v,invalidate:p}}function Ss({servers:r}){const p=r.filter(a=>a.status==="running").length,c=r.filter(a=>a.status==="maintenance").length,t=r.filter(a=>a.status==="stopped").length;return e.jsx(Yr,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:c,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const js=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Ns({open:r,onClose:p}){const[c,t]=o.useState([]),[a,v]=o.useState(1),[u,g]=o.useState(""),[x,_]=o.useState(null),[S,E]=o.useState([]),[n,y]=o.useState([]),[f,R]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[L,N]=o.useState(!1),[z,m]=o.useState([]),[b,M]=o.useState(!1),[F,A]=o.useState(null),[Y,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await ye.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),$r(async()=>{const{credentialApi:s}=await import("./index-D1_Nt40_.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({credentialApi:s})=>{s.list().then(T=>l(T?.list||[])).catch(()=>l([]))}))},[r]);const B=c.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await ye.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await ye.syncRegions(s);const T=await X(s);E(T)}catch(T){throw console.error("同步区域失败:",T),T}finally{i(!1)}},[X]),P=o.useCallback(async()=>{if(!x)return;const s=await X(x.id);if(E(s),s.length===0)try{await K(x.id)}catch{}},[x,X,K]),me=o.useCallback(async()=>{if(!(!x||n.length===0)){N(!0),m([]),C([]),D([]);try{const s=await ye.discoverInstances(x.id,n);C(s?.list||[]),m(s?.errors||[])}catch(s){console.error("发现主机失败:",s),m([s?.message||"发现主机失败"])}finally{N(!1)}}},[x,n]),se=async()=>{if(!(!x||I.length===0)){M(!0);try{const s=h.filter(ae=>I.includes(ae.instance_id)),T=await ye.importInstances(x.id,s,{default_port:Number(Y)||22,credential_id:$?Number($):void 0});A(T||{imported:0,skipped:0})}catch(s){console.error("导入失败:",s)}finally{M(!1)}}},H=()=>{a===2&&x&&a<4?(v(3),P()):a<4&&v(a+1)},Se=()=>{a>1&&v(a-1)},Be=()=>{n.length===S.length&&S.length>0?y([]):y(S.map(s=>s.code))},Ve=s=>{D(T=>T.includes(s)?T.filter(ae=>ae!==s):[...T,s])},Pe=()=>{I.length===h.length&&h.length>0?D([]):D(h.map(s=>s.instance_id))},je=()=>{p(),v(1),g(""),_(null),y([]),E([]),C([]),D([]),R(""),m([]),A(null),q("22"),Q("")},Line truncated
\x1B[31m[连接已关闭]\x1B[0m\r
`)},F.onerror=()=>{N.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
@@ -1,2 +1,2 @@
import{r as o,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Ks,t as V,j as Bs,l as $,k as fe}from"./index-EF2TDvxx.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-dobHN7aQ.js";import{B as cs}from"./badge-BodqHT_V.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-BVNSlZ0C.js";import{I as f}from"./input--Xdj49es.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-CUnn2-lp.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-DbRZUnPK.js";import{U as re,ag as Qs,aE as vs,ah as Gs,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aN as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-Aso0-eeY.js";import{T as Re}from"./textarea-JgdELMPr.js";import{L as Ts}from"./label-DZckFZd3.js";import{C as _e}from"./checkbox-CY3XhE_w.js";import{S as bs}from"./switch-DYISEUSP.js";import"./index-CYARH0Cq.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800Line truncated
import{r as o,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Ks,t as V,j as Bs,l as $,k as fe}from"./index-LZWfu62c.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-kmtfM2I-.js";import{B as cs}from"./badge-B0F5ZNtn.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-B-RtdR4H.js";import{I as f}from"./input-BdDauX3U.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-BPFYQwjr.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-4xU_9B3_.js";import{U as re,ag as Qs,aE as vs,ah as Gs,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aN as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-Aso0-eeY.js";import{T as Re}from"./textarea-BdtIagjy.js";import{L as Ts}from"./label-u-lNUbKh.js";import{C as _e}from"./checkbox-DL3onEGv.js";import{S as bs}from"./switch-C4PJnJ9I.js";import"./index-CYARH0Cq.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800Line truncated
`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;g<c.length;g++){const ms=c[g].split(",").map(Fs=>Fs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),E(null)},os.readAsText(z,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const r=await q.batchImport({users:j,skip_existing:!0});E(r),await X()}catch(r){E({code:500,message:r?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(De,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(se,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(Ee,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:rs,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:K,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:G,setImportResult:E,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{yt as SystemManager};
@@ -1,3 +1,3 @@
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as oe,o as le,D as U,a as J,m as Q,c as X,d as G,f as ce,B as H,b as de}from"./index-EF2TDvxx.js";import{C as z,a as E}from"./card-BVNSlZ0C.js";import{I as $}from"./input--Xdj49es.js";import{T as I,a as O,b as T,c as d,d as q,e as m}from"./table-CUnn2-lp.js";import{x as Z,a as V}from"./vendor-xterm-20M9KZE1.js";import{B as k}from"./badge-BodqHT_V.js";import{m as me,a as pe}from"./xterm-utils-slbfdUHf.js";import{_ as K,L as Y,an as xe,ao as he,X as ue,S as _,R as W,aZ as ge,a_ as ve,A as ee,a$ as fe,x as ye,z as je,v as Se}from"./vendor-icons-Aso0-eeY.js";import{u as se,q as te,b as ae}from"./unwrap-oA0ekUAt.js";import{u as B}from"./useMutation-BLuCS56f.js";import{t as L,s as be}from"./terminal-CLsFzYYz.js";function ne(s={page:1,page_size:100}){return se({queryKey:te.terminalSessions(s),queryFn:async()=>{const r=await L.list(s);return ae(r)}})}function Ne(){const s=oe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=B({mutationFn:p=>L.kill(p),onSuccess:r}),c=B({mutationFn:p=>L.delete(p),onSuccess:r}),l=B({mutationFn:p=>L.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function Pe(s={page:1,page_size:200}){return se({queryKey:te.sessionCommands(s),queryFn:async()=>{const r=await be.list(s);return ae(r)}})}function we({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[y,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[v,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new V.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=le.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(M);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),me(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=R=>{try{const C=JSON.parse(R.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=R=>{N||g(`连接失败 (code=${R.code}): ${R.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r
import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as oe,o as le,D as U,a as J,m as Q,c as X,d as G,f as ce,B as H,b as de}from"./index-LZWfu62c.js";import{C as z,a as E}from"./card-B-RtdR4H.js";import{I as $}from"./input-BdDauX3U.js";import{T as I,a as O,b as T,c as d,d as q,e as m}from"./table-BPFYQwjr.js";import{x as Z,a as V}from"./vendor-xterm-20M9KZE1.js";import{B as k}from"./badge-B0F5ZNtn.js";import{m as me,a as pe}from"./xterm-utils-slbfdUHf.js";import{_ as K,L as Y,an as xe,ao as he,X as ue,S as _,R as W,aZ as ge,a_ as ve,A as ee,a$ as fe,x as ye,z as je,v as Se}from"./vendor-icons-Aso0-eeY.js";import{u as se,q as te,b as ae}from"./unwrap-BmWy-KM2.js";import{u as B}from"./useMutation-Bp3lz5hm.js";import{t as L,s as be}from"./terminal-BchqP-zB.js";function ne(s={page:1,page_size:100}){return se({queryKey:te.terminalSessions(s),queryFn:async()=>{const r=await L.list(s);return ae(r)}})}function Ne(){const s=oe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=B({mutationFn:p=>L.kill(p),onSuccess:r}),c=B({mutationFn:p=>L.delete(p),onSuccess:r}),l=B({mutationFn:p=>L.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function Pe(s={page:1,page_size:200}){return se({queryKey:te.sessionCommands(s),queryFn:async()=>{const r=await be.list(s);return ae(r)}})}function we({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[y,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[v,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new V.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=le.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(M);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),me(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=R=>{try{const C=JSON.parse(R.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=R=>{N||g(`连接失败 (code=${R.code}): ${R.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const w=setTimeout(()=>{N||(g("连接超时 — 请确认已登录且有活跃会话"),S.close())},5e3);return()=>{clearTimeout(w),S.close(),h.dispose(),p.current=null,f.current=null,u.current=null,a(!1)}},[s,i]),n.useEffect(()=>{if(!s)return;let h,o=0;const j=()=>{const D=l.current,M=f.current,S=p.current;if(!D||!M||!S){o++<30&&requestAnimationFrame(j);return}h=pe(D,M,S)};return j(),()=>h?.()},[s,i,v]);const A=h=>h?new Date(h).toLocaleString():"--";return e.jsx(U,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:Q("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",v?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:v?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(X,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(G,{"code-path":"src/components/system/LiveMonitorDialog.tsx:198:9",className:"sr-only",children:"审计在线 WebSSH 会话"}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:201:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:202:11",className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[e.jsx(K,{"code-path":"src/components/system/LiveMonitorDialog.tsx:203:13",className:"h-4 w-4 text-emerald-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:204:13",className:"text-[var(--dg-text-primary)] font-medium",children:"终端实时监控"}),t&&e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:206:15",className:"text-[var(--dg-text-muted)] truncate",children:[t.username," · ",t.server_name," (",t.server_ip,") · ",A(t.start_time)]}),y&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:211:15",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10 text-xs",children:"● 在线"}),!y&&!x&&e.jsxs(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:216:15",variant:"outline",className:"border-yellow-500/30 text-yellow-400 bg-yellow-500/10 text-xs",children:[e.jsx(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),x&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:222:15",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 text-xs",children:"连接失败"})]}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:227:11",className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:228:13",type:"button",onClick:()=>b(!v),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:v?"退出全屏":"全屏",children:v?e.jsx(xe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(he,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:236:13",type:"button",onClick:()=>r(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(ue,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),x&&e.jsx("p",{"code-path":"src/components/system/LiveMonitorDialog.tsx:247:11",className:"text-sm text-red-400 px-4 py-2 border-b border-[var(--dg-border)]",children:x}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:l,className:"xterm-terminal-host",style:{height:v?"calc(100vh - 49px)":"520px"}})]})})}function re(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const r=Math.floor(s/60),i=s%60;if(r<60)return`${r}分${i>0?`${i}秒`:""}`;const c=Math.floor(r/60),l=r%60;return`${c}时${l>0?`${l}分`:""}`}function Ce(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function ie(s){return s==="active"?e.jsxs(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:26:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/helpers.tsx:27:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:34:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:40:5",variant:"outline",cla Line truncated
`).filter(N=>N.trim()),o=[];for(const N of h)try{const w=JSON.parse(N);Array.isArray(w)&&w.length>=3&&o.push({time:w[0],eventType:w[1],data:w[2]})}catch{}if(o.length===0){t.write(A),g(100),u(!1);return}u(!1);const j=o[o.length-1].time;let D=0,M=0;const S=()=>{if(v||D>=o.length){g(100);return}const N=o[D],w=(N.time-M)*1e3;M=N.time,D++;const R=Math.min(w,2e3);p.current=setTimeout(()=>{v||(t.write(N.data),g(Math.round(N.time/j*100)),S())},R)};S()}).catch(b=>{v||(console.error("[Replay] Load failed:",b),a("Failed to load recording data"),u(!1))}),()=>{v=!0,p.current&&clearTimeout(p.current);try{t.dispose()}catch{}l.current=null}},[s,i]),e.jsx(U,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/ReplayDialog.tsx:154:7",showOverlay:!1,className:"bg-slate-900 border-slate-800 p-0 gap-0",style:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(X,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",x>0&&x<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[x,"%"]})]}),e.jsx(G,{"code-path":"src/components/system/ReplayDialog.tsx:162:11",className:"text-slate-500 sr-only",children:"Replay recorded terminal output"})]}),e.jsxs("div",{"code-path":"src/components/system/ReplayDialog.tsx:164:9",className:"relative bg-[#0a0e14]",style:{height:"460px"},children:[f&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:166:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx(Y,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),y&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:171:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx("p",{"code-path":"src/components/system/ReplayDialog.tsx:172:15",className:"text-red-400 text-sm",children:y})}),x>0&&x<100&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:176:13",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-slate-800 z-10",children:e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:177:15",className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${x}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function Re(){const{data:s=[],isLoading:r,refetch:i}=ne({page:1,page_size:100,status:"closed"}),[c,l]=n.useState(""),[p,f]=n.useState(null),[u,y]=n.useState(!1),a=s.filter(t=>{const P=c.toLowerCase();return!P||(t.username||"").toLowerCase().includes(P)||(t.server_name||"").toLowerCase().includes(P)||(t.server_ip||"").toLowerCase().includes(P)}),x=t=>{f(t),y(!0)},g=async t=>{try{await L.download(t)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:57:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:58:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:59:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>l(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:67:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>i(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:72:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:78:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:79:11",className:"border-t border-slate-800",children:r?e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:81:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:82:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:85:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children: Line truncated
@@ -1 +1 @@
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{C as oe,a as ne,b as Fe,c as He,d as Je}from"./card-BVNSlZ0C.js";import{g as Ge,f as Ke,B as v,D as Te,a as je,b as Ve,c as Ne,d as ve,e as Ze,t as j}from"./index-EF2TDvxx.js";import{I as Se}from"./input--Xdj49es.js";import{L as ae}from"./label-DZckFZd3.js";import{B as Ce}from"./badge-BodqHT_V.js";import{S as ce,a as re,b as le,c as ie,d as q}from"./select-DbRZUnPK.js";import{T as qe}from"./textarea-JgdELMPr.js";import{k as _}from"./index-CYw3SC6I.js";import{h as Ee,ad as es,a4 as ss,D as ts,N as os,B as ns,i as pe,G as as,d as _e,L as $e,R as cs,P as rs,ai as Me,$ as ls,n as is,S as ds,T as ps}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const de={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},ms=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function M(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(as,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(pe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(ns,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(os,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(ts,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(ss,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(es,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function us(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(p,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let p=f.filter(g=>g.name===c);p.length===0&&(p=f.filter(g=>g.namespace===o.namespace)),p.length===0&&(p=[f[0]]),p.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),H=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:H[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,image:o.image}})}),f.length>0&&T.length>0&&f.forEach(o=>{const i=`service-${o.id}`;let c=[];try{const p=typeof o.selector=="string"?JSON.parse(o.selector||"{}"):o.selector||{},g=Object.entries(p);g.length>0&&(c=T.filter(P=>{let W={};try{W=typeof P.labels=="string"?JSON.parse(P.labels||"{}"):P.labels||{}}catch{}return g.every(([se,G])=>W[se]===G)}))}catch{}c.length===0&&(c=T.filter(p=>p.name===o.nameLine truncated
import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{C as oe,a as ne,b as Fe,c as He,d as Je}from"./card-B-RtdR4H.js";import{g as Ge,f as Ke,B as v,D as Te,a as je,b as Ve,c as Ne,d as ve,e as Ze,t as j}from"./index-LZWfu62c.js";import{I as Se}from"./input-BdDauX3U.js";import{L as ae}from"./label-u-lNUbKh.js";import{B as Ce}from"./badge-B0F5ZNtn.js";import{S as ce,a as re,b as le,c as ie,d as q}from"./select-4xU_9B3_.js";import{T as qe}from"./textarea-BdtIagjy.js";import{k as _}from"./index-Z0O8nAcG.js";import{h as Ee,ad as es,a4 as ss,D as ts,N as os,B as ns,i as pe,G as as,d as _e,L as $e,R as cs,P as rs,ai as Me,$ as ls,n as is,S as ds,T as ps}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const de={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},ms=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function M(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(as,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(pe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(ns,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(os,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(ts,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(ss,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(es,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function us(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(p,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let p=f.filter(g=>g.name===c);p.length===0&&(p=f.filter(g=>g.namespace===o.namespace)),p.length===0&&(p=[f[0]]),p.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),H=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:H[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,image:o.image}})}),f.length>0&&T.length>0&&f.forEach(o=>{const i=`service-${o.id}`;let c=[];try{const p=typeof o.selector=="string"?JSON.parse(o.selector||"{}"):o.selector||{},g=Object.entries(p);g.length>0&&(c=T.filter(P=>{let W={};try{W=typeof P.labels=="string"?JSON.parse(P.labels||"{}"):P.labels||{}}catch{}return g.every(([se,G])=>W[se]===G)}))}catch{}c.length===0&&(c=T.filter(p=>p.name===o.nameLine truncated
@@ -1 +1 @@
import{r,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{t as y,B as w,D as z,a as Q,b as H,c as J,d as G,p as S,q as le}from"./index-EF2TDvxx.js";import{I as he}from"./input--Xdj49es.js";import{B as j}from"./badge-BodqHT_V.js";import{C as M,a as N,b,c as C}from"./card-BVNSlZ0C.js";import{S as ge}from"./stat-strip-TlkYcldq.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-DbRZUnPK.js";import{T as ue,a as Te,b as F,c as O}from"./tabs-dobHN7aQ.js";import{L as s}from"./label-DZckFZd3.js";import{t as k}from"./trace-L8uY5gM3.js";import{S as je,R as Me,x as Ne,u as fe,aa as ve,J as ye,b as we,a as Se,y as be,Q as Ce,f as De,ab as Ie,ac as Le,ad as Re,a4 as Fe,h as Oe,ae as ke}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const Ke=()=>{const[B,K]=r.useState([]),[p,U]=r.useState([]),[X,E]=r.useState(!1),[f,Z]=r.useState(""),[l,W]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,$]=r.useState(!1),[se,A]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{E(!0);try{const a=await k.getTraces({timeRange:g,service:l,status:h});K(a.data||[])}catch{y.error("获取链路数据失败")}finally{E(!1)}},ne=async()=>{try{const a=await k.getServices(g);U(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await k.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Se,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},de=a=>{switch(a){case"client":return e.jsx(ke,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},ie=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=B.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&i&&c}),pe=Array.from(new Set(B.map(a=>a.serviceName))),xe=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else i.push(u)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,u]=r.useState(!0),x=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),A(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Ce,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(De,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:230:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:232:11",className:"flex items-center gap-2 flex-1 min-w-0",children:[de(a.kind),e.jsx("span",{"code-path":"src/components/monitoLine truncated
import{r,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{t as y,B as w,D as z,a as Q,b as H,c as J,d as G,p as S,q as le}from"./index-LZWfu62c.js";import{I as he}from"./input-BdDauX3U.js";import{B as j}from"./badge-B0F5ZNtn.js";import{C as M,a as N,b,c as C}from"./card-B-RtdR4H.js";import{S as ge}from"./stat-strip-BPzU38xY.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-4xU_9B3_.js";import{T as ue,a as Te,b as F,c as O}from"./tabs-kmtfM2I-.js";import{L as s}from"./label-u-lNUbKh.js";import{t as k}from"./trace-L8uY5gM3.js";import{S as je,R as Me,x as Ne,u as fe,aa as ve,J as ye,b as we,a as Se,y as be,Q as Ce,f as De,ab as Ie,ac as Le,ad as Re,a4 as Fe,h as Oe,ae as ke}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const Ke=()=>{const[B,K]=r.useState([]),[p,U]=r.useState([]),[X,E]=r.useState(!1),[f,Z]=r.useState(""),[l,W]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,$]=r.useState(!1),[se,A]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{E(!0);try{const a=await k.getTraces({timeRange:g,service:l,status:h});K(a.data||[])}catch{y.error("获取链路数据失败")}finally{E(!1)}},ne=async()=>{try{const a=await k.getServices(g);U(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await k.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Se,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},de=a=>{switch(a){case"client":return e.jsx(ke,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},ie=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=B.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&i&&c}),pe=Array.from(new Set(B.map(a=>a.serviceName))),xe=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else i.push(u)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,u]=r.useState(!0),x=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),A(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Ce,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(De,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:230:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:232:11",className:"flex items-center gap-2 flex-1 min-w-0",children:[de(a.kind),e.jsx("span",{"code-path":"src/components/monitoLine truncated
@@ -1 +1 @@
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as R,B as t,D as F,a as O,b as T,c as A,t as a}from"./index-EF2TDvxx.js";import{I as u}from"./input--Xdj49es.js";import{B as I}from"./badge-BodqHT_V.js";import{L as y}from"./label-DZckFZd3.js";import{d as n}from"./config-DLOuMLhF.js";import{R as $,P as H,L as K,V as w,j as V,d as X,T as _,a3 as q,a9 as J}from"./vendor-icons-Aso0-eeY.js";function oe(){const g=R(),[G,C]=o.useState([]),[k,j]=o.useState(!0),[S,D]=o.useState({}),[E,p]=o.useState(!1),[l,M]=o.useState(null),[i,m]=o.useState(""),[x,h]=o.useState(""),[U,v]=o.useState(!1),[f,N]=o.useState({}),c=async()=>{j(!0);try{const s=await n.getGroups();C(s?.list||[])}catch{a.error("加载失败")}finally{j(!1)}};o.useEffect(()=>{c()},[]);const z=async()=>{if(!i.trim()){a.error("请输入组名");return}v(!0);try{l?await n.updateGroup(l,{name:i,description:x}):await n.createGroup({name:i,description:x}),a.success(l?"已更新":"已创建"),p(!1),c()}catch{a.error("操作失败")}finally{v(!1)}},L=async s=>{if(await g({title:"删除用户组",description:`确定删除「${s.name}」?所有成员和流水线授权将同时移除。`,variant:"destructive"}))try{await n.deleteGroup(s.id),a.success("已删除"),c()}catch{a.error("删除失败")}},b=async s=>{const r=(f[s]||"").trim();if(!r){a.error("输入用户名");return}try{await n.addGroupMember(s,{username:r}),a.success("已添加"),c(),N(d=>({...d,[s]:""}))}catch{a.error("添加失败")}},B=async(s,r,d)=>{if(await g({title:"移除成员",description:`确定从组中移除「${d}」?`}))try{await n.removeGroupMember(s,r),a.success("已移除"),c()}catch{a.error("移除失败")}},P=s=>D(r=>({...r,[s]:!r[s]}));return e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:83:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/UserGroupsManager.tsx:84:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"用户组管理"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"创建用户组,将组授权给流水线,组内成员自动获得流水线权限"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:87:9",className:"flex items-center gap-2",children:[e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:11",variant:"outline",size:"sm",onClick:c,children:[e.jsx($,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:68",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:89:11",size:"sm",onClick:()=>{M(null),m(""),h(""),p(!0)},children:[e.jsx(H,{"code-path":"src/components/deploy/UserGroupsManager.tsx:90:13",className:"w-4 h-4 mr-1"}),"新建用户组"]})]})]}),k?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:9",className:"flex justify-center py-12",children:e.jsx(K,{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:52",className:"w-6 h-6 animate-spin text-[var(--dg-text-secondary)]"})}):G.length===0?e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:98:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:99:11",className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:100:11",children:"暂无用户组,点击「新建用户组」创建"})]}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:103:9",className:"space-y-3",children:G.map(s=>e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:105:13",className:"border border-[var(--dg-border)] rounded-lg bg-[var(--dg-bg-secondary)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:106:15",className:"flex items-center justify-between p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:107:17",className:"flex items-center gap-3",style:{cursor:"pointer"},onClick:()=>P(s.id),children:[e.jsx(V,{"code-path":"src/components/deploy/UserGroupsManager.tsx:108:19",className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:109:19",children:[e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:110:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:111:21",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.description||"暂无描述"," · ",(s.members||[]).length," 位成员"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:114Line truncated
import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as R,B as t,D as F,a as O,b as T,c as A,t as a}from"./index-LZWfu62c.js";import{I as u}from"./input-BdDauX3U.js";import{B as I}from"./badge-B0F5ZNtn.js";import{L as y}from"./label-u-lNUbKh.js";import{d as n}from"./config-DAXaHuse.js";import{R as $,P as H,L as K,V as w,j as V,d as X,T as _,a3 as q,a9 as J}from"./vendor-icons-Aso0-eeY.js";function oe(){const g=R(),[G,C]=o.useState([]),[k,j]=o.useState(!0),[S,D]=o.useState({}),[E,p]=o.useState(!1),[l,M]=o.useState(null),[i,m]=o.useState(""),[x,h]=o.useState(""),[U,v]=o.useState(!1),[f,N]=o.useState({}),c=async()=>{j(!0);try{const s=await n.getGroups();C(s?.list||[])}catch{a.error("加载失败")}finally{j(!1)}};o.useEffect(()=>{c()},[]);const z=async()=>{if(!i.trim()){a.error("请输入组名");return}v(!0);try{l?await n.updateGroup(l,{name:i,description:x}):await n.createGroup({name:i,description:x}),a.success(l?"已更新":"已创建"),p(!1),c()}catch{a.error("操作失败")}finally{v(!1)}},L=async s=>{if(await g({title:"删除用户组",description:`确定删除「${s.name}」?所有成员和流水线授权将同时移除。`,variant:"destructive"}))try{await n.deleteGroup(s.id),a.success("已删除"),c()}catch{a.error("删除失败")}},b=async s=>{const r=(f[s]||"").trim();if(!r){a.error("输入用户名");return}try{await n.addGroupMember(s,{username:r}),a.success("已添加"),c(),N(d=>({...d,[s]:""}))}catch{a.error("添加失败")}},B=async(s,r,d)=>{if(await g({title:"移除成员",description:`确定从组中移除「${d}」?`}))try{await n.removeGroupMember(s,r),a.success("已移除"),c()}catch{a.error("移除失败")}},P=s=>D(r=>({...r,[s]:!r[s]}));return e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:83:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/UserGroupsManager.tsx:84:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"用户组管理"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"创建用户组,将组授权给流水线,组内成员自动获得流水线权限"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:87:9",className:"flex items-center gap-2",children:[e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:11",variant:"outline",size:"sm",onClick:c,children:[e.jsx($,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:68",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:89:11",size:"sm",onClick:()=>{M(null),m(""),h(""),p(!0)},children:[e.jsx(H,{"code-path":"src/components/deploy/UserGroupsManager.tsx:90:13",className:"w-4 h-4 mr-1"}),"新建用户组"]})]})]}),k?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:9",className:"flex justify-center py-12",children:e.jsx(K,{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:52",className:"w-6 h-6 animate-spin text-[var(--dg-text-secondary)]"})}):G.length===0?e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:98:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:99:11",className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:100:11",children:"暂无用户组,点击「新建用户组」创建"})]}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:103:9",className:"space-y-3",children:G.map(s=>e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:105:13",className:"border border-[var(--dg-border)] rounded-lg bg-[var(--dg-bg-secondary)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:106:15",className:"flex items-center justify-between p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:107:17",className:"flex items-center gap-3",style:{cursor:"pointer"},onClick:()=>P(s.id),children:[e.jsx(V,{"code-path":"src/components/deploy/UserGroupsManager.tsx:108:19",className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:109:19",children:[e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:110:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:111:21",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.description||"暂无描述"," · ",(s.members||[]).length," 位成员"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:114Line truncated
@@ -1 +1 @@
import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as V,a as W,b as y,c as S}from"./card-BVNSlZ0C.js";import{g as Te,i as Re,k as Le,f as $e,B as m}from"./index-EF2TDvxx.js";import{B as j}from"./badge-BodqHT_V.js";import{T as re,a as ce,b as C,c as h,d as le,e as i}from"./table-CUnn2-lp.js";import{k as U}from"./index-CYw3SC6I.js";import{u as Ae}from"./use-toast-CkA38LVP.js";import{Y as de,S as w,f as ie,s as q,P as Me,a as Be}from"./PodFileBrowser-BPio7wxi.js";import{m as ze,B as xe,n as Oe,o as Fe,p as _e,q as De,D as He,k as he,A as Ye,r as Ee,H as qe,s as Ie,P as Je}from"./vendor-icons-Aso0-eeY.js";import"./select-DbRZUnPK.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";function c({label:t,value:x,sub:P,color:u}){return e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:29:5",className:"bg-slate-900 border-slate-800",children:e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:30:7",className:"p-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:31:9",className:"text-xs text-slate-500",children:t}),e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:32:9",className:"text-base font-bold mt-0.5",style:{color:u||"#e2e8f0"},children:x}),P&&e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:33:17",className:"text-[10px] text-slate-600 mt-0.5",children:P})]})})}function pe({labels:t}){const x=Object.entries(t||{});return x.length===0?e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:42:36",className:"text-xs text-slate-600",children:"无"}):e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:44:5",className:"flex flex-wrap gap-1.5",children:x.map(([P,u])=>e.jsxs(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:46:9",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px] font-mono",children:[P,"=",u]},P))})}function cs(){const t=Te(),x=Re(),P=Le(),{toast:u}=Ae(),ke=$e(),n=t.clusterCode||"",r=t.namespace||"",l=t.name||"",p=P.pathname.includes("/DaemonSet/")?"DaemonSet":"StatefulSet",T=t.mode==="yaml"?"yaml":"view",[N,ue]=d.useState(null),[R,be]=d.useState([]),[ge,I]=d.useState(!0),[we,L]=d.useState(!1),[v,F]=d.useState(1),[$,A]=d.useState(!1),[_,J]=d.useState(null),[D,K]=d.useState(null),[je,G]=d.useState(!1),M=d.useCallback(async()=>{I(!0);try{const[s,o]=await Promise.all([U.getResourceYaml(n,r,p.toLowerCase()+"s",l).catch(()=>""),U.getPods(n).catch(()=>[])]);let f=null;if(s&&typeof s=="string")try{f=JSON.parse(s)}catch{f={_raw:s}}else s&&typeof s=="object"&&(f=s);ue(f);const E=(Array.isArray(o)?o:o?.list||o?.data||[]).filter(O=>{const Ue=O.name||O.metadata?.name||"",ne=O.namespace||O.namespace_name||"";return Ue.startsWith(l)&&(!ne||ne===r)});be(E)}catch(s){console.error("load error",s)}finally{I(!1)}},[n,r,l,p]);d.useEffect(()=>{M()},[M]);const Q=s=>{s!==T&&x(`/kubernetes/${n}/namespace/${r}/workload/${s}/${p}/${l}`,{replace:!0})},Pe=async()=>{if(await ke({title:"滚动重启",description:`确认重启 ${p} ${l}?将触发滚动重启。`,confirmText:"重启"})){A(!0);try{p==="StatefulSet"?await U.restartStatefulSet(n,r,l):await U.restartDaemonSet(n,r,l),u({title:"重启指令已下发",description:`${p} 滚动重启已触发`}),setTimeout(M,1e3)}catch(o){u({title:"重启失败",description:o?.message||String(o),variant:"destructive"})}finally{A(!1)}}},Ve=async()=>{A(!0);try{await U.scaleStatefulSet(n,r,l,v),u({title:"扩缩容成功",description:`StatefulSet 副本数已更新为 ${v}`}),L(!1),setTimeout(M,1e3)}catch(s){u({title:"扩缩容失败",description:s?.message||String(s),variant:"destructive"})}finally{A(!1)}},k=N?.spec||{},b=N?.status||{},X=k?.template?.spec?.containers||[],Z=k?.template?.spec?.initContainers||[],B=k.replicas??1,ee=b.readyReplicas??0,We=b.currentReplicas??0,Ne=b.updatedReplicas??0,H=b.desiredNumberScheduled??0,fe=b.currentNumberScheduled??0,se=b.numberReady??0,ve=b.numberAvailable??0,ye=b.updatedNumberScheduled??0,g=p==="StatefulSet",z=g?ee===B&&B>0:se===H&&H>0,a=k.updateStrategy||{},Y=a.type||"RollingUpdate",te=k.volumeClaimTemplates||[],Se=k.selector?.matchLabels||{},Ce=N?.metadata?.labels||{},ae=N?.metadata?.annotations||{};return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:190:5",className:"p-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:192:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:193:9",className:"flex items-center gap-3",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:194:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-200",onClick:()=>x(-1),children:e.jsx(ze,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:195:13",className:"h-4 w-4"})}),e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:19Line truncated
import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as V,a as W,b as y,c as S}from"./card-B-RtdR4H.js";import{g as Te,i as Re,k as Le,f as $e,B as m}from"./index-LZWfu62c.js";import{B as j}from"./badge-B0F5ZNtn.js";import{T as re,a as ce,b as C,c as h,d as le,e as i}from"./table-BPFYQwjr.js";import{k as U}from"./index-Z0O8nAcG.js";import{u as Ae}from"./use-toast-CkA38LVP.js";import{Y as de,S as w,f as ie,s as q,P as Me,a as Be}from"./PodFileBrowser-Bs6KRfHw.js";import{m as ze,B as xe,n as Oe,o as Fe,p as _e,q as De,D as He,k as he,A as Ye,r as Ee,H as qe,s as Ie,P as Je}from"./vendor-icons-Aso0-eeY.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";function c({label:t,value:x,sub:P,color:u}){return e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:29:5",className:"bg-slate-900 border-slate-800",children:e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:30:7",className:"p-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:31:9",className:"text-xs text-slate-500",children:t}),e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:32:9",className:"text-base font-bold mt-0.5",style:{color:u||"#e2e8f0"},children:x}),P&&e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:33:17",className:"text-[10px] text-slate-600 mt-0.5",children:P})]})})}function pe({labels:t}){const x=Object.entries(t||{});return x.length===0?e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:42:36",className:"text-xs text-slate-600",children:"无"}):e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:44:5",className:"flex flex-wrap gap-1.5",children:x.map(([P,u])=>e.jsxs(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:46:9",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px] font-mono",children:[P,"=",u]},P))})}function cs(){const t=Te(),x=Re(),P=Le(),{toast:u}=Ae(),ke=$e(),n=t.clusterCode||"",r=t.namespace||"",l=t.name||"",p=P.pathname.includes("/DaemonSet/")?"DaemonSet":"StatefulSet",T=t.mode==="yaml"?"yaml":"view",[N,ue]=d.useState(null),[R,be]=d.useState([]),[ge,I]=d.useState(!0),[we,L]=d.useState(!1),[v,F]=d.useState(1),[$,A]=d.useState(!1),[_,J]=d.useState(null),[D,K]=d.useState(null),[je,G]=d.useState(!1),M=d.useCallback(async()=>{I(!0);try{const[s,o]=await Promise.all([U.getResourceYaml(n,r,p.toLowerCase()+"s",l).catch(()=>""),U.getPods(n).catch(()=>[])]);let f=null;if(s&&typeof s=="string")try{f=JSON.parse(s)}catch{f={_raw:s}}else s&&typeof s=="object"&&(f=s);ue(f);const E=(Array.isArray(o)?o:o?.list||o?.data||[]).filter(O=>{const Ue=O.name||O.metadata?.name||"",ne=O.namespace||O.namespace_name||"";return Ue.startsWith(l)&&(!ne||ne===r)});be(E)}catch(s){console.error("load error",s)}finally{I(!1)}},[n,r,l,p]);d.useEffect(()=>{M()},[M]);const Q=s=>{s!==T&&x(`/kubernetes/${n}/namespace/${r}/workload/${s}/${p}/${l}`,{replace:!0})},Pe=async()=>{if(await ke({title:"滚动重启",description:`确认重启 ${p} ${l}?将触发滚动重启。`,confirmText:"重启"})){A(!0);try{p==="StatefulSet"?await U.restartStatefulSet(n,r,l):await U.restartDaemonSet(n,r,l),u({title:"重启指令已下发",description:`${p} 滚动重启已触发`}),setTimeout(M,1e3)}catch(o){u({title:"重启失败",description:o?.message||String(o),variant:"destructive"})}finally{A(!1)}}},Ve=async()=>{A(!0);try{await U.scaleStatefulSet(n,r,l,v),u({title:"扩缩容成功",description:`StatefulSet 副本数已更新为 ${v}`}),L(!1),setTimeout(M,1e3)}catch(s){u({title:"扩缩容失败",description:s?.message||String(s),variant:"destructive"})}finally{A(!1)}},k=N?.spec||{},b=N?.status||{},X=k?.template?.spec?.containers||[],Z=k?.template?.spec?.initContainers||[],B=k.replicas??1,ee=b.readyReplicas??0,We=b.currentReplicas??0,Ne=b.updatedReplicas??0,H=b.desiredNumberScheduled??0,fe=b.currentNumberScheduled??0,se=b.numberReady??0,ve=b.numberAvailable??0,ye=b.updatedNumberScheduled??0,g=p==="StatefulSet",z=g?ee===B&&B>0:se===H&&H>0,a=k.updateStrategy||{},Y=a.type||"RollingUpdate",te=k.volumeClaimTemplates||[],Se=k.selector?.matchLabels||{},Ce=N?.metadata?.labels||{},ae=N?.metadata?.annotations||{};return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:190:5",className:"p-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:192:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:193:9",className:"flex items-center gap-3",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:194:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-200",onClick:()=>x(-1),children:e.jsx(ze,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:195:13",className:"h-4 w-4"})}),e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:19Line truncated
@@ -1 +1 @@
import{h as c}from"./index-EF2TDvxx.js";const o={getAccounts:async()=>c.get("/cloud-accounts"),createAccount:async n=>c.post("/cloud-accounts",n),updateAccount:async(n,t)=>c.put(`/cloud-accounts/${n}`,t),deleteAccount:async n=>c.delete(`/cloud-accounts/${n}`),syncRegions:async n=>c.post(`/cloud-accounts/${n}/sync-regions`),getAccountRegions:async n=>c.get(`/cloud-accounts/${n}/regions`),discoverInstances:async(n,t)=>c.post(`/cloud-accounts/${n}/discover-instances`,{regions:t}),importInstances:async(n,t,s)=>c.post(`/cloud-accounts/${n}/import-instances`,{instances:t,...s}),getDomains:async n=>c.get("/domains",n),createDomain:async n=>c.post("/domains",n),updateDomain:async(n,t)=>c.put(`/domains/${n}`,t),deleteDomain:async n=>c.delete(`/domains/${n}`)};export{o as c};
import{h as c}from"./index-LZWfu62c.js";const o={getAccounts:async()=>c.get("/cloud-accounts"),createAccount:async n=>c.post("/cloud-accounts",n),updateAccount:async(n,t)=>c.put(`/cloud-accounts/${n}`,t),deleteAccount:async n=>c.delete(`/cloud-accounts/${n}`),syncRegions:async n=>c.post(`/cloud-accounts/${n}/sync-regions`),getAccountRegions:async n=>c.get(`/cloud-accounts/${n}/regions`),discoverInstances:async(n,t)=>c.post(`/cloud-accounts/${n}/discover-instances`,{regions:t}),importInstances:async(n,t,s)=>c.post(`/cloud-accounts/${n}/import-instances`,{instances:t,...s}),getDomains:async n=>c.get("/domains",n),createDomain:async n=>c.post("/domains",n),updateDomain:async(n,t)=>c.put(`/domains/${n}`,t),deleteDomain:async n=>c.delete(`/domains/${n}`)};export{o as c};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const g={getLatest:()=>t.get("/agent/latest"),getHistory:(e,a=1)=>t.get(`/agent/history/${e}?hours=${a}`),createTask:e=>t.post("/agent/tasks",e),listTasks:e=>t.get("/agent/tasks",e),execCommand:e=>t.post("/agent/exec",e),getAggregate:e=>t.get("/agent/aggregate",e),aggregate:e=>t.post("/agent/aggregate",e),listRules:()=>t.get("/agent/rules"),createRule:e=>t.post("/agent/rules",e),updateRule:(e,a)=>t.put(`/agent/rules/${e}`,a),deleteRule:e=>t.delete(`/agent/rules/${e}`),quickSetup:e=>t.post("/agent/rules/quick-setup",{type:e||"ecs"}),uninstallAgent:e=>t.post("/agent/uninstall",e),batchUninstall:e=>t.post("/agent/batch-uninstall",{server_ids:e}),batchUpgrade:e=>t.post("/agent/batch-upgrade",{server_ids:e}),listAlerts:e=>t.get("/agent/alerts",e),resolveAlert:e=>t.post(`/agent/alerts/${e}/resolve`),getHealthProbes:e=>t.get("/agent/health-probes",e),createHealthProbe:e=>t.post("/agent/health-probes",e),updateHealthProbe:(e,a)=>t.put(`/agent/health-probes/${e}`,a),deleteHealthProbe:e=>t.delete(`/agent/health-probes/${e}`),getPortPolicy:e=>t.get(`/agent/port-policies/${e}`),savePortPolicy:(e,a)=>t.put(`/agent/port-policies/${e}`,a)};export{g as a};
import{h as t}from"./index-LZWfu62c.js";const g={getLatest:()=>t.get("/agent/latest"),getHistory:(e,a=1)=>t.get(`/agent/history/${e}?hours=${a}`),createTask:e=>t.post("/agent/tasks",e),listTasks:e=>t.get("/agent/tasks",e),execCommand:e=>t.post("/agent/exec",e),getAggregate:e=>t.get("/agent/aggregate",e),aggregate:e=>t.post("/agent/aggregate",e),listRules:()=>t.get("/agent/rules"),createRule:e=>t.post("/agent/rules",e),updateRule:(e,a)=>t.put(`/agent/rules/${e}`,a),deleteRule:e=>t.delete(`/agent/rules/${e}`),quickSetup:e=>t.post("/agent/rules/quick-setup",{type:e||"ecs"}),uninstallAgent:e=>t.post("/agent/uninstall",e),batchUninstall:e=>t.post("/agent/batch-uninstall",{server_ids:e}),batchUpgrade:e=>t.post("/agent/batch-upgrade",{server_ids:e}),listAlerts:e=>t.get("/agent/alerts",e),resolveAlert:e=>t.post(`/agent/alerts/${e}/resolve`),getHealthProbes:e=>t.get("/agent/health-probes",e),createHealthProbe:e=>t.post("/agent/health-probes",e),updateHealthProbe:(e,a)=>t.put(`/agent/health-probes/${e}`,a),deleteHealthProbe:e=>t.delete(`/agent/health-probes/${e}`),getPortPolicy:e=>t.get(`/agent/port-policies/${e}`),savePortPolicy:(e,a)=>t.put(`/agent/port-policies/${e}`,a)};export{g as a};
@@ -1,4 +1,4 @@
import{h as o,o as h}from"./index-EF2TDvxx.js";const C={getConfig:()=>o.get("/aiops/llm-config"),saveConfig:e=>o.put("/aiops/llm-config",e),testConnection:()=>o.post("/aiops/llm-config/test"),chat:(e,s)=>o.post("/aiops/chat",{messages:e,session_id:s||""}),chatStream:async(e,s,d,g)=>{const c=h.getState().token,n=await fetch("/api/v1/aiops/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify({messages:e,session_id:g||""}),signal:d});if(n.status===401)throw h.getState().logout(),window.location.href="/login",new Error("登录已过期,请重新登录");if(!n.body)throw new Error("流式响应不可用");const m=n.body.getReader(),u=new TextDecoder("utf-8");let r="",f="";for(;;){const{done:w,value:y}=await m.read();if(w)break;r+=u.decode(y,{stream:!0});const p=r.split(`
import{h as o,o as h}from"./index-LZWfu62c.js";const C={getConfig:()=>o.get("/aiops/llm-config"),saveConfig:e=>o.put("/aiops/llm-config",e),testConnection:()=>o.post("/aiops/llm-config/test"),chat:(e,s)=>o.post("/aiops/chat",{messages:e,session_id:s||""}),chatStream:async(e,s,d,g)=>{const c=h.getState().token,n=await fetch("/api/v1/aiops/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify({messages:e,session_id:g||""}),signal:d});if(n.status===401)throw h.getState().logout(),window.location.href="/login",new Error("登录已过期,请重新登录");if(!n.body)throw new Error("流式响应不可用");const m=n.body.getReader(),u=new TextDecoder("utf-8");let r="",f="";for(;;){const{done:w,value:y}=await m.read();if(w)break;r+=u.decode(y,{stream:!0});const p=r.split(`
`);r=p.pop()??"";for(const S of p){const b=S.split(`
`);let a="message",l=[];for(const t of b)t.startsWith("event:")?a=t.slice(6).trim():t.startsWith("data:")&&l.push(t.slice(5).trim());const i=l.join("");if(i){if(a==="error")try{const t=JSON.parse(i);throw new Error(t.message||"LLM 流式响应错误")}catch(t){throw t instanceof Error&&t.message?t:new Error("LLM 流式响应错误")}if(a!=="done")try{const t=JSON.parse(i);typeof t.content=="string"&&(f+=t.content,s(t.content))}catch{}}}}return f},getHistory:e=>{const s=e?`?session_id=${encodeURIComponent(e)}`:"";return o.get(`/aiops/chat-history${s}`)},clearHistory:()=>o.delete("/aiops/chat-history")};export{C as a};
@@ -1 +1 @@
import{h as e}from"./index-EF2TDvxx.js";const a={getAlerts:async t=>e.get("/alerts",t),getRules:async()=>e.get("/alerts/rules"),createRule:async t=>e.post("/alerts/rules",t),updateRule:async(t,r)=>e.put(`/alerts/rules/${t}`,r),deleteRule:async t=>e.delete(`/alerts/rules/${t}`),batchDeleteRules:async t=>e.delete("/alerts/rules/batch-delete",{ids:t}),toggleRule:async t=>e.post(`/alerts/rules/${t}/toggle`),acknowledge:async t=>e.post(`/alerts/${t}/ack`),getNotifyChannels:async()=>e.get("/alerts/notify-channels"),createNotifyChannel:async t=>e.post("/alerts/notify-channels",t),updateNotifyChannel:async(t,r)=>e.put(`/alerts/notify-channels/${t}`,r),deleteNotifyChannel:async t=>e.delete(`/alerts/notify-channels/${t}`),testNotifyChannel:async t=>e.post(`/alerts/notify-channels/${t}/test`),getContacts:async()=>e.get("/alerts/contacts"),createContact:async t=>e.post("/alerts/contacts",t),updateContact:async(t,r)=>e.put(`/alerts/contacts/${t}`,r),deleteContact:async t=>e.delete(`/alerts/contacts/${t}`),getContactGroups:async()=>e.get("/alerts/contact-groups"),createContactGroup:async t=>e.post("/alerts/contact-groups",t),updateContactGroup:async(t,r)=>e.put(`/alerts/contact-groups/${t}`,r),deleteContactGroup:async t=>e.delete(`/alerts/contact-groups/${t}`)};export{a};
import{h as e}from"./index-LZWfu62c.js";const a={getAlerts:async t=>e.get("/alerts",t),getRules:async()=>e.get("/alerts/rules"),createRule:async t=>e.post("/alerts/rules",t),updateRule:async(t,r)=>e.put(`/alerts/rules/${t}`,r),deleteRule:async t=>e.delete(`/alerts/rules/${t}`),batchDeleteRules:async t=>e.delete("/alerts/rules/batch-delete",{ids:t}),toggleRule:async t=>e.post(`/alerts/rules/${t}/toggle`),acknowledge:async t=>e.post(`/alerts/${t}/ack`),getNotifyChannels:async()=>e.get("/alerts/notify-channels"),createNotifyChannel:async t=>e.post("/alerts/notify-channels",t),updateNotifyChannel:async(t,r)=>e.put(`/alerts/notify-channels/${t}`,r),deleteNotifyChannel:async t=>e.delete(`/alerts/notify-channels/${t}`),testNotifyChannel:async t=>e.post(`/alerts/notify-channels/${t}/test`),getContacts:async()=>e.get("/alerts/contacts"),createContact:async t=>e.post("/alerts/contacts",t),updateContact:async(t,r)=>e.put(`/alerts/contacts/${t}`,r),deleteContact:async t=>e.delete(`/alerts/contacts/${t}`),getContactGroups:async()=>e.get("/alerts/contact-groups"),createContactGroup:async t=>e.post("/alerts/contact-groups",t),updateContactGroup:async(t,r)=>e.put(`/alerts/contact-groups/${t}`,r),deleteContactGroup:async t=>e.delete(`/alerts/contact-groups/${t}`)};export{a};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const l={getAlerts:async e=>t.get("/alerts",e),getRules:async()=>t.get("/alerts/rules"),getChannels:async()=>t.get("/alerts/notify-channels"),acknowledge:async e=>t.post(`/alerts/${e}/ack`),resolve:async e=>t.post(`/alerts/${e}/ack`),getSilences:async e=>t.get("/alerts/silences",e),createSilence:async e=>t.post("/alerts/silences",e),updateSilence:async(e,s)=>t.put(`/alerts/silences/${e}`,s),deleteSilence:async e=>t.delete(`/alerts/silences/${e}`),toggleSilence:async e=>t.post(`/alerts/silences/${e}/toggle`),toggleRule:async e=>t.post(`/alerts/rules/${e}/toggle`),createRule:async e=>t.post("/alerts/rules",e),deleteRule:async e=>t.delete(`/alerts/rules/${e}`),quickSetup:async(e="ecs")=>t.post("/alerts/quick-setup",{type:e})};export{l as a};
import{h as t}from"./index-LZWfu62c.js";const l={getAlerts:async e=>t.get("/alerts",e),getRules:async()=>t.get("/alerts/rules"),getChannels:async()=>t.get("/alerts/notify-channels"),acknowledge:async e=>t.post(`/alerts/${e}/ack`),resolve:async e=>t.post(`/alerts/${e}/ack`),getSilences:async e=>t.get("/alerts/silences",e),createSilence:async e=>t.post("/alerts/silences",e),updateSilence:async(e,s)=>t.put(`/alerts/silences/${e}`,s),deleteSilence:async e=>t.delete(`/alerts/silences/${e}`),toggleSilence:async e=>t.post(`/alerts/silences/${e}/toggle`),toggleRule:async e=>t.post(`/alerts/rules/${e}/toggle`),createRule:async e=>t.post("/alerts/rules",e),deleteRule:async e=>t.delete(`/alerts/rules/${e}`),quickSetup:async(e="ecs")=>t.post("/alerts/quick-setup",{type:e})};export{l as a};
@@ -1 +1 @@
import{h as a}from"./index-EF2TDvxx.js";const t={list:async e=>a.get("/approval-workflows",e),get:async e=>a.get(`/approval-workflows/${e}`),create:async e=>a.post("/approval-workflows",e),update:async(e,s)=>a.put(`/approval-workflows/${e}`,s),delete:async e=>a.delete(`/approval-workflows/${e}`),setDefault:async e=>a.put(`/approval-workflows/${e}/default`),getSteps:async e=>a.get(`/approval-workflows/${e}/steps`)},o={getTemplates:async e=>a.get("/approvals/templates",e),getTemplate:async e=>a.get(`/approvals/templates/${e}`),createTemplate:async e=>a.post("/approvals/templates",e),updateTemplate:async(e,s)=>a.put(`/approvals/templates/${e}`,s),deleteTemplate:async e=>a.delete(`/approvals/templates/${e}`),getProcesses:async e=>a.get("/approvals/processes",e),createProcess:async e=>a.post("/approvals/processes",e),approveProcess:async(e,s)=>a.post(`/approvals/processes/${e}/approve`,{comment:s}),rejectProcess:async(e,s)=>a.post(`/approvals/processes/${e}/reject`,{comment:s})};export{t as a,o as b};
import{h as a}from"./index-LZWfu62c.js";const t={list:async e=>a.get("/approval-workflows",e),get:async e=>a.get(`/approval-workflows/${e}`),create:async e=>a.post("/approval-workflows",e),update:async(e,s)=>a.put(`/approval-workflows/${e}`,s),delete:async e=>a.delete(`/approval-workflows/${e}`),setDefault:async e=>a.put(`/approval-workflows/${e}/default`),getSteps:async e=>a.get(`/approval-workflows/${e}/steps`)},o={getTemplates:async e=>a.get("/approvals/templates",e),getTemplate:async e=>a.get(`/approvals/templates/${e}`),createTemplate:async e=>a.post("/approvals/templates",e),updateTemplate:async(e,s)=>a.put(`/approvals/templates/${e}`,s),deleteTemplate:async e=>a.delete(`/approvals/templates/${e}`),getProcesses:async e=>a.get("/approvals/processes",e),createProcess:async e=>a.post("/approvals/processes",e),approveProcess:async(e,s)=>a.post(`/approvals/processes/${e}/approve`,{comment:s}),rejectProcess:async(e,s)=>a.post(`/approvals/processes/${e}/reject`,{comment:s})};export{t as a,o as b};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const g={getLogs:async s=>t.get("/audit/logs",s),getLogDetail:async s=>t.get(`/audit/logs/${s}`),getModules:async()=>t.get("/audit/modules"),getActions:async()=>t.get("/audit/actions"),getStatistics:async()=>t.get("/audit/statistics"),exportLogs:async s=>{const e=new URLSearchParams;return e.set("format","csv"),s&&Object.entries(s).forEach(([o,a])=>{a!=null&&a!==""&&e.set(o,String(a))}),t.download(`/audit/logs/export?${e.toString()}`)},clearLogs:async()=>t.post("/audit/logs/clear")};export{g as a};
import{h as t}from"./index-LZWfu62c.js";const g={getLogs:async s=>t.get("/audit/logs",s),getLogDetail:async s=>t.get(`/audit/logs/${s}`),getModules:async()=>t.get("/audit/modules"),getActions:async()=>t.get("/audit/actions"),getStatistics:async()=>t.get("/audit/statistics"),exportLogs:async s=>{const e=new URLSearchParams;return e.set("format","csv"),s&&Object.entries(s).forEach(([o,a])=>{a!=null&&a!==""&&e.set(o,String(a))}),t.download(`/audit/logs/export?${e.toString()}`)},clearLogs:async()=>t.post("/audit/logs/clear")};export{g as a};
@@ -1 +1 @@
import{h as e}from"./index-EF2TDvxx.js";const c={getJobs:async t=>e.get("/cron-jobs",t),getJob:async t=>e.get(`/cron-jobs/${t}`),createJob:async t=>e.post("/cron-jobs",t),updateJob:async(t,r)=>e.put(`/cron-jobs/${t}`,r),deleteJob:async t=>e.delete(`/cron-jobs/${t}`),toggleJob:async t=>e.post(`/cron-jobs/${t}/toggle`),executeJob:async t=>e.post(`/cron-jobs/${t}/execute`),batchDelete:async t=>e.delete("/cron-jobs/batch-delete",{ids:t})},n={getScripts:async t=>e.get("/scripts",t),getScript:async t=>e.get(`/scripts/${t}`),createScript:async t=>e.post("/scripts",t),updateScript:async(t,r)=>e.put(`/scripts/${t}`,r),deleteScript:async t=>e.delete(`/scripts/${t}`),batchDelete:async t=>e.post("/scripts/batch-delete",{ids:t}),executeScript:async t=>e.post(`/scripts/${t}/execute`)},o={getExecutions:async t=>e.get("/task-executions",t)};export{c,n as s,o as t};
import{h as e}from"./index-LZWfu62c.js";const c={getJobs:async t=>e.get("/cron-jobs",t),getJob:async t=>e.get(`/cron-jobs/${t}`),createJob:async t=>e.post("/cron-jobs",t),updateJob:async(t,r)=>e.put(`/cron-jobs/${t}`,r),deleteJob:async t=>e.delete(`/cron-jobs/${t}`),toggleJob:async t=>e.post(`/cron-jobs/${t}/toggle`),executeJob:async t=>e.post(`/cron-jobs/${t}/execute`),batchDelete:async t=>e.delete("/cron-jobs/batch-delete",{ids:t})},n={getScripts:async t=>e.get("/scripts",t),getScript:async t=>e.get(`/scripts/${t}`),createScript:async t=>e.post("/scripts",t),updateScript:async(t,r)=>e.put(`/scripts/${t}`,r),deleteScript:async t=>e.delete(`/scripts/${t}`),batchDelete:async t=>e.post("/scripts/batch-delete",{ids:t}),executeScript:async t=>e.post(`/scripts/${t}/execute`)},o={getExecutions:async t=>e.get("/task-executions",t)};export{c,n as s,o as t};
@@ -1 +1 @@
import{j as n}from"./vendor-codemirror-C7mXSpXt.js";import{S as s,m as o,n as d}from"./index-EF2TDvxx.js";const c=d("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function g({className:e,variant:r,asChild:t=!1,...a}){const i=t?s:"span";return n.jsx(i,{"code-path":"src/components/ui/badge.tsx:38:5","data-slot":"badge",className:o(c({variant:r}),e),...a})}export{g as B};
import{j as n}from"./vendor-codemirror-C7mXSpXt.js";import{S as s,m as o,n as d}from"./index-LZWfu62c.js";const c=d("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function g({className:e,variant:r,asChild:t=!1,...a}){const i=t?s:"span";return n.jsx(i,{"code-path":"src/components/ui/badge.tsx:38:5","data-slot":"badge",className:o(c({variant:r}),e),...a})}export{g as B};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const s={getStats:async()=>t.get("/cloud-billings/stats"),list:async e=>t.get("/cloud-billings",e),create:async e=>t.post("/cloud-billings",e),batchCreate:async e=>t.post("/cloud-billings/batch",{records:e}),remove:async e=>t.delete(`/cloud-billings/${e}`),getProviders:async()=>t.get("/cloud-billings/providers"),listAlertRules:async()=>t.get("/billing-alerts"),createAlertRule:async e=>t.post("/billing-alerts",e),updateAlertRule:async(e,l)=>t.put(`/billing-alerts/${e}`,l),deleteAlertRule:async e=>t.delete(`/billing-alerts/${e}`),toggleAlertRule:async e=>t.post(`/billing-alerts/${e}/toggle`)};export{s as b};
import{h as t}from"./index-LZWfu62c.js";const s={getStats:async()=>t.get("/cloud-billings/stats"),list:async e=>t.get("/cloud-billings",e),create:async e=>t.post("/cloud-billings",e),batchCreate:async e=>t.post("/cloud-billings/batch",{records:e}),remove:async e=>t.delete(`/cloud-billings/${e}`),getProviders:async()=>t.get("/cloud-billings/providers"),listAlertRules:async()=>t.get("/billing-alerts"),createAlertRule:async e=>t.post("/billing-alerts",e),updateAlertRule:async(e,l)=>t.put(`/billing-alerts/${e}`,l),deleteAlertRule:async e=>t.delete(`/billing-alerts/${e}`),toggleAlertRule:async e=>t.post(`/billing-alerts/${e}/toggle`)};export{s as b};
@@ -1 +1 @@
import{j as r}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-EF2TDvxx.js";function e({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:7:5","data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function c({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:20:5","data-slot":"card-header",className:o("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function n({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:33:5","data-slot":"card-title",className:o("leading-none font-semibold",a),...t})}function i({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:43:5","data-slot":"card-description",className:o("text-muted-foreground text-sm",a),...t})}function u({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:66:5","data-slot":"card-content",className:o("px-6",a),...t})}export{e as C,u as a,c as b,n as c,i as d};
import{j as r}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-LZWfu62c.js";function e({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:7:5","data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function c({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:20:5","data-slot":"card-header",className:o("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function n({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:33:5","data-slot":"card-title",className:o("leading-none font-semibold",a),...t})}function i({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:43:5","data-slot":"card-description",className:o("text-muted-foreground text-sm",a),...t})}function u({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:66:5","data-slot":"card-content",className:o("px-6",a),...t})}export{e as C,u as a,c as b,n as c,i as d};
@@ -1 +1 @@
import{r as i,j as o}from"./vendor-codemirror-C7mXSpXt.js";import{r as L,P as O,s as _,v as H,w,x as j,y as G,m as K}from"./index-EF2TDvxx.js";import{u as U}from"./index-CYARH0Cq.js";import{w as X}from"./vendor-icons-Aso0-eeY.js";var y="Checkbox",[$]=L(y),[J,P]=$(y);function Q(t){const{__scopeCheckbox:n,checked:a,children:l,defaultChecked:s,disabled:e,form:h,name:b,onCheckedChange:d,required:k,value:x="on",internal_do_not_use_render:u}=t,[p,v]=H({prop:a,defaultProp:s??!1,onChange:d,caller:y}),[m,C]=i.useState(null),[g,r]=i.useState(null),c=i.useRef(!1),E=m?!!h||!!m.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:m,setControl:C,name:b,form:h,value:x,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:f(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:r};return o.jsx(J,{scope:n,...R,children:V(u)?u(R):l})}var N="CheckboxTrigger",S=i.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:a,...l},s)=>{const{control:e,value:h,disabled:b,checked:d,required:k,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:m}=P(N,t),C=w(s,x),g=i.useRef(d);return i.useEffect(()=>{const r=e?.form;if(r){const c=()=>u(g.current);return r.addEventListener("reset",c),()=>r.removeEventListener("reset",c)}},[e,u]),o.jsx(_.button,{type:"button",role:"checkbox","aria-checked":f(d)?"mixed":d,"aria-required":k,"data-state":z(d),"data-disabled":b?"":void 0,disabled:b,value:h,...l,ref:C,onKeyDown:j(n,r=>{r.key==="Enter"&&r.preventDefault()}),onClick:j(a,r=>{u(c=>f(c)?!0:!c),m&&v&&(p.current=r.isPropagationStopped(),p.current||r.stopPropagation())})})});S.displayName=N;var B=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,name:l,checked:s,defaultChecked:e,required:h,disabled:b,value:d,onCheckedChange:k,form:x,...u}=t;return o.jsx(Q,{__scopeCheckbox:a,checked:s,defaultChecked:e,disabled:b,required:h,onCheckedChange:k,name:l,form:x,value:d,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(S,{...u,ref:n,__scopeCheckbox:a}),p&&o.jsx(A,{__scopeCheckbox:a})]})})});B.displayName=y;var M="CheckboxIndicator",T=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,forceMount:l,...s}=t,e=P(M,a);return o.jsx(O,{present:l||f(e.checked)||e.checked===!0,children:o.jsx(_.span,{"data-state":z(e.checked),"data-disabled":e.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})});T.displayName=M;var q="CheckboxBubbleInput",A=i.forwardRef(({__scopeCheckbox:t,...n},a)=>{const{control:l,hasConsumerStoppedPropagationRef:s,checked:e,defaultChecked:h,required:b,disabled:d,name:k,value:x,form:u,bubbleInput:p,setBubbleInput:v}=P(q,t),m=w(a,v),C=U(e),g=G(l);i.useEffect(()=>{const c=p;if(!c)return;const E=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(E,"checked").set,D=!s.current;if(C!==e&&I){const F=new Event("click",{bubbles:D});c.indeterminate=f(e),I.call(c,f(e)?!1:e),c.dispatchEvent(F)}},[p,C,e,s]);const r=i.useRef(f(e)?!1:e);return o.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??r.current,required:b,disabled:d,name:k,value:x,form:u,...n,tabIndex:-1,ref:m,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A.displayName=q;function V(t){return typeof t=="function"}function f(t){return t==="indeterminate"}function z(t){return f(t)?"indeterminate":t?"checked":"unchecked"}function te({className:t,...n}){return o.jsx(B,{"code-path":"src/components/ui/checkbox.tsx:14:5","data-slot":"checkbox",className:K("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:o.jsx(T,{"code-path":"src/components/ui/checkbox.tsx:22:7","data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:o.jsx(X,{"code-path":"src/components/ui/checkbox.tsx:26:9",className:"size-3.5"})})})}export{te as C};
import{r as i,j as o}from"./vendor-codemirror-C7mXSpXt.js";import{r as L,P as O,s as _,v as H,w,x as j,y as G,m as K}from"./index-LZWfu62c.js";import{u as U}from"./index-CYARH0Cq.js";import{w as X}from"./vendor-icons-Aso0-eeY.js";var y="Checkbox",[$]=L(y),[J,P]=$(y);function Q(t){const{__scopeCheckbox:n,checked:a,children:l,defaultChecked:s,disabled:e,form:h,name:b,onCheckedChange:d,required:k,value:x="on",internal_do_not_use_render:u}=t,[p,v]=H({prop:a,defaultProp:s??!1,onChange:d,caller:y}),[m,C]=i.useState(null),[g,r]=i.useState(null),c=i.useRef(!1),E=m?!!h||!!m.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:m,setControl:C,name:b,form:h,value:x,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:f(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:r};return o.jsx(J,{scope:n,...R,children:V(u)?u(R):l})}var N="CheckboxTrigger",S=i.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:a,...l},s)=>{const{control:e,value:h,disabled:b,checked:d,required:k,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:m}=P(N,t),C=w(s,x),g=i.useRef(d);return i.useEffect(()=>{const r=e?.form;if(r){const c=()=>u(g.current);return r.addEventListener("reset",c),()=>r.removeEventListener("reset",c)}},[e,u]),o.jsx(_.button,{type:"button",role:"checkbox","aria-checked":f(d)?"mixed":d,"aria-required":k,"data-state":z(d),"data-disabled":b?"":void 0,disabled:b,value:h,...l,ref:C,onKeyDown:j(n,r=>{r.key==="Enter"&&r.preventDefault()}),onClick:j(a,r=>{u(c=>f(c)?!0:!c),m&&v&&(p.current=r.isPropagationStopped(),p.current||r.stopPropagation())})})});S.displayName=N;var B=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,name:l,checked:s,defaultChecked:e,required:h,disabled:b,value:d,onCheckedChange:k,form:x,...u}=t;return o.jsx(Q,{__scopeCheckbox:a,checked:s,defaultChecked:e,disabled:b,required:h,onCheckedChange:k,name:l,form:x,value:d,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(S,{...u,ref:n,__scopeCheckbox:a}),p&&o.jsx(A,{__scopeCheckbox:a})]})})});B.displayName=y;var M="CheckboxIndicator",T=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,forceMount:l,...s}=t,e=P(M,a);return o.jsx(O,{present:l||f(e.checked)||e.checked===!0,children:o.jsx(_.span,{"data-state":z(e.checked),"data-disabled":e.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})});T.displayName=M;var q="CheckboxBubbleInput",A=i.forwardRef(({__scopeCheckbox:t,...n},a)=>{const{control:l,hasConsumerStoppedPropagationRef:s,checked:e,defaultChecked:h,required:b,disabled:d,name:k,value:x,form:u,bubbleInput:p,setBubbleInput:v}=P(q,t),m=w(a,v),C=U(e),g=G(l);i.useEffect(()=>{const c=p;if(!c)return;const E=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(E,"checked").set,D=!s.current;if(C!==e&&I){const F=new Event("click",{bubbles:D});c.indeterminate=f(e),I.call(c,f(e)?!1:e),c.dispatchEvent(F)}},[p,C,e,s]);const r=i.useRef(f(e)?!1:e);return o.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??r.current,required:b,disabled:d,name:k,value:x,form:u,...n,tabIndex:-1,ref:m,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A.displayName=q;function V(t){return typeof t=="function"}function f(t){return t==="indeterminate"}function z(t){return f(t)?"indeterminate":t?"checked":"unchecked"}function te({className:t,...n}){return o.jsx(B,{"code-path":"src/components/ui/checkbox.tsx:14:5","data-slot":"checkbox",className:K("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:o.jsx(T,{"code-path":"src/components/ui/checkbox.tsx:22:7","data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:o.jsx(X,{"code-path":"src/components/ui/checkbox.tsx:26:9",className:"size-3.5"})})})}export{te as C};
@@ -1 +1 @@
import{h as o}from"./index-EF2TDvxx.js";const p={getRepos:()=>o.get("/deploy/repos"),getRepo:e=>o.get(`/deploy/repos/${e}`),createRepo:e=>o.post("/deploy/repos",e),updateRepo:(e,t)=>o.put(`/deploy/repos/${e}`,t),deleteRepo:e=>o.delete(`/deploy/repos/${e}`),getRegistries:()=>o.get("/deploy/registries"),getRegistry:e=>o.get(`/deploy/registries/${e}`),createRegistry:e=>o.post("/deploy/registries",e),updateRegistry:(e,t)=>o.put(`/deploy/registries/${e}`,t),deleteRegistry:e=>o.delete(`/deploy/registries/${e}`),getEnvironments:()=>o.get("/deploy/environments"),createEnvironment:e=>o.post("/deploy/environments",e),updateEnvironment:(e,t)=>o.put(`/deploy/environments/${e}`,t),deleteEnvironment:e=>o.delete(`/deploy/environments/${e}`),getItemRoles:()=>o.get("/admin/item-roles"),createItemRole:e=>o.post("/admin/item-roles",e),updateItemRole:(e,t)=>o.put(`/admin/item-roles/${e}`,t),deleteItemRole:e=>o.delete(`/admin/item-roles/${e}`),getUserItemRoles:e=>o.get(`/admin/users/${e}/item-roles`),assignItemRole:(e,t)=>o.post(`/admin/users/${e}/item-roles`,t),removeItemRole:(e,t)=>o.delete(`/admin/users/${e}/item-roles/${t}`),getGroups:()=>o.get("/deploy/groups"),createGroup:e=>o.post("/deploy/groups",e),updateGroup:(e,t)=>o.put(`/deploy/groups/${e}`,t),deleteGroup:e=>o.delete(`/deploy/groups/${e}`),getGroupMembers:e=>o.get(`/deploy/groups/${e}/members`),addGroupMember:(e,t)=>o.post(`/deploy/groups/${e}/members`,t),removeGroupMember:(e,t)=>o.delete(`/deploy/groups/${e}/members/${t}`),getTools:()=>o.get("/deploy/tools"),getTool:e=>o.get(`/deploy/tools/${e}`),updateTool:(e,t)=>o.put(`/deploy/tools/${e}`,t),installTool:(e,t)=>o.post(`/deploy/tools/${e}/install`,t?{version:t}:{}),checkTool:e=>o.post(`/deploy/tools/${e}/check`),getToolVersions:e=>o.get(`/deploy/tools/${e}/versions`)};export{p as d};
import{h as o}from"./index-LZWfu62c.js";const p={getRepos:()=>o.get("/deploy/repos"),getRepo:e=>o.get(`/deploy/repos/${e}`),createRepo:e=>o.post("/deploy/repos",e),updateRepo:(e,t)=>o.put(`/deploy/repos/${e}`,t),deleteRepo:e=>o.delete(`/deploy/repos/${e}`),getRegistries:()=>o.get("/deploy/registries"),getRegistry:e=>o.get(`/deploy/registries/${e}`),createRegistry:e=>o.post("/deploy/registries",e),updateRegistry:(e,t)=>o.put(`/deploy/registries/${e}`,t),deleteRegistry:e=>o.delete(`/deploy/registries/${e}`),getEnvironments:()=>o.get("/deploy/environments"),createEnvironment:e=>o.post("/deploy/environments",e),updateEnvironment:(e,t)=>o.put(`/deploy/environments/${e}`,t),deleteEnvironment:e=>o.delete(`/deploy/environments/${e}`),getItemRoles:()=>o.get("/admin/item-roles"),createItemRole:e=>o.post("/admin/item-roles",e),updateItemRole:(e,t)=>o.put(`/admin/item-roles/${e}`,t),deleteItemRole:e=>o.delete(`/admin/item-roles/${e}`),getUserItemRoles:e=>o.get(`/admin/users/${e}/item-roles`),assignItemRole:(e,t)=>o.post(`/admin/users/${e}/item-roles`,t),removeItemRole:(e,t)=>o.delete(`/admin/users/${e}/item-roles/${t}`),getGroups:()=>o.get("/deploy/groups"),createGroup:e=>o.post("/deploy/groups",e),updateGroup:(e,t)=>o.put(`/deploy/groups/${e}`,t),deleteGroup:e=>o.delete(`/deploy/groups/${e}`),getGroupMembers:e=>o.get(`/deploy/groups/${e}/members`),addGroupMember:(e,t)=>o.post(`/deploy/groups/${e}/members`,t),removeGroupMember:(e,t)=>o.delete(`/deploy/groups/${e}/members/${t}`),getTools:()=>o.get("/deploy/tools"),getTool:e=>o.get(`/deploy/tools/${e}`),updateTool:(e,t)=>o.put(`/deploy/tools/${e}`,t),installTool:(e,t)=>o.post(`/deploy/tools/${e}/install`,t?{version:t}:{}),checkTool:e=>o.post(`/deploy/tools/${e}/check`),getToolVersions:e=>o.get(`/deploy/tools/${e}/versions`)};export{p as d};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const a={list:e=>t.get("/credentials",e),get:e=>t.get(`/credentials/${e}`),create:e=>t.post("/credentials",e),update:(e,s)=>t.put(`/credentials/${e}`,s),delete:e=>t.delete(`/credentials/${e}`),toggleActive:(e,s)=>t.put(`/credentials/${e}`,{is_active:s})},r={assign:(e,s)=>t.post(`/servers/${e}/assign-credential`,{credential_id:s})};export{a as c,r as s};
import{h as t}from"./index-LZWfu62c.js";const a={list:e=>t.get("/credentials",e),get:e=>t.get(`/credentials/${e}`),create:e=>t.post("/credentials",e),update:(e,s)=>t.put(`/credentials/${e}`,s),delete:e=>t.delete(`/credentials/${e}`),toggleActive:(e,s)=>t.put(`/credentials/${e}`,{is_active:s})},r={assign:(e,s)=>t.post(`/servers/${e}/assign-credential`,{credential_id:s})};export{a as c,r as s};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const a={getStats:async()=>t.get("/dashboard/stats"),getAlerts:async e=>t.get("/dashboard/recent-alerts",e?{limit:e}:void 0),getReleases:async e=>t.get("/dashboard/recent-releases",e?{limit:e}:void 0),getMetrics:async e=>t.get("/dashboard/metrics",e?{hours:e}:void 0)};export{a as d};
import{h as t}from"./index-LZWfu62c.js";const a={getStats:async()=>t.get("/dashboard/stats"),getAlerts:async e=>t.get("/dashboard/recent-alerts",e?{limit:e}:void 0),getReleases:async e=>t.get("/dashboard/recent-releases",e?{limit:e}:void 0),getMetrics:async e=>t.get("/dashboard/metrics",e?{hours:e}:void 0)};export{a as d};
@@ -1 +1 @@
import{h as e}from"./index-EF2TDvxx.js";const o={list:()=>e.get("/prometheus-datasources"),get:t=>e.get(`/prometheus-datasources/${t}`),create:t=>e.post("/prometheus-datasources",t),update:(t,s)=>e.put(`/prometheus-datasources/${t}`,s),delete:t=>e.delete(`/prometheus-datasources/${t}`),setDefault:t=>e.post(`/prometheus-datasources/${t}/default`),testConnection:t=>e.post("/prometheus-datasources/test",t)},u={list:()=>e.get("/zabbix-datasources"),get:t=>e.get(`/zabbix-datasources/${t}`),create:t=>e.post("/zabbix-datasources",t),update:(t,s)=>e.put(`/zabbix-datasources/${t}`,s),delete:t=>e.delete(`/zabbix-datasources/${t}`),setDefault:t=>e.post(`/zabbix-datasources/${t}/default`),testConnection:t=>e.post("/zabbix-datasources/test",t)};export{o as p,u as z};
import{h as e}from"./index-LZWfu62c.js";const o={list:()=>e.get("/prometheus-datasources"),get:t=>e.get(`/prometheus-datasources/${t}`),create:t=>e.post("/prometheus-datasources",t),update:(t,s)=>e.put(`/prometheus-datasources/${t}`,s),delete:t=>e.delete(`/prometheus-datasources/${t}`),setDefault:t=>e.post(`/prometheus-datasources/${t}/default`),testConnection:t=>e.post("/prometheus-datasources/test",t)},u={list:()=>e.get("/zabbix-datasources"),get:t=>e.get(`/zabbix-datasources/${t}`),create:t=>e.post("/zabbix-datasources",t),update:(t,s)=>e.put(`/zabbix-datasources/${t}`,s),delete:t=>e.delete(`/zabbix-datasources/${t}`),setDefault:t=>e.post(`/zabbix-datasources/${t}/default`),testConnection:t=>e.post("/zabbix-datasources/test",t)};export{o as p,u as z};
-1
View File
@@ -1 +0,0 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root,[data-theme=ocean-deep]{--background: 220 13% 5%;--foreground: 210 40% 98%;--card: 220 13% 7%;--card-foreground: 210 40% 98%;--popover: 220 13% 7%;--popover-foreground: 210 40% 98%;--primary: 217 91% 60%;--primary-foreground: 0 Line truncated
-1
View File
@@ -1 +0,0 @@
import{l as s,u as e}from"./index-EF2TDvxx.js";import{d as t}from"./dashboard-BNyMEfo2.js";import{s as A}from"./server-rQ-8Frwb.js";import{r as f}from"./region-DScARMXs.js";import{k as n}from"./index-CYw3SC6I.js";import{p as c}from"./pipeline-CvSxTj00.js";import{d as u}from"./config-DLOuMLhF.js";import{c as k,s as v}from"./credential-BFQGM5tX.js";import{c as h,s as y,t as C}from"./automation-_t6YTgo2.js";import{a as P}from"./alert-B4v9izj6.js";import{a as w}from"./alert-center-C2gx2r-S.js";import{s as J}from"./site-Cjg78WIa.js";import{t as W}from"./trace-L8uY5gM3.js";import{d as q}from"./grafana-DTc3taUi.js";import{p as F,z as G}from"./datasource-C4Fvm0Oq.js";import{m as I,p as K,s as M,z as N}from"./metrics-BCZ7fIl4.js";import{a as Q}from"./agent-D_rvbJT8.js";import{c as T}from"./account-DwPCbdbn.js";import{p as V}from"./platform-C7N_g8dz.js";import{b as Y}from"./billing-CoX12im7.js";import{a as _}from"./audit-Z4oPE2dM.js";import{l as rr,s as pr,t as or}from"./terminal-CLsFzYYz.js";import{b as sr,a as er}from"./approval-DPMUbhSE.js";import{a as tr}from"./ai-CEIZUoip.js";import"./vendor-codemirror-C7mXSpXt.js";import"./vendor-icons-Aso0-eeY.js";export{Q as agentApi,tr as aiApi,P as alertApi,w as alertCenterApi,sr as approvalApi,er as approvalWorkflowApi,_ as auditApi,Y as billingApi,T as cloudApi,k as credentialApi,h as cronJobApi,q as dashboardApi,t as dashboardStatsApi,u as deployApi,n as kubernetesApi,s as ldapApi,rr as loginLogApi,I as metricsApi,c as pipelineApi,V as platformApi,F as promDatasourceApi,K as prometheusProxyApi,f as regionApi,y as scriptApi,A as serverApi,v as serverCredentialApi,pr as sessionCommandApi,J as siteApi,M as snmpApi,C as taskExecutionApi,or as terminalSessionApi,W as traceApi,e as userApi,G as zabbixDatasourceApi,N as zabbixProxyApi};
+1
View File
@@ -0,0 +1 @@
*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root,[data-theme=ocean-deep]{--background: 220 13% 5%;--foreground: 210 40% 98%;--card: 220 13% 7%;--card-foreground: 210 40% 98%;--popover: 220 13% 7%;--popover-foreground: 210 40% 98%;--primary: 217 91% 60%;--primary-foreground: 0 Line truncated
+1
View File
@@ -0,0 +1 @@
import{l as s,u as e}from"./index-LZWfu62c.js";import{d as t}from"./dashboard-7Sl2aero.js";import{s as A}from"./server-BUAZv7ZV.js";import{r as f}from"./region-BZBRxF2X.js";import{k as n}from"./index-Z0O8nAcG.js";import{p as c}from"./pipeline-Lgvc2XUS.js";import{d as u}from"./config-DAXaHuse.js";import{c as k,s as v}from"./credential-CwQY-4Ba.js";import{c as h,s as y,t as C}from"./automation-BrmX02Sx.js";import{a as P}from"./alert-C4MMKcUL.js";import{a as w}from"./alert-center-dJk4LGZM.js";import{s as J}from"./site-B-pRndoi.js";import{t as W}from"./trace-L8uY5gM3.js";import{d as q}from"./grafana-DTc3taUi.js";import{p as F,z as G}from"./datasource-DuIT0c1H.js";import{m as I,p as K,s as M,z as N}from"./metrics-Dj4l07HZ.js";import{a as Q}from"./agent-g0Vk8FYK.js";import{c as T}from"./account-Dzyhyahe.js";import{p as V}from"./platform-g_u95ryi.js";import{b as Y}from"./billing-9Cbmzl6K.js";import{a as _}from"./audit-BiL35K5G.js";import{l as rr,s as pr,t as or}from"./terminal-BchqP-zB.js";import{b as sr,a as er}from"./approval-DmGRfKd6.js";import{a as tr}from"./ai-BMSiZ3PN.js";import"./vendor-codemirror-C7mXSpXt.js";import"./vendor-icons-Aso0-eeY.js";export{Q as agentApi,tr as aiApi,P as alertApi,w as alertCenterApi,sr as approvalApi,er as approvalWorkflowApi,_ as auditApi,Y as billingApi,T as cloudApi,k as credentialApi,h as cronJobApi,q as dashboardApi,t as dashboardStatsApi,u as deployApi,n as kubernetesApi,s as ldapApi,rr as loginLogApi,I as metricsApi,c as pipelineApi,V as platformApi,F as promDatasourceApi,K as prometheusProxyApi,f as regionApi,y as scriptApi,A as serverApi,v as serverCredentialApi,pr as sessionCommandApi,J as siteApi,M as snmpApi,C as taskExecutionApi,or as terminalSessionApi,W as traceApi,e as userApi,G as zabbixDatasourceApi,N as zabbixProxyApi};
@@ -1,4 +1,4 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-C3Mgk4Hy.js","assets/vendor-codemirror-C7mXSpXt.js","assets/dashboard-BNyMEfo2.js","assets/server-rQ-8Frwb.js","assets/index-CYw3SC6I.js","assets/stat-strip-TlkYcldq.js","assets/card-BVNSlZ0C.js","assets/badge-BodqHT_V.js","assets/vendor-icons-Aso0-eeY.js","assets/AreaChart-B9PyJ8Di.js","assets/ServerManager-BOk1s-nd.js","assets/input--Xdj49es.js","assets/checkbox-CY3XhE_w.js","assets/index-CYARH0Cq.js","assets/table-CUnn2-lp.js","assets/select-DbRZUnPK.js","assets/unwrap-oA0ekUAt.js","assets/useMutation-BLuCS56f.js","assets/account-DwPCbdbn.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/xterm-utils-slbfdUHf.js","assets/credential-BFQGM5tX.js","assets/region-DScARMXs.js","assets/label-DZckFZd3.js","assets/textarea-JgdELMPr.js","assets/CloudAccountManager-CrfXz-Ux.js","assets/DomainManager-Bc2Y-tnO.js","assets/RegionManager-DAgeWbRr.js","assets/PlatformManager-sKNMDVik.js","assets/platform-C7N_g8dz.js","assets/CloudBilling-kwAWaA8o.js","assets/switch-DYISEUSP.js","assets/billing-CoX12im7.js","assets/KubernetesClusters-BiMWp14A.js","assets/tabs-dobHN7aQ.js","assets/ClusterOverviewPage-CiOj2OGK.js","assets/use-toast-CkA38LVP.js","assets/NodeDetailPage-C5UOgqcz.js","assets/NamespaceOverviewPage-4pfBO49u.js","assets/NamespaceManagementPage-0VnYV9GN.js","assets/NamespaceResourcePage-C3E7L6GV.js","assets/PodFileBrowser-BPio7wxi.js","assets/ResourceVisualEditor-BXksS6e2.js","assets/DeploymentDetailPage-KvjeNnqR.js","assets/WorkloadViewPage-B53qfPO6.js","assets/TopologyView-Feyh7bIr.js","assets/KubernetesNodes-B2jEMWTg.js","assets/PodMetricsPage-On_xK19V.js","assets/EventsPage-BlM0_-X4.js","assets/CapacityPage-CWUpHbri.js","assets/K8sShortcutRedirect-fgkbx9Vp.js","assets/AlertManager-nv_xdloK.js","assets/alert-B4v9izj6.js","assets/AlertRuleDialog-B_V4xcKa.js","assets/ApprovalFlow-D-ftjqRO.js","assets/approval-DPMUbhSE.js","assets/ApprovalResourcePage-VT7IARzv.js","assets/ApprovalCategoryPage-KY6ryxLb.js","assets/ApprovalAppPage-CaEPh2Xz.js","assets/ApprovalPermissionPage-0d3VJHx2.js","assets/ApprovalWorkflowPage-Byqk0MKq.js","assets/ScriptManager-9IW87qYN.js","assets/automation-_t6YTgo2.js","assets/SystemManager-BD0ukLSx.js","assets/TerminalAuditTab-BzRHQUT2.js","assets/terminal-CLsFzYYz.js","assets/AuditOperationsTab-DWYm9W3B.js","assets/audit-Z4oPE2dM.js","assets/LoginLogsTab-q3NP-L1u.js","assets/CredentialManager-CSa9vb54.js","assets/PipelineManager-DCrhFfx4.js","assets/pipeline-CvSxTj00.js","assets/config-DLOuMLhF.js","assets/DeployCredentials-BunsdfYH.js","assets/PipelineEditor-Cvagngmv.js","assets/PipelineRunDetail-OPxhDG-Y.js","assets/DeployRBAC-DCJ4MkVI.js","assets/UserGroupsManager-UM46GMcV.js","assets/CronJobManager-BQpVfKVA.js","assets/AIOpsAssistant-CF1D1Anl.js","assets/agent-D_rvbJT8.js","assets/ai-CEIZUoip.js","assets/AIAlertAnalyzer-BFwPLuXl.js","assets/AIPredictiveAnalytics-BXlrnpYB.js","assets/AlertCenter-CaSpyOJ2.js","assets/alert-center-C2gx2r-S.js","assets/TraceManager-CWjCmm6P.js","assets/trace-L8uY5gM3.js","assets/HostMonitor-BVQwXwZu.js","assets/GrafanaDashboard-DwBz9b6M.js","assets/grafana-DTc3taUi.js","assets/datasource-C4Fvm0Oq.js","assets/metrics-BCZ7fIl4.js","assets/MonitorCenter-btGjdSNo.js","assets/site-Cjg78WIa.js","assets/MetricsExplorer-BC0aPabu.js","assets/DatasourcePage-5YEOUPGv.js"])))=>i.map(i=>d[i]);
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DQzWxW5H.js","assets/vendor-codemirror-C7mXSpXt.js","assets/dashboard-7Sl2aero.js","assets/server-BUAZv7ZV.js","assets/index-Z0O8nAcG.js","assets/stat-strip-BPzU38xY.js","assets/card-B-RtdR4H.js","assets/badge-B0F5ZNtn.js","assets/vendor-icons-Aso0-eeY.js","assets/AreaChart-Czgv4pNk.js","assets/ServerManager-D6Uxl03e.js","assets/input-BdDauX3U.js","assets/checkbox-DL3onEGv.js","assets/index-CYARH0Cq.js","assets/table-BPFYQwjr.js","assets/select-4xU_9B3_.js","assets/unwrap-BmWy-KM2.js","assets/useMutation-Bp3lz5hm.js","assets/account-Dzyhyahe.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/xterm-utils-slbfdUHf.js","assets/credential-CwQY-4Ba.js","assets/region-BZBRxF2X.js","assets/label-u-lNUbKh.js","assets/textarea-BdtIagjy.js","assets/CloudAccountManager-Dth1Gy-B.js","assets/DomainManager-AazO_ekQ.js","assets/RegionManager-BFFP324K.js","assets/PlatformManager-CsXWkkgm.js","assets/platform-g_u95ryi.js","assets/CloudBilling-Dtss07cb.js","assets/switch-C4PJnJ9I.js","assets/billing-9Cbmzl6K.js","assets/KubernetesClusters-DD7SeVKO.js","assets/tabs-kmtfM2I-.js","assets/ClusterOverviewPage-CBfjCIXY.js","assets/use-toast-CkA38LVP.js","assets/NodeDetailPage-CSCwjDLO.js","assets/NamespaceOverviewPage-CrqNiJMQ.js","assets/NamespaceManagementPage-BuGcKQSw.js","assets/NamespaceResourcePage-Cf6hgoD2.js","assets/PodFileBrowser-Bs6KRfHw.js","assets/ResourceVisualEditor-CXyg-7xn.js","assets/DeploymentDetailPage-DEq3tEZd.js","assets/WorkloadViewPage-DSiv67B6.js","assets/TopologyView-DdP6o9Mj.js","assets/KubernetesNodes-B0frAPbY.js","assets/PodMetricsPage-NkW2J2Qd.js","assets/EventsPage-UFe_ZFfW.js","assets/CapacityPage-BucLnYij.js","assets/K8sShortcutRedirect-fX_VMnZ-.js","assets/AlertManager-C0AXwvA2.js","assets/alert-C4MMKcUL.js","assets/AlertRuleDialog-BsJX7bok.js","assets/ApprovalFlow-BziKIUh9.js","assets/approval-DmGRfKd6.js","assets/ApprovalResourcePage-CnDxsH56.js","assets/ApprovalCategoryPage-BdbU4Noo.js","assets/ApprovalAppPage-BrRxxZFx.js","assets/ApprovalPermissionPage-Bv3kKyby.js","assets/ApprovalWorkflowPage-Feqoq_m6.js","assets/ScriptManager-Dz9eHvUK.js","assets/automation-BrmX02Sx.js","assets/SystemManager-B9Kzdis0.js","assets/TerminalAuditTab-D4-qFyPi.js","assets/terminal-BchqP-zB.js","assets/AuditOperationsTab-zpIlq3AD.js","assets/audit-BiL35K5G.js","assets/LoginLogsTab-BZTjs1T3.js","assets/CredentialManager-VPjoE2mR.js","assets/PipelineManager-C_oAjTIU.js","assets/pipeline-Lgvc2XUS.js","assets/config-DAXaHuse.js","assets/DeployCredentials-C7pbsNa2.js","assets/PipelineEditor-BEQjb4Gp.js","assets/PipelineRunDetail-C9e6xlUh.js","assets/DeployRBAC-XP_74TOu.js","assets/UserGroupsManager-CjYJT4qh.js","assets/CronJobManager-Dow5NQrR.js","assets/AIOpsAssistant-annAjw3b.js","assets/agent-g0Vk8FYK.js","assets/ai-BMSiZ3PN.js","assets/AIAlertAnalyzer-DcLlw3nl.js","assets/AIPredictiveAnalytics-PqRHnPeG.js","assets/AlertCenter-VCEUxoOH.js","assets/alert-center-dJk4LGZM.js","assets/TraceManager-JbMTFm_u.js","assets/trace-L8uY5gM3.js","assets/HostMonitor-D4f8NRVg.js","assets/GrafanaDashboard-Cwk6bt47.js","assets/grafana-DTc3taUi.js","assets/datasource-DuIT0c1H.js","assets/metrics-Dj4l07HZ.js","assets/MonitorCenter-DZJmSfOk.js","assets/site-B-pRndoi.js","assets/MetricsExplorer-CBLW7MW5.js","assets/DatasourcePage-7FoNVKhF.js"])))=>i.map(i=>d[i]);
import{b as ty,r as m,g as PS,j as h,a as ct,c as Zd}from"./vendor-codemirror-C7mXSpXt.js";import{i as Td,bd as ny,be as VS,D as ad,ag as zg,G as Lg,M as GS,e as qS,u as kg,h as Ug,g as YS,B as Ds,b as XS,k as QS,N as rd,o as od,j as Ns,p as Xs,t as $o,J as ld,ar as Hg,_ as KS,A as FS,bf as Bg,r as Pg,b3 as ZS,l as ni,av as IS,as as $S,bg as JS,Z as WS,bh as ew,V as tw,Q as nw,I as aw,y as rw,bi as ay,w as ry,bj as ow,U as oy,bk as lw,ap as ly,f as sw,X as iw,ab as cw,aN as uw,aO as dw,x as fw,L as hw,bl as Vg,n as pw}from"./vendor-icons-Aso0-eeY.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function l(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(i){if(i.ep)return;i.ep=!0;const u=l(i);fetch(i.href,u)}})();var sd={exports:{}},Yo={},id={exports:{}},cd={};var Gg;function mw(){return Gg||(Gg=1,(function(n){function r(z,X){var B=z.length;z.push(X);e:for(;0<B;){var F=B-1>>>1,ie=z[F];if(0<i(ie,X))z[F]=X,z[B]=ie,B=F;else break e}}function l(z){return z.length===0?null:z[0]}function s(z){if(z.length===0)return null;var X=z[0],B=z.pop();if(B!==X){z[0]=B;e:for(var F=0,ie=z.length,Oe=ie>>>1;F<Oe;){var Ee=2*(F+1)-1,re=z[Ee],ve=Ee+1,Ke=z[ve];if(0>i(re,B))ve<ie&&0>i(Ke,re)?(z[F]=Ke,z[ve]=B,F=ve):(z[F]=re,z[Ee]=B,F=Ee);else if(ve<ie&&0>i(Ke,B))z[F]=Ke,z[ve]=B,F=ve;else break e}}return X}function i(z,X){var B=z.sortIndex-X.sortIndex;return B!==0?B:z.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var v=[],g=[],x=1,b=null,w=3,A=!1,R=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function U(z){for(var X=l(g);X!==null;){if(X.callback===null)s(g);else if(X.startTime<=z)s(g),X.sortIndex=X.expirationTime,r(v,X);else break;X=l(g)}}function V(z){if(C=!1,U(z),!R)if(l(v)!==null)R=!0,K||(K=!0,ue());else{var X=l(g);X!==null&&de(V,X.startTime-z)}}var K=!1,Q=-1,Y=5,I=-1;function ne(){return E?!0:!(n.unstable_now()-I<Y)}function ce(){if(E=!1,K){var z=n.unstable_now();I=z;var X=!0;try{e:{R=!1,C&&(C=!1,L(Q),Q=-1),A=!0;var B=w;try{t:{for(U(z),b=l(v);b!==null&&!(b.expirationTime>z&&ne());){var F=b.callback;if(typeof F=="function"){b.callback=null,w=b.priorityLevel;var ie=F(b.expirationTime<=z);if(z=n.unstable_now(),typeof ie=="function"){b.callback=ie,U(z),X=!0;break t}b===l(v)&&s(v),U(z)}else s(v);b=l(v)}if(b!==null)X=!0;else{var Oe=l(g);Oe!==null&&de(V,Oe.startTime-z),X=!1}}break e}finally{b=null,w=B,A=!1}X=void 0}}finally{X?ue():K=!1}}}var ue;if(typeof N=="function")ue=function(){N(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,me=we.port2;we.port1.onmessage=ce,ue=function(){me.postMessage(null)}}else ue=function(){O(ce,0)};function de(z,X){Q=O(function(){z(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return w},n.unstable_next=function(z){switch(w){case 1:case 2:case 3:var X=3;break;default:X=w}var B=w;w=X;try{return z()}finally{w=B}},n.unstable_requestPaint=function(){E=!0},n.unstable_runWithPriority=function(z,X){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var B=w;w=z;try{return X()}finally{w=B}},n.unstable_scheduleCallback=function(z,X,B){var F=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?F+B:F):B=F,z){case 1:var ie=-1;break;case 2:ie=250;break;case 5:ie=1073741823;break;case 4:ie=1e4;break;default:ie=5e3}return ie=B+ie,z={id:x++,callback:X,priorityLevel:z,startTime:B,expirationTime:ie,sortIndex:-1},B>F?(z.sortIndex=B,r(g,z),l(v)===null&&z===l(g)&&(C?(L(Q),Q=-1):C=!0,de(V,B-F))):(z.sortIndex=ie,r(v,z),R||A||(R=!0,K||(K=!0,ue()))),z},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(z){var X=w;return function(){var B=w;w=X;try{return z.apply(this,arguments)}finally{w=B}}}})(cd)),cd}var qg;function gw(){return qg||(qg=1,id.exports=mw()),id.exports}var ud={exports:{}},it={};varLine truncated
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
`+fn+e+Aa}var Pi=!1;function Vi(e,t){if(!e||Pi)return"";Pi=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(t){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(H){var k=H}Reflect.construct(e,[],q)}else{try{q.call()}catch(H){k=H}e.call(q.prototype)}}else{try{throw Error()}catch(H){k=H}(q=e())&&typeof q.catch=="function"&&q.catch(function(){})}}catch(H){if(H&&k&&typeof H.stack=="string")return[H.stack,k.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=o.DetermineComponentFrameRoot(),y=d[0],S=d[1];if(y&&S){var T=y.split(`
@@ -100,4 +100,4 @@ ${r?.name}: ${r?.message}
\`\`\`
${l?.componentStack}
\`\`\`
`;navigator.clipboard.writeText(s).then(()=>{Zv.success("错误信息已复制到剪贴板,请粘贴到 Issue 中")}).catch(()=>{Zv.error("复制失败,请手动复制错误信息")})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:64:9",className:"min-h-[60vh] flex items-center justify-center p-6",children:h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:65:11",className:"dg-card max-w-lg w-full p-8 text-center space-y-6",children:[h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:67:13",className:"mx-auto w-16 h-16 rounded-2xl bg-red-500/10 flex items-center justify-center",children:h.jsx(ni,{"code-path":"src/components/layout/ErrorBoundary.tsx:68:15",className:"h-8 w-8 text-red-400"})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:72:13",children:[h.jsx("h2",{"code-path":"src/components/layout/ErrorBoundary.tsx:73:15",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"页面出现错误"}),h.jsx("p",{"code-path":"src/components/layout/ErrorBoundary.tsx:76:15",className:"text-sm text-[var(--dg-text-muted)] mt-2",children:"抱歉,该页面遇到了意外错误。您可以尝试重新加载或返回首页。"})]}),this.state.error&&h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:83:15",className:"text-left",children:h.jsxs("details",{"code-path":"src/components/layout/ErrorBoundary.tsx:84:17",className:"group",children:[h.jsxs("summary",{"code-path":"src/components/layout/ErrorBoundary.tsx:85:19",className:"cursor-pointer text-xs text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1.5",children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:86:21",className:"h-3.5 w-3.5"}),"查看错误详情"]}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:89:19",className:"mt-2 p-3 rounded-lg bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] overflow-auto max-h-48",children:[h.jsxs("code",{"code-path":"src/components/layout/ErrorBoundary.tsx:90:21",className:"text-xs text-red-400 font-mono block whitespace-pre-wrap",children:[this.state.error.name,": ",this.state.error.message]}),this.state.errorInfo&&h.jsx("pre",{"code-path":"src/components/layout/ErrorBoundary.tsx:94:23",className:"text-xs text-[var(--dg-text-muted)] mt-2 whitespace-pre-wrap",children:this.state.errorInfo.componentStack})]})]})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:104:13",className:"flex items-center justify-center gap-3",children:[h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:105:15",variant:"outline",className:"dg-btn-secondary",onClick:this.handleGoHome,children:[h.jsx(ly,{"code-path":"src/components/layout/ErrorBoundary.tsx:110:17",className:"h-4 w-4 mr-1.5"}),"返回首页"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:113:15",className:"dg-btn-primary",onClick:this.handleRetry,children:[h.jsx(pw,{"code-path":"src/components/layout/ErrorBoundary.tsx:117:17",className:"h-4 w-4 mr-1.5"}),"重新加载"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:120:15",variant:"outline",className:"dg-btn-ghost",onClick:this.handleReport,children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:125:17",className:"h-4 w-4 mr-1.5"}),"复制错误"]})]})]})}):this.props.children}}const SM=m.lazy(()=>se(()=>import("./Dashboard-C3Mgk4Hy.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(n=>({default:n.Dashboard}))),wM=m.lazy(()=>se(()=>import("./ServerManager-BOk1s-nd.js"),__vite__mapDeps([10,1,6,11,12,13,8,14,15,16,17,3,5,7,18,19,20,21,22,23,24,25])).then(n=>({default:n.ServerManager}))),EM=m.lazy(()=>se(()=>import("./CloudAccountManager-CrfXz-Ux.js"),__vite__mapDeps([26,1,11,24,6,7,18,8])).then(n=>({default:n.CloudAccountManager}))),AM=m.lazy(()=>se(()=>import("./DomainManager-Bc2Y-tnO.js"),__vite__mapDeps([27,1,11,24,6,7,18,8])).then(n=>({default:n.DomainManager}))),CM=m.lazy(()=>se(()=>import("./RegionManager-DAgeWbRr.js"),__vite__mapDeps([28,1,11,24,7,12,13,8,14,15,23])).then(n=>({default:n.RegionManager}))),RM=m.lazy(()=>se(()=>import("./PlatformManager-sKNMDVik.js"),__vite__mapDeps([29,1,11,24,7,15,13,8,30])).then(n=>({default:n.PlatformManager}))),TM=m.lazy(()=>se(()=>import("./CloudBilling-kwAWaA8o.js"),__vite__mapDeps([31,1,11,24,6,7,32,13,15,8,33,5])).then(n=>({default:n.CloudBilling}))),_M=m.lazy(()=>se(()=>import("./KubernetesClusters-BiMWp14A.js"),__vite__mapDeps([34,1,6,11,7,4,35,8,9,25,24,13,19,20])).then(n=>({default:n.KubernetesClusters}))),OM=m.lazy(()=>se(()=>import("./ClusterOverviewPage-CiOj2OGK.js"),__vite__mapDeps([36,1,6,7,14,4,37,8])).then(n=>({default:n.default}))),jM=m.lazy(()=>se(()=>import("./NodeDetailPage-C5UOgqcz.js"),__vite__mapDeps([38,1,6,7,14,4,8])).then(n=>({default:n.default}))),MM=m.lazy(()=>se(()=>import("./NamespaceOverviewPage-4p Line truncated
`;navigator.clipboard.writeText(s).then(()=>{Zv.success("错误信息已复制到剪贴板,请粘贴到 Issue 中")}).catch(()=>{Zv.error("复制失败,请手动复制错误信息")})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:64:9",className:"min-h-[60vh] flex items-center justify-center p-6",children:h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:65:11",className:"dg-card max-w-lg w-full p-8 text-center space-y-6",children:[h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:67:13",className:"mx-auto w-16 h-16 rounded-2xl bg-red-500/10 flex items-center justify-center",children:h.jsx(ni,{"code-path":"src/components/layout/ErrorBoundary.tsx:68:15",className:"h-8 w-8 text-red-400"})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:72:13",children:[h.jsx("h2",{"code-path":"src/components/layout/ErrorBoundary.tsx:73:15",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"页面出现错误"}),h.jsx("p",{"code-path":"src/components/layout/ErrorBoundary.tsx:76:15",className:"text-sm text-[var(--dg-text-muted)] mt-2",children:"抱歉,该页面遇到了意外错误。您可以尝试重新加载或返回首页。"})]}),this.state.error&&h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:83:15",className:"text-left",children:h.jsxs("details",{"code-path":"src/components/layout/ErrorBoundary.tsx:84:17",className:"group",children:[h.jsxs("summary",{"code-path":"src/components/layout/ErrorBoundary.tsx:85:19",className:"cursor-pointer text-xs text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1.5",children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:86:21",className:"h-3.5 w-3.5"}),"查看错误详情"]}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:89:19",className:"mt-2 p-3 rounded-lg bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] overflow-auto max-h-48",children:[h.jsxs("code",{"code-path":"src/components/layout/ErrorBoundary.tsx:90:21",className:"text-xs text-red-400 font-mono block whitespace-pre-wrap",children:[this.state.error.name,": ",this.state.error.message]}),this.state.errorInfo&&h.jsx("pre",{"code-path":"src/components/layout/ErrorBoundary.tsx:94:23",className:"text-xs text-[var(--dg-text-muted)] mt-2 whitespace-pre-wrap",children:this.state.errorInfo.componentStack})]})]})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:104:13",className:"flex items-center justify-center gap-3",children:[h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:105:15",variant:"outline",className:"dg-btn-secondary",onClick:this.handleGoHome,children:[h.jsx(ly,{"code-path":"src/components/layout/ErrorBoundary.tsx:110:17",className:"h-4 w-4 mr-1.5"}),"返回首页"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:113:15",className:"dg-btn-primary",onClick:this.handleRetry,children:[h.jsx(pw,{"code-path":"src/components/layout/ErrorBoundary.tsx:117:17",className:"h-4 w-4 mr-1.5"}),"重新加载"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:120:15",variant:"outline",className:"dg-btn-ghost",onClick:this.handleReport,children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:125:17",className:"h-4 w-4 mr-1.5"}),"复制错误"]})]})]})}):this.props.children}}const SM=m.lazy(()=>se(()=>import("./Dashboard-DQzWxW5H.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(n=>({default:n.Dashboard}))),wM=m.lazy(()=>se(()=>import("./ServerManager-D6Uxl03e.js"),__vite__mapDeps([10,1,6,11,12,13,8,14,15,16,17,3,5,7,18,19,20,21,22,23,24,25])).then(n=>({default:n.ServerManager}))),EM=m.lazy(()=>se(()=>import("./CloudAccountManager-Dth1Gy-B.js"),__vite__mapDeps([26,1,11,24,6,7,18,8])).then(n=>({default:n.CloudAccountManager}))),AM=m.lazy(()=>se(()=>import("./DomainManager-AazO_ekQ.js"),__vite__mapDeps([27,1,11,24,6,7,18,8])).then(n=>({default:n.DomainManager}))),CM=m.lazy(()=>se(()=>import("./RegionManager-BFFP324K.js"),__vite__mapDeps([28,1,11,24,7,12,13,8,14,15,23])).then(n=>({default:n.RegionManager}))),RM=m.lazy(()=>se(()=>import("./PlatformManager-CsXWkkgm.js"),__vite__mapDeps([29,1,11,24,7,15,13,8,30])).then(n=>({default:n.PlatformManager}))),TM=m.lazy(()=>se(()=>import("./CloudBilling-Dtss07cb.js"),__vite__mapDeps([31,1,11,24,6,7,32,13,15,8,33,5])).then(n=>({default:n.CloudBilling}))),_M=m.lazy(()=>se(()=>import("./KubernetesClusters-DD7SeVKO.js"),__vite__mapDeps([34,1,6,11,7,4,35,8,9,25,24,13,19,20])).then(n=>({default:n.KubernetesClusters}))),OM=m.lazy(()=>se(()=>import("./ClusterOverviewPage-CBfjCIXY.js"),__vite__mapDeps([36,1,6,7,14,4,37,8])).then(n=>({default:n.default}))),jM=m.lazy(()=>se(()=>import("./NodeDetailPage-CSCwjDLO.js"),__vite__mapDeps([38,1,6,7,14,4,8])).then(n=>({default:n.default}))),MM=m.lazy(()=>se(()=>import("./NamespaceOverviewPage-Cr Line truncated
@@ -1,2 +1,2 @@
import{h as n,af as u,ag as l,ah as i}from"./index-EF2TDvxx.js";const m={getClusters:async()=>n.get("/kubernetes-clusters"),getClusterDetail:async e=>n.get(`/kubernetes-clusters/${e}/detail`),createCluster:async e=>n.post("/kubernetes-clusters",e),updateCluster:async(e,s)=>n.put(`/kubernetes-clusters/${e}`,s),deleteCluster:async e=>n.delete(`/kubernetes-clusters/${e}`),getPods:async e=>n.get(`/kubernetes-clusters/${e}/pods`),getDeployments:async e=>n.get(`/kubernetes-clusters/${e}/deployments`),getServices:async e=>n.get(`/kubernetes-clusters/${e}/services`),getIngresses:async e=>n.get(`/kubernetes-clusters/${e}/ingresses`),syncCluster:async e=>n.post(`/kubernetes-clusters/${e}/sync`),exportAllResources:async e=>n.download(`/kubernetes/${e}/export`,`cluster-${e}-resources.tar.gz`),getTopology:async e=>n.get(`/kubernetes-clusters/${e}/topology`),saveTopology:async(e,s)=>n.put(`/kubernetes-clusters/${e}/topology`,{layout_data:s}),getMultiClusterComparison:async()=>n.get("/kubernetes/compare")},g={getNodes:async e=>n.get(`/kubernetes-clusters/${e}/nodes`),getClusterNodes:async e=>n.get(`/kubernetes/${e}/nodes`),getNodeDetail:async(e,s)=>n.get(`/kubernetes/${e}/nodes/${encodeURIComponent(s)}`)};function y(e,s){if(s.length===0)return;const t=Object.keys(s[0]),a=[t.join(","),...s.map(o=>t.map(p=>JSON.stringify(o[p]??"")).join(","))].join(`
import{h as n,af as u,ag as l,ah as i}from"./index-LZWfu62c.js";const m={getClusters:async()=>n.get("/kubernetes-clusters"),getClusterDetail:async e=>n.get(`/kubernetes-clusters/${e}/detail`),createCluster:async e=>n.post("/kubernetes-clusters",e),updateCluster:async(e,s)=>n.put(`/kubernetes-clusters/${e}`,s),deleteCluster:async e=>n.delete(`/kubernetes-clusters/${e}`),getPods:async e=>n.get(`/kubernetes-clusters/${e}/pods`),getDeployments:async e=>n.get(`/kubernetes-clusters/${e}/deployments`),getServices:async e=>n.get(`/kubernetes-clusters/${e}/services`),getIngresses:async e=>n.get(`/kubernetes-clusters/${e}/ingresses`),syncCluster:async e=>n.post(`/kubernetes-clusters/${e}/sync`),exportAllResources:async e=>n.download(`/kubernetes/${e}/export`,`cluster-${e}-resources.tar.gz`),getTopology:async e=>n.get(`/kubernetes-clusters/${e}/topology`),saveTopology:async(e,s)=>n.put(`/kubernetes-clusters/${e}/topology`,{layout_data:s}),getMultiClusterComparison:async()=>n.get("/kubernetes/compare")},g={getNodes:async e=>n.get(`/kubernetes-clusters/${e}/nodes`),getClusterNodes:async e=>n.get(`/kubernetes/${e}/nodes`),getNodeDetail:async(e,s)=>n.get(`/kubernetes/${e}/nodes/${encodeURIComponent(s)}`)};function y(e,s){if(s.length===0)return;const t=Object.keys(s[0]),a=[t.join(","),...s.map(o=>t.map(p=>JSON.stringify(o[p]??"")).join(","))].join(`
`),r=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(r),c.download=e,c.click(),URL.revokeObjectURL(c.href)}function b(e,s){const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=e,a.click(),URL.revokeObjectURL(a.href)}function d(e,s,t,a={}){const r=new URLSearchParams;return r.set("stream","true"),a.container&&r.set("container",a.container),a.tailLines&&a.tailLines>0&&r.set("tailLines",String(a.tailLines)),a.previous&&r.set("previous","true"),a.sinceTime&&r.set("sinceTime",a.sinceTime),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs`,r)}function k(e,s,t,a,r){const c=new URLSearchParams;a&&c.set("container",a),r&&c.set("command",r);const o=u();o&&c.set("token",o);const p=c.toString();return`${i()}/ws/kubernetes-exec/${e}/namespaces/${s}/pods/${t}${p?`?${p}`:""}`}function $(e,s,t,a,r){const c=new URLSearchParams({path:a});r&&c.set("container",r);const o=u();return o&&c.set("token",o),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/download`,c)}async function f(e,s,t,a,r){const c=$(e,s,t,a,r),o=await fetch(c);if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}async function S(e,s,t,a,r,c){const o=new FormData;return o.append("file",r),o.append("path",a),c&&o.append("container",c),n.upload(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/upload`,o)}const h={getPodLogs:async(e,s,t,a=200,r)=>{const c=new URLSearchParams({tail:String(a)});return r&&c.set("container",r),n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs?${c}`)},getPodLogsEnhanced:async(e,s,t,a={})=>{const r=new URLSearchParams;a.container&&r.set("container",a.container),a.tailLines&&a.tailLines>0&&r.set("tailLines",String(a.tailLines)),a.previous&&r.set("previous","true"),a.sinceTime&&r.set("sinceTime",a.sinceTime);const c=r.toString();return n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs${c?`?${c}`:""}`)},buildPodLogsStreamUrl:d,execPod:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/exec`,{command:a,container:r}),buildPodExecWsUrl:k,listPodFiles:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/list`,{path:a,container:r}),buildPodFileDownloadUrl:$,readPodFileText:f,uploadPodFile:S,getPodMetrics:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/metrics/pods`,t)},getAllPods:async e=>n.get(`/kubernetes/${e}/pods`),getNamespacePods:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pods`)},v={scaleDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/scale`,{replicas:a}),restartDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/restart`),pauseDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/pause`),resumeDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/resume`),updateDeploymentImage:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/update-image`,{image:a,container_name:r}),getHPAs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/hpas`):n.get(`/kubernetes/${e}/hpas`),createHPA:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/hpas`,s),deleteHPA:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/hpas/${t}`),getCronJobs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/cronjobs`):n.get(`/kubernetes-clusters/${e}/cronjobs`),createCronJob:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/cronjobs`,s),suspendCronJob:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/suspend`,{suspend:a}),triggerCronJob:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/trigger`),deleteCronJob:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}`),getNamespaceDeployments:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments`),getAllDeployments:async e=>n.get(`/kubernetes/${e}/deployments`),getStatefulSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets`),getDaemonSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets`),getStatefulSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}`),getDaemonSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}`),scaleStatefulSet:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/scale`,{replicas:a}),restartStatefulSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/restart`,{}),restartDaemonSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}/restart`,{}),getReplicaSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/replicasets`),getDeploymentRevisions:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments/${t}/revisions`),rollbackDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/rollback`,{revision:a}),getDeployment:async(e,s,t)=>{try{return await n.get(`/kLine truncated
@@ -1 +1 @@
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as n}from"./index-EF2TDvxx.js";function a({className:e,type:i,...r}){return t.jsx("input",{"code-path":"src/components/ui/input.tsx:7:5",type:i,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}export{a as I};
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as n}from"./index-LZWfu62c.js";function a({className:e,type:i,...r}){return t.jsx("input",{"code-path":"src/components/ui/input.tsx:7:5",type:i,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}export{a as I};
@@ -1 +1 @@
import{r as i,j as o}from"./vendor-codemirror-C7mXSpXt.js";import{a7 as c,m}from"./index-EF2TDvxx.js";var f=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],b=f.reduce((a,e)=>{const t=c(`Primitive.${e}`),r=i.forwardRef((l,n)=>{const{asChild:d,...u}=l,p=d?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...u,ref:n})});return r.displayName=`Primitive.${e}`,{...a,[e]:r}},{}),x="Label",s=i.forwardRef((a,e)=>o.jsx(b.label,{...a,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(a.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName=x;var v=s;function y({className:a,...e}){return o.jsx(v,{"code-path":"src/components/ui/label.tsx:13:5","data-slot":"label",className:m("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...e})}export{y as L};
import{r as i,j as o}from"./vendor-codemirror-C7mXSpXt.js";import{a7 as c,m}from"./index-LZWfu62c.js";var f=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],b=f.reduce((a,e)=>{const t=c(`Primitive.${e}`),r=i.forwardRef((l,n)=>{const{asChild:d,...u}=l,p=d?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...u,ref:n})});return r.displayName=`Primitive.${e}`,{...a,[e]:r}},{}),x="Label",s=i.forwardRef((a,e)=>o.jsx(b.label,{...a,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(a.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName=x;var v=s;function y({className:a,...e}){return o.jsx(v,{"code-path":"src/components/ui/label.tsx:13:5","data-slot":"label",className:m("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...e})}export{y as L};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const p={getTargets:e=>t.get("/metrics/targets",e),getNames:()=>t.get("/metrics/names"),query:e=>t.get("/metrics/query",e)},r={getStats:()=>t.get("/snmp/stats"),getDevices:()=>t.get("/snmp/devices"),createDevice:e=>t.post("/snmp/devices",e),deleteDevice:e=>t.delete(`/snmp/devices/${e}`)},a={connect:e=>t.post("/prometheus/connect",{url:e}),dashboard:(e,s)=>t.post("/prometheus/dashboard",{url:e,type:s})},n={connect:(e,s,c)=>t.post("/zabbix/connect",{url:e,username:s,password:c})};export{p as m,a as p,r as s,n as z};
import{h as t}from"./index-LZWfu62c.js";const p={getTargets:e=>t.get("/metrics/targets",e),getNames:()=>t.get("/metrics/names"),query:e=>t.get("/metrics/query",e)},r={getStats:()=>t.get("/snmp/stats"),getDevices:()=>t.get("/snmp/devices"),createDevice:e=>t.post("/snmp/devices",e),deleteDevice:e=>t.delete(`/snmp/devices/${e}`)},a={connect:e=>t.post("/prometheus/connect",{url:e}),dashboard:(e,s)=>t.post("/prometheus/dashboard",{url:e,type:s})},n={connect:(e,s,c)=>t.post("/zabbix/connect",{url:e,username:s,password:c})};export{p as m,a as p,r as s,n as z};
@@ -1 +1 @@
import{h as s}from"./index-EF2TDvxx.js";const i={getPipelines:async e=>s.get("/pipelines",e),getPipelineDetail:async e=>s.get(`/pipelines/${e}`),createPipeline:async e=>s.post("/pipelines",e),updatePipeline:async(e,p)=>s.put(`/pipelines/${e}`,p),deletePipeline:async e=>s.delete(`/pipelines/${e}`),triggerPipeline:async e=>s.post(`/pipelines/${e}/trigger`),getRuns:async e=>s.get(`/pipelines/${e}/runs`),stopRun:async(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`),getRunLog:async(e,p)=>s.get(`/pipelines/${e}/runs/${p}/log`),getMembers:async e=>s.get(`/pipelines/${e}/members`),addMember:async(e,p)=>s.post(`/pipelines/${e}/members`,p),removeMember:async(e,p)=>s.delete(`/pipelines/${e}/members/${p}`),assignGroup:async(e,p)=>s.post(`/pipelines/${e}/groups`,p),getByCode:e=>s.get(`/pipelines/${e}`),getRunsByCode:(e,p=50)=>s.get(`/pipelines/${e}/runs`,{page_size:p}),triggerByCode:e=>s.post(`/pipelines/${e}/trigger`,{}),stopRunByCode:(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`,{}),batchDeleteRuns:(e,p)=>s.post(`/pipelines/${e}/runs/batch-delete`,{ids:p}),getRunLogStream:e=>s.get(`/pipelines/runs/${e}/log-stream`),getQueue:e=>s.get(`/pipelines/${e}/queue`),removeFromQueue:(e,p)=>s.delete(`/pipelines/${e}/queue/${p}`),getWorkspace:e=>s.get(`/pipelines/runs/${e}/workspace`),listRunFiles:(e,p)=>s.get(`/pipelines/runs/${e}/files`,p?{path:p}:void 0)};export{i as p};
import{h as s}from"./index-LZWfu62c.js";const i={getPipelines:async e=>s.get("/pipelines",e),getPipelineDetail:async e=>s.get(`/pipelines/${e}`),createPipeline:async e=>s.post("/pipelines",e),updatePipeline:async(e,p)=>s.put(`/pipelines/${e}`,p),deletePipeline:async e=>s.delete(`/pipelines/${e}`),triggerPipeline:async e=>s.post(`/pipelines/${e}/trigger`),getRuns:async e=>s.get(`/pipelines/${e}/runs`),stopRun:async(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`),getRunLog:async(e,p)=>s.get(`/pipelines/${e}/runs/${p}/log`),getMembers:async e=>s.get(`/pipelines/${e}/members`),addMember:async(e,p)=>s.post(`/pipelines/${e}/members`,p),removeMember:async(e,p)=>s.delete(`/pipelines/${e}/members/${p}`),assignGroup:async(e,p)=>s.post(`/pipelines/${e}/groups`,p),getByCode:e=>s.get(`/pipelines/${e}`),getRunsByCode:(e,p=50)=>s.get(`/pipelines/${e}/runs`,{page_size:p}),triggerByCode:e=>s.post(`/pipelines/${e}/trigger`,{}),stopRunByCode:(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`,{}),batchDeleteRuns:(e,p)=>s.post(`/pipelines/${e}/runs/batch-delete`,{ids:p}),getRunLogStream:e=>s.get(`/pipelines/runs/${e}/log-stream`),getQueue:e=>s.get(`/pipelines/${e}/queue`),removeFromQueue:(e,p)=>s.delete(`/pipelines/${e}/queue/${p}`),getWorkspace:e=>s.get(`/pipelines/runs/${e}/workspace`),listRunFiles:(e,p)=>s.get(`/pipelines/runs/${e}/files`,p?{path:p}:void 0)};export{i as p};
@@ -1 +1 @@
import{h as r}from"./index-EF2TDvxx.js";const p={list:async()=>r.get("/platforms"),create:async t=>r.post("/platforms",t),update:async(t,e)=>r.put(`/platforms/${t}`,e),delete:async t=>r.delete(`/platforms/${t}`)};export{p};
import{h as r}from"./index-LZWfu62c.js";const p={list:async()=>r.get("/platforms"),create:async t=>r.post("/platforms",t),update:async(t,e)=>r.put(`/platforms/${t}`,e),delete:async t=>r.delete(`/platforms/${t}`)};export{p};
@@ -1 +1 @@
import{h as t}from"./index-EF2TDvxx.js";const s={list:async()=>t.get("/regions"),create:async e=>t.post("/regions",e),update:async(e,r)=>t.put(`/regions/${e}`,r),delete:async e=>t.delete(`/regions/${e}`),batchDelete:async e=>t.delete("/regions/batch-delete",{ids:e})};export{s as r};
import{h as t}from"./index-LZWfu62c.js";const s={list:async()=>t.get("/regions"),create:async e=>t.post("/regions",e),update:async(e,r)=>t.put(`/regions/${e}`,r),delete:async e=>t.delete(`/regions/${e}`),batchDelete:async e=>t.delete("/regions/batch-delete",{ids:e})};export{s as r};
@@ -1 +1 @@
import{r as n,j as l}from"./vendor-codemirror-C7mXSpXt.js";import{O as ot,Q as Ee,J as nt,v as be,T as rt,r as st,K as Ie,U as lt,w as L,V as at,s as j,x as P,W as $,X as ct,Y as Re,Z as it,_ as dt,$ as ut,a0 as pt,a1 as ft,a2 as mt,a3 as ht,a4 as gt,a5 as Pe,a6 as vt,m as te}from"./index-EF2TDvxx.js";import{u as xt}from"./index-CYARH0Cq.js";import{Q as _e,w as St,O as wt}from"./vendor-icons-Aso0-eeY.js";function yt(t){const o=Ct(t),e=n.forwardRef((s,r)=>{const{children:d,...a}=s,c=n.Children.toArray(d),i=c.find(Tt);if(i){const p=i.props.children,g=c.map(x=>x===i?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return l.jsx(o,{...a,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return l.jsx(o,{...a,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function Ct(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const a=Pt(r),c=bt(d,r.props);return r.type!==n.Fragment&&(c.ref=s?ot(s,a):a),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var It=Symbol("radix.slottable");function Tt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===It}function bt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...c)=>{const i=d(...c);return r(...c),i}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Pt(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Et=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],Q="Select",[ie,de,_t]=lt(Q),[oe]=st(Q,[_t,Ee]),ue=Ee(),[Nt,G]=oe(Q),[jt,Mt]=oe(Q),Ne=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:a,defaultValue:c,onValueChange:i,dir:p,name:g,autoComplete:x,disabled:E,required:T,form:C}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=nt(p),[R,A]=be({prop:s,defaultProp:r??!1,onChange:d,caller:Q}),[U,Z]=be({prop:a,defaultProp:c,onChange:i,caller:Q}),k=n.useRef(null),V=h?C||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(_=>_.props.value).join(";");return l.jsx(rt,{...u,children:l.jsxs(Nt,{required:T,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:Z,open:R,onOpenChange:A,dir:ne,triggerPointerDownPosRef:k,disabled:E,children:[l.jsx(ie.Provider,{scope:o,children:l.jsx(jt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(_=>{B(D=>new Set(D).add(_))},[]),onNativeOptionRemove:n.useCallback(_=>{B(D=>{const W=new Set(D);return W.delete(_),W})},[]),children:e})}),V?l.jsxs(Qe,{"aria-hidden":!0,required:T,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:_=>Z(_.target.value),disabled:E,form:C,children:[U===void 0?l.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};Ne.displayName=Q;var je="SelectTrigger",Me=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),a=G(je,e),c=a.disabled||s,i=L(o,a.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,E,T]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===a.value),m=tt(h,u,S);m!==void 0&&a.onValueChange(m.value)}),C=u=>{c||(a.onOpenChange(!0),T()),u&&(a.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return l.jsx(at,{asChild:!0,...d,children:l.jsx(j.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Je(a.value)?"":void 0,...r,ref:i,onClick:P(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&C(u)}),onPointerDown:P(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(C(u),u.preventDefault())}),onKeyDown:P(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&E(u.key),!(h&&u.key===" ")&&Et.includes(u.key)&&(C(),u.preventDefault())})})})});Me.displayName=je;var Oe="SelectValue",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:a="",...c}=t,i=G(Oe,e),{onValueNodeHasChildrenChange:p}=i,g=d!==void 0,x=L(o,i.onValueNodeChange);return $(()=>{p(g)},[p,g]),l.jsx(j.span,{...c,ref:x,style:{pointerEvents:"none"},children:Je(i.value)?l.jsx(l.Fragment,{children:a}):d})});Ae.displayName=Oe;var Ot="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return l.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Ot;var At="SelectPorLine truncated
import{r as n,j as l}from"./vendor-codemirror-C7mXSpXt.js";import{O as ot,Q as Ee,J as nt,v as be,T as rt,r as st,K as Ie,U as lt,w as L,V as at,s as j,x as P,W as $,X as ct,Y as Re,Z as it,_ as dt,$ as ut,a0 as pt,a1 as ft,a2 as mt,a3 as ht,a4 as gt,a5 as Pe,a6 as vt,m as te}from"./index-LZWfu62c.js";import{u as xt}from"./index-CYARH0Cq.js";import{Q as _e,w as St,O as wt}from"./vendor-icons-Aso0-eeY.js";function yt(t){const o=Ct(t),e=n.forwardRef((s,r)=>{const{children:d,...a}=s,c=n.Children.toArray(d),i=c.find(Tt);if(i){const p=i.props.children,g=c.map(x=>x===i?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return l.jsx(o,{...a,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return l.jsx(o,{...a,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function Ct(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const a=Pt(r),c=bt(d,r.props);return r.type!==n.Fragment&&(c.ref=s?ot(s,a):a),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var It=Symbol("radix.slottable");function Tt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===It}function bt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...c)=>{const i=d(...c);return r(...c),i}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Pt(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Et=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],Q="Select",[ie,de,_t]=lt(Q),[oe]=st(Q,[_t,Ee]),ue=Ee(),[Nt,G]=oe(Q),[jt,Mt]=oe(Q),Ne=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:a,defaultValue:c,onValueChange:i,dir:p,name:g,autoComplete:x,disabled:E,required:T,form:C}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=nt(p),[R,A]=be({prop:s,defaultProp:r??!1,onChange:d,caller:Q}),[U,Z]=be({prop:a,defaultProp:c,onChange:i,caller:Q}),k=n.useRef(null),V=h?C||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(_=>_.props.value).join(";");return l.jsx(rt,{...u,children:l.jsxs(Nt,{required:T,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:Z,open:R,onOpenChange:A,dir:ne,triggerPointerDownPosRef:k,disabled:E,children:[l.jsx(ie.Provider,{scope:o,children:l.jsx(jt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(_=>{B(D=>new Set(D).add(_))},[]),onNativeOptionRemove:n.useCallback(_=>{B(D=>{const W=new Set(D);return W.delete(_),W})},[]),children:e})}),V?l.jsxs(Qe,{"aria-hidden":!0,required:T,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:_=>Z(_.target.value),disabled:E,form:C,children:[U===void 0?l.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};Ne.displayName=Q;var je="SelectTrigger",Me=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),a=G(je,e),c=a.disabled||s,i=L(o,a.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,E,T]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===a.value),m=tt(h,u,S);m!==void 0&&a.onValueChange(m.value)}),C=u=>{c||(a.onOpenChange(!0),T()),u&&(a.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return l.jsx(at,{asChild:!0,...d,children:l.jsx(j.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Je(a.value)?"":void 0,...r,ref:i,onClick:P(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&C(u)}),onPointerDown:P(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(C(u),u.preventDefault())}),onKeyDown:P(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&E(u.key),!(h&&u.key===" ")&&Et.includes(u.key)&&(C(),u.preventDefault())})})})});Me.displayName=je;var Oe="SelectValue",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:a="",...c}=t,i=G(Oe,e),{onValueNodeHasChildrenChange:p}=i,g=d!==void 0,x=L(o,i.onValueNodeChange);return $(()=>{p(g)},[p,g]),l.jsx(j.span,{...c,ref:x,style:{pointerEvents:"none"},children:Je(i.value)?l.jsx(l.Fragment,{children:a}):d})});Ae.displayName=Oe;var Ot="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return l.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Ot;var At="SelectPorLine truncated
@@ -1 +1 @@
import{h as r}from"./index-EF2TDvxx.js";const o={getServers:async e=>r.get("/servers",e),getServerDetail:async e=>r.get(`/servers/${e}`),getServerStats:async()=>r.get("/servers/stats"),createServer:async e=>r.post("/servers",e),updateServer:async(e,t)=>r.put(`/servers/${e}`,t),deleteServer:async e=>r.delete(`/servers/${e}`),batchDelete:async e=>r.post("/servers/batch-delete",{ids:e}),batchCreate:async e=>r.post("/servers/batch",e),getMetrics:async e=>r.get("/dashboard/metrics"),installAgent:async(e,t,n)=>{const s={token:t};return n&&Object.assign(s,n),r.post(`/servers/${e}/install-agent`,s)},batchInstallAgent:async(e,t)=>r.post(`/servers/install-agent?token=${encodeURIComponent(t)}`,{server_ids:e}),listFiles:async(e,t)=>r.get(`/servers/${e}/files?path=${encodeURIComponent(t)}`),downloadFile:async(e,t)=>r.download(`/servers/${e}/files/download?path=${encodeURIComponent(t)}`),uploadFile:async(e,t,n)=>{const s=new FormData;return s.append("file",n),r.upload(`/servers/${e}/files/upload?path=${encodeURIComponent(t)}`,s)},deleteFile:async(e,t)=>r.delete(`/servers/${e}/files?path=${encodeURIComponent(t)}`),mkdir:async(e,t)=>r.post(`/servers/${e}/files/mkdir`,{path:t})};export{o as s};
import{h as r}from"./index-LZWfu62c.js";const o={getServers:async e=>r.get("/servers",e),getServerDetail:async e=>r.get(`/servers/${e}`),getServerStats:async()=>r.get("/servers/stats"),createServer:async e=>r.post("/servers",e),updateServer:async(e,t)=>r.put(`/servers/${e}`,t),deleteServer:async e=>r.delete(`/servers/${e}`),batchDelete:async e=>r.post("/servers/batch-delete",{ids:e}),batchCreate:async e=>r.post("/servers/batch",e),getMetrics:async e=>r.get("/dashboard/metrics"),installAgent:async(e,t,n)=>{const s={token:t};return n&&Object.assign(s,n),r.post(`/servers/${e}/install-agent`,s)},batchInstallAgent:async(e,t)=>r.post(`/servers/install-agent?token=${encodeURIComponent(t)}`,{server_ids:e}),listFiles:async(e,t)=>r.get(`/servers/${e}/files?path=${encodeURIComponent(t)}`),downloadFile:async(e,t)=>r.download(`/servers/${e}/files/download?path=${encodeURIComponent(t)}`),uploadFile:async(e,t,n)=>{const s=new FormData;return s.append("file",n),r.upload(`/servers/${e}/files/upload?path=${encodeURIComponent(t)}`,s)},deleteFile:async(e,t)=>r.delete(`/servers/${e}/files?path=${encodeURIComponent(t)}`),mkdir:async(e,t)=>r.post(`/servers/${e}/files/mkdir`,{path:t})};export{o as s};
@@ -1 +1 @@
import{h as s}from"./index-EF2TDvxx.js";const r={getStats:async()=>s.get("/site/stats"),getTasks:async()=>s.get("/site/tasks"),createTask:async t=>s.post("/site/tasks",t),deleteTask:async t=>s.delete(`/site/tasks/${t}`),toggleTask:async(t,e)=>s.put(`/site/tasks/${t}`,{enabled:e})};export{r as s};
import{h as s}from"./index-LZWfu62c.js";const r={getStats:async()=>s.get("/site/stats"),getTasks:async()=>s.get("/site/tasks"),createTask:async t=>s.post("/site/tasks",t),deleteTask:async t=>s.delete(`/site/tasks/${t}`),toggleTask:async(t,e)=>s.put(`/site/tasks/${t}`,{enabled:e})};export{r as s};
@@ -1 +1 @@
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as r}from"./index-EF2TDvxx.js";const o={blue:{text:"text-blue-400",bg:"bg-blue-500/20"},emerald:{text:"text-emerald-400",bg:"bg-emerald-500/20"},amber:{text:"text-amber-400",bg:"bg-amber-500/20"},red:{text:"text-red-400",bg:"bg-red-500/20"},purple:{text:"text-purple-400",bg:"bg-purple-500/20"},cyan:{text:"text-cyan-400",bg:"bg-cyan-500/20"},muted:{text:"text-[var(--dg-text-secondary)]",bg:"bg-[var(--dg-bg-tertiary)]"}};function d({items:c,className:n}){return t.jsx("div",{"code-path":"src/components/ui/stat-strip.tsx:29:5",className:r("flex items-center gap-1.5 px-3 py-2 rounded-lg","bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]","overflow-x-auto",n),children:c.map((e,s)=>{const a=o[e.color||"muted"]||o.muted;return t.jsxs("div",{"code-path":"src/components/ui/stat-strip.tsx:38:11",className:"flex items-center gap-1.5 shrink-0",children:[s>0&&t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:40:15",className:"w-px h-5 bg-[var(--dg-border)] mx-1 shrink-0"}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:42:13",className:r("w-1.5 h-1.5 rounded-full shrink-0",a.bg.replace("/20","").replace("bg-","bg-")||"bg-slate-500"),style:{backgroundColor:e.color?.startsWith("#")?e.color:void 0}}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:48:13",className:"text-xs text-[var(--dg-text-muted)]",children:e.label}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:49:13",className:r("text-sm font-semibold",a.text),children:e.value})]},s)})})}export{d as S};
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as r}from"./index-LZWfu62c.js";const o={blue:{text:"text-blue-400",bg:"bg-blue-500/20"},emerald:{text:"text-emerald-400",bg:"bg-emerald-500/20"},amber:{text:"text-amber-400",bg:"bg-amber-500/20"},red:{text:"text-red-400",bg:"bg-red-500/20"},purple:{text:"text-purple-400",bg:"bg-purple-500/20"},cyan:{text:"text-cyan-400",bg:"bg-cyan-500/20"},muted:{text:"text-[var(--dg-text-secondary)]",bg:"bg-[var(--dg-bg-tertiary)]"}};function d({items:c,className:n}){return t.jsx("div",{"code-path":"src/components/ui/stat-strip.tsx:29:5",className:r("flex items-center gap-1.5 px-3 py-2 rounded-lg","bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]","overflow-x-auto",n),children:c.map((e,s)=>{const a=o[e.color||"muted"]||o.muted;return t.jsxs("div",{"code-path":"src/components/ui/stat-strip.tsx:38:11",className:"flex items-center gap-1.5 shrink-0",children:[s>0&&t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:40:15",className:"w-px h-5 bg-[var(--dg-border)] mx-1 shrink-0"}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:42:13",className:r("w-1.5 h-1.5 rounded-full shrink-0",a.bg.replace("/20","").replace("bg-","bg-")||"bg-slate-500"),style:{backgroundColor:e.color?.startsWith("#")?e.color:void 0}}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:48:13",className:"text-xs text-[var(--dg-text-muted)]",children:e.label}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:49:13",className:r("text-sm font-semibold",a.text),children:e.value})]},s)})})}export{d as S};
@@ -1 +1 @@
import{r as o,j as a}from"./vendor-codemirror-C7mXSpXt.js";import{w as C,v as T,r as I,s as y,x as M,y as H,m as g}from"./index-EF2TDvxx.js";import{u as z}from"./index-CYARH0Cq.js";var m="Switch",[A]=I(m),[U,q]=A(m),P=o.forwardRef((e,r)=>{const{__scopeSwitch:t,name:n,checked:s,defaultChecked:b,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=o.useState(null),v=C(r,f=>p(f)),x=o.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:s,defaultProp:b??!1,onChange:w,caller:m});return a.jsxs(U,{scope:t,checked:h,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&a.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",R=o.forwardRef((e,r)=>{const{__scopeSwitch:t,...n}=e,s=q(E,t);return a.jsx(y.span,{"data-state":_(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:r})});R.displayName=E;var L="SwitchBubbleInput",j=o.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:n=!0,...s},b)=>{const d=o.useRef(null),c=C(d,b),u=z(t),w=H(r);return o.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:c,style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function $({className:e,...r}){return a.jsx(O,{"code-path":"src/components/ui/switch.tsx:13:5","data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:a.jsx(D,{"code-path":"src/components/ui/switch.tsx:21:7","data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{$ as S};
import{r as o,j as a}from"./vendor-codemirror-C7mXSpXt.js";import{w as C,v as T,r as I,s as y,x as M,y as H,m as g}from"./index-LZWfu62c.js";import{u as z}from"./index-CYARH0Cq.js";var m="Switch",[A]=I(m),[U,q]=A(m),P=o.forwardRef((e,r)=>{const{__scopeSwitch:t,name:n,checked:s,defaultChecked:b,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=o.useState(null),v=C(r,f=>p(f)),x=o.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:s,defaultProp:b??!1,onChange:w,caller:m});return a.jsxs(U,{scope:t,checked:h,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&a.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",R=o.forwardRef((e,r)=>{const{__scopeSwitch:t,...n}=e,s=q(E,t);return a.jsx(y.span,{"data-state":_(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:r})});R.displayName=E;var L="SwitchBubbleInput",j=o.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:n=!0,...s},b)=>{const d=o.useRef(null),c=C(d,b),u=z(t),w=H(r);return o.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:c,style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function $({className:e,...r}){return a.jsx(O,{"code-path":"src/components/ui/switch.tsx:13:5","data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:a.jsx(D,{"code-path":"src/components/ui/switch.tsx:21:7","data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{$ as S};
@@ -1 +1 @@
import{j as a}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-EF2TDvxx.js";function r({className:t,...e}){return a.jsx("div",{"code-path":"src/components/ui/table.tsx:7:5","data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"code-path":"src/components/ui/table.tsx:11:7","data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function c({className:t,...e}){return a.jsx("thead",{"code-path":"src/components/ui/table.tsx:22:5","data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function n({className:t,...e}){return a.jsx("tbody",{"code-path":"src/components/ui/table.tsx:32:5","data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a.jsx("tr",{"code-path":"src/components/ui/table.tsx:55:5","data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function b({className:t,...e}){return a.jsx("th",{"code-path":"src/components/ui/table.tsx:68:5","data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function i({className:t,...e}){return a.jsx("td",{"code-path":"src/components/ui/table.tsx:81:5","data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}export{r as T,c as a,d as b,b as c,n as d,i as e};
import{j as a}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-LZWfu62c.js";function r({className:t,...e}){return a.jsx("div",{"code-path":"src/components/ui/table.tsx:7:5","data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"code-path":"src/components/ui/table.tsx:11:7","data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function c({className:t,...e}){return a.jsx("thead",{"code-path":"src/components/ui/table.tsx:22:5","data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function n({className:t,...e}){return a.jsx("tbody",{"code-path":"src/components/ui/table.tsx:32:5","data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a.jsx("tr",{"code-path":"src/components/ui/table.tsx:55:5","data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function b({className:t,...e}){return a.jsx("th",{"code-path":"src/components/ui/table.tsx:68:5","data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function i({className:t,...e}){return a.jsx("td",{"code-path":"src/components/ui/table.tsx:81:5","data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}export{r as T,c as a,d as b,b as c,n as d,i as e};
@@ -1 +1 @@
import{r as b,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{J as M,v as P,r as S,K as k,s as p,M as h,R as F,N as $,x as m,P as D,m as g}from"./index-EF2TDvxx.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),j=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(p.div,{dir:i,"data-orientation":o,...f,ref:t})})});j.displayName=x;var y="TabsList",I=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(y,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});I.displayName=y;var _="TabsTrigger",N=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(_,c),u=C(c),v=A(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx($,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});N.displayName=_;var R="TabsContent",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(R,c),v=A(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx(D,{present:r||i,children:({present:l})=>s.jsx(p.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});w.displayName=R;function A(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=j,K=I,z=N,B=w;function J({className:e,...t}){return s.jsx(L,{"code-path":"src/components/ui/tabs.tsx:13:5","data-slot":"tabs",className:g("flex flex-col gap-2",e),...t})}function O({className:e,...t}){return s.jsx(K,{"code-path":"src/components/ui/tabs.tsx:26:5","data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(z,{"code-path":"src/components/ui/tabs.tsx:42:5","data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function U({className:e,...t}){return s.jsx(B,{"code-path":"src/components/ui/tabs.tsx:58:5","data-slot":"tabs-content",className:g("flex-1 outline-none",e),...t})}export{J as T,O as a,Q as b,U as c};
import{r as b,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{J as M,v as P,r as S,K as k,s as p,M as h,R as F,N as $,x as m,P as D,m as g}from"./index-LZWfu62c.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),j=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(p.div,{dir:i,"data-orientation":o,...f,ref:t})})});j.displayName=x;var y="TabsList",I=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(y,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});I.displayName=y;var _="TabsTrigger",N=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(_,c),u=C(c),v=A(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx($,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});N.displayName=_;var R="TabsContent",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(R,c),v=A(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx(D,{present:r||i,children:({present:l})=>s.jsx(p.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});w.displayName=R;function A(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=j,K=I,z=N,B=w;function J({className:e,...t}){return s.jsx(L,{"code-path":"src/components/ui/tabs.tsx:13:5","data-slot":"tabs",className:g("flex flex-col gap-2",e),...t})}function O({className:e,...t}){return s.jsx(K,{"code-path":"src/components/ui/tabs.tsx:26:5","data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(z,{"code-path":"src/components/ui/tabs.tsx:42:5","data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function U({className:e,...t}){return s.jsx(B,{"code-path":"src/components/ui/tabs.tsx:58:5","data-slot":"tabs-content",className:g("flex-1 outline-none",e),...t})}export{J as T,O as a,Q as b,U as c};
@@ -1 +1 @@
import{h as e}from"./index-EF2TDvxx.js";const t={list:async s=>e.get("/terminal-sessions",s),get:async s=>e.get(`/terminal-sessions/${s}`),getRecord:async s=>e.get(`/terminal-sessions/${s}/record`),kill:async s=>e.post(`/terminal-sessions/${s}/kill`),download:async s=>e.download(`/terminal-sessions/${s}/download`,`session-${s}.cast`),delete:async s=>e.delete(`/terminal-sessions/${s}`),batchDelete:async s=>e.post("/terminal-sessions/batch-delete",{ids:s})},o={list:async s=>e.get("/session-commands",s)},a={list:async s=>e.get("/login-logs",s)};export{a as l,o as s,t};
import{h as e}from"./index-LZWfu62c.js";const t={list:async s=>e.get("/terminal-sessions",s),get:async s=>e.get(`/terminal-sessions/${s}`),getRecord:async s=>e.get(`/terminal-sessions/${s}/record`),kill:async s=>e.post(`/terminal-sessions/${s}/kill`),download:async s=>e.download(`/terminal-sessions/${s}/download`,`session-${s}.cast`),delete:async s=>e.delete(`/terminal-sessions/${s}`),batchDelete:async s=>e.post("/terminal-sessions/batch-delete",{ids:s})},o={list:async s=>e.get("/session-commands",s)},a={list:async s=>e.get("/login-logs",s)};export{a as l,o as s,t};
@@ -1 +1 @@
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as i}from"./index-EF2TDvxx.js";function n({className:e,...r}){return t.jsx("textarea",{"code-path":"src/components/ui/textarea.tsx:7:5","data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}export{n as T};
import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as i}from"./index-LZWfu62c.js";function n({className:e,...r}){return t.jsx("textarea",{"code-path":"src/components/ui/textarea.tsx:7:5","data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}export{n as T};
@@ -1 +1 @@
import{z as G,ai as L,aj as l,A as M,ak as y,H as Q,al as x,am as N,an as J,ao as C,ap as X,aq as Y,ar as j,F as W,I as V,G as Z}from"./index-EF2TDvxx.js";import{r as f}from"./vendor-codemirror-C7mXSpXt.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=L(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#m;#l;#f;#o;#h;#n;#d=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),B(this.#t,this.options)?this.#c():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!M(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#R(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Q)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(x.isServer()||this.#e.isStale||!N(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#R(t){this.#S(),this.#n=t,!(x.isServer()||l(this.options.enabled,this.#t)===!1||!N(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#y(){this.#b(),this.#R(this.#v())}#g(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,n=this.#u,b=t!==s?t.state:this.#p,{state:h}=t;let a={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),R=!c&&B(t,e),S=c&&H(t,s,e,r);(R||S)&&(a={...a,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:g,errorUpdatedAt:D,status:m}=a;o=a.data;let F=!1;if(e.placeholderData!==void 0&&o===void 0&&m==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(c=i.data,F=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,c!==void 0&&(m="success",o=j(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!F)if(i&&o===u?.data&&e.select===this.#m)o=this.#l;else try{this.#m=e.select,o=e.select(o),o=j(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(g=this.#i,o=this.#l,D=Date.now(),m="error");const I=a.fetchStatus==="fetching",T=m==="pending",w=m==="error",U=T&&I,k=o!==void 0,p={status:m,fetchStatus:a.fetchStatus,isPending:T,isSuccess:m==="success",isError:w,isInitialLoading:U,isLoading:U,data:o,dataUpdatedAt:a.dataUpdatedAt,error:g,errorUpdatedAt:D,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>b.dataUpdateCount||a.errorUpdateCount>b.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:a.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isELine truncated
import{z as G,ai as L,aj as l,A as M,ak as y,H as Q,al as x,am as N,an as J,ao as C,ap as X,aq as Y,ar as j,F as W,I as V,G as Z}from"./index-LZWfu62c.js";import{r as f}from"./vendor-codemirror-C7mXSpXt.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=L(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#m;#l;#f;#o;#h;#n;#d=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),B(this.#t,this.options)?this.#c():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!M(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#R(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Q)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(x.isServer()||this.#e.isStale||!N(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#R(t){this.#S(),this.#n=t,!(x.isServer()||l(this.options.enabled,this.#t)===!1||!N(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#y(){this.#b(),this.#R(this.#v())}#g(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,n=this.#u,b=t!==s?t.state:this.#p,{state:h}=t;let a={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),R=!c&&B(t,e),S=c&&H(t,s,e,r);(R||S)&&(a={...a,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:g,errorUpdatedAt:D,status:m}=a;o=a.data;let F=!1;if(e.placeholderData!==void 0&&o===void 0&&m==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(c=i.data,F=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,c!==void 0&&(m="success",o=j(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!F)if(i&&o===u?.data&&e.select===this.#m)o=this.#l;else try{this.#m=e.select,o=e.select(o),o=j(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(g=this.#i,o=this.#l,D=Date.now(),m="error");const I=a.fetchStatus==="fetching",T=m==="pending",w=m==="error",U=T&&I,k=o!==void 0,p={status:m,fetchStatus:a.fetchStatus,isPending:T,isSuccess:m==="success",isError:w,isInitialLoading:U,isLoading:U,data:o,dataUpdatedAt:a.dataUpdatedAt,error:g,errorUpdatedAt:D,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>b.dataUpdateCount||a.errorUpdateCount>b.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:a.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isELine truncated
@@ -1 +1 @@
import{r as o}from"./vendor-codemirror-C7mXSpXt.js";import{z as l,A as d,C as a,E as p,F as h,G as m,H as b,I as v}from"./index-EF2TDvxx.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function C(t,s){const r=m(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(b)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{C as u};
import{r as o}from"./vendor-codemirror-C7mXSpXt.js";import{z as l,A as d,C as a,E as p,F as h,G as m,H as b,I as v}from"./index-LZWfu62c.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function C(t,s){const r=m(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(b)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{C as u};
+2 -2
View File
@@ -7,10 +7,10 @@
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="theme-color" content="#1e6feb" />
<title>AIOps智能运维平台</title>
<script type="module" crossorigin src="/assets/index-EF2TDvxx.js"></script>
<script type="module" crossorigin src="/assets/index-LZWfu62c.js"></script>
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-C7mXSpXt.js">
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-Aso0-eeY.js">
<link rel="stylesheet" crossorigin href="/assets/index-7YeEJX-w.css">
<link rel="stylesheet" crossorigin href="/assets/index-BzYDIT5o.css">
</head>
<body>
<div id="root"></div>
@@ -1,23 +1,23 @@
// DeploymentEditStorage.tsx — 编辑器「存储挂载」Tab
// Kuboard 风格:左侧定义数据卷 / 右侧挂载到容器
// 支持 6 种卷类型:PVC / EmptyDir / HostPath / NFS / ConfigMap / Secret
// DeploymentEditStorage — 存储挂载 Tab(Kuboard 一卷一卡:定义卷 + 挂载同屏)// Logan.Li
import { useState, useEffect } from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
import { Select, SelectContent, SelectItem, SelectTrigger} from '@/components/ui/select';
import { Select, SelectContent, SelectItem, SelectTrigger } from '@/components/ui/select';
import {
Plus, Trash2, Save, Loader2, HardDrive, Database, Folder, Lock, File, Disc, Server,
Plus, Trash2, Save, Loader2, HardDrive, Database, Folder, Lock, File, Disc, Server, Container,
} from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
import { saveDeploymentManifest } from './deployment-manifest-save';
import {
type VolumeForm,
type MountForm,
parseStorageFromManifest,
type VolumeEntry,
parseVolumeEntries,
applyStorageToManifest,
formToVolume,
volumeEntriesToStorage,
emptyVolumeEntry,
} from './deployment-volume-utils';
interface Props {
@@ -29,72 +29,149 @@ interface Props {
onCancel: () => void;
}
const VOLUME_TYPES: { key: VolumeForm['type']; label: string; icon: typeof HardDrive; color: string; desc: string }[] = [
{ key: 'persistentVolumeClaim', label: '存储卷声明', icon: Database, color: 'text-emerald-400', desc: 'PVC' },
{ key: 'emptyDir', label: '临时目录', icon: Disc, color: 'text-slate-400', desc: 'EmptyDir' },
{ key: 'hostPath', label: 'HostPath', icon: HardDrive, color: 'text-amber-400', desc: '主机路径' },
{ key: 'nfs', label: 'NFS', icon: Server, color: 'text-purple-400', desc: '网络存储' },
{ key: 'configMap', label: '配置字典', icon: File, color: 'text-blue-400', desc: 'ConfigMap' },
{ key: 'secret', label: '密文', icon: Lock, color: 'text-rose-400', desc: 'Secret' },
const VOLUME_TYPES: { key: VolumeForm['type']; label: string; icon: typeof HardDrive; color: string }[] = [
{ key: 'persistentVolumeClaim', label: '存储卷声明', icon: Database, color: 'text-emerald-400' },
{ key: 'emptyDir', label: '临时目录', icon: Disc, color: 'text-slate-400' },
{ key: 'hostPath', label: 'HostPath', icon: HardDrive, color: 'text-amber-400' },
{ key: 'nfs', label: 'NFS', icon: Server, color: 'text-purple-400' },
{ key: 'configMap', label: '配置字典', icon: File, color: 'text-blue-400' },
{ key: 'secret', label: '密文', icon: Lock, color: 'text-rose-400' },
];
function VolumeTypeFields({ vol, onChange }: { vol: VolumeForm; onChange: (p: Partial<VolumeForm>) => void }) {
if (vol.type === 'persistentVolumeClaim') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">PVC 名称</span>
<Input value={vol.pvcName || ''} onChange={(e) => onChange({ pvcName: e.target.value })}
placeholder="如 data-pvc" className="h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<label className="flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap">
<input type="checkbox" checked={!!vol.pvcReadOnly} onChange={(e) => onChange({ pvcReadOnly: e.target.checked })} className="accent-blue-500" />
卷只读
</label>
</div>
);
}
if (vol.type === 'emptyDir') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">介质</span>
<select value={vol.medium || ''} onChange={(e) => onChange({ medium: e.target.value })}
className="h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5">
<option value="">默认磁盘</option>
<option value="Memory">Memory</option>
</select>
<Input value={vol.sizeLimit || ''} onChange={(e) => onChange({ sizeLimit: e.target.value })}
placeholder="sizeLimit 如 512Mi" className="h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
);
}
if (vol.type === 'hostPath') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">主机路径</span>
<Input value={vol.path || ''} onChange={(e) => onChange({ path: e.target.value })}
placeholder="/data/app" className="h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<select value={vol.pathType || 'Directory'} onChange={(e) => onChange({ pathType: e.target.value })}
className="h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5">
<option value="Directory">Directory</option>
<option value="File">File</option>
<option value="">默认</option>
</select>
</div>
);
}
if (vol.type === 'nfs') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">NFS</span>
<Input value={vol.nfsServer || ''} onChange={(e) => onChange({ nfsServer: e.target.value })}
placeholder="Server IP" className="h-7 w-36 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={vol.nfsPath || ''} onChange={(e) => onChange({ nfsPath: e.target.value })}
placeholder="/export/path" className="h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
);
}
if (vol.type === 'configMap') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">ConfigMap</span>
<Input value={vol.configMapName || ''} onChange={(e) => onChange({ configMapName: e.target.value })}
placeholder="ConfigMap 名称" className="h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={vol.cmItems || ''} onChange={(e) => onChange({ cmItems: e.target.value })}
placeholder="key:path(可选)" className="h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
);
}
if (vol.type === 'secret') {
return (
<div className="flex items-center gap-2 flex-wrap">
<span className="text-[10px] text-slate-500 w-20 shrink-0">Secret</span>
<Input value={vol.secretName || ''} onChange={(e) => onChange({ secretName: e.target.value })}
placeholder="Secret 名称" className="h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={vol.secItems || ''} onChange={(e) => onChange({ secItems: e.target.value })}
placeholder="key:path(可选)" className="h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
);
}
return null;
}
export function DeploymentEditStorage({ clusterCode, namespace, deploymentName, manifest, onSaved, onCancel }: Props) {
const { toast } = useToast();
const [saving, setSaving] = useState(false);
const [loading, setLoading] = useState(!manifest);
const [rawManifest, setRawManifest] = useState<any>(manifest || {});
const [volumes, setVolumes] = useState<VolumeForm[]>([]);
const [mounts, setMounts] = useState<MountForm[]>([]);
const [entries, setEntries] = useState<VolumeEntry[]>([]);
const [containers, setContainers] = useState<string[]>([]);
const [passthroughVolumes, setPassthroughVolumes] = useState<Record<string, any>[]>([]);
useEffect(() => {
const m = manifest;
if (!m) { setLoading(false); return; }
setRawManifest(m);
const parsed = parseStorageFromManifest(m);
setVolumes(parsed.volumes);
setMounts(parsed.mounts);
if (!manifest) { setLoading(false); return; }
setRawManifest(manifest);
const parsed = parseVolumeEntries(manifest);
setEntries(parsed.entries);
setContainers(parsed.containers);
setPassthroughVolumes(parsed.passthroughVolumes);
setLoading(false);
}, [manifest]);
// Volume operations
const addVolume = () => setVolumes(prev => [...prev, { name: '', type: 'emptyDir' }]);
const removeVolume = (i: number) => {
const name = volumes[i]?.name;
setVolumes(prev => prev.filter((_, idx) => idx !== i));
if (name) setMounts(prev => prev.filter(m => m.volumeName !== name));
};
const updateVolume = (i: number, patch: Partial<VolumeForm>) =>
setVolumes(prev => prev.map((v, idx) => (idx === i ? { ...v, ...patch } : v)));
const defaultContainer = containers.find((c) => c !== '(unnamed)') || containers[0] || '';
// Mount operations
const addMount = () => setMounts(prev => [...prev, { containerName: containers[0] || '', volumeName: '', mountPath: '', subPath: '', readOnly: false }]);
const removeMount = (i: number) => setMounts(prev => prev.filter((_, idx) => idx !== i));
const updateMount = (i: number, patch: Partial<MountForm>) =>
setMounts(prev => prev.map((m, idx) => (idx === i ? { ...m, ...patch } : m)));
const updateEntry = (i: number, patch: Partial<VolumeEntry>) =>
setEntries((prev) => prev.map((e, idx) => (idx === i ? { ...e, ...patch } : e)));
const updateVolume = (i: number, patch: Partial<VolumeForm>) =>
setEntries((prev) => prev.map((e, idx) => (idx === i ? { ...e, volume: { ...e.volume, ...patch } } : e)));
const addEntry = () => setEntries((prev) => [...prev, emptyVolumeEntry(defaultContainer)]);
const removeEntry = (i: number) => setEntries((prev) => prev.filter((_, idx) => idx !== i));
const save = async () => {
for (const vol of volumes) {
if (!vol.name.trim()) {
for (const entry of entries) {
if (!entry.volume.name.trim()) {
toast({ title: '请填写数据卷名称', variant: 'destructive' });
return;
}
if (!formToVolume(vol)) {
toast({ title: '数据卷配置不完整', description: `请补全「${vol.name}」的类型必填项`, variant: 'destructive' });
if (!formToVolume(entry.volume)) {
toast({ title: '数据卷配置不完整', description: `请补全「${entry.volume.name}」的类型必填项`, variant: 'destructive' });
return;
}
if (!entry.mountPath.trim()) {
toast({ title: '请填写挂载路径', description: `数据卷「${entry.volume.name}」需指定挂载到容器的路径`, variant: 'destructive' });
return;
}
}
setSaving(true);
try {
const { volumes, mounts } = volumeEntriesToStorage(entries);
const base = applyStorageToManifest(rawManifest, volumes, mounts, passthroughVolumes);
await saveDeploymentManifest(clusterCode, namespace, deploymentName, base);
toast({ title: '存储配置已保存', description: `${deploymentName} 更新已提交` });
onSaved(base);
} catch (e) {
toast({ title: '保存失败', description: e?.message || String(e), variant: 'destructive' });
toast({ title: '保存失败', description: (e as Error)?.message || String(e), variant: 'destructive' });
} finally { setSaving(false); }
};
@@ -112,226 +189,131 @@ export function DeploymentEditStorage({ clusterCode, namespace, deploymentName,
if (!manifest) {
return (
<Card className="bg-slate-900 border-slate-800">
<CardContent className="p-8 text-center text-slate-500">
未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。
</CardContent>
<CardContent className="p-8 text-center text-slate-500">未获取到 manifest 数据,请使用 YAML 编辑模式。</CardContent>
</Card>
);
}
const volumeNames = volumes.map(v => v.name).filter(Boolean);
return (
<div className="space-y-4">
{/* ══════════ 定义数据卷 ══════════ */}
<Card className="bg-slate-900 border-slate-800">
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
<CardTitle className="text-sm text-slate-200 flex items-center gap-2">
<Database className="h-4 w-4 text-emerald-400" />定义数据卷
<Badge variant="outline" className="border-slate-700 text-slate-400">{volumes.length}</Badge>
</CardTitle>
<Button size="sm" variant="outline" className="h-7 border-slate-700 text-slate-300 text-xs" onClick={addVolume}>
<div className="flex items-center justify-between gap-3">
<div>
<CardTitle className="text-sm text-slate-200 flex items-center gap-2">
<Database className="h-4 w-4 text-emerald-400" />
数据卷
<Badge variant="outline" className="border-slate-700 text-slate-400">{entries.length}</Badge>
</CardTitle>
<p className="text-[11px] text-slate-500 mt-1">定义数据卷,并将其挂载到工作负载的容器中</p>
</div>
<Button size="sm" variant="outline" className="h-7 border-slate-700 text-slate-300 text-xs shrink-0" onClick={addEntry}>
<Plus className="h-3 w-3 mr-1" />添加数据卷
</Button>
</div>
</CardHeader>
<CardContent className="pt-0 space-y-3">
{volumes.length === 0 ? (
<div className="text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg">
<CardContent className="pt-0 space-y-4">
{entries.length === 0 ? (
<div className="text-center py-10 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg">
<Database className="h-8 w-8 mx-auto mb-2 text-slate-700" />
未配置数据卷
未配置数据卷,点击「添加数据卷」开始
</div>
) : volumes.map((vol, i) => {
const vtype = VOLUME_TYPES.find(t => t.key === vol.type);
) : entries.map((entry, i) => {
const vol = entry.volume;
const vtype = VOLUME_TYPES.find((t) => t.key === vol.type);
const VIcon = vtype?.icon || Folder;
return (
<div key={i} className="bg-slate-950/50 border border-slate-800 rounded-lg p-3 space-y-2.5">
{/* 卷名 + 类型 */}
<div className="flex items-center gap-2">
<VIcon className={`h-4 w-4 ${vtype?.color || 'text-slate-400'}`} />
<span className="text-[10px] text-slate-500 w-16 shrink-0">数据卷名称</span>
<Input value={vol.name} onChange={e => updateVolume(i, { name: e.target.value })}
placeholder="volume-name"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Select value={vol.type} onValueChange={v => updateVolume(i, { type: v as VolumeForm['type'] })}>
<SelectTrigger className="h-7 w-[120px] bg-slate-800 border-slate-700 text-xs text-slate-300">
<div className="flex items-center gap-1.5">
<VIcon className="h-3 w-3" />{vtype?.label || vol.type}
</div>
</SelectTrigger>
<SelectContent>
{VOLUME_TYPES.map(t => {
const TI = t.icon;
return (
<SelectItem key={t.key} value={t.key}>
<span className="flex items-center gap-1.5 text-xs">
<TI className="h-3 w-3" />{t.label}
</span>
</SelectItem>
);
})}
</SelectContent>
</Select>
<Button size="icon" variant="ghost" className="h-7 w-7 text-red-400" onClick={() => removeVolume(i)}>
<Trash2 className="h-3.5 w-3.5" />
</Button>
<div key={i} className="bg-slate-950/60 border border-slate-800 rounded-lg overflow-hidden">
{/* 卷定义 */}
<div className="p-3 space-y-2.5 border-b border-slate-800/80">
<div className="flex items-center gap-2 flex-wrap">
<VIcon className={`h-4 w-4 ${vtype?.color || 'text-slate-400'}`} />
<span className="text-xs text-slate-400 shrink-0">数据卷名称</span>
<Input
value={vol.name}
onChange={(e) => {
const name = e.target.value;
const patch: Partial<VolumeForm> = { name };
if (vol.type === 'configMap' && !vol.configMapName) patch.configMapName = name;
if (vol.type === 'secret' && !vol.secretName) patch.secretName = name;
if (vol.type === 'persistentVolumeClaim' && !vol.pvcName) patch.pvcName = name;
updateVolume(i, patch);
}}
placeholder="如 config / uploads / data"
className="h-8 w-40 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"
/>
<Select value={vol.type} onValueChange={(v) => updateVolume(i, { type: v as VolumeForm['type'] })}>
<SelectTrigger className="h-8 w-[128px] bg-slate-800 border-slate-700 text-xs text-slate-300">
<span>{vtype?.label || vol.type}</span>
</SelectTrigger>
<SelectContent>
{VOLUME_TYPES.map((t) => (
<SelectItem key={t.key} value={t.key}>{t.label}</SelectItem>
))}
</SelectContent>
</Select>
<Button size="icon" variant="ghost" className="h-8 w-8 text-red-400 ml-auto" onClick={() => removeEntry(i)}>
<Trash2 className="h-4 w-4" />
</Button>
</div>
<VolumeTypeFields vol={vol} onChange={(p) => updateVolume(i, p)} />
</div>
{/* 类型指定字段 */}
{vol.type === 'persistentVolumeClaim' && (
<div className="flex items-center gap-2 pl-[88px]">
<Input value={vol.pvcName || ''} onChange={e => updateVolume(i, { pvcName: e.target.value })}
placeholder="PVC 名称" className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<label className="flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap">
<input type="checkbox" checked={!!vol.pvcReadOnly}
onChange={e => updateVolume(i, { pvcReadOnly: e.target.checked })}
className="accent-blue-500" />只读
</label>
</div>
)}
{vol.type === 'emptyDir' && (
<div className="flex items-center gap-2 pl-[88px]">
<select value={vol.medium || ''} onChange={e => updateVolume(i, { medium: e.target.value })}
className="h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5">
<option value="">默认磁盘</option>
<option value="Memory">Memory</option>
{/* 挂载到容器(Kuboard 同卡) */}
<div className="px-3 py-2.5 bg-slate-900/40 space-y-2">
<p className="text-[11px] text-slate-500 flex items-center gap-1.5">
<Container className="h-3.5 w-3.5 text-blue-400" />
将上述数据卷挂载到容器
</p>
<div className="flex items-center gap-2 flex-wrap">
<select
value={entry.containerName}
onChange={(e) => updateEntry(i, { containerName: e.target.value })}
className="h-8 min-w-[120px] bg-slate-800 border border-slate-700 rounded-md text-sm text-slate-200 px-2 font-medium"
>
{containers.length === 0 && <option value="">(无容器)</option>}
{containers.map((cn) => <option key={cn} value={cn}>{cn}</option>)}
</select>
<Input value={vol.sizeLimit || ''} onChange={e => updateVolume(i, { sizeLimit: e.target.value })}
placeholder="sizeLimit (如 512Mi)"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<div className="flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700">
<button type="button" onClick={() => updateEntry(i, { readOnly: true })}
className={`px-2.5 py-1 rounded text-xs font-medium transition-all ${entry.readOnly ? 'bg-amber-500/20 text-amber-300' : 'text-slate-500 hover:text-slate-300'}`}>
只读
</button>
<button type="button" onClick={() => updateEntry(i, { readOnly: false })}
className={`px-2.5 py-1 rounded text-xs font-medium transition-all ${!entry.readOnly ? 'bg-blue-500/20 text-blue-300' : 'text-slate-500 hover:text-slate-300'}`}>
读写
</button>
</div>
<Input
value={entry.mountPath}
onChange={(e) => updateEntry(i, { mountPath: e.target.value })}
placeholder="挂载路径 /app/data"
className="h-8 flex-1 min-w-[180px] bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"
/>
</div>
)}
{vol.type === 'hostPath' && (
<div className="flex items-center gap-2 pl-[88px]">
<Input value={vol.path || ''} onChange={e => updateVolume(i, { path: e.target.value })}
placeholder="主机路径 /data/app"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<select value={vol.pathType || 'Directory'} onChange={e => updateVolume(i, { pathType: e.target.value })}
className="h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5">
<option value="Directory">Directory</option>
<option value="File">File</option>
<option value="">(默认)</option>
</select>
<div className="flex items-center gap-2">
<span className="text-[11px] text-slate-500 shrink-0">子路径 subPath</span>
<Input
value={entry.subPath}
onChange={(e) => updateEntry(i, { subPath: e.target.value })}
placeholder="如 config.yaml(挂载单文件时填写)"
className="h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"
/>
</div>
)}
{vol.type === 'nfs' && (
<div className="flex items-center gap-2 pl-[88px]">
<Input value={vol.nfsServer || ''} onChange={e => updateVolume(i, { nfsServer: e.target.value })}
placeholder="NFS Server IP"
className="h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<span className="text-slate-600 text-xs">:</span>
<Input value={vol.nfsPath || ''} onChange={e => updateVolume(i, { nfsPath: e.target.value })}
placeholder="/export/path"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<label className="flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap">
<input type="checkbox" checked={!!vol.nfsReadOnly}
onChange={e => updateVolume(i, { nfsReadOnly: e.target.checked })}
className="accent-blue-500" />只读
</label>
</div>
)}
{vol.type === 'configMap' && (
<div className="flex items-center gap-2 pl-[88px]">
<span className="text-[10px] text-slate-500 whitespace-nowrap">ConfigMap</span>
<Input value={vol.configMapName || ''} onChange={e => updateVolume(i, { configMapName: e.target.value })}
placeholder="ConfigMap 名称"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={vol.cmItems || ''} onChange={e => updateVolume(i, { cmItems: e.target.value })}
placeholder="key:path 或 JSON"
className="h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
)}
{vol.type === 'secret' && (
<div className="flex items-center gap-2 pl-[88px]">
<span className="text-[10px] text-slate-500 whitespace-nowrap">密文</span>
<Input value={vol.secretName || ''} onChange={e => updateVolume(i, { secretName: e.target.value })}
placeholder="Secret 名称"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={vol.secItems || ''} onChange={e => updateVolume(i, { secItems: e.target.value })}
placeholder="key:path 或 JSON"
className="h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
</div>
)}
</div>
</div>
);
})}
</CardContent>
</Card>
{/* ══════════ 挂载到容器 ══════════ */}
<Card className="bg-slate-900 border-slate-800">
<CardHeader className="pb-3">
<div className="flex items-center justify-between">
<CardTitle className="text-sm text-slate-200 flex items-center gap-2">
<Folder className="h-4 w-4 text-blue-400" />将数据卷挂载到容器
<Badge variant="outline" className="border-slate-700 text-slate-400">{mounts.length}</Badge>
</CardTitle>
<Button size="sm" variant="outline" className="h-7 border-slate-700 text-slate-300 text-xs" onClick={addMount}
disabled={volumeNames.length === 0 || containers.length === 0}>
<Plus className="h-3 w-3 mr-1" />添加挂载
</Button>
</div>
</CardHeader>
<CardContent className="pt-0 space-y-2">
{mounts.length === 0 ? (
<div className="text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg">
<Folder className="h-8 w-8 mx-auto mb-2 text-slate-700" />
{volumeNames.length === 0 ? '请先定义数据卷' : '未配置挂载点'}
</div>
) : mounts.map((m, i) => (
<div key={i} className="flex items-center gap-2 bg-slate-950/50 border border-slate-800 rounded-lg p-2.5">
{/* 容器选择 */}
<span className="text-[10px] text-slate-500 whitespace-nowrap">容器:</span>
<select value={m.containerName} onChange={e => updateMount(i, { containerName: e.target.value })}
className="h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[120px]">
{containers.length === 0 && <option value="">(无容器)</option>}
{containers.map(cn => <option key={cn} value={cn}>{cn}</option>)}
</select>
{/* 数据卷选择 */}
<select value={m.volumeName} onChange={e => updateMount(i, { volumeName: e.target.value })}
className="h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[100px]">
<option value="">选择数据卷</option>
{volumeNames.map(vn => <option key={vn} value={vn}>{vn}</option>)}
</select>
{/* 挂载路径 */}
<Input value={m.mountPath} onChange={e => updateMount(i, { mountPath: e.target.value })}
placeholder="挂载路径 /app/data"
className="h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
<Input value={m.subPath} onChange={e => updateMount(i, { subPath: e.target.value })}
placeholder="subPath (可选)"
className="h-7 w-28 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono" />
{/* 只读/读写 */}
<div className="flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700">
<button onClick={() => updateMount(i, { readOnly: false })}
className={`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${!m.readOnly ? 'bg-blue-500/20 text-blue-300' : 'text-slate-500'}`}>
读写
</button>
<button onClick={() => updateMount(i, { readOnly: true })}
className={`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${m.readOnly ? 'bg-amber-500/20 text-amber-300' : 'text-slate-500'}`}>
只读
</button>
</div>
<Button size="icon" variant="ghost" className="h-7 w-7 text-red-400" onClick={() => removeMount(i)}>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</div>
))}
</CardContent>
</Card>
{/* 操作栏 */}
<div className="flex justify-end gap-2 pt-2">
<Button variant="outline" className="border-slate-700 text-slate-400" onClick={onCancel}>取消</Button>
<Button className="bg-blue-600 hover:bg-blue-700" disabled={saving} onClick={save}>
{saving ? <Loader2 className="h-4 w-4 animate-spin mr-1" /> : <Save className="h-4 w-4 mr-1" />}保存
{saving ? <Loader2 className="h-4 w-4 animate-spin mr-1" /> : <Save className="h-4 w-4 mr-1" />}
保存
</Button>
</div>
</div>
);
}
}
@@ -37,6 +37,25 @@ export interface MountForm {
readOnly: boolean;
}
/** Kuboard 风格:一卷一卡(卷定义 + 挂载同屏)// Logan.Li */
export interface VolumeEntry {
volume: VolumeForm;
containerName: string;
mountPath: string;
subPath: string;
readOnly: boolean;
}
export function emptyVolumeEntry(defaultContainer = ''): VolumeEntry {
return {
volume: { name: '', type: 'emptyDir' },
containerName: defaultContainer,
mountPath: '',
subPath: '',
readOnly: false,
};
}
const SYSTEM_VOLUME_PREFIXES = ['kube-api-access-', 'default-token-', 'kube-'];
/** 是否系统/不可编辑卷(保存时保留)// Logan.Li */
@@ -250,6 +269,46 @@ export function parseStorageFromManifest(manifest: Record<string, any>): {
};
}
/** 解析为 Kuboard 一卷一卡条目 // Logan.Li */
export function parseVolumeEntries(manifest: Record<string, any>): {
entries: VolumeEntry[];
containers: string[];
passthroughVolumes: Record<string, any>[];
} {
const { volumes, mounts, containers, passthroughVolumes } = parseStorageFromManifest(manifest);
const defaultContainer = containers.find((c) => c !== '(unnamed)') || containers[0] || '';
const entries: VolumeEntry[] = volumes.map((vol) => {
const matched = mounts.filter((m) => m.volumeName === vol.name);
const primary = matched[0];
return {
volume: vol,
containerName: primary?.containerName || defaultContainer,
mountPath: primary?.mountPath || '',
subPath: primary?.subPath || '',
readOnly: primary?.readOnly ?? false,
};
});
return { entries, containers, passthroughVolumes };
}
/** 一卷一卡 → volumes + mounts // Logan.Li */
export function volumeEntriesToStorage(entries: VolumeEntry[]): {
volumes: VolumeForm[];
mounts: MountForm[];
} {
const volumes = entries.map((e) => e.volume);
const mounts: MountForm[] = entries
.filter((e) => e.volume.name.trim() && e.mountPath.trim())
.map((e) => ({
containerName: e.containerName,
volumeName: e.volume.name.trim(),
mountPath: e.mountPath.trim(),
subPath: e.subPath.trim(),
readOnly: e.readOnly,
}));
return { volumes, mounts };
}
/** 将表单写回 manifest.spec.template.spec // Logan.Li */
export function applyStorageToManifest(
manifest: Record<string, any>,