diff --git a/backend/static/assets/AIAlertAnalyzer-BFwPLuXl.js b/backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js similarity index 98% rename from backend/static/assets/AIAlertAnalyzer-BFwPLuXl.js rename to backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js index 7b3ec73..45b37e2 100644 --- a/backend/static/assets/AIAlertAnalyzer-BFwPLuXl.js +++ b/backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js @@ -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 diff --git a/backend/static/assets/AIOpsAssistant-CF1D1Anl.js b/backend/static/assets/AIOpsAssistant-annAjw3b.js similarity index 98% rename from backend/static/assets/AIOpsAssistant-CF1D1Anl.js rename to backend/static/assets/AIOpsAssistant-annAjw3b.js index 3c1b5f5..8701881 100644 --- a/backend/static/assets/AIOpsAssistant-CF1D1Anl.js +++ b/backend/static/assets/AIOpsAssistant-annAjw3b.js @@ -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("bg-muted flex size-full items-center justify-center rounded-full",e),...n})}const z=[{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","gpt-4-turbo"]},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",models:["deepseek-chat","deepseek-reasoner"]},{id:"qwen",name:"通义千问 (DashScope)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",models:["qwen-plus","qwen-turbo","qwen-max"]},{id:"moonshot",name:"Moonshot 月之暗面",defaultEndpoint:"https://api.moonshot.cn/v1",models:["moonshot-v1-8k","moonshot-v1-32k"]},{id:"ollama",name:"Ollama 本地",defaultEndpoint:"http://localhost:11434/v1",models:["qwen2.5:7b","llama3.2","deepseek-r1:7b"]},{id:"custom",name:"自定义 (OpenAI 兼容)",defaultEndpoint:"",models:[]}],ut={provider:"openai",model:"gpt-4o-mini",api_key:"",endpoint:"https://api.openai.com/v1",temperature:.7,max_tokens:2e3,system_prompt:"",enabled:!1};async function At(){const n=(await Bs.getAlerts({page:1,page_size:20}))?.list||[];if(!n.length)return"(当前无告警事件)";const i=n.slice(0,15).map((o,a)=>`${a+1}. [${o.severity||"未知"}|${o.status||"-"}] ${o.rule_name||"告警"} → 目标:${o.target||"-"} 值:${o.value??"-"} 时间:${(o.started_at||"").slice(0,16)}`),r=n.filter(o=>o.status==="firing").length;return`共 ${n.length} 条告警(firing ${r} 条),前 ${Math.min(15,n.length)} 条: +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("bg-muted flex size-full items-center justify-center rounded-full",e),...n})}const z=[{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","gpt-4-turbo"]},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",models:["deepseek-chat","deepseek-reasoner"]},{id:"qwen",name:"通义千问 (DashScope)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",models:["qwen-plus","qwen-turbo","qwen-max"]},{id:"moonshot",name:"Moonshot 月之暗面",defaultEndpoint:"https://api.moonshot.cn/v1",models:["moonshot-v1-8k","moonshot-v1-32k"]},{id:"ollama",name:"Ollama 本地",defaultEndpoint:"http://localhost:11434/v1",models:["qwen2.5:7b","llama3.2","deepseek-r1:7b"]},{id:"custom",name:"自定义 (OpenAI 兼容)",defaultEndpoint:"",models:[]}],ut={provider:"openai",model:"gpt-4o-mini",api_key:"",endpoint:"https://api.openai.com/v1",temperature:.7,max_tokens:2e3,system_prompt:"",enabled:!1};async function At(){const n=(await Bs.getAlerts({page:1,page_size:20}))?.list||[];if(!n.length)return"(当前无告警事件)";const i=n.slice(0,15).map((o,a)=>`${a+1}. [${o.severity||"未知"}|${o.status||"-"}] ${o.rule_name||"告警"} → 目标:${o.target||"-"} 值:${o.value??"-"} 时间:${(o.started_at||"").slice(0,16)}`),r=n.filter(o=>o.status==="firing").length;return`共 ${n.length} 条告警(firing ${r} 条),前 ${Math.min(15,n.length)} 条: ${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} 台主机实时指标: diff --git a/backend/static/assets/AIPredictiveAnalytics-BXlrnpYB.js b/backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js similarity index 98% rename from backend/static/assets/AIPredictiveAnalytics-BXlrnpYB.js rename to backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js index 613c42a..ecdfe9e 100644 --- a/backend/static/assets/AIPredictiveAnalytics-BXlrnpYB.js +++ b/backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js @@ -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",className:"text-slate-500",children:["当前 ",a.currentUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:86:21",className:"text-amber-400",children:["预测 ",a.predictedUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:87:21",className:"text-red-400",children:["阈值 ",a.threshold,"%"]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:91:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:92:19",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:93:21",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:94:21",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:95:23",className:"text-sm text-slate-400",children:"AI建议:"}),e.jsx("p",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:96:23",className:"text-sm text-slate-300 mt-1",children:a.recommendation})]})]})})]},p))})})]})}const T=[{key:"cpu",label:"CPU使用率",exprKey:"cpu_usage",threshold:85},{key:"memory",label:"内存使用率",exprKey:"memory_usage",threshold:85},{key:"disk",label:"磁盘使用率",exprKey:"disk_usage",threshold:90}],be={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},je={"1h":1,"24h":24,"7d":168,"30d":720};function R(c){const i=c.length;if(i<2)return{slope:0,r2:0};const a=c.map((r,h)=>h),p=a.reduce((r,h)=>r+h,0)/i,y=c.reduce((r,h)=>r+h,0)/i;let b=0,N=0,I=0,C=0;for(let r=0;ra.name===i).sort((a,p)=>new Date(a.timestamp).getTime()-new Date(p.timestamp).getTime()).map(a=>Number(a.value)||0)}function Pe(c){const i=c.match(/[><=]\s*([\d.]+)/);return i?parseFloat(i[1]):null}function ge(c,i){const a=i<=7?"urgent":i<=14?"warning":"normal";return{urgent:{cpu:"CPU增长趋势明显,建议尽快扩容计算资源或优化高负载进程",memory:"内存增长趋势明显,建议增加内存或排查内存泄漏",disk:"磁盘空间即将耗尽,建议立即扩容或清理历史数据与日志"},warning:{cpu:"CPU使用率呈上升趋势,建议持续监控并准备扩容计划",memory:"内存使用率呈上升趋势,建议优化应用内存使用",disk:"磁盘使用率持续增长,建议规划数据归档和清理策略"},normal:{cpu:"CPU使用正常,建议持续监控",memory:"内存使用正常,建议持续监控",disk:"磁盘空间充足,建议持续监控"}}[a]?.[c]||"建议持续监控资源使用趋势"}function O(c){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[c]||"建议检查相关服务状态并持续监控"}function Ne(c){const{rawMetrics:i,serverStats:a,alertEvents:p,alertRules:y,selectedTimeRange:b}=c,N=je[b]||24,I=be[b]||"24小时后",C=T.map(t=>{const n=U(i,t.key),{slope:m,r2:x}=R(n),o=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,l=n.length>0?n[n.length-1]:o||0;let A=l+m*N;A=Math.max(0,Math.min(100,A));const s=m>.05?"up":m<-.05?"down":"stable",d=Math.round(60+x*35);return{name:t.label,current:Math.round(l),predicted:Math.round(A),unit:"%",trend:s,confidence:d,timeRange:I}}),j=T.map(t=>{const n=U(i,t.key),{slope:m}=R(n),x=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,o=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,A=Math.round(Math.min(100,o+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-o)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:o,predictedUsage:A,threshold:s,daysUntilThreshold:d,recommendation:ge(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of y){if(!t.enabled)continue;const n=Pe(t.expression||""),m=(t.expression||"").toLowerCase(),x=T.find(o=>m.includes(o.exprKey));if(x&&n){const o=U(i,x.key),{slope:l}=R(o),A=x.key==="cpu"?a.avg_cpu:x.key==="memory"?a.avg_memory:a.avg_disk,s=o.length>0?o[o.length-1]:A||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const S=p.filter(v=>v.rule_id===t.id||v.rule_name===t.name).length;u+=Math.min(20,S*3),u=Math.max(5,Math.min(90,u));let P="未来24小时";if(l>.01&&n>s){const v=(n-s)/l;v<4?P="未来4小时":v<12?P="未来12小时":v<24?P="未来24小时":P=`未来${Math.ceil(v/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:P,suggestedAction:O(x.key)})}else{const o=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(o>0){const l=m.includes("service")?"service":m.includes("pod")?"pod":"service";f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能再次发生`,probability:Math.min(60,20+o*5),timeframe:"未来24小时",suggestedAction:O(l)})}}}const w=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),r=T.length>0?T.reduce((t,n)=>t+R(U(i,n.key)).r2,0)/T.length:0,h=Math.round(78+r*17),k=w.filter(t=>t.probability>=50).length,E=j.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:C,capacityForecasts:j,dedupedAnomalies:w,accuracy:h,predictedAlertCount:k,capacityWarningCount:E}}function V(c){switch(c){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function De(){const[c,i]=g.useState("24h"),[a,p]=g.useState(!1),[y,b]=g.useState(!0),[N,I]=g.useState([]),[C,j]=g.useState({}),[f,w]=g.useState([]),[r,h]=g.useState([]);g.useEffect(()=>{k()},[]);const k=async()=>{b(!0);try{const[s,d,u,S]=await Promise.all([ce.getMetrics(72),ie.getServerStats(),H.getAlerts({page:1,page_size:100}),H.getRules()]);I(Array.isArray(s)?s:[]),j(d||{});const P=u?.list||u||[];w(Array.isArray(P)?P:[]);const v=S?.list||S||[];h(Array.isArray(v)?v:[])}catch{}finally{b(!1)}},E=async()=>{p(!0),await k(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:o,capacityWarningCount:l}=Ne({rawMetrics:N,serverStats:C,alertEvents:f,alertRules:r,selectedTimeRange:c}),A=s=>{switch(s){case"up":return e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:99:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(Ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:101:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(ve,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:103:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:108:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:110:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center",children:e.jsx(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:115:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:120:9",className:"flex items-center gap-2",children:[e.jsxs(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:11",value:c,onValueChange:i,children:[e.jsxs(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:15",className:"h-4 w-4 mr-2"}),e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15"})]}),e.jsxs(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:126:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:15",value:"1h",children:"1小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"24h",children:"24小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"7d",children:"7天"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"30d",children:"30天"})]})]}),e.jsx(q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:133:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:E,children:a||y?e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:39",className:"h-4 w-4 animate-spin"}):e.jsx(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:86",className:"h-4 w-4"})})]})]}),e.jsx(Z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:140:7",items:[{label:"置信度",value:`${x}%`,color:"emerald"},{label:"高风险",value:o,color:"amber"},{label:"容量预警",value:l,color:"red"},{label:"指标",value:t.length,color:"purple"}]}),e.jsxs(J,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:149:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:150:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:151:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:155:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:156:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:159:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:165:9",value:"metrics",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:167:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:168:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:173:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(me,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:174:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:179:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:181:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:185:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:187:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:189:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:190:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:191:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(xe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:198:25",className:"flex items-center gap-1",children:[A(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:200:27",className:`text-sm ${V(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:206:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:207:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:208:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:209:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:214:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:215:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:27",className:`text-lg font-bold ${V(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:223:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:224:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:225:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:27",className:"w-16 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227:29",className:"h-full bg-gradient-to-r from-blue-500 to-purple-500",style:{width:`${s.confidence}%`}})}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:232:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:243:9",value:"capacity",className:"space-y-4",children:e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:244:11",forecasts:n,loading:y})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:247:9",value:"anomaly",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:249:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:255:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:258:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:260:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:264:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:266:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:268:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:270:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:271:27",className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.probability>=70?"bg-red-500/20":s.probability>=50?"bg-amber-500/20":"bg-blue-500/20"}`,children:e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:280:29",className:`h-5 w-5 ${s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"}`})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:290:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:291:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:292:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:294:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:295:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:297:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:304:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:306:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",className:"text-slate-700"}),e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:315:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",strokeDasharray:`${s.probability*1.76} 176`,className:s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:332:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:333:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:337:23",className:"mt-3 p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:338:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:339:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:340:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:342:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{De as AIPredictiveAnalytics}; +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",className:"text-slate-500",children:["当前 ",a.currentUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:86:21",className:"text-amber-400",children:["预测 ",a.predictedUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:87:21",className:"text-red-400",children:["阈值 ",a.threshold,"%"]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:91:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:92:19",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:93:21",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:94:21",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:95:23",className:"text-sm text-slate-400",children:"AI建议:"}),e.jsx("p",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:96:23",className:"text-sm text-slate-300 mt-1",children:a.recommendation})]})]})})]},p))})})]})}const T=[{key:"cpu",label:"CPU使用率",exprKey:"cpu_usage",threshold:85},{key:"memory",label:"内存使用率",exprKey:"memory_usage",threshold:85},{key:"disk",label:"磁盘使用率",exprKey:"disk_usage",threshold:90}],be={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},je={"1h":1,"24h":24,"7d":168,"30d":720};function R(c){const i=c.length;if(i<2)return{slope:0,r2:0};const a=c.map((r,h)=>h),p=a.reduce((r,h)=>r+h,0)/i,y=c.reduce((r,h)=>r+h,0)/i;let b=0,N=0,I=0,C=0;for(let r=0;ra.name===i).sort((a,p)=>new Date(a.timestamp).getTime()-new Date(p.timestamp).getTime()).map(a=>Number(a.value)||0)}function Pe(c){const i=c.match(/[><=]\s*([\d.]+)/);return i?parseFloat(i[1]):null}function ge(c,i){const a=i<=7?"urgent":i<=14?"warning":"normal";return{urgent:{cpu:"CPU增长趋势明显,建议尽快扩容计算资源或优化高负载进程",memory:"内存增长趋势明显,建议增加内存或排查内存泄漏",disk:"磁盘空间即将耗尽,建议立即扩容或清理历史数据与日志"},warning:{cpu:"CPU使用率呈上升趋势,建议持续监控并准备扩容计划",memory:"内存使用率呈上升趋势,建议优化应用内存使用",disk:"磁盘使用率持续增长,建议规划数据归档和清理策略"},normal:{cpu:"CPU使用正常,建议持续监控",memory:"内存使用正常,建议持续监控",disk:"磁盘空间充足,建议持续监控"}}[a]?.[c]||"建议持续监控资源使用趋势"}function O(c){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[c]||"建议检查相关服务状态并持续监控"}function Ne(c){const{rawMetrics:i,serverStats:a,alertEvents:p,alertRules:y,selectedTimeRange:b}=c,N=je[b]||24,I=be[b]||"24小时后",C=T.map(t=>{const n=U(i,t.key),{slope:m,r2:x}=R(n),o=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,l=n.length>0?n[n.length-1]:o||0;let A=l+m*N;A=Math.max(0,Math.min(100,A));const s=m>.05?"up":m<-.05?"down":"stable",d=Math.round(60+x*35);return{name:t.label,current:Math.round(l),predicted:Math.round(A),unit:"%",trend:s,confidence:d,timeRange:I}}),j=T.map(t=>{const n=U(i,t.key),{slope:m}=R(n),x=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,o=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,A=Math.round(Math.min(100,o+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-o)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:o,predictedUsage:A,threshold:s,daysUntilThreshold:d,recommendation:ge(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of y){if(!t.enabled)continue;const n=Pe(t.expression||""),m=(t.expression||"").toLowerCase(),x=T.find(o=>m.includes(o.exprKey));if(x&&n){const o=U(i,x.key),{slope:l}=R(o),A=x.key==="cpu"?a.avg_cpu:x.key==="memory"?a.avg_memory:a.avg_disk,s=o.length>0?o[o.length-1]:A||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const S=p.filter(v=>v.rule_id===t.id||v.rule_name===t.name).length;u+=Math.min(20,S*3),u=Math.max(5,Math.min(90,u));let P="未来24小时";if(l>.01&&n>s){const v=(n-s)/l;v<4?P="未来4小时":v<12?P="未来12小时":v<24?P="未来24小时":P=`未来${Math.ceil(v/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:P,suggestedAction:O(x.key)})}else{const o=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(o>0){const l=m.includes("service")?"service":m.includes("pod")?"pod":"service";f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能再次发生`,probability:Math.min(60,20+o*5),timeframe:"未来24小时",suggestedAction:O(l)})}}}const w=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),r=T.length>0?T.reduce((t,n)=>t+R(U(i,n.key)).r2,0)/T.length:0,h=Math.round(78+r*17),k=w.filter(t=>t.probability>=50).length,E=j.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:C,capacityForecasts:j,dedupedAnomalies:w,accuracy:h,predictedAlertCount:k,capacityWarningCount:E}}function V(c){switch(c){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function De(){const[c,i]=g.useState("24h"),[a,p]=g.useState(!1),[y,b]=g.useState(!0),[N,I]=g.useState([]),[C,j]=g.useState({}),[f,w]=g.useState([]),[r,h]=g.useState([]);g.useEffect(()=>{k()},[]);const k=async()=>{b(!0);try{const[s,d,u,S]=await Promise.all([ce.getMetrics(72),ie.getServerStats(),H.getAlerts({page:1,page_size:100}),H.getRules()]);I(Array.isArray(s)?s:[]),j(d||{});const P=u?.list||u||[];w(Array.isArray(P)?P:[]);const v=S?.list||S||[];h(Array.isArray(v)?v:[])}catch{}finally{b(!1)}},E=async()=>{p(!0),await k(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:o,capacityWarningCount:l}=Ne({rawMetrics:N,serverStats:C,alertEvents:f,alertRules:r,selectedTimeRange:c}),A=s=>{switch(s){case"up":return e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:99:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(Ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:101:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(ve,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:103:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:108:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:110:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center",children:e.jsx(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:115:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:120:9",className:"flex items-center gap-2",children:[e.jsxs(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:11",value:c,onValueChange:i,children:[e.jsxs(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:15",className:"h-4 w-4 mr-2"}),e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15"})]}),e.jsxs(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:126:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:15",value:"1h",children:"1小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"24h",children:"24小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"7d",children:"7天"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"30d",children:"30天"})]})]}),e.jsx(q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:133:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:E,children:a||y?e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:39",className:"h-4 w-4 animate-spin"}):e.jsx(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:86",className:"h-4 w-4"})})]})]}),e.jsx(Z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:140:7",items:[{label:"置信度",value:`${x}%`,color:"emerald"},{label:"高风险",value:o,color:"amber"},{label:"容量预警",value:l,color:"red"},{label:"指标",value:t.length,color:"purple"}]}),e.jsxs(J,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:149:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:150:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:151:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:155:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:156:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:159:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:165:9",value:"metrics",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:167:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:168:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:173:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(me,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:174:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:179:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:181:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:185:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:187:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:189:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:190:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:191:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(xe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:198:25",className:"flex items-center gap-1",children:[A(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:200:27",className:`text-sm ${V(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:206:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:207:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:208:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:209:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:214:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:215:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:27",className:`text-lg font-bold ${V(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:223:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:224:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:225:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:27",className:"w-16 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227:29",className:"h-full bg-gradient-to-r from-blue-500 to-purple-500",style:{width:`${s.confidence}%`}})}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:232:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:243:9",value:"capacity",className:"space-y-4",children:e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:244:11",forecasts:n,loading:y})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:247:9",value:"anomaly",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:249:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:255:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:258:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:260:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:264:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:266:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:268:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:270:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:271:27",className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.probability>=70?"bg-red-500/20":s.probability>=50?"bg-amber-500/20":"bg-blue-500/20"}`,children:e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:280:29",className:`h-5 w-5 ${s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"}`})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:290:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:291:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:292:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:294:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:295:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:297:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:304:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:306:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",className:"text-slate-700"}),e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:315:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",strokeDasharray:`${s.probability*1.76} 176`,className:s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:332:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:333:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:337:23",className:"mt-3 p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:338:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:339:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:340:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:342:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{De as AIPredictiveAnalytics}; diff --git a/backend/static/assets/AlertCenter-CaSpyOJ2.js b/backend/static/assets/AlertCenter-VCEUxoOH.js similarity index 98% rename from backend/static/assets/AlertCenter-CaSpyOJ2.js rename to backend/static/assets/AlertCenter-VCEUxoOH.js index 62ce223..883d9af 100644 --- a/backend/static/assets/AlertCenter-CaSpyOJ2.js +++ b/backend/static/assets/AlertCenter-VCEUxoOH.js @@ -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(t={}){return ze({queryKey:ae.alerts(t),queryFn:async()=>{const s=await E.getAlerts({page:t.page,page_size:t.page_size,severity:t.severity!=="all"?t.severity:void 0,status:t.status!=="all"?t.status:void 0}),u=Ge(s).map(g=>St(g));return{list:u,total:mt(s),stats:Tt(u)}},staleTime:15e3,refetchInterval:3e4})}function Et(){const t=ct(),s=()=>t.invalidateQueries({queryKey:ae.alertRules()}),n=()=>t.invalidateQueries({queryKey:ae.agentAlertRules()}),u=()=>t.invalidateQueries({queryKey:["alerts"]}),g=$({mutationFn:o=>R.toggleRule(o),onSuccess:s}),h=$({mutationFn:o=>R.deleteRule(o),onSuccess:s}),l=$({mutationFn:({id:o,enabled:p})=>Ce.updateRule(o,{enabled:p}),onSuccess:n}),C=$({mutationFn:o=>Ce.deleteRule(o),onSuccess:n}),b=$({mutationFn:o=>E.acknowledge(o),onSuccess:u}),v=$({mutationFn:o=>E.resolve(o),onSuccess:u}),f=$({mutationFn:o=>E.quickSetup(o),onSuccess:n});return{toggleRuleMutation:g,deleteRuleMutation:h,toggleAgentRuleMutation:l,deleteAgentRuleMutation:C,ackMutation:b,resolveMutation:v,quickSetupMutation:f,invalidateRules:s,invalidateAgentRules:n,invalidateAlerts:u}}function Ot({alert:t,open:s,onOpenChange:n,onAcknowledge:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:22:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:23:7",className:"max-w-3xl",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:24:9",children:[e.jsxs(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:25:11",className:"flex items-center gap-2",children:[t?.title,t&&fe(t.severity)]}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:29:11",className:"sr-only",children:"查看告警详情"})]}),t&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:32:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:33:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:34:15",className:"text-muted-foreground",children:"描述"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:35:15",className:"mt-1",children:t.description})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:37:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:38:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:39:17",className:"text-muted-foreground",children:"来源"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:40:17",className:"font-medium",children:t.source})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:42:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:43:17",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:44:17",className:"font-medium",children:t.service})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:46:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:47:17",className:"text-muted-foreground",children:"指标"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:48:17",className:"font-medium",children:t.metric})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:50:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:51:17",className:"text-muted-foreground",children:"当前值 / 阈值"}),e.jsxs("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:52:17",className:"font-medium",children:[t.value," / ",t.threshold]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:54:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:55:17",className:"text-muted-foreground",children:"开始时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:56:17",className:"font-medium",children:t.startedAt})]}),t.resolvedAt&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:59:17",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:60:19",className:"text-muted-foreground",children:"解决时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:61:19",className:"font-medium",children:t.resolvedAt})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:65:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:66:15",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:67:15",className:"flex flex-wrap gap-2 mt-1",children:Object.entries(t.labels).map(([g,h])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:69:19",variant:"outline",children:[g,"=",h]},g))})]}),t.runbookUrl&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:74:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:75:17",className:"text-muted-foreground",children:"处理手册"}),e.jsx("a",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:76:17",href:t.runbookUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline block mt-1",children:"查看处理手册 →"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:83:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:84:11",variant:"outline",onClick:()=>n(!1),children:"关闭"}),t?.status==="firing"&&e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:86:13",onClick:()=>{u(t.id),n(!1)},children:[e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:87:15",className:"w-4 h-4 mr-2"}),"确认告警"]})]})]})})}function Lt({alert:t,open:s,onOpenChange:n,onSilence:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:109:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:110:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:111:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:112:11",children:"静默告警"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:113:11",children:"选择静默持续时间"})]}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:115:9",className:"space-y-2",children:["1h","4h","8h","24h","7d"].map(g=>e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:117:13",variant:"outline",className:"w-full justify-between",onClick:()=>t&&u(t.id,g),children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:123:15",children:["静默 ",g]}),e.jsx(ut,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:124:15",className:"w-4 h-4"})]},g))})]})})}const Re=[{value:"feishu",label:"飞书",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{value:"dingtalk",label:"钉钉",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=..."},{value:"wechat",label:"企业微信",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..."},{value:"webhook",label:"自定义Webhook",placeholder:"https://your-webhook-url..."}];function zt({open:t,onOpenChange:s,editingContact:n,onSaved:u}){const[g,h]=a.useState("feishu"),[l,C]=a.useState({name:"",phone:"",email:"",webhook_url:""}),[b,v]=a.useState(!1);a.useEffect(()=>{t&&(n?(h(n.channel_type||"feishu"),C({name:n.name||"",phone:n.phone||"",email:n.email||"",webhook_url:n.webhook_url||""})):(h("feishu"),C({name:"",phone:"",email:"",webhook_url:""})))},[t,n]);const f=async()=>{if(!(!l.name.trim()||!l.webhook_url.trim())){v(!0);try{const p={name:l.name.trim(),phone:l.phone.trim()||void 0,email:l.email.trim()||void 0,channel_type:g,webhook_url:l.webhook_url.trim()};n?(await R.updateContact(n.id,p),d.success("联系人已更新")):(await R.createContact(p),d.success("联系人已添加")),s(!1),u()}catch{d.error("保存失败")}finally{v(!1)}}},o=Re.find(p=>p.value===g);return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:85:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:86:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:87:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:88:11",children:n?"编辑报警联系人":"添加报警联系人"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:89:11",children:"选择通知渠道并填入 Webhook 地址"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:91:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:92:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:93:13",children:"姓名 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:94:13",value:l.name,onChange:p=>C({...l,name:p.target.value}),placeholder:"如:张三"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:100:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:101:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:102:15",children:"手机号"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:103:15",value:l.phone,onChange:p=>C({...l,phone:p.target.value}),placeholder:"13800138000"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:109:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:110:15",children:"邮箱"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:111:15",value:l.email,onChange:p=>C({...l,email:p.target.value}),placeholder:"zhangsan@example.com"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:118:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:119:13",children:"渠道类型 *"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:120:13",value:g,onValueChange:h,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:121:15",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:122:17",placeholder:"选择渠道类型"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:124:15",children:Re.map(p=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:126:19",value:p.value,children:p.label},p.value))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:131:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:132:13",children:"Webhook URL *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:133:13",value:l.webhook_url,onChange:p=>C({...l,webhook_url:p.target.value}),placeholder:o?.placeholder||"https://...",className:"font-mono text-xs"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:141:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:142:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:143:11",onClick:f,disabled:!l.name.trim()||!l.webhook_url.trim()||b,children:b?"保存中...":n?"保存修改":"添加联系人"})]})]})})}function Gt({open:t,onOpenChange:s,editingGroup:n,contacts:u,onSaved:g}){const[h,l]=a.useState({group_name:"",notes:"",contact_ids:[]}),[C,b]=a.useState(!1);a.useEffect(()=>{if(t)if(n){let o=[];try{o=JSON.parse(n.contact_ids||"[]")}catch{}l({group_name:n.group_name||"",notes:n.notes||"",contact_ids:o})}else l({group_name:"",notes:"",contact_ids:[]})},[t,n]);const v=o=>{l(p=>({...p,contact_ids:p.contact_ids.includes(o)?p.contact_ids.filter(O=>O!==o):[...p.contact_ids,o]}))},f=async()=>{if(h.group_name.trim()){b(!0);try{const o={group_name:h.group_name.trim(),notes:h.notes.trim()||void 0,contact_ids:h.contact_ids};n?(await R.updateContactGroup(n.id,o),d.success("联系组已更新")):(await R.createContactGroup(o),d.success("联系组已添加")),s(!1),g()}catch{d.error("保存失败")}finally{b(!1)}}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:84:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:85:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:86:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:87:11",children:n?"编辑报警联系组":"添加报警联系组"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:88:11",children:"配置报警联系组,选择组内成员"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:90:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:91:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:92:13",children:"组名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:93:13",value:h.group_name,onChange:o=>l({...h,group_name:o.target.value}),placeholder:"如:运维值班组"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:99:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:100:13",children:"备注"}),e.jsx(bt,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:101:13",value:h.notes,onChange:o=>l({...h,notes:o.target.value}),placeholder:"如:周一至周五 9:00-21:00",rows:2})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:108:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:109:13",children:"选择联系人"}),u.length===0?e.jsx("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:111:15",className:"text-xs text-muted-foreground",children:"暂无联系人,请先在「报警联系人」标签页添加"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:113:15",className:"flex flex-wrap gap-1.5 max-h-[180px] overflow-y-auto border rounded-md p-2",children:u.map(o=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:115:19",variant:h.contact_ids.includes(o.id)?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>v(o.id),children:[o.name,h.contact_ids.includes(o.id)&&" ✓"]},o.id))}),h.contact_ids.length>0&&e.jsxs("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:128:15",className:"text-xs text-muted-foreground",children:["已选择 ",h.contact_ids.length," 位联系人"]})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:132:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:133:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:134:11",onClick:f,disabled:!h.group_name.trim()||C,children:C?"保存中...":n?"保存修改":"添加联系组"})]})]})})}const Mt={onetime:"一次性",daily:"每天循环",weekly:"每周循环"},$t=["周日","周一","周二","周三","周四","周五","周六"];function ee(t){const s=t.getTimezoneOffset();return new Date(t.getTime()-s*6e4).toISOString().slice(0,16)}function Ee(t,s){return new Date(t.getTime()+s*36e5)}function It({open:t,onOpenChange:s,editingSilence:n,onSaved:u}){const[g,h]=a.useState(!1),[l,C]=a.useState(""),[b,v]=a.useState(""),[f,o]=a.useState("onetime"),[p,O]=a.useState(""),[L,c]=a.useState(""),[N,k]=a.useState([]);a.useEffect(()=>{if(n){C(n.name||""),v(n.description||""),o(n.silence_type||"onetime");const x=n.start_time?new Date(n.start_time):new Date,y=n.end_time?new Date(n.end_time):Ee(new Date,1);O(ee(x)),c(ee(y));let G=[];if(n.weekday_list)G=n.weekday_list;else if(n.weekdays)try{G=JSON.parse(n.weekdays)}catch{}k(G)}else{C(""),v(""),o("onetime");const x=new Date;O(ee(x)),c(ee(Ee(x,2))),k([])}},[n,t]);const S=x=>{k(y=>y.includes(x)?y.filter(G=>G!==x):[...y,x])},z=async()=>{if(!l.trim()){d.error("请填写规则名称");return}if(!L){d.error("请设置结束时间");return}if(f==="weekly"&&N.length===0){d.error("每周静默需要选择至少一个星期");return}const x={name:l.trim(),description:b.trim(),silence_type:f,start_time:p,end_time:L,weekdays:f==="weekly"?N:[]};h(!0);try{n?(await E.updateSilence(n.id,x),d.success("静默规则已更新")):(await E.createSilence(x),d.success("静默规则已创建")),s(!1),u()}catch{d.error("保存失败")}finally{h(!1)}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:141:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:142:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:143:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:144:11",className:"text-[var(--dg-text-primary)]",children:n?"编辑静默规则":"创建静默规则"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:147:11",className:"text-[var(--dg-text-secondary)]",children:"静默期间匹配的告警将不会触发通知"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:151:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:153:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:154:13",className:"text-[var(--dg-text-primary)]",children:"规则名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:155:13",value:l,onChange:x=>C(x.target.value),placeholder:"如:维护窗口静默",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:164:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:165:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:166:13",value:b,onChange:x=>v(x.target.value),placeholder:"可选备注",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:175:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:176:13",className:"text-[var(--dg-text-primary)]",children:"静默类型"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:177:13",value:f,onValueChange:o,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:178:15",className:"bg-[var(--dg-bg-primary)]",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:179:17"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:181:15",children:Object.entries(Mt).map(([x,y])=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:183:19",value:x,children:y},x))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:190:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:191:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:192:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"开始时间":"每日开始"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:195:15",type:"datetime-local",value:p,onChange:x=>O(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:202:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:203:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"结束时间":"每日结束"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:206:15",type:"datetime-local",value:L,onChange:x=>c(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]})]}),f==="weekly"&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:217:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:218:15",className:"text-[var(--dg-text-primary)]",children:"生效星期"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:219:15",className:"flex flex-wrap gap-2",children:$t.map((x,y)=>e.jsx("button",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:221:19",type:"button",onClick:()=>S(y),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${N.includes(y)?"bg-primary text-primary-foreground":"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] text-[var(--dg-text-secondary)]"}`,children:x},y))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:239:11",className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2",children:[f==="onetime"&&"在指定时间窗口内,所有匹配条件的告警将被静默。窗口结束后自动恢复正常。",f==="daily"&&"每天在指定时段内静默告警,适合非工作时间免打扰。",f==="weekly"&&"仅在选定星期的指定时段内静默,适合周末维护窗口。"]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:245:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:246:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:247:11",onClick:z,disabled:g,children:g?"保存中…":"保存"})]})]})})}const qt={onetime:"一次性",daily:"每天",weekly:"每周"},Ft=["日","一","二","三","四","五","六"];function P(t){if(!t)return"—";const s=typeof t=="string"?new Date(t):t;return isNaN(s.getTime())?"—":s.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}const Bt=()=>{const t=Oe(),[s,n]=a.useState([]),[u,g]=a.useState(!1),[h,l]=a.useState(!1),[C,b]=a.useState(null),v=a.useCallback(async()=>{g(!0);try{const c=await E.getSilences(),N=c?.list||c?.data?.list||[];n(N)}catch{d.error("获取静默规则失败")}finally{g(!1)}},[]);a.useEffect(()=>{v()},[v]);const f=()=>{b(null),l(!0)},o=c=>{b(c),l(!0)},p=async c=>{if(await t({title:"删除静默规则",description:`确定删除「${c.name}」?删除后该规则匹配的告警将恢复通知。`,confirmText:"删除",variant:"destructive"}))try{await E.deleteSilence(c.id),d.success("已删除"),v()}catch{d.error("删除失败")}},O=async c=>{try{await E.toggleSilence(c.id),d.success(c.status===1?"已禁用":"已启用"),v()}catch{d.error("操作失败")}},L=c=>{if(c.is_active!==void 0)return c.is_active;if(c.status!==1)return!1;const N=new Date,k=new Date(c.start_time),S=new Date(c.end_time);return N>=k&&N<=S};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:102:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:104:7",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:105:9",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:106:11",className:"w-4 h-4"}),e.jsxs("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:107:11",children:["共 ",s.length," 条规则"]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:109:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:110:11",variant:"outline",size:"sm",onClick:v,disabled:u,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:111:13",className:"w-3.5 h-3.5 mr-1"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:114:11",size:"sm",onClick:f,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:115:13",className:"w-3.5 h-3.5 mr-1"}),"添加静默规则"]})]})]}),u&&s.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:123:9",className:"text-center py-12 text-muted-foreground",children:e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:124:11",className:"text-sm",children:"加载中..."})}):s.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:127:9",className:"text-center py-12 text-muted-foreground border border-dashed rounded-lg",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:128:11",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:129:11",className:"text-sm",children:"暂无静默规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:130:11",className:"text-xs mt-1",children:"点击「添加静默规则」创建维护窗口或免打扰时段"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:133:9",className:"grid grid-cols-1 gap-3",children:s.map(c=>{const N=L(c),k=c.status===1,S=c.silence_type||"onetime",z=c.weekday_list||(()=>{try{return JSON.parse(c.weekdays||"[]")}catch{return[]}})();return e.jsx(W,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:142:15",className:N?"border-primary/50":"",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:143:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:144:19",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:146:21",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:147:23",className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:148:25",className:"font-medium text-sm",children:c.name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:150:25",variant:"outline",className:"text-xs",children:[S==="onetime"&&e.jsx(gt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:151:51",className:"w-3 h-3 mr-1"}),S==="daily"&&e.jsx(jt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:152:49",className:"w-3 h-3 mr-1"}),S==="weekly"&&e.jsx(Ct,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:153:50",className:"w-3 h-3 mr-1"}),qt[S]||S]}),N&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:158:27",className:"bg-green-500 text-xs",children:"生效中"}),!k&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:161:27",variant:"secondary",className:"text-xs",children:"已禁用"})]}),c.description&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:166:25",className:"text-xs text-muted-foreground mb-1.5",children:c.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:170:23",className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:171:25",children:S==="onetime"?`${P(c.start_time)} — ${P(c.end_time)}`:`每日 ${P(c.start_time)} — ${P(c.end_time)}`}),S==="weekly"&&z.length>0&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:178:27",className:"flex items-center gap-1",children:z.sort((x,y)=>x-y).map(x=>e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:180:31",className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px]",children:Ft[x]},x))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:189:23",className:"text-[10px] text-muted-foreground/60 mt-1",children:["创建于 ",P(c.created_at)]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:195:21",className:"flex items-center gap-2 shrink-0",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:196:23",checked:k,onCheckedChange:()=>O(c)}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:200:23",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(c),children:[e.jsx(ft,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:201:25",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:203:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>p(c),children:[e.jsx(vt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:204:25",className:"w-3 h-3 mr-1"}),"删除"]})]})]})})},c.id)})}),e.jsx(It,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:216:7",open:h,onOpenChange:l,editingSilence:C,onSaved:v})]})},ir=()=>{const t=Oe(),[s,n]=a.useState(""),[u,g]=a.useState("all"),[h,l]=a.useState("all"),[C,b]=a.useState("alerts"),[v,f]=a.useState(null),[o,p]=a.useState(!1),[O,L]=a.useState(!1),[c,N]=a.useState(!1),[k,S]=a.useState(null),[z,x]=a.useState([]),[y,G]=a.useState([]),[qe,me]=a.useState(!1),[Fe,ve]=a.useState(null),[Be,de]=a.useState(!1),[Pe,Ae]=a.useState(null),[M,H]=a.useState(1),[pe]=a.useState(10),We=a.useMemo(()=>({page:M,page_size:pe,severity:u,status:h}),[M,pe,u,h]),{data:xe,isLoading:Ke,refetch:Ne}=Rt(We),{data:ye=[],refetch:we}=_t(),{ackMutation:Qe,resolveMutation:Je,quickSetupMutation:he,toggleAgentRuleMutation:Ve,deleteAgentRuleMutation:Ue}=Et(),ue=xe?.list??[],ge=xe?.total??0,q=xe?.stats??{firing:0,critical:0,warning:0,resolved:0},I=Math.max(1,Math.ceil(ge/pe));a.useEffect(()=>{C==="contacts"&&X(),C==="groups"&&(X(),Z())},[C]);const X=async()=>{try{const r=await R.getContacts();x(r?.data?.list||r?.list||[])}catch{}},Z=async()=>{try{const r=await R.getContactGroups();G(r?.data?.list||r?.list||[])}catch{}},be=async r=>{try{await Qe.mutateAsync(r),d.success("告警已确认")}catch{d.error("操作失败")}},Ye=async r=>{try{await Je.mutateAsync(r),d.success("告警已解决")}catch{d.error("操作失败")}},He=async(r,i)=>{try{const D=ue.find(ot=>ot.id===r),w=new Date,je=i.match(/^(\d+)([hd])$/),ke=je?parseInt(je[1]):1,nt=(je?.[2]||"h")==="d"?ke*24:ke,st=new Date(w.getTime()+nt*36e5);await E.createSilence({name:`静默: ${D?.title||r} (${i})`,description:`从告警列表快速静默 — ${D?.source||""}`,silence_type:"onetime",start_time:w.toISOString(),end_time:st.toISOString()}),d.success(`告警已静默 ${i}`),L(!1),Ne()}catch{d.error("操作失败")}},Xe=async(r,i)=>{try{await Ve.mutateAsync({id:Number(r),enabled:i}),d.success("规则状态已更新")}catch{d.error("更新失败")}},Ze=()=>{S(null),N(!0)},et=r=>{S(r),N(!0)},Se=()=>{N(!1),S(null)},tt=async()=>{if(await t({title:"一键报警",description:"为 Agent 在线主机创建 CPU(>80%)/内存(>80%)/磁盘(>90%)/TIME_WAIT(>15000)/CLOSE_WAIT(>200)/进程检测 6 条告警规则。",confirmText:"确认创建"}))try{const i=await he.mutateAsync("ecs");d.success(typeof i=="string"?i:i?.message||"默认告警规则创建成功")}catch{d.error("创建失败,请检查 Agent 主机是否在线")}},rt=async r=>{if(await t({title:"删除规则",description:`确定删除规则「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await Ue.mutateAsync(Number(r.id)),d.success("已删除")}catch{d.error("删除失败")}},De=(r,i)=>{r==="severity"?g(i):l(i),H(1)};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:179:5",className:"space-y-3",children:[e.jsx(at,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:181:7",items:[{label:"触发中",value:q.firing,color:q.firing>0?"red":"muted"},{label:"严重",value:q.critical,color:"red"},{label:"警告",value:q.warning,color:"amber"},{label:"已解决",value:q.resolved,color:"emerald"}]}),e.jsxs(lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:190:7",value:C,onValueChange:b,children:[e.jsxs(it,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:191:9",className:"grid w-full grid-cols-5 lg:w-[600px] h-9",children:[e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:192:11",value:"alerts",className:"text-xs",children:"告警列表"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:193:11",value:"rules",className:"text-xs",children:"告警规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:194:11",value:"silences",className:"text-xs",children:"静默规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:195:11",value:"contacts",className:"text-xs",children:"报警联系人"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:196:11",value:"groups",className:"text-xs",children:"报警联系组"})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:200:9",value:"alerts",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:201:11",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:202:13",className:"flex items-center gap-2 flex-1 min-w-[280px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:203:15",className:"relative flex-1",children:[e.jsx(At,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:204:17",className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:205:17",placeholder:"搜索告警...",value:s,onChange:r=>n(r.target.value),className:"pl-8 h-8 text-xs"})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:212:15",value:u,onValueChange:r=>De("severity",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:213:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:214:19",placeholder:"级别"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:216:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:217:19",value:"all",children:"全部级别"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:218:19",value:"critical",children:"严重"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:219:19",value:"warning",children:"警告"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:220:19",value:"info",children:"信息"})]})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:223:15",value:h,onValueChange:r=>De("status",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:224:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:225:19",placeholder:"状态"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:227:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:228:19",value:"all",children:"全部状态"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:229:19",value:"firing",children:"触发中"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:230:19",value:"acknowledged",children:"已确认"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:231:19",value:"resolved",children:"已解决"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:235:13",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:236:15",children:["共 ",ge," 条"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:237:15",variant:"outline",size:"sm",onClick:()=>Ne(),className:"h-7 text-xs px-2",children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:238:17",className:"w-3 h-3 mr-1"}),"刷新"]})]})]}),e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:244:11",children:e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:245:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:246:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:247:17",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:248:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:249:21",children:[e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:250:23",className:"px-3 py-2 text-left text-xs font-medium",children:"告警信息"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:251:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"级别"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:252:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:253:23",className:"px-3 py-2 text-left text-xs font-medium w-24",children:"来源"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:254:23",className:"px-3 py-2 text-left text-xs font-medium w-20",children:"持续"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:255:23",className:"px-3 py-2 text-left text-xs font-medium w-28",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:258:19",className:"divide-y",children:Ke?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"加载中..."})}):ue.length===0?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"暂无告警"})}):ue.filter(r=>{if(!s)return!0;const i=s.toLowerCase();return r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i)||r.source.toLowerCase().includes(i)}).map(r=>e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:272:25",className:"hover:bg-muted/50",children:[e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:273:27",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:274:29",className:"font-medium text-xs",children:r.title}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:275:29",className:"text-xs text-muted-foreground line-clamp-1",children:r.description}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:276:29",className:"flex gap-1 mt-0.5",children:Object.entries(r.labels).slice(0,2).map(([i,D])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:278:33",variant:"outline",className:"text-[10px] px-1 py-0",children:[i,"=",D]},i))})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:282:27",className:"px-3 py-2",children:fe(r.severity)}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:283:27",className:"px-3 py-2",children:Dt(r.status)}),e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:284:27",className:"px-3 py-2 text-xs",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:285:29",children:r.source}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:286:29",className:"text-muted-foreground text-[10px]",children:r.service})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:288:27",className:"px-3 py-2 text-xs text-muted-foreground",children:r.status==="resolved"&&r.resolvedAt?`${Math.floor((new Date(r.resolvedAt).getTime()-new Date(r.startedAt).getTime())/6e4)}分`:`${Math.floor((Date.now()-new Date(r.startedAt).getTime())/6e4)}分`}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:293:27",className:"px-3 py-2",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:294:29",className:"flex items-center gap-0.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:295:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),p(!0)},children:e.jsx(Nt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:297:33",className:"w-3.5 h-3.5"})}),r.status==="firing"&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:300:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>be(r.id),children:e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:302:35",className:"w-3.5 h-3.5 text-blue-600"})}),(r.status==="firing"||r.status==="acknowledged")&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:306:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ye(r.id),children:e.jsx($e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:308:35",className:"w-3.5 h-3.5 text-green-600"})}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:311:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),L(!0)},children:e.jsx(le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:313:33",className:"w-3.5 h-3.5 text-orange-600"})})]})})]},r.id))})]})}),I>1&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:325:17",className:"flex items-center justify-between px-3 py-2 border-t text-xs",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:326:19",className:"text-muted-foreground",children:["第 ",M,"/",I," 页,共 ",ge," 条"]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:327:19",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:328:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M<=1,onClick:()=>H(r=>r-1),children:"上一页"}),Array.from({length:Math.min(I,5)},(r,i)=>{const w=Math.max(1,Math.min(M-2,I-4))+i;return w>I?null:e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:337:25",variant:w===M?"default":"outline",size:"sm",className:"h-7 min-w-[28px] text-xs px-1",onClick:()=>H(w),children:w},w)}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:344:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M>=I,onClick:()=>H(r=>r+1),children:"下一页"})]})]})]})})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:356:9",value:"rules",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:357:11",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:358:13",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:359:15",onClick:Ze,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:360:17",className:"w-4 h-4 mr-1"}),"添加规则"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:362:15",variant:"secondary",onClick:tt,disabled:he.isPending,children:[e.jsx(yt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:363:17",className:"w-4 h-4 mr-1"}),he.isPending?"创建中…":"一键报警"]})]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:367:13",variant:"outline",onClick:()=>we(),children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:368:15",className:"w-4 h-4 mr-2"}),"刷新"]})]}),ye.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:373:13",className:"text-center py-12 text-muted-foreground",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:374:15",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:375:15",className:"text-sm",children:"暂无告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:376:15",className:"text-xs mt-1",children:"点击「添加规则」或「一键报警」快速创建"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:379:11",className:"grid grid-cols-1 gap-4",children:ye.map(r=>e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:381:15",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:382:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:383:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:384:21",className:"flex-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:385:23",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:386:25",className:"font-medium",children:r.name}),fe(r.severity),e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:388:25",variant:r.enabled?"default":"secondary",children:r.enabled?"已启用":"已禁用"})]}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:392:23",className:"text-sm text-muted-foreground mb-2",children:r.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:393:23",className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.expression&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:395:27",className:"font-mono bg-muted px-2 py-1 rounded",children:r.expression}),r.duration?e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:397:42",children:["持续 ",r.duration,"秒"]}):null]}),(()=>{let i=[];try{const D=r.notify_channels;D&&(i=Array.isArray(D)?D:JSON.parse(D))}catch{}return i.length?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:407:27",className:"flex gap-1 mt-2",children:i.map(D=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:409:31",variant:"outline",className:"text-xs",children:D},D))}):null})()]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:415:21",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:416:23",variant:"ghost",size:"sm",onClick:()=>et(r),children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:417:23",variant:"ghost",size:"sm",className:"text-red-400",onClick:()=>rt(r),children:"删除"}),e.jsx(Le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:418:23",checked:r.enabled,onCheckedChange:i=>Xe(String(r.id),i)})]})]})})},r.id))})]}),e.jsx(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:432:9",value:"silences",children:e.jsx(Bt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:433:11"})}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:437:9",value:"contacts",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:438:13",className:"flex justify-between items-center",children:[e.jsx("h3",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:439:15",className:"text-sm font-medium",children:"报警联系人"}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:440:15",size:"sm",onClick:()=>{ve(null),me(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:441:17",className:"w-4 h-4 mr-1"}),"添加联系人"]})]}),z.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:446:15",className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg text-xs",children:"暂无报警联系人,点击「添加联系人」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:450:15",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:z.map(r=>e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:452:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:453:21",className:"pb-2",children:e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:454:23",className:"flex items-start justify-between",children:e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:455:25",className:"text-sm",children:r.name})})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:458:21",className:"pt-0 space-y-1 text-xs text-muted-foreground",children:[r.phone&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:459:35",children:["📱 ",r.phone]}),r.email&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:460:35",children:["📧 ",r.email]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:461:23",className:"flex gap-1 flex-wrap",children:[r.channel_type&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:463:27",variant:"outline",className:"text-[10px]",children:kt(r.channel_type)}),r.webhook_url&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:468:27",className:"text-[10px] text-muted-foreground truncate max-w-[200px]",title:r.webhook_url,children:r.webhook_url})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:473:23",className:"flex gap-1.5 pt-1.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:474:25",variant:"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>{ve(r),me(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:478:25",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:async()=>{if(await t({title:"删除联系人",description:`确定删除「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContact(r.id),d.success("已删除"),X()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id))})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:496:9",value:"groups",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:497:11",className:"flex justify-between items-center",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:498:13",variant:"outline",onClick:Z,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:499:15",className:"w-4 h-4 mr-2"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:502:13",onClick:()=>{Ae(null),de(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:503:15",className:"w-4 h-4 mr-2"}),"添加联系组"]})]}),y.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:508:13",className:"text-center py-16 text-muted-foreground border border-dashed rounded-lg",children:"暂无报警联系组,点击「添加联系组」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:512:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(r=>{let i=[];try{i=JSON.parse(r.contact_ids||"[]")}catch{}const D=z.filter(w=>i.includes(w.id)).map(w=>w.name);return e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:520:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:521:21",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:522:23",className:"flex items-start justify-between",children:[e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:523:25",className:"text-base",children:r.group_name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:524:25",variant:"secondary",children:[i.length," 人"]})]})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:527:21",className:"pt-0 space-y-2",children:[r.notes&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:528:35",className:"text-sm text-muted-foreground",children:r.notes}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:529:23",className:"flex flex-wrap gap-1",children:D.map(w=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:531:27",variant:"outline",className:"text-xs",children:w},w))}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:534:23",className:"flex gap-2 pt-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:535:25",variant:"outline",size:"sm",className:"flex-1",onClick:()=>{Ae(r),de(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:539:25",variant:"outline",size:"sm",onClick:async()=>{if(await t({title:"删除联系组",description:`确定删除联系组「${r.group_name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContactGroup(r.id),d.success("已删除"),Z()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id)})})]})]}),e.jsx(Ot,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:558:7",alert:v,open:o,onOpenChange:p,onAcknowledge:be}),e.jsx(Lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:564:7",alert:v,open:O,onOpenChange:L,onSilence:He}),e.jsx(wt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:570:7",open:c,onOpenChange:Se,editingRule:k,notifyChannels:[],onSaved:()=>{Se(),we()}}),e.jsx(zt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:577:7",open:qe,onOpenChange:me,editingContact:Fe,onSaved:X}),e.jsx(Gt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:583:7",open:Be,onOpenChange:de,editingGroup:Pe,contacts:z,onSaved:()=>{Z()}})]})};export{ir as default}; +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(t={}){return ze({queryKey:ae.alerts(t),queryFn:async()=>{const s=await E.getAlerts({page:t.page,page_size:t.page_size,severity:t.severity!=="all"?t.severity:void 0,status:t.status!=="all"?t.status:void 0}),u=Ge(s).map(g=>St(g));return{list:u,total:mt(s),stats:Tt(u)}},staleTime:15e3,refetchInterval:3e4})}function Et(){const t=ct(),s=()=>t.invalidateQueries({queryKey:ae.alertRules()}),n=()=>t.invalidateQueries({queryKey:ae.agentAlertRules()}),u=()=>t.invalidateQueries({queryKey:["alerts"]}),g=$({mutationFn:o=>R.toggleRule(o),onSuccess:s}),h=$({mutationFn:o=>R.deleteRule(o),onSuccess:s}),l=$({mutationFn:({id:o,enabled:p})=>Ce.updateRule(o,{enabled:p}),onSuccess:n}),C=$({mutationFn:o=>Ce.deleteRule(o),onSuccess:n}),b=$({mutationFn:o=>E.acknowledge(o),onSuccess:u}),v=$({mutationFn:o=>E.resolve(o),onSuccess:u}),f=$({mutationFn:o=>E.quickSetup(o),onSuccess:n});return{toggleRuleMutation:g,deleteRuleMutation:h,toggleAgentRuleMutation:l,deleteAgentRuleMutation:C,ackMutation:b,resolveMutation:v,quickSetupMutation:f,invalidateRules:s,invalidateAgentRules:n,invalidateAlerts:u}}function Ot({alert:t,open:s,onOpenChange:n,onAcknowledge:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:22:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:23:7",className:"max-w-3xl",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:24:9",children:[e.jsxs(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:25:11",className:"flex items-center gap-2",children:[t?.title,t&&fe(t.severity)]}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:29:11",className:"sr-only",children:"查看告警详情"})]}),t&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:32:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:33:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:34:15",className:"text-muted-foreground",children:"描述"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:35:15",className:"mt-1",children:t.description})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:37:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:38:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:39:17",className:"text-muted-foreground",children:"来源"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:40:17",className:"font-medium",children:t.source})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:42:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:43:17",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:44:17",className:"font-medium",children:t.service})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:46:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:47:17",className:"text-muted-foreground",children:"指标"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:48:17",className:"font-medium",children:t.metric})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:50:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:51:17",className:"text-muted-foreground",children:"当前值 / 阈值"}),e.jsxs("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:52:17",className:"font-medium",children:[t.value," / ",t.threshold]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:54:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:55:17",className:"text-muted-foreground",children:"开始时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:56:17",className:"font-medium",children:t.startedAt})]}),t.resolvedAt&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:59:17",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:60:19",className:"text-muted-foreground",children:"解决时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:61:19",className:"font-medium",children:t.resolvedAt})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:65:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:66:15",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:67:15",className:"flex flex-wrap gap-2 mt-1",children:Object.entries(t.labels).map(([g,h])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:69:19",variant:"outline",children:[g,"=",h]},g))})]}),t.runbookUrl&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:74:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:75:17",className:"text-muted-foreground",children:"处理手册"}),e.jsx("a",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:76:17",href:t.runbookUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline block mt-1",children:"查看处理手册 →"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:83:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:84:11",variant:"outline",onClick:()=>n(!1),children:"关闭"}),t?.status==="firing"&&e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:86:13",onClick:()=>{u(t.id),n(!1)},children:[e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:87:15",className:"w-4 h-4 mr-2"}),"确认告警"]})]})]})})}function Lt({alert:t,open:s,onOpenChange:n,onSilence:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:109:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:110:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:111:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:112:11",children:"静默告警"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:113:11",children:"选择静默持续时间"})]}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:115:9",className:"space-y-2",children:["1h","4h","8h","24h","7d"].map(g=>e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:117:13",variant:"outline",className:"w-full justify-between",onClick:()=>t&&u(t.id,g),children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:123:15",children:["静默 ",g]}),e.jsx(ut,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:124:15",className:"w-4 h-4"})]},g))})]})})}const Re=[{value:"feishu",label:"飞书",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{value:"dingtalk",label:"钉钉",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=..."},{value:"wechat",label:"企业微信",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..."},{value:"webhook",label:"自定义Webhook",placeholder:"https://your-webhook-url..."}];function zt({open:t,onOpenChange:s,editingContact:n,onSaved:u}){const[g,h]=a.useState("feishu"),[l,C]=a.useState({name:"",phone:"",email:"",webhook_url:""}),[b,v]=a.useState(!1);a.useEffect(()=>{t&&(n?(h(n.channel_type||"feishu"),C({name:n.name||"",phone:n.phone||"",email:n.email||"",webhook_url:n.webhook_url||""})):(h("feishu"),C({name:"",phone:"",email:"",webhook_url:""})))},[t,n]);const f=async()=>{if(!(!l.name.trim()||!l.webhook_url.trim())){v(!0);try{const p={name:l.name.trim(),phone:l.phone.trim()||void 0,email:l.email.trim()||void 0,channel_type:g,webhook_url:l.webhook_url.trim()};n?(await R.updateContact(n.id,p),d.success("联系人已更新")):(await R.createContact(p),d.success("联系人已添加")),s(!1),u()}catch{d.error("保存失败")}finally{v(!1)}}},o=Re.find(p=>p.value===g);return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:85:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:86:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:87:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:88:11",children:n?"编辑报警联系人":"添加报警联系人"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:89:11",children:"选择通知渠道并填入 Webhook 地址"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:91:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:92:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:93:13",children:"姓名 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:94:13",value:l.name,onChange:p=>C({...l,name:p.target.value}),placeholder:"如:张三"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:100:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:101:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:102:15",children:"手机号"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:103:15",value:l.phone,onChange:p=>C({...l,phone:p.target.value}),placeholder:"13800138000"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:109:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:110:15",children:"邮箱"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:111:15",value:l.email,onChange:p=>C({...l,email:p.target.value}),placeholder:"zhangsan@example.com"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:118:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:119:13",children:"渠道类型 *"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:120:13",value:g,onValueChange:h,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:121:15",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:122:17",placeholder:"选择渠道类型"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:124:15",children:Re.map(p=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:126:19",value:p.value,children:p.label},p.value))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:131:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:132:13",children:"Webhook URL *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:133:13",value:l.webhook_url,onChange:p=>C({...l,webhook_url:p.target.value}),placeholder:o?.placeholder||"https://...",className:"font-mono text-xs"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:141:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:142:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:143:11",onClick:f,disabled:!l.name.trim()||!l.webhook_url.trim()||b,children:b?"保存中...":n?"保存修改":"添加联系人"})]})]})})}function Gt({open:t,onOpenChange:s,editingGroup:n,contacts:u,onSaved:g}){const[h,l]=a.useState({group_name:"",notes:"",contact_ids:[]}),[C,b]=a.useState(!1);a.useEffect(()=>{if(t)if(n){let o=[];try{o=JSON.parse(n.contact_ids||"[]")}catch{}l({group_name:n.group_name||"",notes:n.notes||"",contact_ids:o})}else l({group_name:"",notes:"",contact_ids:[]})},[t,n]);const v=o=>{l(p=>({...p,contact_ids:p.contact_ids.includes(o)?p.contact_ids.filter(O=>O!==o):[...p.contact_ids,o]}))},f=async()=>{if(h.group_name.trim()){b(!0);try{const o={group_name:h.group_name.trim(),notes:h.notes.trim()||void 0,contact_ids:h.contact_ids};n?(await R.updateContactGroup(n.id,o),d.success("联系组已更新")):(await R.createContactGroup(o),d.success("联系组已添加")),s(!1),g()}catch{d.error("保存失败")}finally{b(!1)}}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:84:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:85:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:86:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:87:11",children:n?"编辑报警联系组":"添加报警联系组"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:88:11",children:"配置报警联系组,选择组内成员"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:90:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:91:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:92:13",children:"组名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:93:13",value:h.group_name,onChange:o=>l({...h,group_name:o.target.value}),placeholder:"如:运维值班组"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:99:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:100:13",children:"备注"}),e.jsx(bt,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:101:13",value:h.notes,onChange:o=>l({...h,notes:o.target.value}),placeholder:"如:周一至周五 9:00-21:00",rows:2})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:108:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:109:13",children:"选择联系人"}),u.length===0?e.jsx("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:111:15",className:"text-xs text-muted-foreground",children:"暂无联系人,请先在「报警联系人」标签页添加"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:113:15",className:"flex flex-wrap gap-1.5 max-h-[180px] overflow-y-auto border rounded-md p-2",children:u.map(o=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:115:19",variant:h.contact_ids.includes(o.id)?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>v(o.id),children:[o.name,h.contact_ids.includes(o.id)&&" ✓"]},o.id))}),h.contact_ids.length>0&&e.jsxs("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:128:15",className:"text-xs text-muted-foreground",children:["已选择 ",h.contact_ids.length," 位联系人"]})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:132:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:133:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:134:11",onClick:f,disabled:!h.group_name.trim()||C,children:C?"保存中...":n?"保存修改":"添加联系组"})]})]})})}const Mt={onetime:"一次性",daily:"每天循环",weekly:"每周循环"},$t=["周日","周一","周二","周三","周四","周五","周六"];function ee(t){const s=t.getTimezoneOffset();return new Date(t.getTime()-s*6e4).toISOString().slice(0,16)}function Ee(t,s){return new Date(t.getTime()+s*36e5)}function It({open:t,onOpenChange:s,editingSilence:n,onSaved:u}){const[g,h]=a.useState(!1),[l,C]=a.useState(""),[b,v]=a.useState(""),[f,o]=a.useState("onetime"),[p,O]=a.useState(""),[L,c]=a.useState(""),[N,k]=a.useState([]);a.useEffect(()=>{if(n){C(n.name||""),v(n.description||""),o(n.silence_type||"onetime");const x=n.start_time?new Date(n.start_time):new Date,y=n.end_time?new Date(n.end_time):Ee(new Date,1);O(ee(x)),c(ee(y));let G=[];if(n.weekday_list)G=n.weekday_list;else if(n.weekdays)try{G=JSON.parse(n.weekdays)}catch{}k(G)}else{C(""),v(""),o("onetime");const x=new Date;O(ee(x)),c(ee(Ee(x,2))),k([])}},[n,t]);const S=x=>{k(y=>y.includes(x)?y.filter(G=>G!==x):[...y,x])},z=async()=>{if(!l.trim()){d.error("请填写规则名称");return}if(!L){d.error("请设置结束时间");return}if(f==="weekly"&&N.length===0){d.error("每周静默需要选择至少一个星期");return}const x={name:l.trim(),description:b.trim(),silence_type:f,start_time:p,end_time:L,weekdays:f==="weekly"?N:[]};h(!0);try{n?(await E.updateSilence(n.id,x),d.success("静默规则已更新")):(await E.createSilence(x),d.success("静默规则已创建")),s(!1),u()}catch{d.error("保存失败")}finally{h(!1)}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:141:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:142:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:143:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:144:11",className:"text-[var(--dg-text-primary)]",children:n?"编辑静默规则":"创建静默规则"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:147:11",className:"text-[var(--dg-text-secondary)]",children:"静默期间匹配的告警将不会触发通知"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:151:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:153:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:154:13",className:"text-[var(--dg-text-primary)]",children:"规则名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:155:13",value:l,onChange:x=>C(x.target.value),placeholder:"如:维护窗口静默",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:164:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:165:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:166:13",value:b,onChange:x=>v(x.target.value),placeholder:"可选备注",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:175:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:176:13",className:"text-[var(--dg-text-primary)]",children:"静默类型"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:177:13",value:f,onValueChange:o,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:178:15",className:"bg-[var(--dg-bg-primary)]",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:179:17"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:181:15",children:Object.entries(Mt).map(([x,y])=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:183:19",value:x,children:y},x))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:190:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:191:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:192:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"开始时间":"每日开始"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:195:15",type:"datetime-local",value:p,onChange:x=>O(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:202:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:203:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"结束时间":"每日结束"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:206:15",type:"datetime-local",value:L,onChange:x=>c(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]})]}),f==="weekly"&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:217:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:218:15",className:"text-[var(--dg-text-primary)]",children:"生效星期"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:219:15",className:"flex flex-wrap gap-2",children:$t.map((x,y)=>e.jsx("button",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:221:19",type:"button",onClick:()=>S(y),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${N.includes(y)?"bg-primary text-primary-foreground":"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] text-[var(--dg-text-secondary)]"}`,children:x},y))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:239:11",className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2",children:[f==="onetime"&&"在指定时间窗口内,所有匹配条件的告警将被静默。窗口结束后自动恢复正常。",f==="daily"&&"每天在指定时段内静默告警,适合非工作时间免打扰。",f==="weekly"&&"仅在选定星期的指定时段内静默,适合周末维护窗口。"]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:245:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:246:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:247:11",onClick:z,disabled:g,children:g?"保存中…":"保存"})]})]})})}const qt={onetime:"一次性",daily:"每天",weekly:"每周"},Ft=["日","一","二","三","四","五","六"];function P(t){if(!t)return"—";const s=typeof t=="string"?new Date(t):t;return isNaN(s.getTime())?"—":s.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}const Bt=()=>{const t=Oe(),[s,n]=a.useState([]),[u,g]=a.useState(!1),[h,l]=a.useState(!1),[C,b]=a.useState(null),v=a.useCallback(async()=>{g(!0);try{const c=await E.getSilences(),N=c?.list||c?.data?.list||[];n(N)}catch{d.error("获取静默规则失败")}finally{g(!1)}},[]);a.useEffect(()=>{v()},[v]);const f=()=>{b(null),l(!0)},o=c=>{b(c),l(!0)},p=async c=>{if(await t({title:"删除静默规则",description:`确定删除「${c.name}」?删除后该规则匹配的告警将恢复通知。`,confirmText:"删除",variant:"destructive"}))try{await E.deleteSilence(c.id),d.success("已删除"),v()}catch{d.error("删除失败")}},O=async c=>{try{await E.toggleSilence(c.id),d.success(c.status===1?"已禁用":"已启用"),v()}catch{d.error("操作失败")}},L=c=>{if(c.is_active!==void 0)return c.is_active;if(c.status!==1)return!1;const N=new Date,k=new Date(c.start_time),S=new Date(c.end_time);return N>=k&&N<=S};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:102:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:104:7",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:105:9",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:106:11",className:"w-4 h-4"}),e.jsxs("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:107:11",children:["共 ",s.length," 条规则"]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:109:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:110:11",variant:"outline",size:"sm",onClick:v,disabled:u,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:111:13",className:"w-3.5 h-3.5 mr-1"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:114:11",size:"sm",onClick:f,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:115:13",className:"w-3.5 h-3.5 mr-1"}),"添加静默规则"]})]})]}),u&&s.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:123:9",className:"text-center py-12 text-muted-foreground",children:e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:124:11",className:"text-sm",children:"加载中..."})}):s.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:127:9",className:"text-center py-12 text-muted-foreground border border-dashed rounded-lg",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:128:11",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:129:11",className:"text-sm",children:"暂无静默规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:130:11",className:"text-xs mt-1",children:"点击「添加静默规则」创建维护窗口或免打扰时段"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:133:9",className:"grid grid-cols-1 gap-3",children:s.map(c=>{const N=L(c),k=c.status===1,S=c.silence_type||"onetime",z=c.weekday_list||(()=>{try{return JSON.parse(c.weekdays||"[]")}catch{return[]}})();return e.jsx(W,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:142:15",className:N?"border-primary/50":"",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:143:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:144:19",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:146:21",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:147:23",className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:148:25",className:"font-medium text-sm",children:c.name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:150:25",variant:"outline",className:"text-xs",children:[S==="onetime"&&e.jsx(gt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:151:51",className:"w-3 h-3 mr-1"}),S==="daily"&&e.jsx(jt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:152:49",className:"w-3 h-3 mr-1"}),S==="weekly"&&e.jsx(Ct,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:153:50",className:"w-3 h-3 mr-1"}),qt[S]||S]}),N&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:158:27",className:"bg-green-500 text-xs",children:"生效中"}),!k&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:161:27",variant:"secondary",className:"text-xs",children:"已禁用"})]}),c.description&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:166:25",className:"text-xs text-muted-foreground mb-1.5",children:c.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:170:23",className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:171:25",children:S==="onetime"?`${P(c.start_time)} — ${P(c.end_time)}`:`每日 ${P(c.start_time)} — ${P(c.end_time)}`}),S==="weekly"&&z.length>0&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:178:27",className:"flex items-center gap-1",children:z.sort((x,y)=>x-y).map(x=>e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:180:31",className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px]",children:Ft[x]},x))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:189:23",className:"text-[10px] text-muted-foreground/60 mt-1",children:["创建于 ",P(c.created_at)]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:195:21",className:"flex items-center gap-2 shrink-0",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:196:23",checked:k,onCheckedChange:()=>O(c)}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:200:23",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(c),children:[e.jsx(ft,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:201:25",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:203:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>p(c),children:[e.jsx(vt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:204:25",className:"w-3 h-3 mr-1"}),"删除"]})]})]})})},c.id)})}),e.jsx(It,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:216:7",open:h,onOpenChange:l,editingSilence:C,onSaved:v})]})},ir=()=>{const t=Oe(),[s,n]=a.useState(""),[u,g]=a.useState("all"),[h,l]=a.useState("all"),[C,b]=a.useState("alerts"),[v,f]=a.useState(null),[o,p]=a.useState(!1),[O,L]=a.useState(!1),[c,N]=a.useState(!1),[k,S]=a.useState(null),[z,x]=a.useState([]),[y,G]=a.useState([]),[qe,me]=a.useState(!1),[Fe,ve]=a.useState(null),[Be,de]=a.useState(!1),[Pe,Ae]=a.useState(null),[M,H]=a.useState(1),[pe]=a.useState(10),We=a.useMemo(()=>({page:M,page_size:pe,severity:u,status:h}),[M,pe,u,h]),{data:xe,isLoading:Ke,refetch:Ne}=Rt(We),{data:ye=[],refetch:we}=_t(),{ackMutation:Qe,resolveMutation:Je,quickSetupMutation:he,toggleAgentRuleMutation:Ve,deleteAgentRuleMutation:Ue}=Et(),ue=xe?.list??[],ge=xe?.total??0,q=xe?.stats??{firing:0,critical:0,warning:0,resolved:0},I=Math.max(1,Math.ceil(ge/pe));a.useEffect(()=>{C==="contacts"&&X(),C==="groups"&&(X(),Z())},[C]);const X=async()=>{try{const r=await R.getContacts();x(r?.data?.list||r?.list||[])}catch{}},Z=async()=>{try{const r=await R.getContactGroups();G(r?.data?.list||r?.list||[])}catch{}},be=async r=>{try{await Qe.mutateAsync(r),d.success("告警已确认")}catch{d.error("操作失败")}},Ye=async r=>{try{await Je.mutateAsync(r),d.success("告警已解决")}catch{d.error("操作失败")}},He=async(r,i)=>{try{const D=ue.find(ot=>ot.id===r),w=new Date,je=i.match(/^(\d+)([hd])$/),ke=je?parseInt(je[1]):1,nt=(je?.[2]||"h")==="d"?ke*24:ke,st=new Date(w.getTime()+nt*36e5);await E.createSilence({name:`静默: ${D?.title||r} (${i})`,description:`从告警列表快速静默 — ${D?.source||""}`,silence_type:"onetime",start_time:w.toISOString(),end_time:st.toISOString()}),d.success(`告警已静默 ${i}`),L(!1),Ne()}catch{d.error("操作失败")}},Xe=async(r,i)=>{try{await Ve.mutateAsync({id:Number(r),enabled:i}),d.success("规则状态已更新")}catch{d.error("更新失败")}},Ze=()=>{S(null),N(!0)},et=r=>{S(r),N(!0)},Se=()=>{N(!1),S(null)},tt=async()=>{if(await t({title:"一键报警",description:"为 Agent 在线主机创建 CPU(>80%)/内存(>80%)/磁盘(>90%)/TIME_WAIT(>15000)/CLOSE_WAIT(>200)/进程检测 6 条告警规则。",confirmText:"确认创建"}))try{const i=await he.mutateAsync("ecs");d.success(typeof i=="string"?i:i?.message||"默认告警规则创建成功")}catch{d.error("创建失败,请检查 Agent 主机是否在线")}},rt=async r=>{if(await t({title:"删除规则",description:`确定删除规则「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await Ue.mutateAsync(Number(r.id)),d.success("已删除")}catch{d.error("删除失败")}},De=(r,i)=>{r==="severity"?g(i):l(i),H(1)};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:179:5",className:"space-y-3",children:[e.jsx(at,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:181:7",items:[{label:"触发中",value:q.firing,color:q.firing>0?"red":"muted"},{label:"严重",value:q.critical,color:"red"},{label:"警告",value:q.warning,color:"amber"},{label:"已解决",value:q.resolved,color:"emerald"}]}),e.jsxs(lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:190:7",value:C,onValueChange:b,children:[e.jsxs(it,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:191:9",className:"grid w-full grid-cols-5 lg:w-[600px] h-9",children:[e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:192:11",value:"alerts",className:"text-xs",children:"告警列表"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:193:11",value:"rules",className:"text-xs",children:"告警规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:194:11",value:"silences",className:"text-xs",children:"静默规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:195:11",value:"contacts",className:"text-xs",children:"报警联系人"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:196:11",value:"groups",className:"text-xs",children:"报警联系组"})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:200:9",value:"alerts",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:201:11",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:202:13",className:"flex items-center gap-2 flex-1 min-w-[280px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:203:15",className:"relative flex-1",children:[e.jsx(At,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:204:17",className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:205:17",placeholder:"搜索告警...",value:s,onChange:r=>n(r.target.value),className:"pl-8 h-8 text-xs"})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:212:15",value:u,onValueChange:r=>De("severity",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:213:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:214:19",placeholder:"级别"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:216:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:217:19",value:"all",children:"全部级别"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:218:19",value:"critical",children:"严重"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:219:19",value:"warning",children:"警告"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:220:19",value:"info",children:"信息"})]})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:223:15",value:h,onValueChange:r=>De("status",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:224:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:225:19",placeholder:"状态"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:227:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:228:19",value:"all",children:"全部状态"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:229:19",value:"firing",children:"触发中"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:230:19",value:"acknowledged",children:"已确认"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:231:19",value:"resolved",children:"已解决"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:235:13",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:236:15",children:["共 ",ge," 条"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:237:15",variant:"outline",size:"sm",onClick:()=>Ne(),className:"h-7 text-xs px-2",children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:238:17",className:"w-3 h-3 mr-1"}),"刷新"]})]})]}),e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:244:11",children:e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:245:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:246:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:247:17",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:248:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:249:21",children:[e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:250:23",className:"px-3 py-2 text-left text-xs font-medium",children:"告警信息"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:251:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"级别"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:252:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:253:23",className:"px-3 py-2 text-left text-xs font-medium w-24",children:"来源"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:254:23",className:"px-3 py-2 text-left text-xs font-medium w-20",children:"持续"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:255:23",className:"px-3 py-2 text-left text-xs font-medium w-28",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:258:19",className:"divide-y",children:Ke?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"加载中..."})}):ue.length===0?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"暂无告警"})}):ue.filter(r=>{if(!s)return!0;const i=s.toLowerCase();return r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i)||r.source.toLowerCase().includes(i)}).map(r=>e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:272:25",className:"hover:bg-muted/50",children:[e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:273:27",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:274:29",className:"font-medium text-xs",children:r.title}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:275:29",className:"text-xs text-muted-foreground line-clamp-1",children:r.description}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:276:29",className:"flex gap-1 mt-0.5",children:Object.entries(r.labels).slice(0,2).map(([i,D])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:278:33",variant:"outline",className:"text-[10px] px-1 py-0",children:[i,"=",D]},i))})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:282:27",className:"px-3 py-2",children:fe(r.severity)}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:283:27",className:"px-3 py-2",children:Dt(r.status)}),e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:284:27",className:"px-3 py-2 text-xs",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:285:29",children:r.source}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:286:29",className:"text-muted-foreground text-[10px]",children:r.service})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:288:27",className:"px-3 py-2 text-xs text-muted-foreground",children:r.status==="resolved"&&r.resolvedAt?`${Math.floor((new Date(r.resolvedAt).getTime()-new Date(r.startedAt).getTime())/6e4)}分`:`${Math.floor((Date.now()-new Date(r.startedAt).getTime())/6e4)}分`}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:293:27",className:"px-3 py-2",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:294:29",className:"flex items-center gap-0.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:295:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),p(!0)},children:e.jsx(Nt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:297:33",className:"w-3.5 h-3.5"})}),r.status==="firing"&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:300:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>be(r.id),children:e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:302:35",className:"w-3.5 h-3.5 text-blue-600"})}),(r.status==="firing"||r.status==="acknowledged")&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:306:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ye(r.id),children:e.jsx($e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:308:35",className:"w-3.5 h-3.5 text-green-600"})}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:311:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),L(!0)},children:e.jsx(le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:313:33",className:"w-3.5 h-3.5 text-orange-600"})})]})})]},r.id))})]})}),I>1&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:325:17",className:"flex items-center justify-between px-3 py-2 border-t text-xs",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:326:19",className:"text-muted-foreground",children:["第 ",M,"/",I," 页,共 ",ge," 条"]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:327:19",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:328:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M<=1,onClick:()=>H(r=>r-1),children:"上一页"}),Array.from({length:Math.min(I,5)},(r,i)=>{const w=Math.max(1,Math.min(M-2,I-4))+i;return w>I?null:e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:337:25",variant:w===M?"default":"outline",size:"sm",className:"h-7 min-w-[28px] text-xs px-1",onClick:()=>H(w),children:w},w)}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:344:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M>=I,onClick:()=>H(r=>r+1),children:"下一页"})]})]})]})})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:356:9",value:"rules",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:357:11",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:358:13",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:359:15",onClick:Ze,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:360:17",className:"w-4 h-4 mr-1"}),"添加规则"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:362:15",variant:"secondary",onClick:tt,disabled:he.isPending,children:[e.jsx(yt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:363:17",className:"w-4 h-4 mr-1"}),he.isPending?"创建中…":"一键报警"]})]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:367:13",variant:"outline",onClick:()=>we(),children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:368:15",className:"w-4 h-4 mr-2"}),"刷新"]})]}),ye.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:373:13",className:"text-center py-12 text-muted-foreground",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:374:15",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:375:15",className:"text-sm",children:"暂无告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:376:15",className:"text-xs mt-1",children:"点击「添加规则」或「一键报警」快速创建"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:379:11",className:"grid grid-cols-1 gap-4",children:ye.map(r=>e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:381:15",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:382:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:383:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:384:21",className:"flex-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:385:23",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:386:25",className:"font-medium",children:r.name}),fe(r.severity),e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:388:25",variant:r.enabled?"default":"secondary",children:r.enabled?"已启用":"已禁用"})]}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:392:23",className:"text-sm text-muted-foreground mb-2",children:r.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:393:23",className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.expression&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:395:27",className:"font-mono bg-muted px-2 py-1 rounded",children:r.expression}),r.duration?e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:397:42",children:["持续 ",r.duration,"秒"]}):null]}),(()=>{let i=[];try{const D=r.notify_channels;D&&(i=Array.isArray(D)?D:JSON.parse(D))}catch{}return i.length?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:407:27",className:"flex gap-1 mt-2",children:i.map(D=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:409:31",variant:"outline",className:"text-xs",children:D},D))}):null})()]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:415:21",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:416:23",variant:"ghost",size:"sm",onClick:()=>et(r),children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:417:23",variant:"ghost",size:"sm",className:"text-red-400",onClick:()=>rt(r),children:"删除"}),e.jsx(Le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:418:23",checked:r.enabled,onCheckedChange:i=>Xe(String(r.id),i)})]})]})})},r.id))})]}),e.jsx(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:432:9",value:"silences",children:e.jsx(Bt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:433:11"})}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:437:9",value:"contacts",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:438:13",className:"flex justify-between items-center",children:[e.jsx("h3",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:439:15",className:"text-sm font-medium",children:"报警联系人"}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:440:15",size:"sm",onClick:()=>{ve(null),me(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:441:17",className:"w-4 h-4 mr-1"}),"添加联系人"]})]}),z.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:446:15",className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg text-xs",children:"暂无报警联系人,点击「添加联系人」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:450:15",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:z.map(r=>e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:452:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:453:21",className:"pb-2",children:e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:454:23",className:"flex items-start justify-between",children:e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:455:25",className:"text-sm",children:r.name})})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:458:21",className:"pt-0 space-y-1 text-xs text-muted-foreground",children:[r.phone&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:459:35",children:["📱 ",r.phone]}),r.email&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:460:35",children:["📧 ",r.email]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:461:23",className:"flex gap-1 flex-wrap",children:[r.channel_type&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:463:27",variant:"outline",className:"text-[10px]",children:kt(r.channel_type)}),r.webhook_url&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:468:27",className:"text-[10px] text-muted-foreground truncate max-w-[200px]",title:r.webhook_url,children:r.webhook_url})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:473:23",className:"flex gap-1.5 pt-1.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:474:25",variant:"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>{ve(r),me(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:478:25",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:async()=>{if(await t({title:"删除联系人",description:`确定删除「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContact(r.id),d.success("已删除"),X()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id))})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:496:9",value:"groups",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:497:11",className:"flex justify-between items-center",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:498:13",variant:"outline",onClick:Z,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:499:15",className:"w-4 h-4 mr-2"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:502:13",onClick:()=>{Ae(null),de(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:503:15",className:"w-4 h-4 mr-2"}),"添加联系组"]})]}),y.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:508:13",className:"text-center py-16 text-muted-foreground border border-dashed rounded-lg",children:"暂无报警联系组,点击「添加联系组」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:512:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(r=>{let i=[];try{i=JSON.parse(r.contact_ids||"[]")}catch{}const D=z.filter(w=>i.includes(w.id)).map(w=>w.name);return e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:520:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:521:21",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:522:23",className:"flex items-start justify-between",children:[e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:523:25",className:"text-base",children:r.group_name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:524:25",variant:"secondary",children:[i.length," 人"]})]})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:527:21",className:"pt-0 space-y-2",children:[r.notes&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:528:35",className:"text-sm text-muted-foreground",children:r.notes}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:529:23",className:"flex flex-wrap gap-1",children:D.map(w=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:531:27",variant:"outline",className:"text-xs",children:w},w))}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:534:23",className:"flex gap-2 pt-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:535:25",variant:"outline",size:"sm",className:"flex-1",onClick:()=>{Ae(r),de(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:539:25",variant:"outline",size:"sm",onClick:async()=>{if(await t({title:"删除联系组",description:`确定删除联系组「${r.group_name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContactGroup(r.id),d.success("已删除"),Z()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id)})})]})]}),e.jsx(Ot,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:558:7",alert:v,open:o,onOpenChange:p,onAcknowledge:be}),e.jsx(Lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:564:7",alert:v,open:O,onOpenChange:L,onSilence:He}),e.jsx(wt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:570:7",open:c,onOpenChange:Se,editingRule:k,notifyChannels:[],onSaved:()=>{Se(),we()}}),e.jsx(zt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:577:7",open:qe,onOpenChange:me,editingContact:Fe,onSaved:X}),e.jsx(Gt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:583:7",open:Be,onOpenChange:de,editingGroup:Pe,contacts:z,onSaved:()=>{Z()}})]})};export{ir as default}; diff --git a/backend/static/assets/AlertManager-nv_xdloK.js b/backend/static/assets/AlertManager-C0AXwvA2.js similarity index 98% rename from backend/static/assets/AlertManager-nv_xdloK.js rename to backend/static/assets/AlertManager-C0AXwvA2.js index 2702f41..698db02 100644 --- a/backend/static/assets/AlertManager-nv_xdloK.js +++ b/backend/static/assets/AlertManager-C0AXwvA2.js @@ -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:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:134:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertEventsTab.tsx:135:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertEventsTab.tsx:136:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:137:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:138:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:139:19",className:"text-slate-400",children:"告警名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:141:19",className:"text-slate-400",children:"目标"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:142:19",className:"text-slate-400",children:"当前值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:143:19",className:"text-slate-400",children:"阈值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:144:19",className:"text-slate-400",children:"开始时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:145:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertEventsTab.tsx:148:15",children:T?e.jsx(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:150:19",className:"border-slate-800",children:e.jsxs(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:151:21",colSpan:8,className:"text-center text-slate-500 py-8",children:[e.jsx(O,{"code-path":"src/components/monitor/AlertEventsTab.tsx:152:23",className:"h-5 w-5 animate-spin inline mr-2"}),"加载中..."]})}):j.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:157:19",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:158:21",children:y(t.severity)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:159:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:160:23",className:"text-sm font-medium text-slate-200",children:t.rule&&t.rule.name||t.message})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:164:21",children:a(t.status)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:165:21",className:"max-w-[160px]",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:166:23",className:"text-sm text-slate-300 block truncate",title:t.target,children:t.target})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:168:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:169:23",className:"text-sm text-slate-300",children:typeof t.value=="number"?t.value.toFixed(1):t.value})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:171:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:172:23",className:"text-sm text-slate-500",children:t.threshold})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:174:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:175:23",className:"text-sm text-slate-400",children:t.created_at?new Date(t.created_at).toLocaleString():"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:179:21",className:"text-right",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:180:23",className:"flex items-center justify-end gap-1",children:t.status==="firing"&&e.jsxs(A,{"code-path":"src/components/monitor/AlertEventsTab.tsx:182:27",variant:"ghost",size:"sm",className:"h-8 text-slate-400 hover:text-emerald-400",onClick:()=>x(t.id),children:[e.jsx(J,{"code-path":"src/components/monitor/AlertEventsTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"确认"]})})})]},t.id))})]})})})})]})}const Ce=9;function ye({rules:m,notifyChannels:T,onReload:d,onEditRule:p}){const u=_(),[o,h]=l.useState([]),b=()=>{m.length>0&&o.length===m.length?h([]):h(m.map(t=>t.id))},C=t=>{h(r=>r.includes(t)?r.filter(N=>N!==t):[...r,t])},j=async t=>{if(await u({title:"删除告警规则",description:"确定删除此告警规则?",confirmText:"删除",variant:"destructive"}))try{await g.deleteRule(t),E.success("告警规则已删除"),d()}catch(N){console.error("Failed to delete rule:",N),E.error("删除失败")}},y=async()=>{if(!(o.length===0||!await u({title:"批量删除告警规则",description:`确定删除选中的 ${o.length} 条告警规则吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await g.batchDeleteRules(o),E.success(`已删除 ${o.length} 条告警规则`),h([]),d()}catch(r){console.error("Failed to batch delete rules:",r),E.error("批量删除失败")}},a=async t=>{try{await g.toggleRule(t),d()}catch(r){console.error("Failed to toggle rule:",r)}},x=m.length>0&&o.length===m.length;return e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:104:5",className:"mt-4",children:[o.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:107:9",className:"flex items-center gap-2 mb-3",children:[e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:108:11",className:"text-sm text-slate-400",children:["已选择 ",o.length," 项"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:109:11",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:y,children:[e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:115:13",className:"h-4 w-4 mr-2"}),"批量删除"]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertRulesTab.tsx:121:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertRulesTab.tsx:122:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:123:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertRulesTab.tsx:124:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:125:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:126:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:127:19",className:"w-12",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:128:21",checked:x,onCheckedChange:b,className:"border-slate-600"})}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:134:19",className:"text-slate-400",children:"规则名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:135:19",className:"text-slate-400",children:"数据源"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:136:19",className:"text-slate-400",children:"触发条件"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:137:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:138:19",className:"text-slate-400",children:"持续时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:139:19",className:"text-slate-400",children:"通知渠道"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:141:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertRulesTab.tsx:144:15",children:m.length===0?e.jsx(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:146:19",className:"border-slate-800",children:e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:147:21",colSpan:Ce,className:"text-center text-slate-500 py-12",children:"暂无告警规则"})}):m.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:153:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:154:23",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:155:25",checked:o.includes(t.id),onCheckedChange:()=>C(t.id),className:"border-slate-600"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:161:23",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:162:25",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:163:27",className:"text-sm font-medium text-slate-200",children:t.name}),t.description&&e.jsx("p",{"code-path":"src/components/monitor/AlertRulesTab.tsx:165:29",className:"text-xs text-slate-500",children:t.description})]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:169:23",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:170:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded",children:t.source||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:174:23",className:"max-w-[180px]",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:175:25",className:"text-xs text-blue-300 block truncate",title:t.expression,children:t.expression||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:179:23",children:t.severity==="critical"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:181:27",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"严重"}):t.severity==="warning"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:185:27",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"警告"}):e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:189:27",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:"提示"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:194:23",children:e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:195:25",className:"text-sm text-slate-300",children:[(t.duration||0)/60,"分钟"]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:197:23",children:pe(t,T)}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:200:23",children:e.jsx(P,{"code-path":"src/components/monitor/AlertRulesTab.tsx:201:25",checked:!!t.enabled,className:"data-[state=checked]:bg-blue-600",onCheckedChange:()=>a(t.id)})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:207:23",className:"text-right",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:208:25",className:"flex items-center justify-end gap-1",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:209:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>p(t),children:e.jsx(q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:215:29",className:"h-4 w-4"})}),e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:217:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>j(t.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:223:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})})]})}const L={name:"",type:"dingtalk",config:"",enabled:!0};function we({open:m,onOpenChange:T,notifyChannels:d,onChannelsChanged:p}){const u=_(),[o,h]=l.useState(null),[b,C]=l.useState(!1),[j,y]=l.useState(null),[a,x]=l.useState({...L});l.useEffect(()=>{m&&(h(null),x({...L}))},[m]);const t=s=>{h(s),x({name:s.name||"",type:s.type||"dingtalk",config:s.config||"",enabled:s.enabled!==!1})},r=()=>{h(null),x({...L})},N=async()=>{if(a.name.trim()){C(!0);try{const s={name:a.name.trim(),type:a.type,config:a.config.trim()};o?await g.updateNotifyChannel(o.id,{...s,enabled:a.enabled}):await g.createNotifyChannel(s),r(),p()}catch(s){console.error("Failed to save notify channel:",s)}finally{C(!1)}}},v=async s=>{if(await u({title:"删除通知渠道",description:"确定删除此通知渠道?",confirmText:"删除",variant:"destructive"}))try{await g.deleteNotifyChannel(s),o&&o.id===s&&r(),p()}catch(n){console.error("Failed to delete notify channel:",n)}},k=async s=>{try{await g.updateNotifyChannel(s.id,{enabled:!s.enabled}),p()}catch(n){console.error("Failed to toggle notify channel:",n)}},S=async s=>{y(s);try{await g.testNotifyChannel(s),p()}catch(n){console.error("Failed to test notify channel:",n)}finally{y(null)}};return e.jsx(oe,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:119:5",open:m,onOpenChange:T,children:e.jsxs(ae,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:120:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-2xl",children:[e.jsxs(ne,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:121:9",children:[e.jsx(re,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:122:11",className:"text-slate-100",children:"通知渠道配置"}),e.jsx(ce,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:123:11",className:"text-slate-500",children:"管理告警通知渠道(钉钉/企业微信/邮件/短信/Webhook),配置后可在告警规则中引用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:128:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:130:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:131:13",className:"flex items-center justify-between",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:132:15",className:"text-slate-300 text-sm",children:"已配置渠道"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:133:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 hover:bg-slate-800 text-xs",onClick:r,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:139:17",className:"h-3 w-3 mr-1"}),"新建"]})]}),d.length===0?e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:144:15",className:"text-center py-8 text-sm text-slate-600 border border-dashed border-slate-800 rounded-lg",children:"暂无通知渠道,请在右侧添加"}):e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:148:15",className:"space-y-2",children:d.map(s=>e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:150:19",className:`p-3 rounded-lg border cursor-pointer transition-colors ${o&&o.id===s.id?"border-blue-500/50 bg-blue-500/5":"border-slate-800 bg-slate-800/30 hover:border-slate-700"}`,onClick:()=>t(s),children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:159:21",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:160:23",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:161:25",className:"text-sm text-slate-200 truncate",children:s.name}),e.jsx(f,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:162:25",variant:"outline",className:"border-slate-600 text-slate-400 text-[10px] py-0",children:he(s.type)})]}),e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:166:23",checked:s.enabled!==!1,onCheckedChange:()=>k(s),onClick:n=>n.stopPropagation(),className:"data-[state=checked]:bg-emerald-600 scale-90"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:173:21",className:"flex items-center justify-between mt-2",children:[s.test_status==="success"?e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:175:25",className:"text-[11px] text-emerald-400",children:"测试通过"}):e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:177:25",className:"text-[11px] text-slate-600",children:"未测试"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:179:23",className:"flex items-center gap-1",onClick:n=>n.stopPropagation(),children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:180:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 text-xs",disabled:j===s.id,onClick:()=>S(s.id),children:j===s.id?e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:187:55",className:"h-3 w-3 animate-spin"}):"测试"}),e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:189:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 text-xs",onClick:()=>v(s.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:195:27",className:"h-3 w-3"})})]})]})]},s.id))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:206:11",className:"space-y-4",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:207:13",className:"text-slate-300 text-sm",children:o?"编辑渠道":"新建渠道"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:210:13",className:"space-y-1.5",children:[e.jsxs(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:15",className:"text-slate-400 text-xs",children:["渠道名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:62",className:"text-red-400",children:"*"})]}),e.jsx(Y,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:212:15",value:a.name,onChange:s=>x({...a,name:s.target.value}),placeholder:"如:运维告警群",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 h-9"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:219:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:220:15",className:"text-slate-400 text-xs",children:"渠道类型"}),e.jsx("select",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:221:15",value:a.type,onChange:s=>x({...a,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:K.map(({key:s,label:n})=>e.jsx("option",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:227:19",value:s,children:n},s))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:231:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:232:15",className:"text-slate-400 text-xs",children:"配置(JSON)"}),e.jsx(be,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:233:15",value:a.config,onChange:s=>x({...a,config:s.target.value}),placeholder:K.find(s=>s.key===a.type)?.placeholder||"",rows:5,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 font-mono text-xs resize-none"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:242:15",className:"flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:243:17",checked:a.enabled,onCheckedChange:s=>x({...a,enabled:s}),className:"data-[state=checked]:bg-emerald-600"}),e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:248:17",className:"text-slate-400 text-xs",children:"启用此渠道"})]})]})]}),e.jsxs(le,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:254:9",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:255:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:()=>T(!1),children:"关闭"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:262:11",className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:!a.name.trim()||b,onClick:N,children:[b&&e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:267:31",className:"h-4 w-4 mr-2 animate-spin"}),o?"保存修改":"添加渠道"]})]})]})})}function Ke(){const[m,T]=l.useState("events"),[d,p]=l.useState([]),[u,o]=l.useState([]),[h,b]=l.useState(!0),[C,j]=l.useState(!1),[y,a]=l.useState(null),[x,t]=l.useState(!1),[r,N]=l.useState([]),v=async()=>{try{b(!0);const[n,F,Z]=await Promise.all([g.getAlerts(),g.getRules(),g.getNotifyChannels()]);p(n?.list||[]),o(F?.list||(Array.isArray(F)?F:[])),N(Z?.list||[])}catch(n){console.error("Failed to load alert data:",n)}finally{b(!1)}};l.useEffect(()=>{v()},[]);const k=()=>{a(null),j(!0)},S=n=>{a(n),j(!0)},s=[{time:"00:00",critical:2,warning:5,info:8},{time:"04:00",critical:1,warning:3,info:6},{time:"08:00",critical:3,warning:7,info:12},{time:"12:00",critical:5,warning:10,info:15},{time:"16:00",critical:4,warning:8,info:10},{time:"20:00",critical:3,warning:6,info:9},{time:"24:00",critical:2,warning:4,info:7}];return e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:75:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:77:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:78:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/AlertManager.tsx:79:11",className:"text-2xl font-bold text-slate-100",children:"监控告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:80:11",className:"text-sm text-slate-500 mt-1",children:"告警规则管理与告警事件处理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:83:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>t(!0),children:[e.jsx(q,{"code-path":"src/components/monitor/AlertManager.tsx:88:13",className:"h-4 w-4 mr-2"}),"通知配置"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:91:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:k,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertManager.tsx:92:13",className:"h-4 w-4 mr-2"}),"新建规则"]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:99:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:100:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:101:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:102:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:103:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:104:17",className:"text-sm text-slate-500",children:"告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:105:17",className:"text-2xl font-bold text-slate-100",children:u.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:107:15",className:"p-3 rounded-lg bg-blue-500/10 text-blue-400",children:e.jsx(V,{"code-path":"src/components/monitor/AlertManager.tsx:108:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:113:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:114:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:115:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:116:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:117:17",className:"text-sm text-slate-500",children:"触发中"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:118:17",className:"text-2xl font-bold text-red-400",children:d.filter(n=>n.status==="firing").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:122:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(z,{"code-path":"src/components/monitor/AlertManager.tsx:123:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:129:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:130:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:131:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:132:17",className:"text-sm text-slate-500",children:"今日告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:133:17",className:"text-2xl font-bold text-amber-400",children:d.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:135:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(xe,{"code-path":"src/components/monitor/AlertManager.tsx:136:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:141:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:142:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:143:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:144:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:145:17",className:"text-sm text-slate-500",children:"已恢复"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:146:17",className:"text-2xl font-bold text-emerald-400",children:d.filter(n=>n.status==="resolved").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:150:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(J,{"code-path":"src/components/monitor/AlertManager.tsx:151:17",className:"h-5 w-5"})})]})})})]}),e.jsxs(w,{"code-path":"src/components/monitor/AlertManager.tsx:159:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ee,{"code-path":"src/components/monitor/AlertManager.tsx:160:9",className:"pb-2",children:[e.jsx(te,{"code-path":"src/components/monitor/AlertManager.tsx:161:11",className:"text-slate-100",children:"告警趋势"}),e.jsx(se,{"code-path":"src/components/monitor/AlertManager.tsx:162:11",className:"text-slate-500",children:"过去24小时告警统计"})]}),e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:164:9",children:e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:165:11",className:"h-[200px]",children:e.jsx(Ae,{"code-path":"src/components/monitor/AlertManager.tsx:166:13",width:"100%",height:"100%",children:e.jsxs(je,{"code-path":"src/components/monitor/AlertManager.tsx:167:15",data:s,children:[e.jsxs("defs",{"code-path":"src/components/monitor/AlertManager.tsx:168:17",children:[e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:169:19",id:"colorCritical",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:170:21",offset:"5%",stopColor:"#ef4444",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:171:21",offset:"95%",stopColor:"#ef4444",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:173:19",id:"colorWarning",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:174:21",offset:"5%",stopColor:"#f59e0b",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:175:21",offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),e.jsx(ue,{"code-path":"src/components/monitor/AlertManager.tsx:178:17",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(Ne,{"code-path":"src/components/monitor/AlertManager.tsx:179:17",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(ve,{"code-path":"src/components/monitor/AlertManager.tsx:180:17",stroke:"#475569",fontSize:12}),e.jsx(fe,{"code-path":"src/components/monitor/AlertManager.tsx:181:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:189:17",type:"monotone",dataKey:"critical",stroke:"#ef4444",fillOpacity:1,fill:"url(#colorCritical)",name:"严重"}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:197:17",type:"monotone",dataKey:"warning",stroke:"#f59e0b",fillOpacity:1,fill:"url(#colorWarning)",name:"警告"})]})})})})]}),e.jsxs(ie,{"code-path":"src/components/monitor/AlertManager.tsx:212:7",value:m,onValueChange:T,className:"w-full",children:[e.jsxs(me,{"code-path":"src/components/monitor/AlertManager.tsx:213:9",className:"bg-slate-800 border border-slate-700",children:[e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:214:11",value:"events",className:"data-[state=active]:bg-slate-700",children:"告警事件"}),e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:217:11",value:"rules",className:"data-[state=active]:bg-slate-700",children:"告警规则"})]}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:223:9",value:"events",children:e.jsx(Te,{"code-path":"src/components/monitor/AlertManager.tsx:224:11",alerts:d,loading:h,onReload:v})}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:227:9",value:"rules",children:e.jsx(ye,{"code-path":"src/components/monitor/AlertManager.tsx:228:11",rules:u,notifyChannels:r,onReload:v,onEditRule:S})})]}),e.jsx(ge,{"code-path":"src/components/monitor/AlertManager.tsx:239:7",open:C,onOpenChange:j,editingRule:y,notifyChannels:r,onSaved:v}),e.jsx(we,{"code-path":"src/components/monitor/AlertManager.tsx:246:7",open:x,onOpenChange:t,notifyChannels:r,onChannelsChanged:v})]})}export{Ke as AlertManager}; +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:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:134:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertEventsTab.tsx:135:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertEventsTab.tsx:136:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:137:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:138:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:139:19",className:"text-slate-400",children:"告警名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:141:19",className:"text-slate-400",children:"目标"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:142:19",className:"text-slate-400",children:"当前值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:143:19",className:"text-slate-400",children:"阈值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:144:19",className:"text-slate-400",children:"开始时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:145:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertEventsTab.tsx:148:15",children:T?e.jsx(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:150:19",className:"border-slate-800",children:e.jsxs(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:151:21",colSpan:8,className:"text-center text-slate-500 py-8",children:[e.jsx(O,{"code-path":"src/components/monitor/AlertEventsTab.tsx:152:23",className:"h-5 w-5 animate-spin inline mr-2"}),"加载中..."]})}):j.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:157:19",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:158:21",children:y(t.severity)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:159:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:160:23",className:"text-sm font-medium text-slate-200",children:t.rule&&t.rule.name||t.message})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:164:21",children:a(t.status)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:165:21",className:"max-w-[160px]",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:166:23",className:"text-sm text-slate-300 block truncate",title:t.target,children:t.target})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:168:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:169:23",className:"text-sm text-slate-300",children:typeof t.value=="number"?t.value.toFixed(1):t.value})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:171:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:172:23",className:"text-sm text-slate-500",children:t.threshold})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:174:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:175:23",className:"text-sm text-slate-400",children:t.created_at?new Date(t.created_at).toLocaleString():"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:179:21",className:"text-right",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:180:23",className:"flex items-center justify-end gap-1",children:t.status==="firing"&&e.jsxs(A,{"code-path":"src/components/monitor/AlertEventsTab.tsx:182:27",variant:"ghost",size:"sm",className:"h-8 text-slate-400 hover:text-emerald-400",onClick:()=>x(t.id),children:[e.jsx(J,{"code-path":"src/components/monitor/AlertEventsTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"确认"]})})})]},t.id))})]})})})})]})}const Ce=9;function ye({rules:m,notifyChannels:T,onReload:d,onEditRule:p}){const u=_(),[o,h]=l.useState([]),b=()=>{m.length>0&&o.length===m.length?h([]):h(m.map(t=>t.id))},C=t=>{h(r=>r.includes(t)?r.filter(N=>N!==t):[...r,t])},j=async t=>{if(await u({title:"删除告警规则",description:"确定删除此告警规则?",confirmText:"删除",variant:"destructive"}))try{await g.deleteRule(t),E.success("告警规则已删除"),d()}catch(N){console.error("Failed to delete rule:",N),E.error("删除失败")}},y=async()=>{if(!(o.length===0||!await u({title:"批量删除告警规则",description:`确定删除选中的 ${o.length} 条告警规则吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await g.batchDeleteRules(o),E.success(`已删除 ${o.length} 条告警规则`),h([]),d()}catch(r){console.error("Failed to batch delete rules:",r),E.error("批量删除失败")}},a=async t=>{try{await g.toggleRule(t),d()}catch(r){console.error("Failed to toggle rule:",r)}},x=m.length>0&&o.length===m.length;return e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:104:5",className:"mt-4",children:[o.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:107:9",className:"flex items-center gap-2 mb-3",children:[e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:108:11",className:"text-sm text-slate-400",children:["已选择 ",o.length," 项"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:109:11",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:y,children:[e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:115:13",className:"h-4 w-4 mr-2"}),"批量删除"]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertRulesTab.tsx:121:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertRulesTab.tsx:122:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:123:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertRulesTab.tsx:124:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:125:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:126:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:127:19",className:"w-12",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:128:21",checked:x,onCheckedChange:b,className:"border-slate-600"})}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:134:19",className:"text-slate-400",children:"规则名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:135:19",className:"text-slate-400",children:"数据源"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:136:19",className:"text-slate-400",children:"触发条件"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:137:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:138:19",className:"text-slate-400",children:"持续时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:139:19",className:"text-slate-400",children:"通知渠道"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:141:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertRulesTab.tsx:144:15",children:m.length===0?e.jsx(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:146:19",className:"border-slate-800",children:e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:147:21",colSpan:Ce,className:"text-center text-slate-500 py-12",children:"暂无告警规则"})}):m.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:153:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:154:23",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:155:25",checked:o.includes(t.id),onCheckedChange:()=>C(t.id),className:"border-slate-600"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:161:23",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:162:25",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:163:27",className:"text-sm font-medium text-slate-200",children:t.name}),t.description&&e.jsx("p",{"code-path":"src/components/monitor/AlertRulesTab.tsx:165:29",className:"text-xs text-slate-500",children:t.description})]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:169:23",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:170:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded",children:t.source||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:174:23",className:"max-w-[180px]",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:175:25",className:"text-xs text-blue-300 block truncate",title:t.expression,children:t.expression||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:179:23",children:t.severity==="critical"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:181:27",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"严重"}):t.severity==="warning"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:185:27",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"警告"}):e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:189:27",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:"提示"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:194:23",children:e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:195:25",className:"text-sm text-slate-300",children:[(t.duration||0)/60,"分钟"]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:197:23",children:pe(t,T)}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:200:23",children:e.jsx(P,{"code-path":"src/components/monitor/AlertRulesTab.tsx:201:25",checked:!!t.enabled,className:"data-[state=checked]:bg-blue-600",onCheckedChange:()=>a(t.id)})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:207:23",className:"text-right",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:208:25",className:"flex items-center justify-end gap-1",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:209:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>p(t),children:e.jsx(q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:215:29",className:"h-4 w-4"})}),e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:217:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>j(t.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:223:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})})]})}const L={name:"",type:"dingtalk",config:"",enabled:!0};function we({open:m,onOpenChange:T,notifyChannels:d,onChannelsChanged:p}){const u=_(),[o,h]=l.useState(null),[b,C]=l.useState(!1),[j,y]=l.useState(null),[a,x]=l.useState({...L});l.useEffect(()=>{m&&(h(null),x({...L}))},[m]);const t=s=>{h(s),x({name:s.name||"",type:s.type||"dingtalk",config:s.config||"",enabled:s.enabled!==!1})},r=()=>{h(null),x({...L})},N=async()=>{if(a.name.trim()){C(!0);try{const s={name:a.name.trim(),type:a.type,config:a.config.trim()};o?await g.updateNotifyChannel(o.id,{...s,enabled:a.enabled}):await g.createNotifyChannel(s),r(),p()}catch(s){console.error("Failed to save notify channel:",s)}finally{C(!1)}}},v=async s=>{if(await u({title:"删除通知渠道",description:"确定删除此通知渠道?",confirmText:"删除",variant:"destructive"}))try{await g.deleteNotifyChannel(s),o&&o.id===s&&r(),p()}catch(n){console.error("Failed to delete notify channel:",n)}},k=async s=>{try{await g.updateNotifyChannel(s.id,{enabled:!s.enabled}),p()}catch(n){console.error("Failed to toggle notify channel:",n)}},S=async s=>{y(s);try{await g.testNotifyChannel(s),p()}catch(n){console.error("Failed to test notify channel:",n)}finally{y(null)}};return e.jsx(oe,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:119:5",open:m,onOpenChange:T,children:e.jsxs(ae,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:120:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-2xl",children:[e.jsxs(ne,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:121:9",children:[e.jsx(re,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:122:11",className:"text-slate-100",children:"通知渠道配置"}),e.jsx(ce,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:123:11",className:"text-slate-500",children:"管理告警通知渠道(钉钉/企业微信/邮件/短信/Webhook),配置后可在告警规则中引用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:128:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:130:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:131:13",className:"flex items-center justify-between",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:132:15",className:"text-slate-300 text-sm",children:"已配置渠道"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:133:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 hover:bg-slate-800 text-xs",onClick:r,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:139:17",className:"h-3 w-3 mr-1"}),"新建"]})]}),d.length===0?e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:144:15",className:"text-center py-8 text-sm text-slate-600 border border-dashed border-slate-800 rounded-lg",children:"暂无通知渠道,请在右侧添加"}):e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:148:15",className:"space-y-2",children:d.map(s=>e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:150:19",className:`p-3 rounded-lg border cursor-pointer transition-colors ${o&&o.id===s.id?"border-blue-500/50 bg-blue-500/5":"border-slate-800 bg-slate-800/30 hover:border-slate-700"}`,onClick:()=>t(s),children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:159:21",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:160:23",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:161:25",className:"text-sm text-slate-200 truncate",children:s.name}),e.jsx(f,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:162:25",variant:"outline",className:"border-slate-600 text-slate-400 text-[10px] py-0",children:he(s.type)})]}),e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:166:23",checked:s.enabled!==!1,onCheckedChange:()=>k(s),onClick:n=>n.stopPropagation(),className:"data-[state=checked]:bg-emerald-600 scale-90"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:173:21",className:"flex items-center justify-between mt-2",children:[s.test_status==="success"?e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:175:25",className:"text-[11px] text-emerald-400",children:"测试通过"}):e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:177:25",className:"text-[11px] text-slate-600",children:"未测试"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:179:23",className:"flex items-center gap-1",onClick:n=>n.stopPropagation(),children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:180:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 text-xs",disabled:j===s.id,onClick:()=>S(s.id),children:j===s.id?e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:187:55",className:"h-3 w-3 animate-spin"}):"测试"}),e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:189:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 text-xs",onClick:()=>v(s.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:195:27",className:"h-3 w-3"})})]})]})]},s.id))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:206:11",className:"space-y-4",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:207:13",className:"text-slate-300 text-sm",children:o?"编辑渠道":"新建渠道"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:210:13",className:"space-y-1.5",children:[e.jsxs(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:15",className:"text-slate-400 text-xs",children:["渠道名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:62",className:"text-red-400",children:"*"})]}),e.jsx(Y,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:212:15",value:a.name,onChange:s=>x({...a,name:s.target.value}),placeholder:"如:运维告警群",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 h-9"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:219:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:220:15",className:"text-slate-400 text-xs",children:"渠道类型"}),e.jsx("select",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:221:15",value:a.type,onChange:s=>x({...a,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:K.map(({key:s,label:n})=>e.jsx("option",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:227:19",value:s,children:n},s))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:231:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:232:15",className:"text-slate-400 text-xs",children:"配置(JSON)"}),e.jsx(be,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:233:15",value:a.config,onChange:s=>x({...a,config:s.target.value}),placeholder:K.find(s=>s.key===a.type)?.placeholder||"",rows:5,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 font-mono text-xs resize-none"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:242:15",className:"flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:243:17",checked:a.enabled,onCheckedChange:s=>x({...a,enabled:s}),className:"data-[state=checked]:bg-emerald-600"}),e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:248:17",className:"text-slate-400 text-xs",children:"启用此渠道"})]})]})]}),e.jsxs(le,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:254:9",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:255:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:()=>T(!1),children:"关闭"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:262:11",className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:!a.name.trim()||b,onClick:N,children:[b&&e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:267:31",className:"h-4 w-4 mr-2 animate-spin"}),o?"保存修改":"添加渠道"]})]})]})})}function Ke(){const[m,T]=l.useState("events"),[d,p]=l.useState([]),[u,o]=l.useState([]),[h,b]=l.useState(!0),[C,j]=l.useState(!1),[y,a]=l.useState(null),[x,t]=l.useState(!1),[r,N]=l.useState([]),v=async()=>{try{b(!0);const[n,F,Z]=await Promise.all([g.getAlerts(),g.getRules(),g.getNotifyChannels()]);p(n?.list||[]),o(F?.list||(Array.isArray(F)?F:[])),N(Z?.list||[])}catch(n){console.error("Failed to load alert data:",n)}finally{b(!1)}};l.useEffect(()=>{v()},[]);const k=()=>{a(null),j(!0)},S=n=>{a(n),j(!0)},s=[{time:"00:00",critical:2,warning:5,info:8},{time:"04:00",critical:1,warning:3,info:6},{time:"08:00",critical:3,warning:7,info:12},{time:"12:00",critical:5,warning:10,info:15},{time:"16:00",critical:4,warning:8,info:10},{time:"20:00",critical:3,warning:6,info:9},{time:"24:00",critical:2,warning:4,info:7}];return e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:75:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:77:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:78:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/AlertManager.tsx:79:11",className:"text-2xl font-bold text-slate-100",children:"监控告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:80:11",className:"text-sm text-slate-500 mt-1",children:"告警规则管理与告警事件处理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:83:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>t(!0),children:[e.jsx(q,{"code-path":"src/components/monitor/AlertManager.tsx:88:13",className:"h-4 w-4 mr-2"}),"通知配置"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:91:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:k,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertManager.tsx:92:13",className:"h-4 w-4 mr-2"}),"新建规则"]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:99:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:100:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:101:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:102:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:103:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:104:17",className:"text-sm text-slate-500",children:"告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:105:17",className:"text-2xl font-bold text-slate-100",children:u.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:107:15",className:"p-3 rounded-lg bg-blue-500/10 text-blue-400",children:e.jsx(V,{"code-path":"src/components/monitor/AlertManager.tsx:108:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:113:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:114:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:115:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:116:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:117:17",className:"text-sm text-slate-500",children:"触发中"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:118:17",className:"text-2xl font-bold text-red-400",children:d.filter(n=>n.status==="firing").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:122:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(z,{"code-path":"src/components/monitor/AlertManager.tsx:123:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:129:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:130:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:131:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:132:17",className:"text-sm text-slate-500",children:"今日告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:133:17",className:"text-2xl font-bold text-amber-400",children:d.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:135:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(xe,{"code-path":"src/components/monitor/AlertManager.tsx:136:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:141:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:142:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:143:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:144:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:145:17",className:"text-sm text-slate-500",children:"已恢复"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:146:17",className:"text-2xl font-bold text-emerald-400",children:d.filter(n=>n.status==="resolved").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:150:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(J,{"code-path":"src/components/monitor/AlertManager.tsx:151:17",className:"h-5 w-5"})})]})})})]}),e.jsxs(w,{"code-path":"src/components/monitor/AlertManager.tsx:159:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ee,{"code-path":"src/components/monitor/AlertManager.tsx:160:9",className:"pb-2",children:[e.jsx(te,{"code-path":"src/components/monitor/AlertManager.tsx:161:11",className:"text-slate-100",children:"告警趋势"}),e.jsx(se,{"code-path":"src/components/monitor/AlertManager.tsx:162:11",className:"text-slate-500",children:"过去24小时告警统计"})]}),e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:164:9",children:e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:165:11",className:"h-[200px]",children:e.jsx(Ae,{"code-path":"src/components/monitor/AlertManager.tsx:166:13",width:"100%",height:"100%",children:e.jsxs(je,{"code-path":"src/components/monitor/AlertManager.tsx:167:15",data:s,children:[e.jsxs("defs",{"code-path":"src/components/monitor/AlertManager.tsx:168:17",children:[e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:169:19",id:"colorCritical",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:170:21",offset:"5%",stopColor:"#ef4444",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:171:21",offset:"95%",stopColor:"#ef4444",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:173:19",id:"colorWarning",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:174:21",offset:"5%",stopColor:"#f59e0b",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:175:21",offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),e.jsx(ue,{"code-path":"src/components/monitor/AlertManager.tsx:178:17",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(Ne,{"code-path":"src/components/monitor/AlertManager.tsx:179:17",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(ve,{"code-path":"src/components/monitor/AlertManager.tsx:180:17",stroke:"#475569",fontSize:12}),e.jsx(fe,{"code-path":"src/components/monitor/AlertManager.tsx:181:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:189:17",type:"monotone",dataKey:"critical",stroke:"#ef4444",fillOpacity:1,fill:"url(#colorCritical)",name:"严重"}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:197:17",type:"monotone",dataKey:"warning",stroke:"#f59e0b",fillOpacity:1,fill:"url(#colorWarning)",name:"警告"})]})})})})]}),e.jsxs(ie,{"code-path":"src/components/monitor/AlertManager.tsx:212:7",value:m,onValueChange:T,className:"w-full",children:[e.jsxs(me,{"code-path":"src/components/monitor/AlertManager.tsx:213:9",className:"bg-slate-800 border border-slate-700",children:[e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:214:11",value:"events",className:"data-[state=active]:bg-slate-700",children:"告警事件"}),e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:217:11",value:"rules",className:"data-[state=active]:bg-slate-700",children:"告警规则"})]}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:223:9",value:"events",children:e.jsx(Te,{"code-path":"src/components/monitor/AlertManager.tsx:224:11",alerts:d,loading:h,onReload:v})}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:227:9",value:"rules",children:e.jsx(ye,{"code-path":"src/components/monitor/AlertManager.tsx:228:11",rules:u,notifyChannels:r,onReload:v,onEditRule:S})})]}),e.jsx(ge,{"code-path":"src/components/monitor/AlertManager.tsx:239:7",open:C,onOpenChange:j,editingRule:y,notifyChannels:r,onSaved:v}),e.jsx(we,{"code-path":"src/components/monitor/AlertManager.tsx:246:7",open:x,onOpenChange:t,notifyChannels:r,onChannelsChanged:v})]})}export{Ke as AlertManager}; diff --git a/backend/static/assets/AlertRuleDialog-B_V4xcKa.js b/backend/static/assets/AlertRuleDialog-BsJX7bok.js similarity index 97% rename from backend/static/assets/AlertRuleDialog-B_V4xcKa.js rename to backend/static/assets/AlertRuleDialog-BsJX7bok.js index c7c003a..9d01624 100644 --- a/backend/static/assets/AlertRuleDialog-B_V4xcKa.js +++ b/backend/static/assets/AlertRuleDialog-BsJX7bok.js @@ -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:`{ diff --git a/backend/static/assets/ApprovalAppPage-CaEPh2Xz.js b/backend/static/assets/ApprovalAppPage-BrRxxZFx.js similarity index 71% rename from backend/static/assets/ApprovalAppPage-CaEPh2Xz.js rename to backend/static/assets/ApprovalAppPage-BrRxxZFx.js index b741822..9b10935 100644 --- a/backend/static/assets/ApprovalAppPage-CaEPh2Xz.js +++ b/backend/static/assets/ApprovalAppPage-BrRxxZFx.js @@ -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}; diff --git a/backend/static/assets/ApprovalCategoryPage-KY6ryxLb.js b/backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js similarity index 98% rename from backend/static/assets/ApprovalCategoryPage-KY6ryxLb.js rename to backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js index 5ff52d5..3ed89df 100644 --- a/backend/static/assets/ApprovalCategoryPage-KY6ryxLb.js +++ b/backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js @@ -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",placeholder:"搜索申请...",value:P,onChange:a=>S(a.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:171:9",value:i,onValueChange:D,children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:172:11",className:"w-32 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:173:13",placeholder:"全部状态"})}),e.jsxs(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:175:11",children:[e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:176:13",value:"all",children:"全部状态"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:177:13",value:"pending",children:"审批中"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:178:13",value:"approved",children:"已通过"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:179:13",value:"rejected",children:"已拒绝"})]})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:182:9",variant:"outline",size:"sm",className:"border-[var(--dg-border)]",onClick:m,children:[e.jsx(ue,{"code-path":"src/pages/ApprovalCategoryPage.tsx:183:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(de,{"code-path":"src/pages/ApprovalCategoryPage.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:188:9",className:"p-0",children:k?e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:13",className:"flex items-center justify-center py-16",children:e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:69",className:"h-6 w-6 animate-spin text-[var(--dg-blue)]"})}):V.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:192:13",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[e.jsx(Ce,{"code-path":"src/pages/ApprovalCategoryPage.tsx:193:15",className:"h-10 w-10 mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:194:15",className:"text-sm",children:"暂无申请记录"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:195:15",variant:"link",className:"mt-2",onClick:O,children:"立即申请"})]}):e.jsxs(he,{"code-path":"src/pages/ApprovalCategoryPage.tsx:198:13",children:[e.jsx(ie,{"code-path":"src/pages/ApprovalCategoryPage.tsx:199:15",children:e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:200:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:201:19",className:"text-[var(--dg-text-secondary)]",children:"提交时间"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:202:19",className:"text-[var(--dg-text-secondary)]",children:"提交账号"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:203:19",className:"text-[var(--dg-text-secondary)]",children:"当前审核人"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:204:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:205:19",className:"text-[var(--dg-text-secondary)] w-28",children:"操作"})]})}),e.jsx(ve,{"code-path":"src/pages/ApprovalCategoryPage.tsx:208:15",children:V.map(a=>e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:210:19",className:"border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:211:21",className:"text-[var(--dg-text-muted)] text-sm whitespace-nowrap",children:a.created_at?new Date(a.created_at).toLocaleString("zh-CN"):"--"}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:214:21",className:"text-[var(--dg-text-primary)]",children:se(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:215:21",className:"text-[var(--dg-text-muted)] text-sm",children:ke(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:216:21",children:ae(a.status)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:217:21",children:e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:218:23",className:"flex items-center gap-1",children:a.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:221:29",variant:"ghost",size:"sm",className:"h-8 text-red-400 hover:bg-red-500/10",onClick:()=>ce(a.id),disabled:E,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:222:31",className:"h-3.5 w-3.5 mr-1"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:224:29",variant:"ghost",size:"sm",className:"h-8 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>pe(a.id),disabled:E,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:225:31",className:"h-3.5 w-3.5 mr-1"}),"通过"]})]}):e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:229:27",variant:"ghost",size:"sm",className:"h-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>oe(a),children:[e.jsx(je,{"code-path":"src/pages/ApprovalCategoryPage.tsx:230:29",className:"h-3.5 w-3.5 mr-1"}),"详情"]})})})]},a.id))})]})})}),e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:244:7",open:s,onOpenChange:o,children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:245:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:246:11",children:[e.jsxs(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:247:13",className:"text-[var(--dg-text-primary)]",children:["新建",p]}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:248:13",className:"text-[var(--dg-text-secondary)]",children:d})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:250:11",className:"space-y-4 py-2",children:g.map(a=>e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:252:15",className:"space-y-1.5",children:[e.jsxs(ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:17",className:"text-[var(--dg-text-primary)] text-sm",children:[a.label,a.required&&e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:106",className:"text-red-400 ml-0.5",children:"*"})]}),a.type==="select"?e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:255:19",value:v[a.key]||"",onValueChange:r=>b(u=>({...u,[a.key]:r})),children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:101",placeholder:a.placeholder||`选择${a.label}`})}),e.jsx(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:21",children:(a.options||[]).map(r=>e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:73",value:r,children:r},r))})]}):a.type==="textarea"?e.jsx("textarea",{"code-path":"src/pages/ApprovalCategoryPage.tsx:260:19",value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,rows:3,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] px-3 py-2 text-sm resize-none focus:outline-none focus:border-[var(--dg-blue)]"}):e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:264:19",type:a.type,value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]},a.key))}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:270:11",className:"flex justify-end gap-3 pt-2",children:[e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:271:13",variant:"outline",className:"border-[var(--dg-border)]",onClick:()=>o(!1),children:"取消"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:272:13",onClick:re,disabled:n,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:273:31",className:"h-4 w-4 mr-2 animate-spin"}),"提交中..."]}):"提交申请"})]})]})}),e.jsx(_e,{"code-path":"src/pages/ApprovalCategoryPage.tsx:280:7",item:te,onClose:()=>L(null),fields:g,onStatusChange:m})]})}function _e({item:t,onClose:p,fields:d,onStatusChange:g}){const[C,y]=c.useState(!1);if(!t)return null;const j=s=>s?new Date(s).toLocaleString("zh-CN"):"",k=t.steps||[],_=async()=>{y(!0);try{await h.approveProcess(t.id),l.success("已通过"),g(),p()}catch(s){l.error(s?.response?.data?.message||"审批失败")}finally{y(!1)}},P=async()=>{y(!0);try{await h.rejectProcess(t.id,"审批拒绝"),l.success("已拒绝"),g(),p()}catch(s){l.error(s?.response?.data?.message||"操作失败")}finally{y(!1)}},S=s=>s.status==="approved"?"通过":s.status==="rejected"?"拒绝":s.status==="pending"&&s.step===t.current_step?"待审批":s.status==="pending"?"待开始":s.status,i=s=>s.status==="approved"?"text-emerald-400":s.status==="rejected"?"text-red-400":s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]",D=s=>s.approver_user?s.approver_user.real_name||s.approver_user.username||`#${s.approver}`:"管理员";return e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:337:5",open:!!t,onOpenChange:s=>{s||p()},children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:338:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:339:9",children:[e.jsx(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:340:11",className:"text-[var(--dg-text-primary)]",children:"申请详情"}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:341:11",className:"text-[var(--dg-text-secondary)]",children:t.title})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:344:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:346:11",className:"flex items-center gap-3",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:347:13",className:"text-sm text-[var(--dg-text-muted)]",children:"状态:"}),ae(t.status),t.status==="pending"&&e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:350:15",className:"text-xs text-[var(--dg-text-muted)]",children:["第 ",t.current_step,"/",t.total_steps," 步"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:357:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:358:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-4",children:"操作时间线"}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:359:13",className:"space-y-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:361:15",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:362:17",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:19",className:"w-7 h-7 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(Ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:105",className:"w-3.5 h-3.5 text-blue-400"})}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:364:19",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:366:17",className:"flex-1 pb-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:367:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:368:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"提交申请"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:369:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:370:21",className:"text-xs text-[var(--dg-text-secondary)]",children:se(t)}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:371:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:372:21",className:"text-xs text-[var(--dg-text-muted)]",children:j(t.created_at)})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:375:19",className:"mt-1 flex flex-wrap gap-2",children:(()=>{const s=M(t.form_data||"{}");return d.slice(0,4).map(o=>{const n=s[o.key];return n?e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:382:27",className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:[o.label,": ",e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:383:40",className:"text-[var(--dg-text-secondary)]",children:n})]},o.key):null})})()})]})]}),k.map((s,o)=>{const n=o===k.length-1,A=s.step_type==="execute",$=A?"执行":"审核",F=s.status==="approved"?"bg-emerald-500/20":s.status==="rejected"?"bg-red-500/20":"bg-[var(--dg-bg-tertiary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:401:19",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:402:21",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:403:23",className:`w-7 h-7 rounded-full flex items-center justify-center ${F}`,children:s.status==="approved"?e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:404:52",className:"w-3.5 h-3.5 text-emerald-400"}):s.status==="rejected"?e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:405:55",className:"w-3.5 h-3.5 text-red-400"}):A?e.jsx(fe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:407:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-green-400":"text-[var(--dg-text-muted)]"}`}):e.jsx(we,{"code-path":"src/pages/ApprovalCategoryPage.tsx:408:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]"}`})}),!n&&e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:410:35",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:412:21",className:`flex-1 ${n?"":"pb-4"}`,children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:413:23",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:414:25",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:$}),s.approver_user&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:417:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:418:29",className:"text-xs text-[var(--dg-text-secondary)]",children:["指派人: ",D(s)]})]}),s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:423:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:424:29",className:`text-xs ${i(s)}`,children:[D(s)," · ",S(s)," · ",j(s.approved_at)]})]}),!s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:431:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:432:29",className:`text-xs ${i(s)}`,children:S(s)})]})]}),s.comment&&s.comment!==s.status&&s.comment!=="pending"&&e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:437:25",className:"text-xs text-[var(--dg-text-muted)] mt-1 ml-0",children:s.comment})]})]},s.id)})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:447:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:448:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:"申请内容"}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:449:13",className:"space-y-2",children:(()=>{const s=M(t.form_data||"{}");return d.map(o=>{const n=s[o.key];return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:455:21",className:"grid grid-cols-3 gap-2 text-sm",children:[e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:456:23",className:"text-[var(--dg-text-muted)]",children:[o.label,":"]}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:457:23",className:"text-[var(--dg-text-primary)] col-span-2",children:n??"--"})]},o.key)})})()})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:466:9",className:"flex justify-end gap-3 pt-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:469:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:P,disabled:C,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:470:17",className:"h-4 w-4 mr-1.5"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:472:15",className:"bg-emerald-600 hover:bg-emerald-700",onClick:_,disabled:C,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:473:17",className:"h-4 w-4 mr-1.5"}),"通过"]})]}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:477:11",variant:"outline",className:"border-[var(--dg-border)]",onClick:p,children:"关闭"})]})]})})}export{Re as A}; +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",placeholder:"搜索申请...",value:P,onChange:a=>S(a.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:171:9",value:i,onValueChange:D,children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:172:11",className:"w-32 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:173:13",placeholder:"全部状态"})}),e.jsxs(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:175:11",children:[e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:176:13",value:"all",children:"全部状态"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:177:13",value:"pending",children:"审批中"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:178:13",value:"approved",children:"已通过"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:179:13",value:"rejected",children:"已拒绝"})]})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:182:9",variant:"outline",size:"sm",className:"border-[var(--dg-border)]",onClick:m,children:[e.jsx(ue,{"code-path":"src/pages/ApprovalCategoryPage.tsx:183:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(de,{"code-path":"src/pages/ApprovalCategoryPage.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:188:9",className:"p-0",children:k?e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:13",className:"flex items-center justify-center py-16",children:e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:69",className:"h-6 w-6 animate-spin text-[var(--dg-blue)]"})}):V.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:192:13",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[e.jsx(Ce,{"code-path":"src/pages/ApprovalCategoryPage.tsx:193:15",className:"h-10 w-10 mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:194:15",className:"text-sm",children:"暂无申请记录"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:195:15",variant:"link",className:"mt-2",onClick:O,children:"立即申请"})]}):e.jsxs(he,{"code-path":"src/pages/ApprovalCategoryPage.tsx:198:13",children:[e.jsx(ie,{"code-path":"src/pages/ApprovalCategoryPage.tsx:199:15",children:e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:200:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:201:19",className:"text-[var(--dg-text-secondary)]",children:"提交时间"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:202:19",className:"text-[var(--dg-text-secondary)]",children:"提交账号"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:203:19",className:"text-[var(--dg-text-secondary)]",children:"当前审核人"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:204:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:205:19",className:"text-[var(--dg-text-secondary)] w-28",children:"操作"})]})}),e.jsx(ve,{"code-path":"src/pages/ApprovalCategoryPage.tsx:208:15",children:V.map(a=>e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:210:19",className:"border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:211:21",className:"text-[var(--dg-text-muted)] text-sm whitespace-nowrap",children:a.created_at?new Date(a.created_at).toLocaleString("zh-CN"):"--"}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:214:21",className:"text-[var(--dg-text-primary)]",children:se(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:215:21",className:"text-[var(--dg-text-muted)] text-sm",children:ke(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:216:21",children:ae(a.status)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:217:21",children:e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:218:23",className:"flex items-center gap-1",children:a.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:221:29",variant:"ghost",size:"sm",className:"h-8 text-red-400 hover:bg-red-500/10",onClick:()=>ce(a.id),disabled:E,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:222:31",className:"h-3.5 w-3.5 mr-1"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:224:29",variant:"ghost",size:"sm",className:"h-8 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>pe(a.id),disabled:E,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:225:31",className:"h-3.5 w-3.5 mr-1"}),"通过"]})]}):e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:229:27",variant:"ghost",size:"sm",className:"h-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>oe(a),children:[e.jsx(je,{"code-path":"src/pages/ApprovalCategoryPage.tsx:230:29",className:"h-3.5 w-3.5 mr-1"}),"详情"]})})})]},a.id))})]})})}),e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:244:7",open:s,onOpenChange:o,children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:245:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:246:11",children:[e.jsxs(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:247:13",className:"text-[var(--dg-text-primary)]",children:["新建",p]}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:248:13",className:"text-[var(--dg-text-secondary)]",children:d})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:250:11",className:"space-y-4 py-2",children:g.map(a=>e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:252:15",className:"space-y-1.5",children:[e.jsxs(ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:17",className:"text-[var(--dg-text-primary)] text-sm",children:[a.label,a.required&&e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:106",className:"text-red-400 ml-0.5",children:"*"})]}),a.type==="select"?e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:255:19",value:v[a.key]||"",onValueChange:r=>b(u=>({...u,[a.key]:r})),children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:101",placeholder:a.placeholder||`选择${a.label}`})}),e.jsx(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:21",children:(a.options||[]).map(r=>e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:73",value:r,children:r},r))})]}):a.type==="textarea"?e.jsx("textarea",{"code-path":"src/pages/ApprovalCategoryPage.tsx:260:19",value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,rows:3,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] px-3 py-2 text-sm resize-none focus:outline-none focus:border-[var(--dg-blue)]"}):e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:264:19",type:a.type,value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]},a.key))}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:270:11",className:"flex justify-end gap-3 pt-2",children:[e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:271:13",variant:"outline",className:"border-[var(--dg-border)]",onClick:()=>o(!1),children:"取消"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:272:13",onClick:re,disabled:n,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:273:31",className:"h-4 w-4 mr-2 animate-spin"}),"提交中..."]}):"提交申请"})]})]})}),e.jsx(_e,{"code-path":"src/pages/ApprovalCategoryPage.tsx:280:7",item:te,onClose:()=>L(null),fields:g,onStatusChange:m})]})}function _e({item:t,onClose:p,fields:d,onStatusChange:g}){const[C,y]=c.useState(!1);if(!t)return null;const j=s=>s?new Date(s).toLocaleString("zh-CN"):"",k=t.steps||[],_=async()=>{y(!0);try{await h.approveProcess(t.id),l.success("已通过"),g(),p()}catch(s){l.error(s?.response?.data?.message||"审批失败")}finally{y(!1)}},P=async()=>{y(!0);try{await h.rejectProcess(t.id,"审批拒绝"),l.success("已拒绝"),g(),p()}catch(s){l.error(s?.response?.data?.message||"操作失败")}finally{y(!1)}},S=s=>s.status==="approved"?"通过":s.status==="rejected"?"拒绝":s.status==="pending"&&s.step===t.current_step?"待审批":s.status==="pending"?"待开始":s.status,i=s=>s.status==="approved"?"text-emerald-400":s.status==="rejected"?"text-red-400":s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]",D=s=>s.approver_user?s.approver_user.real_name||s.approver_user.username||`#${s.approver}`:"管理员";return e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:337:5",open:!!t,onOpenChange:s=>{s||p()},children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:338:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:339:9",children:[e.jsx(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:340:11",className:"text-[var(--dg-text-primary)]",children:"申请详情"}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:341:11",className:"text-[var(--dg-text-secondary)]",children:t.title})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:344:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:346:11",className:"flex items-center gap-3",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:347:13",className:"text-sm text-[var(--dg-text-muted)]",children:"状态:"}),ae(t.status),t.status==="pending"&&e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:350:15",className:"text-xs text-[var(--dg-text-muted)]",children:["第 ",t.current_step,"/",t.total_steps," 步"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:357:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:358:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-4",children:"操作时间线"}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:359:13",className:"space-y-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:361:15",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:362:17",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:19",className:"w-7 h-7 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(Ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:105",className:"w-3.5 h-3.5 text-blue-400"})}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:364:19",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:366:17",className:"flex-1 pb-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:367:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:368:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"提交申请"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:369:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:370:21",className:"text-xs text-[var(--dg-text-secondary)]",children:se(t)}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:371:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:372:21",className:"text-xs text-[var(--dg-text-muted)]",children:j(t.created_at)})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:375:19",className:"mt-1 flex flex-wrap gap-2",children:(()=>{const s=M(t.form_data||"{}");return d.slice(0,4).map(o=>{const n=s[o.key];return n?e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:382:27",className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:[o.label,": ",e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:383:40",className:"text-[var(--dg-text-secondary)]",children:n})]},o.key):null})})()})]})]}),k.map((s,o)=>{const n=o===k.length-1,A=s.step_type==="execute",$=A?"执行":"审核",F=s.status==="approved"?"bg-emerald-500/20":s.status==="rejected"?"bg-red-500/20":"bg-[var(--dg-bg-tertiary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:401:19",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:402:21",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:403:23",className:`w-7 h-7 rounded-full flex items-center justify-center ${F}`,children:s.status==="approved"?e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:404:52",className:"w-3.5 h-3.5 text-emerald-400"}):s.status==="rejected"?e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:405:55",className:"w-3.5 h-3.5 text-red-400"}):A?e.jsx(fe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:407:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-green-400":"text-[var(--dg-text-muted)]"}`}):e.jsx(we,{"code-path":"src/pages/ApprovalCategoryPage.tsx:408:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]"}`})}),!n&&e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:410:35",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:412:21",className:`flex-1 ${n?"":"pb-4"}`,children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:413:23",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:414:25",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:$}),s.approver_user&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:417:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:418:29",className:"text-xs text-[var(--dg-text-secondary)]",children:["指派人: ",D(s)]})]}),s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:423:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:424:29",className:`text-xs ${i(s)}`,children:[D(s)," · ",S(s)," · ",j(s.approved_at)]})]}),!s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:431:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:432:29",className:`text-xs ${i(s)}`,children:S(s)})]})]}),s.comment&&s.comment!==s.status&&s.comment!=="pending"&&e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:437:25",className:"text-xs text-[var(--dg-text-muted)] mt-1 ml-0",children:s.comment})]})]},s.id)})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:447:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:448:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:"申请内容"}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:449:13",className:"space-y-2",children:(()=>{const s=M(t.form_data||"{}");return d.map(o=>{const n=s[o.key];return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:455:21",className:"grid grid-cols-3 gap-2 text-sm",children:[e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:456:23",className:"text-[var(--dg-text-muted)]",children:[o.label,":"]}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:457:23",className:"text-[var(--dg-text-primary)] col-span-2",children:n??"--"})]},o.key)})})()})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:466:9",className:"flex justify-end gap-3 pt-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:469:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:P,disabled:C,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:470:17",className:"h-4 w-4 mr-1.5"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:472:15",className:"bg-emerald-600 hover:bg-emerald-700",onClick:_,disabled:C,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:473:17",className:"h-4 w-4 mr-1.5"}),"通过"]})]}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:477:11",variant:"outline",className:"border-[var(--dg-border)]",onClick:p,children:"关闭"})]})]})})}export{Re as A}; diff --git a/backend/static/assets/ApprovalFlow-D-ftjqRO.js b/backend/static/assets/ApprovalFlow-BziKIUh9.js similarity index 98% rename from backend/static/assets/ApprovalFlow-D-ftjqRO.js rename to backend/static/assets/ApprovalFlow-BziKIUh9.js index 361c320..5e69205 100644 --- a/backend/static/assets/ApprovalFlow-D-ftjqRO.js +++ b/backend/static/assets/ApprovalFlow-BziKIUh9.js @@ -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}`})]}),no(c.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:108:9",className:"flex items-center gap-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg p-1",children:Je.map(c=>e.jsx("button",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:110:13",onClick:()=>m(c.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",n===c.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:c.label},c.key))})]}),r?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:128:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:129:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:130:13",className:"flex items-center justify-center text-[var(--dg-text-muted)]",children:[e.jsx($,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:131:15",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]})})}):a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:137:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:138:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:139:13",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:140:15",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:141:15",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无审批流程"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:142:15",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的流程实例"})]})})}):e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:147:9",className:"grid grid-cols-1 gap-4",children:a.map(c=>{const w=Be(A(c)),{percentage:l}=U(c);return e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:152:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-[var(--dg-border)] transition-colors",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:153:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:154:19",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:155:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:156:23",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(c))},children:e.jsx(w,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:157:25",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:159:23",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:160:25",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:161:27",className:"font-medium text-[var(--dg-text-primary)]",children:c.title}),Me(c.status)]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:164:25",className:"flex items-center gap-3 text-xs text-[var(--dg-text-muted)]",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:165:27",className:"flex items-center gap-1",children:e.jsx(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:166:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(c))},children:Y(A(c))})}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:170:27",children:["申请人:",c.applicant_name||c.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:171:27",children:["提交于 ",c.created_at?new Date(c.created_at).toLocaleString():"--"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:175:21",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:176:23",variant:"ghost",size:"sm",className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>p(c),children:[e.jsx(Fe,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:177:25",className:"h-4 w-4 mr-1"}),"详情"]}),c.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:182:27",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>d(c),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:191:27",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>y(c),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:197:29",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:205:19",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:206:21",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:207:23",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:208:23",children:[l,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:210:21",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:211:23",className:b("h-full rounded-full transition-all",c.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${l}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:221:19",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(c)})]})},c.id)})})]})}function ne(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[]}const K=[{value:"deploy",label:"发布审批",color:"var(--dg-blue)"},{value:"server",label:"服务器操作",color:"var(--dg-cyan)"},{value:"permission",label:"权限申请",color:"var(--dg-purple)"}],qe=a=>K.find(r=>r.value===a)?.label||a||"通用审批",He=a=>K.find(r=>r.value===a)?.color||"var(--dg-text-secondary)";function Qe(a){const r=ne(a.steps);return r.length===0?e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:37:12",className:"text-[var(--dg-text-muted)] text-center py-4",children:"暂无流程节点"}):e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:40:5",className:"flex items-center gap-2 overflow-x-auto py-4",children:r.map((s,o)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:42:9",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:43:11",className:b("px-4 py-2 rounded-lg border min-w-[100px] text-center",s.type==="start"&&"bg-emerald-500/10 border-emerald-500/30 text-emerald-400",s.type==="approval"&&"bg-[var(--dg-blue)]/10 border-[var(--dg-blue)]/30 text-[var(--dg-blue)]",s.type==="condition"&&"bg-amber-500/10 border-amber-500/30 text-amber-400",s.type==="end"&&"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-secondary)]"),children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:52:13",className:"text-sm font-medium",children:s.name}),s.approvers&&e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Array.isArray(s.approvers)?s.approvers.join(", "):s.approvers})]}),os("all"),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",r==="all"?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:"全部类型"}),K.map(o=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:100:13",onClick:()=>s(o.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors flex items-center gap-1.5",r===o.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:110:15",style:{color:o.color},children:"●"}),o.label]},o.value))]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:117:7",className:"grid grid-cols-1 gap-4",children:a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:119:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:120:13",className:"p-8",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:121:15",className:"text-center",children:[e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:122:17",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:123:17",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无流程模板"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:124:17",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的模板"})]})})}):a.map(o=>e.jsxs(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:130:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(ye,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:131:15",className:"pb-2",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:132:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:133:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:134:21",className:"w-10 h-10 rounded-lg bg-[var(--dg-blue)]/10 flex items-center justify-center",children:e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:135:23",className:"h-5 w-5 text-[var(--dg-blue)]"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:137:21",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:138:23",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:139:25",className:"text-base text-[var(--dg-text-primary)]",children:o.name}),o.type&&e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:141:27",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:He(o.type)},children:qe(o.type)})]}),e.jsx(we,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:150:23",className:"text-[var(--dg-text-muted)]",children:o.description})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:153:19",className:"flex items-center gap-2",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:154:21",variant:"outline",className:o.status===1||o.status==="active"||o.status===!0?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",children:o.status===1||o.status==="active"||o.status===!0?"已启用":"已停用"}),e.jsx(i,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:164:21",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",children:e.jsx(Pe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:165:23",className:"h-4 w-4"})})]})]})}),e.jsxs(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:170:15",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:171:17",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4 overflow-x-auto",children:Qe(o)}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:174:17",className:"flex items-center justify-between mt-4 text-sm text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:175:19",children:["创建于 ",o.created_at?new Date(o.created_at).toLocaleDateString():"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:176:19",children:[ne(o.steps).length," 个节点"]})]})]})]},o.id))})]})}function Ye({open:a,onOpenChange:r,instance:s,templates:o,onApprove:n,onReject:m}){return s?e.jsx(M,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:41:5",open:a,onOpenChange:r,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:42:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:43:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:44:11",className:"text-[var(--dg-text-primary)]",children:"审批详情"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:45:11",className:"text-[var(--dg-text-muted)]",children:"查看审批流程详细信息"})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:47:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:48:11",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:49:13",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:s.title}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:50:13",className:"flex items-center gap-2 mt-1",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:51:15",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(s))},children:Y(A(s))}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",s.applicant_name||s.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:57:15",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",s.created_at?new Date(s.created_at).toLocaleString():"--"]})]})]}),s.content&&e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:65:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:66:15",className:"text-sm text-[var(--dg-text-secondary)] whitespace-pre-wrap",children:s.content})}),(()=>{const p=o.find(y=>y.id===s.template_id),d=Ee(s.form_data,p);return d?e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:76:15",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:77:17",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"申请表单"}),d]}):null})(),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:84:11",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:85:13",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"审批进度"}),X(s)]}),s.actions&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:91:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:92:15",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"操作记录"}),e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:93:15",className:"space-y-2",children:s.actions.map((p,d)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:95:19",className:"flex items-center gap-3 text-sm",children:[p.action==="approve"?e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:97:23",className:"h-4 w-4 text-emerald-400"}):p.action==="reject"?e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:99:23",className:"h-4 w-4 text-red-400"}):e.jsx(ce,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:101:23",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:103:21",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:104:23",className:"text-[var(--dg-text-secondary)]",children:p.operator_name||p.operator}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:107:23",className:"text-[var(--dg-text-muted)] mx-1",children:"·"}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:108:23",className:"text-[var(--dg-text-secondary)]",children:p.action==="approve"?"通过":p.action==="reject"?"拒绝":"提交"}),p.comment&&e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:112:25",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:p.comment})]}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:115:21",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:p.created_at?new Date(p.created_at).toLocaleString():""})]},d))})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:124:9",children:[s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:127:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>{r(!1),m(s)},children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:128:17",className:"h-4 w-4 mr-2"}),"拒绝"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:130:15",className:"bg-emerald-500/90 hover:bg-emerald-500 text-white",onClick:()=>{r(!1),n(s)},children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:131:17",className:"h-4 w-4 mr-2"}),"通过"]})]}),e.jsx(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:135:11",variant:"ghost",onClick:()=>r(!1),children:"关闭"})]})]})}):null}function Ue({open:a,onOpenChange:r,templates:s,onSuccess:o}){const[n,m]=v.useState(null),[p,d]=v.useState({}),[y,c]=v.useState(!1),w=async()=>{if(!n){T.error("请先选择申请类型");return}const l=I(n.form_schema);for(const x of l)if(x.required&&!p[x.key]){T.error(`请填写${x.label}`);return}c(!0);try{await k.createProcess({template_id:n.id,title:p.app_name||n.name,form_data:JSON.stringify(p)}),T.success("申请已提交"),r(!1),m(null),d({}),o()}catch(x){T.error("提交失败",{description:x?.message})}finally{c(!1)}};return e.jsx(M,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:78:5",open:a,onOpenChange:l=>{l||(m(null),d({})),r(l)},children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:89:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:90:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:91:11",className:"text-[var(--dg-text-primary)]",children:"新建资源申请"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:92:11",className:"text-[var(--dg-text-muted)]",children:n?"请填写申请信息":"请选择申请类型"})]}),n?e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:135:11",className:"py-2",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:136:13",className:"flex items-center gap-2 mb-4",children:e.jsx("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:137:15",type:"button",onClick:()=>{m(null),d({})},className:"text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",children:"← 返回选择类型"})}),e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:145:13",className:"grid grid-cols-2 gap-x-4 gap-y-4",children:I(n.form_schema).map(l=>{const x=l.type==="textarea";return e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:149:19",className:b("space-y-1.5",x&&"col-span-2"),children:[e.jsxs(_e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:150:21",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:[l.label,l.required&&e.jsx("span",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:152:42",className:"text-red-400 ml-0.5",children:"*"})]}),l.type==="select"?e.jsxs(Le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:155:23",value:String(p[l.key]??""),onValueChange:h=>d(g=>({...g,[l.key]:h})),children:[e.jsx(Oe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:159:25",className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ie,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:160:27",placeholder:l.placeholder||`请选择${l.label}`})}),e.jsx($e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:162:25",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:(l.options||[]).map(h=>e.jsx(Re,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:164:29",value:h,className:"text-[var(--dg-text-primary)] focus:bg-[var(--dg-bg-hover)]",children:h},h))})]}):l.type==="textarea"?e.jsx(pe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:171:23",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"}):e.jsx(le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:178:23",type:l.type==="number"?"number":"text",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]},l.key)})})]}):e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:99:11",className:"grid grid-cols-2 gap-4 py-2",children:R.map(l=>{const x=s.find(g=>g.type===l.value&&g.enabled!==!1),h=l.icon;return e.jsxs("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:106:17",type:"button",disabled:!x,onClick:()=>{m(x),d({})},className:b("flex flex-col items-start gap-3 p-5 rounded-xl text-left transition-colors","bg-[var(--dg-bg-tertiary)] hover:bg-[var(--dg-bg-hover)]",!x&&"opacity-40 cursor-not-allowed hover:bg-[var(--dg-bg-tertiary)]"),children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:117:19",className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`color-mix(in srgb, ${l.color} 15%, transparent)`,color:l.color},children:e.jsx(h,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:121:21",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:123:19",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:124:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:l.label}),e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:125:21",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:x?x.description||`共 ${I(x.form_schema).length} 个字段`:"暂无可用模板"})]})]},l.value)})}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:196:9",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:197:11",variant:"ghost",onClick:()=>r(!1),children:"取消"}),n&&e.jsxs(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:199:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:w,disabled:y,children:[y&&e.jsx($,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:204:30",className:"h-4 w-4 mr-2 animate-spin"}),"提交申请"]})]})]})})}function Xe(){const[a,r]=v.useState("instances"),[s,o]=v.useState([]),[n,m]=v.useState([]),[p,d]=v.useState([]),[y,c]=v.useState(!0),[w,l]=v.useState(""),[x,h]=v.useState(""),[g,de]=v.useState("all"),[me,W]=v.useState(!1),[P,Z]=v.useState(null),[ve,O]=v.useState(!1),[f,xe]=v.useState("approve"),[z,ee]=v.useState(""),[ae,te]=v.useState(!1),[ie,se]=v.useState(!1),E=async()=>{try{c(!0);const[t,N,J]=await Promise.all([k.getProcesses().catch(()=>null),k.getTemplates().catch(()=>null),k.getProcesses({status:"pending"}).catch(()=>null)]);o(t?.list||[]),m(N?.list||[]),d(J?.list||[])}catch(t){console.error("加载审批数据失败:",t)}finally{c(!1)}};v.useEffect(()=>{E()},[]);const he=s.filter(t=>{const N=(t.title||"").toLowerCase().includes(w.toLowerCase())||(t.applicant_name||t.applicant||"").toLowerCase().includes(w.toLowerCase()),J=!x||t.status===x;return N&&J}),ge=n.filter(t=>g==="all"||t.type===g),re=t=>{Z(t),W(!0)},S=(t,N)=>{xe(t),Z(N),ee(""),O(!0)},be=async()=>{if(P)try{te(!0),f==="approve"?(await k.approveProcess(P.id,z),T.success("审批通过")):(await k.rejectProcess(P.id,z),T.success("已拒绝")),O(!1),E()}catch(t){T.error("操作失败",{description:t.message})}finally{te(!1)}},ue=s.filter(t=>t.status==="pending").length,je=s.filter(t=>t.status==="approved").length,Ae=s.filter(t=>t.status==="rejected").length,B=p.filter(t=>t.status==="pending").length;return e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:139:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:141:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:142:9",children:[e.jsx("h1",{"code-path":"src/components/approval/ApprovalFlow.tsx:143:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"资源申请"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:144:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"云服务器申请 · 应用部署申请"})]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:146:9",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:()=>se(!0),children:[e.jsx(ke,{"code-path":"src/components/approval/ApprovalFlow.tsx:150:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:156:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:157:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:158:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:159:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:160:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:161:17",className:"text-sm text-[var(--dg-text-muted)]",children:"待审批"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:162:17",className:"text-2xl font-bold text-amber-400",children:ue})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:164:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(ce,{"code-path":"src/components/approval/ApprovalFlow.tsx:165:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:170:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:171:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:172:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:173:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:174:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已通过"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:175:17",className:"text-2xl font-bold text-emerald-400",children:je})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:177:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:178:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:183:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:184:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:185:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:186:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:187:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已拒绝"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:188:17",className:"text-2xl font-bold text-red-400",children:Ae})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:190:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:191:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:196:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:197:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:198:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:199:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:200:17",className:"text-sm text-[var(--dg-text-muted)]",children:"我的待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:201:17",className:"text-2xl font-bold text-[var(--dg-blue)]",children:B})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:203:15",className:"p-3 rounded-lg bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]",children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:204:17",className:"h-5 w-5"})})]})})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:212:7",className:"flex items-center gap-1 border-b border-[var(--dg-border)]",children:[{key:"instances",label:"审批实例"},{key:"flows",label:"流程模板"},{key:"my-approvals",label:"我的审批"}].map(t=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalFlow.tsx:218:11",onClick:()=>r(t.key),className:b("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",a===t.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[t.label,t.key==="my-approvals"&&B>0&&e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:230:15",className:"ml-2 bg-red-500/20 text-red-400 border-0 text-xs",children:B})]},t.key))}),a==="instances"&&e.jsx(Ve,{"code-path":"src/components/approval/ApprovalFlow.tsx:238:9",processes:s,filteredInstances:he,loading:y,searchQuery:w,setSearchQuery:l,statusFilter:x,setStatusFilter:h,onView:re,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),a==="flows"&&e.jsx(Ge,{"code-path":"src/components/approval/ApprovalFlow.tsx:253:9",filteredTemplates:ge,templateTypeFilter:g,setTemplateTypeFilter:de}),a==="my-approvals"&&e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:261:9",className:"grid grid-cols-1 gap-4",children:p.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:263:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:264:15",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:265:17",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:266:19",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:267:19",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:268:19",className:"text-sm text-[var(--dg-text-muted)]",children:"没有等待你处理的审批"})]})})}):p.map(t=>{const{percentage:N}=U(t);return e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:276:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:277:19",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:278:21",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:279:23",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:280:25",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(t))},children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:281:27",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:283:25",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:284:27",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:285:29",className:"font-medium text-[var(--dg-text-primary)]",children:t.title}),e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:286:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(t))},children:Y(A(t))})]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:290:27",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",t.applicant_name||t.applicant||"--"]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:293:27",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",t.created_at?new Date(t.created_at).toLocaleString():"--"]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:298:23",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:299:25",variant:"ghost",size:"sm",onClick:()=>re(t),children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:300:27",className:"h-4 w-4 mr-1"}),"详情"]}),t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:305:29",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>S("approve",t),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:306:31",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:308:29",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>S("reject",t),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:309:31",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:315:21",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:316:23",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:317:25",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:318:25",children:[N,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:320:23",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:321:25",className:b("h-full rounded-full",t.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${N}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:324:21",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(t)})]})},t.id)})}),e.jsx(Ye,{"code-path":"src/components/approval/ApprovalFlow.tsx:336:7",open:me,onOpenChange:W,instance:P,templates:n,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),e.jsx(M,{"code-path":"src/components/approval/ApprovalFlow.tsx:346:7",open:ve,onOpenChange:O,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalFlow.tsx:347:9",className:"max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalFlow.tsx:348:11",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalFlow.tsx:349:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:f==="approve"?e.jsxs(e.Fragment,{children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:352:19",className:"h-5 w-5 text-emerald-400"}),"确认通过审批"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:357:19",className:"h-5 w-5 text-red-400"}),"确认拒绝审批"]})}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalFlow.tsx:362:13",className:"text-[var(--dg-text-muted)]",children:f==="approve"?"请填写审批意见后确认通过":"请填写拒绝原因后确认拒绝"})]}),P&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:367:13",className:"py-2",children:[e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:368:15",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:["审批标题:",e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:369:22",className:"text-[var(--dg-text-primary)]",children:P.title})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:371:15",className:"space-y-2",children:[e.jsx("label",{"code-path":"src/components/approval/ApprovalFlow.tsx:372:17",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:f==="approve"?"审批意见":"拒绝原因"}),e.jsx(pe,{"code-path":"src/components/approval/ApprovalFlow.tsx:375:17",placeholder:f==="approve"?"请填写审批意见(可选)":"请填写拒绝原因",value:z,onChange:t=>ee(t.target.value),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalFlow.tsx:384:11",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:385:13",variant:"outline",onClick:()=>O(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:388:13",onClick:be,disabled:ae,className:f==="approve"?"bg-emerald-500/90 hover:bg-emerald-500 text-white":"bg-red-500 hover:bg-red-600 text-white",children:[ae&&e.jsx($,{"code-path":"src/components/approval/ApprovalFlow.tsx:393:36",className:"h-4 w-4 mr-2 animate-spin"}),f==="approve"?"确认通过":"确认拒绝"]})]})]})}),e.jsx(Ue,{"code-path":"src/components/approval/ApprovalFlow.tsx:401:7",open:ie,onOpenChange:se,templates:n,onSuccess:E})]})}const ca=Xe;export{Xe as ApprovalFlow,ca as ApprovalFlowManager}; +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}`})]}),no(c.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:108:9",className:"flex items-center gap-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg p-1",children:Je.map(c=>e.jsx("button",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:110:13",onClick:()=>m(c.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",n===c.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:c.label},c.key))})]}),r?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:128:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:129:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:130:13",className:"flex items-center justify-center text-[var(--dg-text-muted)]",children:[e.jsx($,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:131:15",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]})})}):a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:137:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:138:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:139:13",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:140:15",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:141:15",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无审批流程"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:142:15",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的流程实例"})]})})}):e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:147:9",className:"grid grid-cols-1 gap-4",children:a.map(c=>{const w=Be(A(c)),{percentage:l}=U(c);return e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:152:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-[var(--dg-border)] transition-colors",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:153:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:154:19",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:155:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:156:23",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(c))},children:e.jsx(w,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:157:25",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:159:23",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:160:25",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:161:27",className:"font-medium text-[var(--dg-text-primary)]",children:c.title}),Me(c.status)]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:164:25",className:"flex items-center gap-3 text-xs text-[var(--dg-text-muted)]",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:165:27",className:"flex items-center gap-1",children:e.jsx(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:166:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(c))},children:Y(A(c))})}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:170:27",children:["申请人:",c.applicant_name||c.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:171:27",children:["提交于 ",c.created_at?new Date(c.created_at).toLocaleString():"--"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:175:21",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:176:23",variant:"ghost",size:"sm",className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>p(c),children:[e.jsx(Fe,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:177:25",className:"h-4 w-4 mr-1"}),"详情"]}),c.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:182:27",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>d(c),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:191:27",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>y(c),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:197:29",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:205:19",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:206:21",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:207:23",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:208:23",children:[l,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:210:21",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:211:23",className:b("h-full rounded-full transition-all",c.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${l}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:221:19",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(c)})]})},c.id)})})]})}function ne(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[]}const K=[{value:"deploy",label:"发布审批",color:"var(--dg-blue)"},{value:"server",label:"服务器操作",color:"var(--dg-cyan)"},{value:"permission",label:"权限申请",color:"var(--dg-purple)"}],qe=a=>K.find(r=>r.value===a)?.label||a||"通用审批",He=a=>K.find(r=>r.value===a)?.color||"var(--dg-text-secondary)";function Qe(a){const r=ne(a.steps);return r.length===0?e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:37:12",className:"text-[var(--dg-text-muted)] text-center py-4",children:"暂无流程节点"}):e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:40:5",className:"flex items-center gap-2 overflow-x-auto py-4",children:r.map((s,o)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:42:9",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:43:11",className:b("px-4 py-2 rounded-lg border min-w-[100px] text-center",s.type==="start"&&"bg-emerald-500/10 border-emerald-500/30 text-emerald-400",s.type==="approval"&&"bg-[var(--dg-blue)]/10 border-[var(--dg-blue)]/30 text-[var(--dg-blue)]",s.type==="condition"&&"bg-amber-500/10 border-amber-500/30 text-amber-400",s.type==="end"&&"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-secondary)]"),children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:52:13",className:"text-sm font-medium",children:s.name}),s.approvers&&e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Array.isArray(s.approvers)?s.approvers.join(", "):s.approvers})]}),os("all"),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",r==="all"?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:"全部类型"}),K.map(o=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:100:13",onClick:()=>s(o.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors flex items-center gap-1.5",r===o.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:110:15",style:{color:o.color},children:"●"}),o.label]},o.value))]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:117:7",className:"grid grid-cols-1 gap-4",children:a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:119:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:120:13",className:"p-8",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:121:15",className:"text-center",children:[e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:122:17",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:123:17",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无流程模板"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:124:17",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的模板"})]})})}):a.map(o=>e.jsxs(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:130:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(ye,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:131:15",className:"pb-2",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:132:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:133:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:134:21",className:"w-10 h-10 rounded-lg bg-[var(--dg-blue)]/10 flex items-center justify-center",children:e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:135:23",className:"h-5 w-5 text-[var(--dg-blue)]"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:137:21",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:138:23",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:139:25",className:"text-base text-[var(--dg-text-primary)]",children:o.name}),o.type&&e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:141:27",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:He(o.type)},children:qe(o.type)})]}),e.jsx(we,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:150:23",className:"text-[var(--dg-text-muted)]",children:o.description})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:153:19",className:"flex items-center gap-2",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:154:21",variant:"outline",className:o.status===1||o.status==="active"||o.status===!0?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",children:o.status===1||o.status==="active"||o.status===!0?"已启用":"已停用"}),e.jsx(i,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:164:21",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",children:e.jsx(Pe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:165:23",className:"h-4 w-4"})})]})]})}),e.jsxs(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:170:15",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:171:17",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4 overflow-x-auto",children:Qe(o)}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:174:17",className:"flex items-center justify-between mt-4 text-sm text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:175:19",children:["创建于 ",o.created_at?new Date(o.created_at).toLocaleDateString():"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:176:19",children:[ne(o.steps).length," 个节点"]})]})]})]},o.id))})]})}function Ye({open:a,onOpenChange:r,instance:s,templates:o,onApprove:n,onReject:m}){return s?e.jsx(M,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:41:5",open:a,onOpenChange:r,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:42:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:43:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:44:11",className:"text-[var(--dg-text-primary)]",children:"审批详情"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:45:11",className:"text-[var(--dg-text-muted)]",children:"查看审批流程详细信息"})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:47:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:48:11",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:49:13",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:s.title}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:50:13",className:"flex items-center gap-2 mt-1",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:51:15",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(s))},children:Y(A(s))}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",s.applicant_name||s.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:57:15",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",s.created_at?new Date(s.created_at).toLocaleString():"--"]})]})]}),s.content&&e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:65:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:66:15",className:"text-sm text-[var(--dg-text-secondary)] whitespace-pre-wrap",children:s.content})}),(()=>{const p=o.find(y=>y.id===s.template_id),d=Ee(s.form_data,p);return d?e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:76:15",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:77:17",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"申请表单"}),d]}):null})(),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:84:11",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:85:13",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"审批进度"}),X(s)]}),s.actions&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:91:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:92:15",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"操作记录"}),e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:93:15",className:"space-y-2",children:s.actions.map((p,d)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:95:19",className:"flex items-center gap-3 text-sm",children:[p.action==="approve"?e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:97:23",className:"h-4 w-4 text-emerald-400"}):p.action==="reject"?e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:99:23",className:"h-4 w-4 text-red-400"}):e.jsx(ce,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:101:23",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:103:21",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:104:23",className:"text-[var(--dg-text-secondary)]",children:p.operator_name||p.operator}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:107:23",className:"text-[var(--dg-text-muted)] mx-1",children:"·"}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:108:23",className:"text-[var(--dg-text-secondary)]",children:p.action==="approve"?"通过":p.action==="reject"?"拒绝":"提交"}),p.comment&&e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:112:25",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:p.comment})]}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:115:21",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:p.created_at?new Date(p.created_at).toLocaleString():""})]},d))})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:124:9",children:[s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:127:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>{r(!1),m(s)},children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:128:17",className:"h-4 w-4 mr-2"}),"拒绝"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:130:15",className:"bg-emerald-500/90 hover:bg-emerald-500 text-white",onClick:()=>{r(!1),n(s)},children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:131:17",className:"h-4 w-4 mr-2"}),"通过"]})]}),e.jsx(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:135:11",variant:"ghost",onClick:()=>r(!1),children:"关闭"})]})]})}):null}function Ue({open:a,onOpenChange:r,templates:s,onSuccess:o}){const[n,m]=v.useState(null),[p,d]=v.useState({}),[y,c]=v.useState(!1),w=async()=>{if(!n){T.error("请先选择申请类型");return}const l=I(n.form_schema);for(const x of l)if(x.required&&!p[x.key]){T.error(`请填写${x.label}`);return}c(!0);try{await k.createProcess({template_id:n.id,title:p.app_name||n.name,form_data:JSON.stringify(p)}),T.success("申请已提交"),r(!1),m(null),d({}),o()}catch(x){T.error("提交失败",{description:x?.message})}finally{c(!1)}};return e.jsx(M,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:78:5",open:a,onOpenChange:l=>{l||(m(null),d({})),r(l)},children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:89:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:90:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:91:11",className:"text-[var(--dg-text-primary)]",children:"新建资源申请"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:92:11",className:"text-[var(--dg-text-muted)]",children:n?"请填写申请信息":"请选择申请类型"})]}),n?e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:135:11",className:"py-2",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:136:13",className:"flex items-center gap-2 mb-4",children:e.jsx("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:137:15",type:"button",onClick:()=>{m(null),d({})},className:"text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",children:"← 返回选择类型"})}),e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:145:13",className:"grid grid-cols-2 gap-x-4 gap-y-4",children:I(n.form_schema).map(l=>{const x=l.type==="textarea";return e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:149:19",className:b("space-y-1.5",x&&"col-span-2"),children:[e.jsxs(_e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:150:21",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:[l.label,l.required&&e.jsx("span",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:152:42",className:"text-red-400 ml-0.5",children:"*"})]}),l.type==="select"?e.jsxs(Le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:155:23",value:String(p[l.key]??""),onValueChange:h=>d(g=>({...g,[l.key]:h})),children:[e.jsx(Oe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:159:25",className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ie,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:160:27",placeholder:l.placeholder||`请选择${l.label}`})}),e.jsx($e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:162:25",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:(l.options||[]).map(h=>e.jsx(Re,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:164:29",value:h,className:"text-[var(--dg-text-primary)] focus:bg-[var(--dg-bg-hover)]",children:h},h))})]}):l.type==="textarea"?e.jsx(pe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:171:23",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"}):e.jsx(le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:178:23",type:l.type==="number"?"number":"text",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]},l.key)})})]}):e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:99:11",className:"grid grid-cols-2 gap-4 py-2",children:R.map(l=>{const x=s.find(g=>g.type===l.value&&g.enabled!==!1),h=l.icon;return e.jsxs("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:106:17",type:"button",disabled:!x,onClick:()=>{m(x),d({})},className:b("flex flex-col items-start gap-3 p-5 rounded-xl text-left transition-colors","bg-[var(--dg-bg-tertiary)] hover:bg-[var(--dg-bg-hover)]",!x&&"opacity-40 cursor-not-allowed hover:bg-[var(--dg-bg-tertiary)]"),children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:117:19",className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`color-mix(in srgb, ${l.color} 15%, transparent)`,color:l.color},children:e.jsx(h,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:121:21",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:123:19",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:124:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:l.label}),e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:125:21",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:x?x.description||`共 ${I(x.form_schema).length} 个字段`:"暂无可用模板"})]})]},l.value)})}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:196:9",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:197:11",variant:"ghost",onClick:()=>r(!1),children:"取消"}),n&&e.jsxs(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:199:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:w,disabled:y,children:[y&&e.jsx($,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:204:30",className:"h-4 w-4 mr-2 animate-spin"}),"提交申请"]})]})]})})}function Xe(){const[a,r]=v.useState("instances"),[s,o]=v.useState([]),[n,m]=v.useState([]),[p,d]=v.useState([]),[y,c]=v.useState(!0),[w,l]=v.useState(""),[x,h]=v.useState(""),[g,de]=v.useState("all"),[me,W]=v.useState(!1),[P,Z]=v.useState(null),[ve,O]=v.useState(!1),[f,xe]=v.useState("approve"),[z,ee]=v.useState(""),[ae,te]=v.useState(!1),[ie,se]=v.useState(!1),E=async()=>{try{c(!0);const[t,N,J]=await Promise.all([k.getProcesses().catch(()=>null),k.getTemplates().catch(()=>null),k.getProcesses({status:"pending"}).catch(()=>null)]);o(t?.list||[]),m(N?.list||[]),d(J?.list||[])}catch(t){console.error("加载审批数据失败:",t)}finally{c(!1)}};v.useEffect(()=>{E()},[]);const he=s.filter(t=>{const N=(t.title||"").toLowerCase().includes(w.toLowerCase())||(t.applicant_name||t.applicant||"").toLowerCase().includes(w.toLowerCase()),J=!x||t.status===x;return N&&J}),ge=n.filter(t=>g==="all"||t.type===g),re=t=>{Z(t),W(!0)},S=(t,N)=>{xe(t),Z(N),ee(""),O(!0)},be=async()=>{if(P)try{te(!0),f==="approve"?(await k.approveProcess(P.id,z),T.success("审批通过")):(await k.rejectProcess(P.id,z),T.success("已拒绝")),O(!1),E()}catch(t){T.error("操作失败",{description:t.message})}finally{te(!1)}},ue=s.filter(t=>t.status==="pending").length,je=s.filter(t=>t.status==="approved").length,Ae=s.filter(t=>t.status==="rejected").length,B=p.filter(t=>t.status==="pending").length;return e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:139:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:141:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:142:9",children:[e.jsx("h1",{"code-path":"src/components/approval/ApprovalFlow.tsx:143:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"资源申请"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:144:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"云服务器申请 · 应用部署申请"})]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:146:9",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:()=>se(!0),children:[e.jsx(ke,{"code-path":"src/components/approval/ApprovalFlow.tsx:150:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:156:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:157:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:158:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:159:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:160:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:161:17",className:"text-sm text-[var(--dg-text-muted)]",children:"待审批"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:162:17",className:"text-2xl font-bold text-amber-400",children:ue})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:164:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(ce,{"code-path":"src/components/approval/ApprovalFlow.tsx:165:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:170:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:171:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:172:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:173:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:174:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已通过"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:175:17",className:"text-2xl font-bold text-emerald-400",children:je})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:177:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:178:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:183:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:184:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:185:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:186:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:187:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已拒绝"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:188:17",className:"text-2xl font-bold text-red-400",children:Ae})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:190:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:191:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:196:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:197:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:198:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:199:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:200:17",className:"text-sm text-[var(--dg-text-muted)]",children:"我的待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:201:17",className:"text-2xl font-bold text-[var(--dg-blue)]",children:B})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:203:15",className:"p-3 rounded-lg bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]",children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:204:17",className:"h-5 w-5"})})]})})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:212:7",className:"flex items-center gap-1 border-b border-[var(--dg-border)]",children:[{key:"instances",label:"审批实例"},{key:"flows",label:"流程模板"},{key:"my-approvals",label:"我的审批"}].map(t=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalFlow.tsx:218:11",onClick:()=>r(t.key),className:b("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",a===t.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[t.label,t.key==="my-approvals"&&B>0&&e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:230:15",className:"ml-2 bg-red-500/20 text-red-400 border-0 text-xs",children:B})]},t.key))}),a==="instances"&&e.jsx(Ve,{"code-path":"src/components/approval/ApprovalFlow.tsx:238:9",processes:s,filteredInstances:he,loading:y,searchQuery:w,setSearchQuery:l,statusFilter:x,setStatusFilter:h,onView:re,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),a==="flows"&&e.jsx(Ge,{"code-path":"src/components/approval/ApprovalFlow.tsx:253:9",filteredTemplates:ge,templateTypeFilter:g,setTemplateTypeFilter:de}),a==="my-approvals"&&e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:261:9",className:"grid grid-cols-1 gap-4",children:p.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:263:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:264:15",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:265:17",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:266:19",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:267:19",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:268:19",className:"text-sm text-[var(--dg-text-muted)]",children:"没有等待你处理的审批"})]})})}):p.map(t=>{const{percentage:N}=U(t);return e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:276:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:277:19",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:278:21",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:279:23",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:280:25",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(t))},children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:281:27",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:283:25",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:284:27",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:285:29",className:"font-medium text-[var(--dg-text-primary)]",children:t.title}),e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:286:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(t))},children:Y(A(t))})]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:290:27",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",t.applicant_name||t.applicant||"--"]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:293:27",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",t.created_at?new Date(t.created_at).toLocaleString():"--"]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:298:23",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:299:25",variant:"ghost",size:"sm",onClick:()=>re(t),children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:300:27",className:"h-4 w-4 mr-1"}),"详情"]}),t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:305:29",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>S("approve",t),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:306:31",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:308:29",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>S("reject",t),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:309:31",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:315:21",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:316:23",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:317:25",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:318:25",children:[N,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:320:23",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:321:25",className:b("h-full rounded-full",t.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${N}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:324:21",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(t)})]})},t.id)})}),e.jsx(Ye,{"code-path":"src/components/approval/ApprovalFlow.tsx:336:7",open:me,onOpenChange:W,instance:P,templates:n,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),e.jsx(M,{"code-path":"src/components/approval/ApprovalFlow.tsx:346:7",open:ve,onOpenChange:O,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalFlow.tsx:347:9",className:"max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalFlow.tsx:348:11",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalFlow.tsx:349:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:f==="approve"?e.jsxs(e.Fragment,{children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:352:19",className:"h-5 w-5 text-emerald-400"}),"确认通过审批"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:357:19",className:"h-5 w-5 text-red-400"}),"确认拒绝审批"]})}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalFlow.tsx:362:13",className:"text-[var(--dg-text-muted)]",children:f==="approve"?"请填写审批意见后确认通过":"请填写拒绝原因后确认拒绝"})]}),P&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:367:13",className:"py-2",children:[e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:368:15",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:["审批标题:",e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:369:22",className:"text-[var(--dg-text-primary)]",children:P.title})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:371:15",className:"space-y-2",children:[e.jsx("label",{"code-path":"src/components/approval/ApprovalFlow.tsx:372:17",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:f==="approve"?"审批意见":"拒绝原因"}),e.jsx(pe,{"code-path":"src/components/approval/ApprovalFlow.tsx:375:17",placeholder:f==="approve"?"请填写审批意见(可选)":"请填写拒绝原因",value:z,onChange:t=>ee(t.target.value),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalFlow.tsx:384:11",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:385:13",variant:"outline",onClick:()=>O(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:388:13",onClick:be,disabled:ae,className:f==="approve"?"bg-emerald-500/90 hover:bg-emerald-500 text-white":"bg-red-500 hover:bg-red-600 text-white",children:[ae&&e.jsx($,{"code-path":"src/components/approval/ApprovalFlow.tsx:393:36",className:"h-4 w-4 mr-2 animate-spin"}),f==="approve"?"确认通过":"确认拒绝"]})]})]})}),e.jsx(Ue,{"code-path":"src/components/approval/ApprovalFlow.tsx:401:7",open:ie,onOpenChange:se,templates:n,onSuccess:E})]})}const ca=Xe;export{Xe as ApprovalFlow,ca as ApprovalFlowManager}; diff --git a/backend/static/assets/ApprovalPermissionPage-0d3VJHx2.js b/backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js similarity index 69% rename from backend/static/assets/ApprovalPermissionPage-0d3VJHx2.js rename to backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js index aefda54..4939350 100644 --- a/backend/static/assets/ApprovalPermissionPage-0d3VJHx2.js +++ b/backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js @@ -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}; diff --git a/backend/static/assets/ApprovalResourcePage-VT7IARzv.js b/backend/static/assets/ApprovalResourcePage-CnDxsH56.js similarity index 70% rename from backend/static/assets/ApprovalResourcePage-VT7IARzv.js rename to backend/static/assets/ApprovalResourcePage-CnDxsH56.js index f8f9b90..b4932b1 100644 --- a/backend/static/assets/ApprovalResourcePage-VT7IARzv.js +++ b/backend/static/assets/ApprovalResourcePage-CnDxsH56.js @@ -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}; diff --git a/backend/static/assets/ApprovalWorkflowPage-Byqk0MKq.js b/backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js similarity index 99% rename from backend/static/assets/ApprovalWorkflowPage-Byqk0MKq.js rename to backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js index dbf164f..0ef1fe6 100644 --- a/backend/static/assets/ApprovalWorkflowPage-Byqk0MKq.js +++ b/backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js @@ -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:"提交申请",step_type:"submit",approver_ids:[]},{name:"审核",step_type:"audit",approver_ids:[]}])},[i]);const T=s=>{if(!s)return[];try{const t=JSON.parse(s);return Array.isArray(t)?t:[]}catch{return[]}},U=s=>{const t={submit:"提交",audit:"审核",execute:"执行"},r=l.filter(f=>f.step_type===s).length,x=r>0?` ${r+1}`:"";h([...l,{name:`${t[s]}${x}`,step_type:s,approver_ids:[]}])},a=s=>h(l.filter((t,r)=>r!==s)),d=(s,t)=>{const r=s+t;if(r<0||r>=l.length)return;const x=[...l];[x[s],x[r]]=[x[r],x[s]],h(x)},o=(s,t)=>{h(l.map((r,x)=>x===s?{...r,...t}:r))},n=(s,t)=>{const r=l[s],x=r.approver_ids.includes(t);o(s,{approver_ids:x?r.approver_ids.filter(f=>f!==t):[...r.approver_ids,t]})},w=s=>{const t=g.filter(r=>r.is_active!==!1);return s==="audit"?t:s==="execute"?t.filter(r=>["super_admin","k8s_admin","release_admin","resource_admin"].includes(r.role)):t},N=s=>{const t=l[s],r=w(t.step_type),x=t.approver_ids.length===r.length&&r.length>0;o(s,{approver_ids:x?[]:r.map(f=>f.id)})},I=async()=>{if(!A.trim()){W("请输入流程名称");return}if(l.length===0){W("请至少添加一个步骤");return}for(let s=0;s({step_number:r+1,name:t.name,step_type:t.step_type,approver_ids:t.approver_ids.length>0?JSON.stringify(t.approver_ids):null,is_required:!0,timeout_hours:24,auto_approve_on_timeout:!1}))};y&&i?await S.update(i.id,s):await S.create(s),b()}catch(s){const t=s?.response?.data?.detail||"保存失败";W(t)}finally{u(!1)}},K=s=>{const t=g.find(r=>r.id===s);return t?t.display_name||t.username:`#${s}`},O="w-full px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg text-sm focus:border-blue-400 focus:outline-none transition-colors text-[var(--dg-text-primary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:315:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:316:7",className:"absolute inset-0 bg-black/50",onClick:v}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:317:7",className:"relative bg-[var(--dg-bg-secondary)] rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto m-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:318:9",className:"flex items-center justify-between px-5 py-4 border-b border-[var(--dg-border)]",children:[e.jsx("h2",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:319:11",className:"text-base font-semibold text-[var(--dg-text-primary)]",children:y?"编辑审批流程":"新建审批流程"}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:322:11",onClick:v,className:"p-1.5 rounded-lg hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] transition-colors",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:323:13",className:"w-4 h-4"})})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:327:9",className:"px-5 pb-5 space-y-4 pt-4",children:[E&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:328:21",className:"px-3 py-2 text-sm text-red-400 bg-red-500/10 rounded-lg",children:E}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:330:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:331:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:332:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"流程名称 *"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:333:15",className:O,value:A,onChange:s=>_(s.target.value),placeholder:"输入流程名称"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:335:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:336:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"所属分类"}),e.jsxs("select",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:337:15",className:O,value:k,onChange:s=>P(s.target.value),children:[e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:338:17",value:"resource",children:"资源申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:339:17",value:"app",children:"应用申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:340:17",value:"permission",children:"权限审批"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:345:11",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:346:13",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"描述"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:347:13",className:O,value:m,onChange:s=>j(s.target.value),placeholder:"可选"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:351:11",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:352:13",className:"flex items-center justify-between mb-2",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:353:15",className:"text-xs font-medium text-[var(--dg-text-secondary)]",children:"流程步骤"}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:354:15",className:"flex items-center gap-1",children:le.map(s=>e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:356:19",onClick:()=>U(s.value),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 rounded transition-colors",children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:358:21",className:"w-3 h-3"}),s.label]},s.value))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:364:13",className:"space-y-2",children:[l.map((s,t)=>{const r=B[s.step_type],x=pe[s.step_type]||q;return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:369:19",className:"p-3 bg-[var(--dg-bg-primary)] rounded-lg border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:370:21",className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:371:23",className:`w-7 h-7 rounded-md flex items-center justify-center flex-shrink-0 ${r.split(" ")[0]}`,children:e.jsx(x,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:372:25",className:`w-3.5 h-3.5 ${r.split(" ")[1]}`})}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:374:23",className:"flex-1 px-2 py-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded text-sm focus:border-blue-400 focus:outline-none text-[var(--dg-text-primary)]",value:s.name,onChange:f=>o(t,{name:f.target.value}),placeholder:"步骤名称"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:379:23",className:`text-[10px] px-1.5 py-0.5 rounded ${r}`,children:L[s.step_type]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:382:23",className:"flex items-center gap-0.5 ml-1",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:383:25",onClick:()=>d(t,-1),disabled:t===0,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(ae,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:385:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:387:25",onClick:()=>d(t,1),disabled:t===l.length-1,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(te,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:389:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:391:25",onClick:()=>a(t),className:"p-1 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:393:27",className:"w-3.5 h-3.5"})})]})]}),s.step_type!=="submit"&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:399:23",className:"pl-9 mt-2",children:e.jsx(ce,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:400:25",users:w(s.step_type),selectedIds:s.approver_ids,label:s.step_type==="audit"?"审核人":"执行人",onToggle:f=>n(t,f),onToggleAll:()=>N(t),onClear:()=>o(t,{approver_ids:[]}),getUserName:K})})]},t)}),l.length===0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:416:17",className:"text-center py-4 text-sm text-[var(--dg-text-muted)]",children:"请点击上方按钮添加流程步骤"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:424:9",className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:425:11",onClick:v,className:"px-4 py-2 text-sm text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)] rounded-lg transition-colors",children:"取消"}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:428:11",onClick:I,disabled:c,children:[c&&e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:429:28",className:"w-4 h-4 animate-spin mr-1"}),y?"保存":"创建"]})]})]})]})}function ve(){const i=V(),[g,v]=p.useState([]),[b,y]=p.useState([]),[A,_]=p.useState(!0),[m,j]=p.useState(null),[k,P]=p.useState(null),[l,h]=p.useState(void 0),c=p.useCallback(async()=>{try{_(!0),j(null);const a=await S.list(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,steps:n.steps||[]}));v(o)}catch{j("获取审批流程失败")}finally{_(!1)}},[]),u=p.useCallback(async()=>{try{const a=await X.getUsers(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,role:n.role||(Array.isArray(n.roles)&&n.roles.length>0?n.roles[0].code:"")}));y(o)}catch{}},[]);p.useEffect(()=>{c(),u()},[c,u]);const E=p.useCallback(async a=>{try{await S.update(a.id,{is_active:!a.is_active}),v(d=>d.map(o=>o.id===a.id?{...o,is_active:!o.is_active}:o)),C.success(a.is_active?"已停用":"已启用")}catch{C.error("操作失败")}},[]),W=p.useCallback(async(a,d)=>{if(await i({title:"删除审批流程",description:`确定删除审批流程「${d}」?删除后不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await S.delete(a),v(n=>n.filter(w=>w.id!==a)),C.success("已删除")}catch{C.error("删除失败")}},[i]),T=p.useCallback(async a=>{try{await S.setDefault(a),v(d=>d.map(o=>({...o,is_default:o.id===a}))),C.success("已设为默认")}catch{C.error("操作失败")}},[]),U=p.useCallback(a=>{const d=b.find(o=>o.id===a);return d?d.display_name||d.username:`#${a}`},[b]);return A?e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:525:7",className:"flex items-center justify-center h-64",children:e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:526:9",className:"w-8 h-8 animate-spin text-blue-400"})}):m?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:533:7",className:"flex flex-col items-center justify-center h-64 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:534:9",className:"text-sm",children:m}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:535:9",variant:"outline",onClick:c,className:"mt-3",children:"重试"})]}):e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:541:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:543:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:544:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:545:11",className:"text-2xl font-semibold text-[var(--dg-text-primary)]",children:"审批流程配置"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:546:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"为资源申请、应用申请、权限审批配置多级审批流程"})]}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:550:9",onClick:()=>h(null),children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:551:11",className:"w-4 h-4 mr-1.5"}),"新建流程"]})]}),g.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:556:9",className:"dg-card p-12 text-center",children:[e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:557:11",className:"w-12 h-12 mx-auto mb-3 opacity-50 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:558:11",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"暂无审批流程"}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:559:11",variant:"outline",onClick:()=>h(null),children:"创建第一个流程"})]}):e.jsx(e.Fragment,{children:e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:564:11",className:"space-y-4",children:g.map(a=>{const d=k===a.id;return e.jsx(M,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:568:17",className:`dg-card overflow-hidden ${a.is_active?"":"opacity-50"}`,children:e.jsxs(Q,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:569:19",className:"p-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:570:21",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:571:23",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:572:25",className:"flex items-center gap-3 mb-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:573:27",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:a.name}),a.is_default&&e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:45",className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-400/15 text-yellow-400 flex items-center gap-1",children:[e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:154",className:"w-3 h-3"}),"默认"]}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:575:27",className:`text-[10px] px-1.5 py-0.5 rounded ${a.is_active?"bg-green-500/15 text-green-400":"bg-red-500/15 text-red-400"}`,children:a.is_active?"启用":"停用"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:578:27",className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-500/15 text-blue-400",children:oe[a.category]||a.category})]}),a.description&&e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:582:44",className:"text-sm text-[var(--dg-text-secondary)] mb-1",children:a.description}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:583:25",className:"flex items-center gap-1.5 mt-2 flex-wrap",children:a.steps?.map((o,n)=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:585:29",className:"flex items-center gap-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:586:31",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type}),n<(a.steps?.length||0)-1&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:590:33",className:"text-[var(--dg-text-muted)] text-[10px]",children:"→"})]},n))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:597:23",className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:598:25",onClick:()=>P(d?null:a.id),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] transition-colors",children:d?e.jsx(Z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:41",className:"w-4 h-4"}):e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:77",className:"w-4 h-4"})}),!a.is_default&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:603:27",onClick:()=>T(a.id),className:"p-1.5 rounded hover:bg-yellow-500/10 text-[var(--dg-text-muted)] hover:text-yellow-400 transition-colors",title:"设为默认",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:605:29",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:608:25",onClick:()=>E(a),className:`p-1.5 rounded transition-colors ${a.is_active?"hover:bg-red-500/10 text-green-400 hover:text-red-400":"hover:bg-green-500/10 text-red-400 hover:text-green-400"}`,title:a.is_active?"停用":"启用",children:e.jsx(J,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:611:27",className:`w-4 h-4 ${a.is_active?"":"rotate-180"}`})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:613:25",onClick:()=>h(a),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] hover:text-blue-400 transition-colors",title:"编辑",children:e.jsx(ee,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:615:27",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:617:25",onClick:()=>W(a.id,a.name),className:"p-1.5 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",title:"删除",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:619:27",className:"w-4 h-4"})})]})]}),d&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:625:23",className:"mt-4 pt-4 border-t border-[var(--dg-border)] space-y-3",children:a.steps?.map((o,n)=>{const w=(()=>{try{const N=JSON.parse(o.approver_ids||"[]");return Array.isArray(N)?N:[]}catch{return[]}})();return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:629:29",className:"flex items-start gap-3 p-3 bg-[var(--dg-bg-primary)] rounded-lg",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:630:31",className:"w-6 h-6 rounded-full bg-[var(--dg-bg-tertiary)] flex items-center justify-center text-xs font-medium text-[var(--dg-text-secondary)] flex-shrink-0 mt-0.5",children:o.step_number}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:633:31",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:634:33",className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:635:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:636:35",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type})]}),w.length>0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:641:35",className:"flex flex-wrap gap-1",children:w.map(N=>e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:643:39",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:U(N)},N))}),w.length===0&&o.step_type!=="submit"&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:650:35",className:"text-[11px] text-red-400",children:"未关联审批人"})]})]},n)})})]})},a.id)})})}),l!==void 0&&e.jsx(de,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:667:9",workflow:l,users:b,onClose:()=>h(void 0),onSaved:()=>{h(void 0),c()}})]})}export{ve as default}; +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:"提交申请",step_type:"submit",approver_ids:[]},{name:"审核",step_type:"audit",approver_ids:[]}])},[i]);const T=s=>{if(!s)return[];try{const t=JSON.parse(s);return Array.isArray(t)?t:[]}catch{return[]}},U=s=>{const t={submit:"提交",audit:"审核",execute:"执行"},r=l.filter(f=>f.step_type===s).length,x=r>0?` ${r+1}`:"";h([...l,{name:`${t[s]}${x}`,step_type:s,approver_ids:[]}])},a=s=>h(l.filter((t,r)=>r!==s)),d=(s,t)=>{const r=s+t;if(r<0||r>=l.length)return;const x=[...l];[x[s],x[r]]=[x[r],x[s]],h(x)},o=(s,t)=>{h(l.map((r,x)=>x===s?{...r,...t}:r))},n=(s,t)=>{const r=l[s],x=r.approver_ids.includes(t);o(s,{approver_ids:x?r.approver_ids.filter(f=>f!==t):[...r.approver_ids,t]})},w=s=>{const t=g.filter(r=>r.is_active!==!1);return s==="audit"?t:s==="execute"?t.filter(r=>["super_admin","k8s_admin","release_admin","resource_admin"].includes(r.role)):t},N=s=>{const t=l[s],r=w(t.step_type),x=t.approver_ids.length===r.length&&r.length>0;o(s,{approver_ids:x?[]:r.map(f=>f.id)})},I=async()=>{if(!A.trim()){W("请输入流程名称");return}if(l.length===0){W("请至少添加一个步骤");return}for(let s=0;s({step_number:r+1,name:t.name,step_type:t.step_type,approver_ids:t.approver_ids.length>0?JSON.stringify(t.approver_ids):null,is_required:!0,timeout_hours:24,auto_approve_on_timeout:!1}))};y&&i?await S.update(i.id,s):await S.create(s),b()}catch(s){const t=s?.response?.data?.detail||"保存失败";W(t)}finally{u(!1)}},K=s=>{const t=g.find(r=>r.id===s);return t?t.display_name||t.username:`#${s}`},O="w-full px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg text-sm focus:border-blue-400 focus:outline-none transition-colors text-[var(--dg-text-primary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:315:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:316:7",className:"absolute inset-0 bg-black/50",onClick:v}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:317:7",className:"relative bg-[var(--dg-bg-secondary)] rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto m-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:318:9",className:"flex items-center justify-between px-5 py-4 border-b border-[var(--dg-border)]",children:[e.jsx("h2",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:319:11",className:"text-base font-semibold text-[var(--dg-text-primary)]",children:y?"编辑审批流程":"新建审批流程"}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:322:11",onClick:v,className:"p-1.5 rounded-lg hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] transition-colors",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:323:13",className:"w-4 h-4"})})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:327:9",className:"px-5 pb-5 space-y-4 pt-4",children:[E&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:328:21",className:"px-3 py-2 text-sm text-red-400 bg-red-500/10 rounded-lg",children:E}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:330:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:331:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:332:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"流程名称 *"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:333:15",className:O,value:A,onChange:s=>_(s.target.value),placeholder:"输入流程名称"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:335:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:336:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"所属分类"}),e.jsxs("select",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:337:15",className:O,value:k,onChange:s=>P(s.target.value),children:[e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:338:17",value:"resource",children:"资源申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:339:17",value:"app",children:"应用申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:340:17",value:"permission",children:"权限审批"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:345:11",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:346:13",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"描述"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:347:13",className:O,value:m,onChange:s=>j(s.target.value),placeholder:"可选"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:351:11",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:352:13",className:"flex items-center justify-between mb-2",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:353:15",className:"text-xs font-medium text-[var(--dg-text-secondary)]",children:"流程步骤"}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:354:15",className:"flex items-center gap-1",children:le.map(s=>e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:356:19",onClick:()=>U(s.value),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 rounded transition-colors",children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:358:21",className:"w-3 h-3"}),s.label]},s.value))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:364:13",className:"space-y-2",children:[l.map((s,t)=>{const r=B[s.step_type],x=pe[s.step_type]||q;return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:369:19",className:"p-3 bg-[var(--dg-bg-primary)] rounded-lg border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:370:21",className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:371:23",className:`w-7 h-7 rounded-md flex items-center justify-center flex-shrink-0 ${r.split(" ")[0]}`,children:e.jsx(x,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:372:25",className:`w-3.5 h-3.5 ${r.split(" ")[1]}`})}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:374:23",className:"flex-1 px-2 py-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded text-sm focus:border-blue-400 focus:outline-none text-[var(--dg-text-primary)]",value:s.name,onChange:f=>o(t,{name:f.target.value}),placeholder:"步骤名称"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:379:23",className:`text-[10px] px-1.5 py-0.5 rounded ${r}`,children:L[s.step_type]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:382:23",className:"flex items-center gap-0.5 ml-1",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:383:25",onClick:()=>d(t,-1),disabled:t===0,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(ae,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:385:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:387:25",onClick:()=>d(t,1),disabled:t===l.length-1,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(te,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:389:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:391:25",onClick:()=>a(t),className:"p-1 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:393:27",className:"w-3.5 h-3.5"})})]})]}),s.step_type!=="submit"&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:399:23",className:"pl-9 mt-2",children:e.jsx(ce,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:400:25",users:w(s.step_type),selectedIds:s.approver_ids,label:s.step_type==="audit"?"审核人":"执行人",onToggle:f=>n(t,f),onToggleAll:()=>N(t),onClear:()=>o(t,{approver_ids:[]}),getUserName:K})})]},t)}),l.length===0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:416:17",className:"text-center py-4 text-sm text-[var(--dg-text-muted)]",children:"请点击上方按钮添加流程步骤"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:424:9",className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:425:11",onClick:v,className:"px-4 py-2 text-sm text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)] rounded-lg transition-colors",children:"取消"}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:428:11",onClick:I,disabled:c,children:[c&&e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:429:28",className:"w-4 h-4 animate-spin mr-1"}),y?"保存":"创建"]})]})]})]})}function ve(){const i=V(),[g,v]=p.useState([]),[b,y]=p.useState([]),[A,_]=p.useState(!0),[m,j]=p.useState(null),[k,P]=p.useState(null),[l,h]=p.useState(void 0),c=p.useCallback(async()=>{try{_(!0),j(null);const a=await S.list(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,steps:n.steps||[]}));v(o)}catch{j("获取审批流程失败")}finally{_(!1)}},[]),u=p.useCallback(async()=>{try{const a=await X.getUsers(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,role:n.role||(Array.isArray(n.roles)&&n.roles.length>0?n.roles[0].code:"")}));y(o)}catch{}},[]);p.useEffect(()=>{c(),u()},[c,u]);const E=p.useCallback(async a=>{try{await S.update(a.id,{is_active:!a.is_active}),v(d=>d.map(o=>o.id===a.id?{...o,is_active:!o.is_active}:o)),C.success(a.is_active?"已停用":"已启用")}catch{C.error("操作失败")}},[]),W=p.useCallback(async(a,d)=>{if(await i({title:"删除审批流程",description:`确定删除审批流程「${d}」?删除后不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await S.delete(a),v(n=>n.filter(w=>w.id!==a)),C.success("已删除")}catch{C.error("删除失败")}},[i]),T=p.useCallback(async a=>{try{await S.setDefault(a),v(d=>d.map(o=>({...o,is_default:o.id===a}))),C.success("已设为默认")}catch{C.error("操作失败")}},[]),U=p.useCallback(a=>{const d=b.find(o=>o.id===a);return d?d.display_name||d.username:`#${a}`},[b]);return A?e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:525:7",className:"flex items-center justify-center h-64",children:e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:526:9",className:"w-8 h-8 animate-spin text-blue-400"})}):m?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:533:7",className:"flex flex-col items-center justify-center h-64 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:534:9",className:"text-sm",children:m}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:535:9",variant:"outline",onClick:c,className:"mt-3",children:"重试"})]}):e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:541:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:543:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:544:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:545:11",className:"text-2xl font-semibold text-[var(--dg-text-primary)]",children:"审批流程配置"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:546:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"为资源申请、应用申请、权限审批配置多级审批流程"})]}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:550:9",onClick:()=>h(null),children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:551:11",className:"w-4 h-4 mr-1.5"}),"新建流程"]})]}),g.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:556:9",className:"dg-card p-12 text-center",children:[e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:557:11",className:"w-12 h-12 mx-auto mb-3 opacity-50 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:558:11",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"暂无审批流程"}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:559:11",variant:"outline",onClick:()=>h(null),children:"创建第一个流程"})]}):e.jsx(e.Fragment,{children:e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:564:11",className:"space-y-4",children:g.map(a=>{const d=k===a.id;return e.jsx(M,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:568:17",className:`dg-card overflow-hidden ${a.is_active?"":"opacity-50"}`,children:e.jsxs(Q,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:569:19",className:"p-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:570:21",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:571:23",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:572:25",className:"flex items-center gap-3 mb-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:573:27",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:a.name}),a.is_default&&e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:45",className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-400/15 text-yellow-400 flex items-center gap-1",children:[e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:154",className:"w-3 h-3"}),"默认"]}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:575:27",className:`text-[10px] px-1.5 py-0.5 rounded ${a.is_active?"bg-green-500/15 text-green-400":"bg-red-500/15 text-red-400"}`,children:a.is_active?"启用":"停用"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:578:27",className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-500/15 text-blue-400",children:oe[a.category]||a.category})]}),a.description&&e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:582:44",className:"text-sm text-[var(--dg-text-secondary)] mb-1",children:a.description}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:583:25",className:"flex items-center gap-1.5 mt-2 flex-wrap",children:a.steps?.map((o,n)=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:585:29",className:"flex items-center gap-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:586:31",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type}),n<(a.steps?.length||0)-1&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:590:33",className:"text-[var(--dg-text-muted)] text-[10px]",children:"→"})]},n))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:597:23",className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:598:25",onClick:()=>P(d?null:a.id),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] transition-colors",children:d?e.jsx(Z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:41",className:"w-4 h-4"}):e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:77",className:"w-4 h-4"})}),!a.is_default&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:603:27",onClick:()=>T(a.id),className:"p-1.5 rounded hover:bg-yellow-500/10 text-[var(--dg-text-muted)] hover:text-yellow-400 transition-colors",title:"设为默认",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:605:29",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:608:25",onClick:()=>E(a),className:`p-1.5 rounded transition-colors ${a.is_active?"hover:bg-red-500/10 text-green-400 hover:text-red-400":"hover:bg-green-500/10 text-red-400 hover:text-green-400"}`,title:a.is_active?"停用":"启用",children:e.jsx(J,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:611:27",className:`w-4 h-4 ${a.is_active?"":"rotate-180"}`})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:613:25",onClick:()=>h(a),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] hover:text-blue-400 transition-colors",title:"编辑",children:e.jsx(ee,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:615:27",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:617:25",onClick:()=>W(a.id,a.name),className:"p-1.5 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",title:"删除",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:619:27",className:"w-4 h-4"})})]})]}),d&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:625:23",className:"mt-4 pt-4 border-t border-[var(--dg-border)] space-y-3",children:a.steps?.map((o,n)=>{const w=(()=>{try{const N=JSON.parse(o.approver_ids||"[]");return Array.isArray(N)?N:[]}catch{return[]}})();return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:629:29",className:"flex items-start gap-3 p-3 bg-[var(--dg-bg-primary)] rounded-lg",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:630:31",className:"w-6 h-6 rounded-full bg-[var(--dg-bg-tertiary)] flex items-center justify-center text-xs font-medium text-[var(--dg-text-secondary)] flex-shrink-0 mt-0.5",children:o.step_number}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:633:31",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:634:33",className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:635:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:636:35",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type})]}),w.length>0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:641:35",className:"flex flex-wrap gap-1",children:w.map(N=>e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:643:39",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:U(N)},N))}),w.length===0&&o.step_type!=="submit"&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:650:35",className:"text-[11px] text-red-400",children:"未关联审批人"})]})]},n)})})]})},a.id)})})}),l!==void 0&&e.jsx(de,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:667:9",workflow:l,users:b,onClose:()=>h(void 0),onSaved:()=>{h(void 0),c()}})]})}export{ve as default}; diff --git a/backend/static/assets/AreaChart-B9PyJ8Di.js b/backend/static/assets/AreaChart-Czgv4pNk.js similarity index 99% rename from backend/static/assets/AreaChart-B9PyJ8Di.js rename to backend/static/assets/AreaChart-Czgv4pNk.js index cd49e62..f9be410 100644 --- a/backend/static/assets/AreaChart-B9PyJ8Di.js +++ b/backend/static/assets/AreaChart-Czgv4pNk.js @@ -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-1}return xo=t,xo}var wo,Gh;function Aw(){if(Gh)return wo;Gh=1;var e=pa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return wo=t,wo}var Oo,Kh;function da(){if(Kh)return Oo;Kh=1;var e=ww(),t=Ow(),r=_w(),n=Sw(),i=Aw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},zt=function(t){return Xt(t)&&t.indexOf("%")===t.length-1},q=function(t){return Vw(t)&&!Br(t)},Xw=function(t){return J(t)},we=function(t){return q(t)||Xt(t)},Yw=0,Kn=function(t){var r=++Yw;return"".concat(t||"").concat(r)},Je=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!Xt(t))return n;var a;if(zt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return Br(a)&&(a=n),i&&a>r&&(a=r),a},Pt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Zw=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}var wp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},pt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Op=null,Vo=null,vf=function e(t){if(t===Op&&Array.isArray(Vo))return Vo;var r=[];return N.Children.forEach(t,function(n){J(n)||(Uw.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Vo=r,Op=t,r};function Qe(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return pt(i)}):n=[pt(t)],vf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function Ne(e,t){var r=Qe(e,t);return r&&r[0]}var _p=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},aO=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],oO=function(t){return t&&t.type&&Xt(t.type)&&aO.indexOf(t.type)>=0},uO=function(t){return t&&Hs(t)==="object"&&"clipDot"in t},cO=function(t,r,n,i){var a,o=(a=Ko?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!V(t)&&(i&&o.includes(r)||eO.includes(r))||n&&df.includes(r)},Z=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!qr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;cO((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},Gs=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Sp(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vs(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=hO(e,fO),f=i||{width:r,height:n,x:0,y:0},l=ee("recharts-surface",a);return T.createElement("svg",Ks({},Z(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),T.createElement("title",null,u),T.createElement("desc",null,c),t)}var dO=["children","className"];function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var fe=T.forwardRef(function(e,t){var r=e.children,n=e.className,i=vO(e,dO),a=ee("recharts-layer",n);return T.createElement("g",Xs({className:a},Z(i,!0),{ref:t}),r)}),dt=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return Yo=t,Yo}var Zo,Ep;function ib(){if(Ep)return Zo;Ep=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Zo=c,Zo}var Jo,jp;function bO(){if(jp)return Jo;jp=1;function e(t){return t.split("")}return Jo=e,Jo}var Qo,Mp;function xO(){if(Mp)return Qo;Mp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",m=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+m+")*",b=v+m+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+b,"g");function O(y){return y.match(w)||[]}return Qo=O,Qo}var eu,Cp;function wO(){if(Cp)return eu;Cp=1;var e=bO(),t=ib(),r=xO();function n(i){return t(i)?r(i):e(i)}return eu=n,eu}var tu,$p;function OO(){if($p)return tu;$p=1;var e=gO(),t=ib(),r=wO(),n=eb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return tu=i,tu}var ru,Ip;function _O(){if(Ip)return ru;Ip=1;var e=OO(),t=e("toUpperCase");return ru=t,ru}var SO=_O();const ma=ue(SO);function oe(e){return function(){return e}}const ab=Math.cos,gi=Math.sin,et=Math.sqrt,bi=Math.PI,ga=2*bi,Ys=Math.PI,Zs=2*Ys,Lt=1e-6,AO=Zs-Lt;function ob(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ob;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iLt)if(!(Math.abs(l*c-s*f)>Lt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,m=i-u,v=c*c+s*s,p=d*d+m*m,b=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ys-Math.acos((v+h-p)/(2*b*x)))/2),O=w/x,y=w/b;Math.abs(O-1)>Lt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*m)},${this._x1=t+y*c},${this._y1=r+y*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Lt||Math.abs(this._y1-f)>Lt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%Zs+Zs),h>AO?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Lt&&this._append`A${n},${n},0,${+(h>=Ys)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function yf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new TO(t)}function mf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ub(e){this._context=e}ub.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ba(e){return new ub(e)}function cb(e){return e[0]}function sb(e){return e[1]}function lb(e,t){var r=oe(!0),n=null,i=ba,a=null,o=yf(u);e=typeof e=="function"?e:e===void 0?cb:oe(e),t=typeof t=="function"?t:t===void 0?sb:oe(t);function u(c){var s,f=(c=mf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--m)u.point(w[m],O[m]);u.lineEnd(),u.areaEnd()}b&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return lb().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:oe(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:oe(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:oe(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class fb{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function EO(e){return new fb(e,!0)}function jO(e){return new fb(e,!1)}const gf={draw(e,t){const r=et(t/bi);e.moveTo(r,0),e.arc(0,0,r,0,ga)}},MO={draw(e,t){const r=et(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},hb=et(1/3),CO=hb*2,$O={draw(e,t){const r=et(t/CO),n=r*hb;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},IO={draw(e,t){const r=et(t),n=-r/2;e.rect(n,n,r,r)}},RO=.8908130915292852,pb=gi(bi/10)/gi(7*bi/10),kO=gi(ga/10)*pb,DO=-ab(ga/10)*pb,NO={draw(e,t){const r=et(t*RO),n=kO*r,i=DO*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ga*a/5,u=ab(o),c=gi(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},nu=et(3),qO={draw(e,t){const r=-et(t/(nu*3));e.moveTo(0,r*2),e.lineTo(-nu*r,-r),e.lineTo(nu*r,-r),e.closePath()}},Le=-.5,Fe=et(3)/2,Js=1/et(12),BO=(Js/2+1)*3,LO={draw(e,t){const r=et(t/BO),n=r/2,i=r*Js,a=n,o=r*Js+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Le*n-Fe*i,Fe*n+Le*i),e.lineTo(Le*a-Fe*o,Fe*a+Le*o),e.lineTo(Le*u-Fe*c,Fe*u+Le*c),e.lineTo(Le*n+Fe*i,Le*i-Fe*n),e.lineTo(Le*a+Fe*o,Le*o-Fe*a),e.lineTo(Le*u+Fe*c,Le*c-Fe*u),e.closePath()}};function FO(e,t){let r=null,n=yf(i);e=typeof e=="function"?e:oe(e||gf),t=typeof t=="function"?t:oe(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:oe(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:oe(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function xi(){}function wi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function db(e){this._context=e}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zO(e){return new db(e)}function vb(e){this._context=e}vb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function WO(e){return new vb(e)}function yb(e){this._context=e}yb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function UO(e){return new yb(e)}function mb(e){this._context=e}mb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function HO(e){return new mb(e)}function Rp(e){return e<0?-1:1}function kp(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Rp(a)+Rp(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Dp(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function iu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Oi(e){this._context=e}Oi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iu(this,this._t0,Dp(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,iu(this,Dp(this,r=kp(this,e,t)),r);break;default:iu(this,this._t0,r=kp(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function gb(e){this._context=new bb(e)}(gb.prototype=Object.create(Oi.prototype)).point=function(e,t){Oi.prototype.point.call(this,t,e)};function bb(e){this._context=e}bb.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function GO(e){return new Oi(e)}function KO(e){return new gb(e)}function xb(e){this._context=e}xb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Np(e),i=Np(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function XO(e){return new xa(e,.5)}function YO(e){return new xa(e,0)}function ZO(e){return new xa(e,1)}function vr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function JO(e,t){return e[t]}function QO(e){const t=[];return t.key=e,t}function e1(){var e=oe([]),t=Qs,r=vr,n=JO;function i(a){var o=Array.from(e.apply(this,arguments),QO),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var wb={symbolCircle:gf,symbolCross:MO,symbolDiamond:$O,symbolSquare:IO,symbolStar:NO,symbolTriangle:qO,symbolWye:LO},l1=Math.PI/180,f1=function(t){var r="symbol".concat(ma(t));return wb[r]||gf},h1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*l1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},p1=function(t,r){wb["symbol".concat(ma(t))]=r},bf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=c1(t,i1),s=Bp(Bp({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=f1(n),b=FO().type(p).size(h1(a,u,n));return b()},l=s.className,h=s.cx,d=s.cy,m=Z(s,!0);return h===+h&&d===+d&&a===+a?T.createElement("path",el({},m,{className:ee("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};bf.registerSymbol=p1;function yr(e){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(e)}function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t-1}return xo=t,xo}var wo,Gh;function Aw(){if(Gh)return wo;Gh=1;var e=pa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return wo=t,wo}var Oo,Kh;function da(){if(Kh)return Oo;Kh=1;var e=ww(),t=Ow(),r=_w(),n=Sw(),i=Aw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},zt=function(t){return Xt(t)&&t.indexOf("%")===t.length-1},q=function(t){return Vw(t)&&!Br(t)},Xw=function(t){return J(t)},we=function(t){return q(t)||Xt(t)},Yw=0,Kn=function(t){var r=++Yw;return"".concat(t||"").concat(r)},Je=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!Xt(t))return n;var a;if(zt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return Br(a)&&(a=n),i&&a>r&&(a=r),a},Pt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Zw=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}var wp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},pt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Op=null,Vo=null,vf=function e(t){if(t===Op&&Array.isArray(Vo))return Vo;var r=[];return N.Children.forEach(t,function(n){J(n)||(Uw.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Vo=r,Op=t,r};function Qe(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return pt(i)}):n=[pt(t)],vf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function Ne(e,t){var r=Qe(e,t);return r&&r[0]}var _p=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},aO=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],oO=function(t){return t&&t.type&&Xt(t.type)&&aO.indexOf(t.type)>=0},uO=function(t){return t&&Hs(t)==="object"&&"clipDot"in t},cO=function(t,r,n,i){var a,o=(a=Ko?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!V(t)&&(i&&o.includes(r)||eO.includes(r))||n&&df.includes(r)},Z=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!qr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;cO((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},Gs=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Sp(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vs(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=hO(e,fO),f=i||{width:r,height:n,x:0,y:0},l=ee("recharts-surface",a);return T.createElement("svg",Ks({},Z(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),T.createElement("title",null,u),T.createElement("desc",null,c),t)}var dO=["children","className"];function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var fe=T.forwardRef(function(e,t){var r=e.children,n=e.className,i=vO(e,dO),a=ee("recharts-layer",n);return T.createElement("g",Xs({className:a},Z(i,!0),{ref:t}),r)}),dt=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return Yo=t,Yo}var Zo,Ep;function ib(){if(Ep)return Zo;Ep=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Zo=c,Zo}var Jo,jp;function bO(){if(jp)return Jo;jp=1;function e(t){return t.split("")}return Jo=e,Jo}var Qo,Mp;function xO(){if(Mp)return Qo;Mp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",m=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+m+")*",b=v+m+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+b,"g");function O(y){return y.match(w)||[]}return Qo=O,Qo}var eu,Cp;function wO(){if(Cp)return eu;Cp=1;var e=bO(),t=ib(),r=xO();function n(i){return t(i)?r(i):e(i)}return eu=n,eu}var tu,$p;function OO(){if($p)return tu;$p=1;var e=gO(),t=ib(),r=wO(),n=eb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return tu=i,tu}var ru,Ip;function _O(){if(Ip)return ru;Ip=1;var e=OO(),t=e("toUpperCase");return ru=t,ru}var SO=_O();const ma=ue(SO);function oe(e){return function(){return e}}const ab=Math.cos,gi=Math.sin,et=Math.sqrt,bi=Math.PI,ga=2*bi,Ys=Math.PI,Zs=2*Ys,Lt=1e-6,AO=Zs-Lt;function ob(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ob;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iLt)if(!(Math.abs(l*c-s*f)>Lt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,m=i-u,v=c*c+s*s,p=d*d+m*m,b=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ys-Math.acos((v+h-p)/(2*b*x)))/2),O=w/x,y=w/b;Math.abs(O-1)>Lt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*m)},${this._x1=t+y*c},${this._y1=r+y*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Lt||Math.abs(this._y1-f)>Lt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%Zs+Zs),h>AO?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Lt&&this._append`A${n},${n},0,${+(h>=Ys)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function yf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new TO(t)}function mf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ub(e){this._context=e}ub.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ba(e){return new ub(e)}function cb(e){return e[0]}function sb(e){return e[1]}function lb(e,t){var r=oe(!0),n=null,i=ba,a=null,o=yf(u);e=typeof e=="function"?e:e===void 0?cb:oe(e),t=typeof t=="function"?t:t===void 0?sb:oe(t);function u(c){var s,f=(c=mf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--m)u.point(w[m],O[m]);u.lineEnd(),u.areaEnd()}b&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return lb().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:oe(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:oe(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:oe(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class fb{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function EO(e){return new fb(e,!0)}function jO(e){return new fb(e,!1)}const gf={draw(e,t){const r=et(t/bi);e.moveTo(r,0),e.arc(0,0,r,0,ga)}},MO={draw(e,t){const r=et(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},hb=et(1/3),CO=hb*2,$O={draw(e,t){const r=et(t/CO),n=r*hb;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},IO={draw(e,t){const r=et(t),n=-r/2;e.rect(n,n,r,r)}},RO=.8908130915292852,pb=gi(bi/10)/gi(7*bi/10),kO=gi(ga/10)*pb,DO=-ab(ga/10)*pb,NO={draw(e,t){const r=et(t*RO),n=kO*r,i=DO*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ga*a/5,u=ab(o),c=gi(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},nu=et(3),qO={draw(e,t){const r=-et(t/(nu*3));e.moveTo(0,r*2),e.lineTo(-nu*r,-r),e.lineTo(nu*r,-r),e.closePath()}},Le=-.5,Fe=et(3)/2,Js=1/et(12),BO=(Js/2+1)*3,LO={draw(e,t){const r=et(t/BO),n=r/2,i=r*Js,a=n,o=r*Js+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Le*n-Fe*i,Fe*n+Le*i),e.lineTo(Le*a-Fe*o,Fe*a+Le*o),e.lineTo(Le*u-Fe*c,Fe*u+Le*c),e.lineTo(Le*n+Fe*i,Le*i-Fe*n),e.lineTo(Le*a+Fe*o,Le*o-Fe*a),e.lineTo(Le*u+Fe*c,Le*c-Fe*u),e.closePath()}};function FO(e,t){let r=null,n=yf(i);e=typeof e=="function"?e:oe(e||gf),t=typeof t=="function"?t:oe(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:oe(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:oe(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function xi(){}function wi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function db(e){this._context=e}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zO(e){return new db(e)}function vb(e){this._context=e}vb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function WO(e){return new vb(e)}function yb(e){this._context=e}yb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function UO(e){return new yb(e)}function mb(e){this._context=e}mb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function HO(e){return new mb(e)}function Rp(e){return e<0?-1:1}function kp(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Rp(a)+Rp(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Dp(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function iu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Oi(e){this._context=e}Oi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iu(this,this._t0,Dp(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,iu(this,Dp(this,r=kp(this,e,t)),r);break;default:iu(this,this._t0,r=kp(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function gb(e){this._context=new bb(e)}(gb.prototype=Object.create(Oi.prototype)).point=function(e,t){Oi.prototype.point.call(this,t,e)};function bb(e){this._context=e}bb.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function GO(e){return new Oi(e)}function KO(e){return new gb(e)}function xb(e){this._context=e}xb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Np(e),i=Np(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function XO(e){return new xa(e,.5)}function YO(e){return new xa(e,0)}function ZO(e){return new xa(e,1)}function vr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function JO(e,t){return e[t]}function QO(e){const t=[];return t.key=e,t}function e1(){var e=oe([]),t=Qs,r=vr,n=JO;function i(a){var o=Array.from(e.apply(this,arguments),QO),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var wb={symbolCircle:gf,symbolCross:MO,symbolDiamond:$O,symbolSquare:IO,symbolStar:NO,symbolTriangle:qO,symbolWye:LO},l1=Math.PI/180,f1=function(t){var r="symbol".concat(ma(t));return wb[r]||gf},h1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*l1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},p1=function(t,r){wb["symbol".concat(ma(t))]=r},bf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=c1(t,i1),s=Bp(Bp({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=f1(n),b=FO().type(p).size(h1(a,u,n));return b()},l=s.className,h=s.cx,d=s.cy,m=Z(s,!0);return h===+h&&d===+d&&a===+a?T.createElement("path",el({},m,{className:ee("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};bf.registerSymbol=p1;function yr(e){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(e)}function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);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.lengthd))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-1&&n%1==0&&n-1&&r%1==0&&r<=e}return Cu=t,Cu}var $u,vd;function L1(){if(vd)return $u;vd=1;var e=xt(),t=Sf(),r=wt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",m="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",b="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",y="[object Int16Array]",g="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",P="[object Uint16Array]",M="[object Uint32Array]",A={};A[x]=A[w]=A[O]=A[y]=A[g]=A[_]=A[S]=A[P]=A[M]=!0,A[n]=A[i]=A[p]=A[a]=A[b]=A[o]=A[u]=A[c]=A[s]=A[f]=A[l]=A[h]=A[d]=A[m]=A[v]=!1;function E(j){return r(j)&&t(j.length)&&!!A[e(j)]}return $u=E,$u}var Iu,yd;function Cb(){if(yd)return Iu;yd=1;function e(t){return function(r){return t(r)}}return Iu=e,Iu}var rn={exports:{}};rn.exports;var md;function F1(){return md||(md=1,(function(e,t){var r=Zg(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(rn,rn.exports)),rn.exports}var Ru,gd;function $b(){if(gd)return Ru;gd=1;var e=L1(),t=Cb(),r=F1(),n=r&&r.isTypedArray,i=n?t(n):e;return Ru=i,Ru}var ku,bd;function z1(){if(bd)return ku;bd=1;var e=N1(),t=Of(),r=Re(),n=Mb(),i=_f(),a=$b(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),m=!l&&!h&&!d&&a(s),v=l||h||d||m,p=v?e(s.length,String):[],b=p.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||d&&(x=="offset"||x=="parent")||m&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,b)))&&p.push(x);return p}return ku=c,ku}var Du,xd;function W1(){if(xd)return Du;xd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return Du=t,Du}var Nu,wd;function Ib(){if(wd)return Nu;wd=1;function e(t,r){return function(n){return t(r(n))}}return Nu=e,Nu}var qu,Od;function U1(){if(Od)return qu;Od=1;var e=Ib(),t=e(Object.keys,Object);return qu=t,qu}var Bu,_d;function H1(){if(_d)return Bu;_d=1;var e=W1(),t=U1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return Bu=i,Bu}var Lu,Sd;function Vn(){if(Sd)return Lu;Sd=1;var e=cf(),t=Sf();function r(n){return n!=null&&t(n.length)&&!e(n)}return Lu=r,Lu}var Fu,Ad;function wa(){if(Ad)return Fu;Ad=1;var e=z1(),t=H1(),r=Vn();function n(i){return r(i)?e(i):t(i)}return Fu=n,Fu}var zu,Pd;function G1(){if(Pd)return zu;Pd=1;var e=I1(),t=D1(),r=wa();function n(i){return e(i,r,t)}return zu=n,zu}var Wu,Td;function K1(){if(Td)return Wu;Td=1;var e=G1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,m=e(o),v=m.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var b=h[p];if(!(l?b in o:n.call(o,b)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var y=l;++p-1}return vc=t,vc}var yc,ev;function p_(){if(ev)return yc;ev=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var b=s?null:i(c);if(b)return a(b);m=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function E_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function j_(e){return e.value}function M_(e,t){if(T.isValidElement(e))return T.cloneElement(e,t);if(typeof e=="function")return T.createElement(e,t);t.ref;var r=T_(t,b_);return T.createElement(xf,r)}var cv=1,hr=(function(e){function t(){var r;x_(this,t);for(var n=arguments.length,i=new Array(n),a=0;acv||Math.abs(i.height-this.lastBoundingBox.height)>cv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ut({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var m=this.getBBoxSnapshot();h={top:((f||0)-m.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return ut(ut({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=ut(ut({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return T.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},M_(a,ut(ut({},this.props),{},{payload:qb(f,s,j_)})))}}],[{key:"getWithHeight",value:function(n,i){var a=ut(ut({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);Oa(hr,"displayName","Legend");Oa(hr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var wc,sv;function C_(){if(sv)return wc;sv=1;var e=Gn(),t=Of(),r=Re(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return wc=i,wc}var Oc,lv;function Fb(){if(lv)return Oc;lv=1;var e=jb(),t=C_();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return Oc=r,Oc}var _c,fv;function $_(){if(fv)return _c;fv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return _c=e,_c}var Sc,hv;function I_(){if(hv)return Sc;hv=1;var e=$_(),t=e();return Sc=t,Sc}var Ac,pv;function zb(){if(pv)return Ac;pv=1;var e=I_(),t=wa();function r(n,i){return n&&e(n,i,t)}return Ac=r,Ac}var Pc,dv;function R_(){if(dv)return Pc;dv=1;var e=Vn();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return Cc=t,Cc}var $c,xv;function q_(){if(xv)return $c;xv=1;var e=hf(),t=pf(),r=$t(),n=Wb(),i=k_(),a=Cb(),o=N_(),u=Lr(),c=Re();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var m=n(f,function(v,p,b){var x=e(l,function(w){return w(v)});return{criteria:x,index:++d,value:v}});return i(m,function(v,p){return o(v,p,h)})}return $c=s,$c}var Ic,wv;function B_(){if(wv)return Ic;wv=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Ic=e,Ic}var Rc,Ov;function L_(){if(Ov)return Rc;Ov=1;var e=B_(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return qc=n,qc}var Bc,Tv;function U_(){if(Tv)return Bc;Tv=1;var e=z_(),t=W_(),r=t(e);return Bc=r,Bc}var Lc,Ev;function H_(){if(Ev)return Lc;Ev=1;var e=Lr(),t=L_(),r=U_();function n(i,a){return r(t(i,a,e),i+"")}return Lc=n,Lc}var Fc,jv;function _a(){if(jv)return Fc;jv=1;var e=sf(),t=Vn(),r=_f(),n=Ct();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return Fc=i,Fc}var zc,Mv;function G_(){if(Mv)return zc;Mv=1;var e=Fb(),t=q_(),r=H_(),n=_a(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zc=i,zc}var K_=G_();const Tf=ue(K_);function hn(e){"@babel/helpers - typeof";return hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hn(e)}function il(){return il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{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 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):T.length===0?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:218:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:219:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:220:17",className:"text-sm",children:"暂无操作日志"})]}):e.jsxs(Q,{"code-path":"src/pages/AuditOperationsTab.tsx:223:15",children:[e.jsx(U,{"code-path":"src/pages/AuditOperationsTab.tsx:224:17",children:e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:225:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:226:21",className:"text-slate-400",children:"时间"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:227:21",className:"text-slate-400",children:"用户"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:228:21",className:"text-slate-400",children:"模块"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:229:21",className:"text-slate-400",children:"操作类型"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:230:21",className:"text-slate-400",children:"资源"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:231:21",className:"text-slate-400",children:"IP"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:232:21",className:"text-slate-400",children:"结果"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:233:21",className:"text-slate-400 text-right",children:"详情"})]})}),e.jsx(X,{"code-path":"src/pages/AuditOperationsTab.tsx:236:17",children:T.map(t=>e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:238:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:239:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:240:25",className:"text-sm text-slate-400",children:t.createdAt?new Date(t.createdAt).toLocaleString():"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:244:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:245:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:247:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:248:25",className:"text-sm text-slate-300",children:t.module||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:250:23",children:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:251:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.action||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:255:23",children:e.jsx("code",{"code-path":"src/pages/AuditOperationsTab.tsx:256:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:t.resource||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:260:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:261:25",className:"text-sm text-slate-400",children:t.ip||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:263:23",children:M(t.result)}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:264:23",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:265:25",className:"flex items-center justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:266:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>F(t),title:"查看详情",children:e.jsx(Z,{"code-path":"src/pages/AuditOperationsTab.tsx:273:29",className:"h-4 w-4"})})})})]},t.id))})]})})})}),e.jsx(te,{"code-path":"src/pages/AuditOperationsTab.tsx:287:7",log:D,onClose:()=>A(null)}),e.jsx(ae,{"code-path":"src/pages/AuditOperationsTab.tsx:290:7",open:I,onClose:()=>z(!1),loading:B,stats:R})]})}function te({log:s,onClose:a}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:308:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:309:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:310:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-lg w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:311:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:312:11",className:"text-lg font-semibold text-slate-100",children:"操作日志详情"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:313:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:319:13",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:323:9",className:"space-y-3 text-sm",children:[e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:324:11",label:"ID",value:s.id}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:325:11",label:"时间",value:s.createdAt?new Date(s.createdAt).toLocaleString():"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:326:11",label:"用户",value:s.username||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:327:11",label:"用户ID",value:s.userId||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:328:11",label:"模块",value:s.module||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:329:11",label:"操作类型",value:s.action||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:330:11",label:"资源",value:s.resource||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:331:11",label:"IP地址",value:s.ip||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:332:11",label:"User-Agent",value:s.userAgent||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:333:11",label:"结果",value:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:336:15",variant:"outline",className:s.result==="success"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:s.result==="success"?"成功":"失败"})}),s.message&&e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:348:27",label:"详情",value:s.message,mono:!0})]}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:351:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:352:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function o({label:s,value:a,mono:i}){return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:367:5",className:"flex items-start gap-4",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:368:7",className:"text-slate-500 w-20 flex-shrink-0",children:s}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:369:7",className:i?"text-slate-300 font-mono text-xs break-all":"text-slate-200 break-all",children:a})]})}function ae({open:s,onClose:a,loading:i,stats:r}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:394:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:395:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:396:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:397:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:398:11",className:"text-lg font-semibold text-slate-100",children:"审计统计"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:399:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:405:13",className:"h-4 w-4"})})]}),i?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:410:11",className:"flex items-center justify-center py-10",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:411:13",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:414:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:415:13",className:"grid grid-cols-2 gap-3",children:[e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:416:15",label:"总日志数",value:String(r.total_logs??"--"),color:"blue"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:417:15",label:"今日日志",value:String(r.today_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:418:15",label:"成功数",value:String(r.success_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:419:15",label:"失败数",value:String(r.failure_count??"--"),color:"red"})]}),r.top_modules&&r.top_modules.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:423:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:424:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"热门模块"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:425:17",className:"space-y-1",children:r.top_modules.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:427:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:428:23",className:"text-slate-300",children:d.module}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:429:23",className:"text-slate-500",children:d.count})]},u))})]}),r.top_users&&r.top_users.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:437:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:438:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"活跃用户"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:439:17",className:"space-y-1",children:r.top_users.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:441:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:442:23",className:"text-slate-300",children:d.username}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:443:23",className:"text-slate-500",children:d.count})]},u))})]})]}):e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:451:11",className:"text-slate-500 text-center py-10 text-sm",children:"暂无统计数据"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:454:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:455:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function h({label:s,value:a,color:i}){const r={blue:"border-blue-500/20 bg-blue-500/5 text-blue-400",emerald:"border-emerald-500/20 bg-emerald-500/5 text-emerald-400",red:"border-red-500/20 bg-red-500/5 text-red-400"};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:475:5",className:`rounded-lg border p-3 ${r[i]}`,children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:476:7",className:"text-xs text-slate-500",children:s}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:477:7",className:"text-xl font-bold mt-0.5",children:a})]})}export{be as AuditOperationsTab}; +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 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):T.length===0?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:218:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:219:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:220:17",className:"text-sm",children:"暂无操作日志"})]}):e.jsxs(Q,{"code-path":"src/pages/AuditOperationsTab.tsx:223:15",children:[e.jsx(U,{"code-path":"src/pages/AuditOperationsTab.tsx:224:17",children:e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:225:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:226:21",className:"text-slate-400",children:"时间"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:227:21",className:"text-slate-400",children:"用户"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:228:21",className:"text-slate-400",children:"模块"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:229:21",className:"text-slate-400",children:"操作类型"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:230:21",className:"text-slate-400",children:"资源"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:231:21",className:"text-slate-400",children:"IP"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:232:21",className:"text-slate-400",children:"结果"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:233:21",className:"text-slate-400 text-right",children:"详情"})]})}),e.jsx(X,{"code-path":"src/pages/AuditOperationsTab.tsx:236:17",children:T.map(t=>e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:238:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:239:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:240:25",className:"text-sm text-slate-400",children:t.createdAt?new Date(t.createdAt).toLocaleString():"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:244:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:245:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:247:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:248:25",className:"text-sm text-slate-300",children:t.module||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:250:23",children:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:251:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.action||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:255:23",children:e.jsx("code",{"code-path":"src/pages/AuditOperationsTab.tsx:256:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:t.resource||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:260:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:261:25",className:"text-sm text-slate-400",children:t.ip||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:263:23",children:M(t.result)}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:264:23",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:265:25",className:"flex items-center justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:266:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>F(t),title:"查看详情",children:e.jsx(Z,{"code-path":"src/pages/AuditOperationsTab.tsx:273:29",className:"h-4 w-4"})})})})]},t.id))})]})})})}),e.jsx(te,{"code-path":"src/pages/AuditOperationsTab.tsx:287:7",log:D,onClose:()=>A(null)}),e.jsx(ae,{"code-path":"src/pages/AuditOperationsTab.tsx:290:7",open:I,onClose:()=>z(!1),loading:B,stats:R})]})}function te({log:s,onClose:a}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:308:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:309:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:310:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-lg w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:311:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:312:11",className:"text-lg font-semibold text-slate-100",children:"操作日志详情"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:313:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:319:13",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:323:9",className:"space-y-3 text-sm",children:[e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:324:11",label:"ID",value:s.id}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:325:11",label:"时间",value:s.createdAt?new Date(s.createdAt).toLocaleString():"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:326:11",label:"用户",value:s.username||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:327:11",label:"用户ID",value:s.userId||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:328:11",label:"模块",value:s.module||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:329:11",label:"操作类型",value:s.action||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:330:11",label:"资源",value:s.resource||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:331:11",label:"IP地址",value:s.ip||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:332:11",label:"User-Agent",value:s.userAgent||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:333:11",label:"结果",value:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:336:15",variant:"outline",className:s.result==="success"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:s.result==="success"?"成功":"失败"})}),s.message&&e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:348:27",label:"详情",value:s.message,mono:!0})]}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:351:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:352:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function o({label:s,value:a,mono:i}){return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:367:5",className:"flex items-start gap-4",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:368:7",className:"text-slate-500 w-20 flex-shrink-0",children:s}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:369:7",className:i?"text-slate-300 font-mono text-xs break-all":"text-slate-200 break-all",children:a})]})}function ae({open:s,onClose:a,loading:i,stats:r}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:394:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:395:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:396:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:397:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:398:11",className:"text-lg font-semibold text-slate-100",children:"审计统计"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:399:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:405:13",className:"h-4 w-4"})})]}),i?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:410:11",className:"flex items-center justify-center py-10",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:411:13",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:414:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:415:13",className:"grid grid-cols-2 gap-3",children:[e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:416:15",label:"总日志数",value:String(r.total_logs??"--"),color:"blue"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:417:15",label:"今日日志",value:String(r.today_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:418:15",label:"成功数",value:String(r.success_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:419:15",label:"失败数",value:String(r.failure_count??"--"),color:"red"})]}),r.top_modules&&r.top_modules.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:423:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:424:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"热门模块"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:425:17",className:"space-y-1",children:r.top_modules.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:427:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:428:23",className:"text-slate-300",children:d.module}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:429:23",className:"text-slate-500",children:d.count})]},u))})]}),r.top_users&&r.top_users.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:437:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:438:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"活跃用户"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:439:17",className:"space-y-1",children:r.top_users.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:441:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:442:23",className:"text-slate-300",children:d.username}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:443:23",className:"text-slate-500",children:d.count})]},u))})]})]}):e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:451:11",className:"text-slate-500 text-center py-10 text-sm",children:"暂无统计数据"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:454:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:455:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function h({label:s,value:a,color:i}){const r={blue:"border-blue-500/20 bg-blue-500/5 text-blue-400",emerald:"border-emerald-500/20 bg-emerald-500/5 text-emerald-400",red:"border-red-500/20 bg-red-500/5 text-red-400"};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:475:5",className:`rounded-lg border p-3 ${r[i]}`,children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:476:7",className:"text-xs text-slate-500",children:s}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:477:7",className:"text-xl font-bold mt-0.5",children:a})]})}export{be as AuditOperationsTab}; diff --git a/backend/static/assets/CapacityPage-CWUpHbri.js b/backend/static/assets/CapacityPage-BucLnYij.js similarity index 95% rename from backend/static/assets/CapacityPage-CWUpHbri.js rename to backend/static/assets/CapacityPage-BucLnYij.js index ae9747e..1bf1325 100644 --- a/backend/static/assets/CapacityPage-CWUpHbri.js +++ b/backend/static/assets/CapacityPage-BucLnYij.js @@ -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/CapacityPage.tsx:105:7",className:"bg-slate-900 border-slate-800",children:e.jsx(L,{"code-path":"src/components/kubernetes/CapacityPage.tsx:106:9",className:"p-0",children:e.jsxs(z,{"code-path":"src/components/kubernetes/CapacityPage.tsx:107:11",children:[e.jsx(U,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:13",children:e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:109:15",className:"text-slate-400",children:"Deployment"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:110:15",className:"text-slate-400",children:"命名空间"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:111:15",className:"text-slate-400",children:"副本"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:112:15",className:"text-slate-400",children:"容器"}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:53",className:"h-3 w-3 inline mr-1"}),"CPU Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:53",className:"h-3 w-3 inline mr-1"}),"CPU Lim"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:53",className:"h-3 w-3 inline mr-1"}),"Mem Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:53",className:"h-3 w-3 inline mr-1"}),"Mem Lim"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/CapacityPage.tsx:118:13",children:m.length===0?e.jsx(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-8",children:["暂无数据",l?e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):m.map((s,t)=>e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:122:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:123:19",className:"font-medium text-slate-200 text-sm",children:s.deployment}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:19",children:e.jsx(D,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:125:19",className:"text-sm text-slate-300",children:s.replicas}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:126:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:127:19",className:`text-sm ${s.cpu_req!=="-"?"text-blue-400":"text-slate-600"}`,children:s.cpu_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:128:19",className:`text-sm ${s.cpu_lim!=="-"?"text-cyan-400":"text-slate-600"}`,children:s.cpu_lim}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:129:19",className:`text-sm ${s.mem_req!=="-"?"text-emerald-400":"text-slate-600"}`,children:s.mem_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:130:19",className:`text-sm ${s.mem_lim!=="-"?"text-teal-400":"text-slate-600"}`,children:s.mem_lim})]},`${s.deployment}-${s.container}-${t}`))})]})})})]})}export{te as default}; +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/CapacityPage.tsx:105:7",className:"bg-slate-900 border-slate-800",children:e.jsx(L,{"code-path":"src/components/kubernetes/CapacityPage.tsx:106:9",className:"p-0",children:e.jsxs(z,{"code-path":"src/components/kubernetes/CapacityPage.tsx:107:11",children:[e.jsx(U,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:13",children:e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:109:15",className:"text-slate-400",children:"Deployment"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:110:15",className:"text-slate-400",children:"命名空间"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:111:15",className:"text-slate-400",children:"副本"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:112:15",className:"text-slate-400",children:"容器"}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:53",className:"h-3 w-3 inline mr-1"}),"CPU Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:53",className:"h-3 w-3 inline mr-1"}),"CPU Lim"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:53",className:"h-3 w-3 inline mr-1"}),"Mem Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:53",className:"h-3 w-3 inline mr-1"}),"Mem Lim"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/CapacityPage.tsx:118:13",children:m.length===0?e.jsx(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-8",children:["暂无数据",l?e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):m.map((s,t)=>e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:122:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:123:19",className:"font-medium text-slate-200 text-sm",children:s.deployment}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:19",children:e.jsx(D,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:125:19",className:"text-sm text-slate-300",children:s.replicas}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:126:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:127:19",className:`text-sm ${s.cpu_req!=="-"?"text-blue-400":"text-slate-600"}`,children:s.cpu_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:128:19",className:`text-sm ${s.cpu_lim!=="-"?"text-cyan-400":"text-slate-600"}`,children:s.cpu_lim}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:129:19",className:`text-sm ${s.mem_req!=="-"?"text-emerald-400":"text-slate-600"}`,children:s.mem_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:130:19",className:`text-sm ${s.mem_lim!=="-"?"text-teal-400":"text-slate-600"}`,children:s.mem_lim})]},`${s.deployment}-${s.container}-${t}`))})]})})})]})}export{te as default}; diff --git a/backend/static/assets/CloudAccountManager-CrfXz-Ux.js b/backend/static/assets/CloudAccountManager-Dth1Gy-B.js similarity index 98% rename from backend/static/assets/CloudAccountManager-CrfXz-Ux.js rename to backend/static/assets/CloudAccountManager-Dth1Gy-B.js index ff9b963..87639e0 100644 --- a/backend/static/assets/CloudAccountManager-CrfXz-Ux.js +++ b/backend/static/assets/CloudAccountManager-Dth1Gy-B.js @@ -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.9-54.2,58.7-93.2,115.3-93.2c47.8,0,89.2,28.2,108.7,69.3c0,0,2.2,2.2,2.2,0C652.6,192.8,670,188.5,685.3,188.5L685.3,188.5"},{fill:"#00C8DC",d:"M456.9,242.6c-23.9-17.3-47.9-26-76.1-26c-33.9,0-66.2,14.2-89.2,39c-48.4,49.7-47.4,129.2,2.2,177.7c21.7,19.5,43.5,30.3,69.6,32.5l50-47.7h-28.3c-28.3-2.1-45.7-10.8-56.5-21.6c-30-29.6-30.9-77.6-2.2-108.3c15.2-15.2,32.6-21.7,54.4-21.7c13.1,0,32.6,2.1,52.2,21.6c8.7,8.7,32.6,26,41.3,34.7h2.1l32.6-32.5v-2.2C493.9,273,470,253.5,456.9,242.6"},{fill:"#00A3FF",d:"M724.4,396.5c-8.7,8.7-26.1,21.7-56.5,21.7h-187c56.5-54.1,104.4-99.6,108.8-104c8.3-8.4,17-16.3,26.1-23.8c21.8-19.5,39.1-21.7,54.4-21.7c21.7,0,39.1,8.7,54.4,21.6C754.9,318.5,754.9,368.4,724.4,396.5z M761.4,255.6c-23-24.8-55.3-39-89.2-39c-30.4,0-56.5,10.9-80.5,28.2c-8.8,8.7-21.8,17.3-32.7,30.3c-8.7,8.7-195.7,190.7-195.7,190.7c10.9,2.2,23.9,2.2,34.8,2.2h237.1c17.4,0,30.5,0,43.5-2.2c30-2.2,58.3-14.4,80.5-34.7C809.2,383.5,809.2,303.4,761.4,255.6L761.4,255.6"}]},huawei:{viewBox:"0 0 24 24",color:"#FF0000",path:"M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z"}};function ee({provider:t,className:p="h-5 w-5"}){const n=L[t]||L.aliyun;return e.jsx("svg",{"code-path":"src/components/icons/CloudBrandIcon.tsx:69:5",className:p,viewBox:n.viewBox,fill:"currentColor",style:{color:n.color},role:"img","aria-label":t,children:n.paths?n.paths.map((m,x)=>e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:79:11",d:m.d,fill:m.fill||"currentColor"},x)):e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:82:9",d:n.path})})}function ce(t){return{aws:"#FF9900",azure:"#0078D4",gcp:"#4285F4",aliyun:"#FF6A00",tencent:"#006EFF",huawei:"#FF0000"}[t]||"#64748B"}const se={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure",gcp:"GCP"};function pe(){const[t,p]=a.useState([]),[n,m]=a.useState(!0),[x,B]=a.useState(""),[M,D]=a.useState("all"),[E,i]=a.useState(!1),[b,f]=a.useState(!1),[o,w]=a.useState(null),[s,l]=a.useState({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"}),I=()=>{w(null),l({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"})},K=()=>{I(),i(!0)},P=c=>{w(c),l({name:c.name||"",provider:c.provider||"aliyun",access_key:"",secret_key:"",monthly_cost:String(c.monthly_cost??0),status:c.status||"active"}),i(!0)},H=async()=>{if(!(!s.name.trim()||!s.provider.trim()))try{f(!0);const c={name:s.name.trim(),provider:s.provider,access_key:s.access_key.trim(),secret_key:s.secret_key.trim(),monthly_cost:Number(s.monthly_cost)||0,status:s.status};o?await v.updateAccount(o.id,c):await v.createAccount(c),i(!1),g()}catch(c){console.error(o?"更新云账号失败:":"创建云账号失败:",c)}finally{f(!1)}},g=async()=>{try{m(!0);const c=await v.getAccounts();p(c?.list||[])}catch(c){console.error("加载云账号列表失败:",c),p([])}finally{m(!1)}};a.useEffect(()=>{g()},[]);const O=async c=>{try{await v.deleteAccount(c),g()}catch(r){console.error("删除云账号失败:",r)}},z=t.filter(c=>{const r=c.access_key||c.accessKey||"",j=(c.name||"").toLowerCase().includes(x.toLowerCase())||r.toLowerCase().includes(x.toLowerCase()),C=M==="all"||c.provider===M;return j&&C});return t.length,t.filter(c=>c.status==="active").length,t.filter(c=>c.status==="inactive").length,t.filter(c=>c.status==="error").length,e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/CloudAccountManager.tsx:160:11",className:"text-2xl font-bold text-slate-100",children:"云账号管理"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:161:11",className:"text-slate-400 mt-1",children:"管理多云平台的访问凭证和账号信息"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:164:11",variant:"outline",onClick:g,className:"border-slate-700 text-slate-300",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:165:13",className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:168:11",className:"bg-blue-600 hover:bg-blue-700",onClick:K,children:[e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:169:13",className:"h-4 w-4 mr-2"}),"添加账号"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:176:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:177:9",className:"relative flex-1 max-w-md",children:[e.jsx(X,{"code-path":"src/components/cloud/CloudAccountManager.tsx:178:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:179:11",placeholder:"搜索账号名称或AccessKey...",value:x,onChange:c=>B(c.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:186:9",value:M,onChange:c=>D(c.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/CloudAccountManager.tsx:191:11",value:"all",children:"全部平台"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:192:11",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:193:11",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:194:11",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:195:11",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:196:11",value:"azure",children:"Azure"})]})]}),n?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:202:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:203:11",className:"p-12 text-center text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:204:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):z.length===0?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:209:9",className:"bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:210:11",className:"p-12 text-center text-slate-500",children:"暂无云账号数据"})}):e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:213:9",className:"grid grid-cols-2 gap-4",children:z.map(c=>{const r=c.access_key||c.accessKey||"",j=c.server_count??c.serverCount??0,C=c.last_sync||c.lastSync||c.created_at||"-",T=c.monthly_cost??c.monthlyCost??0;return e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:220:15",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:221:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:222:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:223:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:224:23",className:"w-10 h-10 rounded-lg bg-slate-800 flex items-center justify-center",style:{borderBottom:`2px solid ${ce(c.provider)}`},children:e.jsx(ee,{"code-path":"src/components/cloud/CloudAccountManager.tsx:225:25",provider:c.provider,className:"h-6 w-6"})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:227:23",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudAccountManager.tsx:228:25",className:"font-medium text-slate-100",children:c.name}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:229:25",className:"text-sm text-slate-400 mt-0.5",children:se[c.provider]||c.provider}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:230:25",className:"flex items-center gap-3 mt-2",children:[r&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:232:29",variant:"secondary",className:"bg-slate-700 text-slate-300",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:233:31",className:"h-3 w-3 mr-1"}),r.slice(0,8),"..."]}),c.status==="active"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:238:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(Z,{"code-path":"src/components/cloud/CloudAccountManager.tsx:239:31",className:"h-3 w-3 mr-1"}),"正常"]}),c.status==="inactive"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:244:29",className:"bg-slate-500/20 text-slate-400 border-0",children:[e.jsx(q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:245:31",className:"h-3 w-3 mr-1"}),"已停用"]}),c.status==="error"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:250:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:251:31",className:"h-3 w-3 mr-1"}),"异常"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:258:21",className:"flex items-center gap-1",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:259:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>P(c),children:e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:265:25",className:"h-4 w-4"})}),e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:267:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>O(c.id),children:e.jsx(J,{"code-path":"src/components/cloud/CloudAccountManager.tsx:273:25",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:277:19",className:"grid grid-cols-3 gap-4 mt-4 pt-4 border-t border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:278:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:279:23",className:"text-xs text-slate-400",children:"月费用"}),e.jsxs("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:280:23",className:"text-lg font-medium text-emerald-400",children:["¥",Number(T).toLocaleString()]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:282:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:283:23",className:"text-xs text-slate-400",children:"服务器数"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:284:23",className:"text-lg font-medium text-slate-100",children:j})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:286:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:287:23",className:"text-xs text-slate-400",children:"最后同步"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:288:23",className:"text-sm text-slate-300",children:C!=="-"?new Date(C).toLocaleString():"-"})]})]})]})},c.id)})}),e.jsx(R,{"code-path":"src/components/cloud/CloudAccountManager.tsx:301:7",open:E,onOpenChange:i,children:e.jsxs(W,{"code-path":"src/components/cloud/CloudAccountManager.tsx:302:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(Q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:303:11",children:[e.jsxs(V,{"code-path":"src/components/cloud/CloudAccountManager.tsx:304:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/CloudAccountManager.tsx:305:15",className:"h-5 w-5 text-blue-400"}),o?"编辑云账号":"添加云账号"]}),e.jsx($,{"code-path":"src/components/cloud/CloudAccountManager.tsx:308:13",className:"text-slate-400",children:o?"修改账号信息和访问凭证,留空则保持原凭证不变":"录入多云平台的访问凭证,用于资源同步与成本统计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:313:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:314:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:315:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:316:17",className:"text-slate-300",children:["账号名称 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:317:24",className:"text-red-400",children:"*"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:319:17",placeholder:"阿里云生产账号",value:s.name,onChange:c=>l({...s,name:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:326:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:327:17",className:"text-slate-300",children:["云平台 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:328:23",className:"text-red-400",children:"*"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:330:17",value:s.provider,onChange:c=>l({...s,provider:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:335:19",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:336:19",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:337:19",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:338:19",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:339:19",value:"azure",children:"Azure"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:344:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:345:15",className:"text-slate-300",children:["AccessKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:347:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:349:15",placeholder:"LTAI...",value:s.access_key,onChange:c=>l({...s,access_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:357:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:358:15",className:"text-slate-300",children:["SecretKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:360:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:362:15",type:"password",placeholder:"••••••••",value:s.secret_key,onChange:c=>l({...s,secret_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:371:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:372:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:373:17",className:"text-slate-300",children:"月费用 (元)"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:374:17",type:"number",min:"0",placeholder:"0",value:s.monthly_cost,onChange:c=>l({...s,monthly_cost:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:383:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:384:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:385:17",value:s.status,onChange:c=>l({...s,status:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:390:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:391:19",value:"inactive",children:"已停用"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:392:19",value:"error",children:"异常"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/cloud/CloudAccountManager.tsx:398:11",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:399:13",variant:"outline",onClick:()=>i(!1),className:"border-slate-700 text-slate-300 hover:bg-slate-700",children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:402:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!s.name.trim()||b,onClick:H,children:[b?e.jsx(Y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:29",className:"h-4 w-4 mr-2 animate-spin"}):o?e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:98",className:"h-4 w-4 mr-2"}):e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:136",className:"h-4 w-4 mr-2"}),o?"保存修改":"创建账号"]})]})]})})]})}export{pe as CloudAccountManager}; +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.9-54.2,58.7-93.2,115.3-93.2c47.8,0,89.2,28.2,108.7,69.3c0,0,2.2,2.2,2.2,0C652.6,192.8,670,188.5,685.3,188.5L685.3,188.5"},{fill:"#00C8DC",d:"M456.9,242.6c-23.9-17.3-47.9-26-76.1-26c-33.9,0-66.2,14.2-89.2,39c-48.4,49.7-47.4,129.2,2.2,177.7c21.7,19.5,43.5,30.3,69.6,32.5l50-47.7h-28.3c-28.3-2.1-45.7-10.8-56.5-21.6c-30-29.6-30.9-77.6-2.2-108.3c15.2-15.2,32.6-21.7,54.4-21.7c13.1,0,32.6,2.1,52.2,21.6c8.7,8.7,32.6,26,41.3,34.7h2.1l32.6-32.5v-2.2C493.9,273,470,253.5,456.9,242.6"},{fill:"#00A3FF",d:"M724.4,396.5c-8.7,8.7-26.1,21.7-56.5,21.7h-187c56.5-54.1,104.4-99.6,108.8-104c8.3-8.4,17-16.3,26.1-23.8c21.8-19.5,39.1-21.7,54.4-21.7c21.7,0,39.1,8.7,54.4,21.6C754.9,318.5,754.9,368.4,724.4,396.5z M761.4,255.6c-23-24.8-55.3-39-89.2-39c-30.4,0-56.5,10.9-80.5,28.2c-8.8,8.7-21.8,17.3-32.7,30.3c-8.7,8.7-195.7,190.7-195.7,190.7c10.9,2.2,23.9,2.2,34.8,2.2h237.1c17.4,0,30.5,0,43.5-2.2c30-2.2,58.3-14.4,80.5-34.7C809.2,383.5,809.2,303.4,761.4,255.6L761.4,255.6"}]},huawei:{viewBox:"0 0 24 24",color:"#FF0000",path:"M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z"}};function ee({provider:t,className:p="h-5 w-5"}){const n=L[t]||L.aliyun;return e.jsx("svg",{"code-path":"src/components/icons/CloudBrandIcon.tsx:69:5",className:p,viewBox:n.viewBox,fill:"currentColor",style:{color:n.color},role:"img","aria-label":t,children:n.paths?n.paths.map((m,x)=>e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:79:11",d:m.d,fill:m.fill||"currentColor"},x)):e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:82:9",d:n.path})})}function ce(t){return{aws:"#FF9900",azure:"#0078D4",gcp:"#4285F4",aliyun:"#FF6A00",tencent:"#006EFF",huawei:"#FF0000"}[t]||"#64748B"}const se={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure",gcp:"GCP"};function pe(){const[t,p]=a.useState([]),[n,m]=a.useState(!0),[x,B]=a.useState(""),[M,D]=a.useState("all"),[E,i]=a.useState(!1),[b,f]=a.useState(!1),[o,w]=a.useState(null),[s,l]=a.useState({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"}),I=()=>{w(null),l({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"})},K=()=>{I(),i(!0)},P=c=>{w(c),l({name:c.name||"",provider:c.provider||"aliyun",access_key:"",secret_key:"",monthly_cost:String(c.monthly_cost??0),status:c.status||"active"}),i(!0)},H=async()=>{if(!(!s.name.trim()||!s.provider.trim()))try{f(!0);const c={name:s.name.trim(),provider:s.provider,access_key:s.access_key.trim(),secret_key:s.secret_key.trim(),monthly_cost:Number(s.monthly_cost)||0,status:s.status};o?await v.updateAccount(o.id,c):await v.createAccount(c),i(!1),g()}catch(c){console.error(o?"更新云账号失败:":"创建云账号失败:",c)}finally{f(!1)}},g=async()=>{try{m(!0);const c=await v.getAccounts();p(c?.list||[])}catch(c){console.error("加载云账号列表失败:",c),p([])}finally{m(!1)}};a.useEffect(()=>{g()},[]);const O=async c=>{try{await v.deleteAccount(c),g()}catch(r){console.error("删除云账号失败:",r)}},z=t.filter(c=>{const r=c.access_key||c.accessKey||"",j=(c.name||"").toLowerCase().includes(x.toLowerCase())||r.toLowerCase().includes(x.toLowerCase()),C=M==="all"||c.provider===M;return j&&C});return t.length,t.filter(c=>c.status==="active").length,t.filter(c=>c.status==="inactive").length,t.filter(c=>c.status==="error").length,e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/CloudAccountManager.tsx:160:11",className:"text-2xl font-bold text-slate-100",children:"云账号管理"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:161:11",className:"text-slate-400 mt-1",children:"管理多云平台的访问凭证和账号信息"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:164:11",variant:"outline",onClick:g,className:"border-slate-700 text-slate-300",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:165:13",className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:168:11",className:"bg-blue-600 hover:bg-blue-700",onClick:K,children:[e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:169:13",className:"h-4 w-4 mr-2"}),"添加账号"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:176:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:177:9",className:"relative flex-1 max-w-md",children:[e.jsx(X,{"code-path":"src/components/cloud/CloudAccountManager.tsx:178:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:179:11",placeholder:"搜索账号名称或AccessKey...",value:x,onChange:c=>B(c.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:186:9",value:M,onChange:c=>D(c.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/CloudAccountManager.tsx:191:11",value:"all",children:"全部平台"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:192:11",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:193:11",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:194:11",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:195:11",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:196:11",value:"azure",children:"Azure"})]})]}),n?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:202:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:203:11",className:"p-12 text-center text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:204:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):z.length===0?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:209:9",className:"bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:210:11",className:"p-12 text-center text-slate-500",children:"暂无云账号数据"})}):e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:213:9",className:"grid grid-cols-2 gap-4",children:z.map(c=>{const r=c.access_key||c.accessKey||"",j=c.server_count??c.serverCount??0,C=c.last_sync||c.lastSync||c.created_at||"-",T=c.monthly_cost??c.monthlyCost??0;return e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:220:15",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:221:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:222:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:223:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:224:23",className:"w-10 h-10 rounded-lg bg-slate-800 flex items-center justify-center",style:{borderBottom:`2px solid ${ce(c.provider)}`},children:e.jsx(ee,{"code-path":"src/components/cloud/CloudAccountManager.tsx:225:25",provider:c.provider,className:"h-6 w-6"})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:227:23",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudAccountManager.tsx:228:25",className:"font-medium text-slate-100",children:c.name}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:229:25",className:"text-sm text-slate-400 mt-0.5",children:se[c.provider]||c.provider}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:230:25",className:"flex items-center gap-3 mt-2",children:[r&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:232:29",variant:"secondary",className:"bg-slate-700 text-slate-300",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:233:31",className:"h-3 w-3 mr-1"}),r.slice(0,8),"..."]}),c.status==="active"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:238:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(Z,{"code-path":"src/components/cloud/CloudAccountManager.tsx:239:31",className:"h-3 w-3 mr-1"}),"正常"]}),c.status==="inactive"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:244:29",className:"bg-slate-500/20 text-slate-400 border-0",children:[e.jsx(q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:245:31",className:"h-3 w-3 mr-1"}),"已停用"]}),c.status==="error"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:250:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:251:31",className:"h-3 w-3 mr-1"}),"异常"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:258:21",className:"flex items-center gap-1",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:259:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>P(c),children:e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:265:25",className:"h-4 w-4"})}),e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:267:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>O(c.id),children:e.jsx(J,{"code-path":"src/components/cloud/CloudAccountManager.tsx:273:25",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:277:19",className:"grid grid-cols-3 gap-4 mt-4 pt-4 border-t border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:278:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:279:23",className:"text-xs text-slate-400",children:"月费用"}),e.jsxs("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:280:23",className:"text-lg font-medium text-emerald-400",children:["¥",Number(T).toLocaleString()]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:282:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:283:23",className:"text-xs text-slate-400",children:"服务器数"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:284:23",className:"text-lg font-medium text-slate-100",children:j})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:286:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:287:23",className:"text-xs text-slate-400",children:"最后同步"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:288:23",className:"text-sm text-slate-300",children:C!=="-"?new Date(C).toLocaleString():"-"})]})]})]})},c.id)})}),e.jsx(R,{"code-path":"src/components/cloud/CloudAccountManager.tsx:301:7",open:E,onOpenChange:i,children:e.jsxs(W,{"code-path":"src/components/cloud/CloudAccountManager.tsx:302:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(Q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:303:11",children:[e.jsxs(V,{"code-path":"src/components/cloud/CloudAccountManager.tsx:304:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/CloudAccountManager.tsx:305:15",className:"h-5 w-5 text-blue-400"}),o?"编辑云账号":"添加云账号"]}),e.jsx($,{"code-path":"src/components/cloud/CloudAccountManager.tsx:308:13",className:"text-slate-400",children:o?"修改账号信息和访问凭证,留空则保持原凭证不变":"录入多云平台的访问凭证,用于资源同步与成本统计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:313:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:314:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:315:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:316:17",className:"text-slate-300",children:["账号名称 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:317:24",className:"text-red-400",children:"*"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:319:17",placeholder:"阿里云生产账号",value:s.name,onChange:c=>l({...s,name:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:326:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:327:17",className:"text-slate-300",children:["云平台 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:328:23",className:"text-red-400",children:"*"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:330:17",value:s.provider,onChange:c=>l({...s,provider:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:335:19",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:336:19",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:337:19",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:338:19",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:339:19",value:"azure",children:"Azure"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:344:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:345:15",className:"text-slate-300",children:["AccessKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:347:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:349:15",placeholder:"LTAI...",value:s.access_key,onChange:c=>l({...s,access_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:357:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:358:15",className:"text-slate-300",children:["SecretKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:360:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:362:15",type:"password",placeholder:"••••••••",value:s.secret_key,onChange:c=>l({...s,secret_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:371:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:372:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:373:17",className:"text-slate-300",children:"月费用 (元)"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:374:17",type:"number",min:"0",placeholder:"0",value:s.monthly_cost,onChange:c=>l({...s,monthly_cost:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:383:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:384:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:385:17",value:s.status,onChange:c=>l({...s,status:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:390:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:391:19",value:"inactive",children:"已停用"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:392:19",value:"error",children:"异常"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/cloud/CloudAccountManager.tsx:398:11",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:399:13",variant:"outline",onClick:()=>i(!1),className:"border-slate-700 text-slate-300 hover:bg-slate-700",children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:402:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!s.name.trim()||b,onClick:H,children:[b?e.jsx(Y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:29",className:"h-4 w-4 mr-2 animate-spin"}):o?e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:98",className:"h-4 w-4 mr-2"}):e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:136",className:"h-4 w-4 mr-2"}),o?"保存修改":"创建账号"]})]})]})})]})}export{pe as CloudAccountManager}; diff --git a/backend/static/assets/CloudBilling-kwAWaA8o.js b/backend/static/assets/CloudBilling-Dtss07cb.js similarity index 98% rename from backend/static/assets/CloudBilling-kwAWaA8o.js rename to backend/static/assets/CloudBilling-Dtss07cb.js index 00c6645..0bd996d 100644 --- a/backend/static/assets/CloudBilling-kwAWaA8o.js +++ b/backend/static/assets/CloudBilling-Dtss07cb.js @@ -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,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:110:15",className:"text-sm text-slate-300",children:"日期 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:111:15",type:"date",className:"mt-1",value:o.billing_date,onChange:l=>i({...o,billing_date:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:114:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:115:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:116:15",className:"text-sm text-slate-300",children:"费用(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:117:15",type:"number",step:"0.01",className:"mt-1",placeholder:"0.00",value:o.cost,onChange:l=>i({...o,cost:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:119:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:120:15",className:"text-sm text-slate-300",children:"服务"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:121:15",className:"mt-1",placeholder:"ECS, RDS...",value:o.service,onChange:l=>i({...o,service:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:124:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:125:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:126:15",className:"text-sm text-slate-300",children:"区域"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:127:15",className:"mt-1",placeholder:"cn-hangzhou",value:o.region,onChange:l=>i({...o,region:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:130:15",className:"text-sm text-slate-300",children:"账号名称"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:131:15",className:"mt-1",placeholder:"主账号",value:o.account_name,onChange:l=>i({...o,account_name:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:134:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:135:13",className:"text-sm text-slate-300",children:"备注"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:136:13",className:"mt-1",placeholder:"可选",value:o.description,onChange:l=>i({...o,description:l.target.value})})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}const U={name:"",provider:"",metric:"daily",threshold:"",operator:">",enabled:!0};function Re({open:d,onOpenChange:n,editingRule:t,onSuccess:a}){const[o,i]=c.useState(U),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{name:t.name,provider:t.provider||"",metric:t.metric||"daily",threshold:t.threshold,operator:t.operator||">",enabled:t.enabled}:{...U})},[d,t]);const y=async()=>{if(!o.name||!o.threshold){p.error("请填写规则名称和阈值");return}C(!0);try{const l={...o,threshold:parseFloat(o.threshold)};t?await h.updateAlertRule(t.id,l):await h.createAlertRule(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:81:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:82:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:83:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:84:11",children:t?"编辑预警规则":"添加预警规则"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:85:11",children:"设置成本阈值,超标时自动预警"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:87:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:88:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:89:13",className:"text-sm text-slate-300",children:"规则名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:90:13",className:"mt-1",placeholder:"如:日成本超 500 元预警",value:o.name,onChange:l=>i({...o,name:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:92:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:93:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:94:15",className:"text-sm text-slate-300",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:95:15",value:o.provider||"all",onValueChange:l=>i({...o,provider:l==="all"?"":l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:97:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:98:19",value:"all",children:"全部厂商"}),Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:100:21",value:l,children:f},l))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:105:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:106:15",className:"text-sm text-slate-300",children:"指标"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:107:15",value:o.metric,onValueChange:l=>i({...o,metric:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:109:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:110:19",value:"daily",children:"日成本"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:111:19",value:"monthly",children:"月累计"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:116:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:117:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:118:15",className:"text-sm text-slate-300",children:"比较"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:119:15",value:o.operator,onValueChange:l=>i({...o,operator:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:121:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:122:19",value:">",children:"大于 >"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:123:19",value:">=",children:"大于等于 ≥"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:124:19",value:"<",children:"小于 <"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:125:19",value:"<=",children:"小于等于 ≤"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:130:15",className:"text-sm text-slate-300",children:"阈值(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:131:15",type:"number",step:"0.01",className:"mt-1",placeholder:"500.00",value:o.threshold,onChange:l=>i({...o,threshold:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:134:11",className:"flex items-center gap-2",children:[e.jsx(oe,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:135:13",checked:o.enabled,onCheckedChange:l=>i({...o,enabled:l})}),e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:136:13",className:"text-sm text-slate-300",children:"启用"})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}function Oe(){const d=ve(),[n,t]=c.useState("overview"),[a,o]=c.useState(null),[i,B]=c.useState(!0),[C,y]=c.useState([]),[l,f]=c.useState(!0),[z,te]=c.useState(""),[E,ce]=c.useState(""),[F,ne]=c.useState(""),[P,ae]=c.useState([]),[ie,I]=c.useState(!0),[de,L]=c.useState(!1),[re,M]=c.useState(null),[pe,$]=c.useState(!1),[ue,W]=c.useState(null),N=c.useCallback(async()=>{B(!0);try{const s=await h.getStats();o(s)}catch(s){p.error("加载统计失败",{description:s.message})}finally{B(!1)}},[]),b=c.useCallback(async()=>{f(!0);try{const s={};z&&(s.provider=z),E&&(s.start_date=E),F&&(s.end_date=F);const u=await h.list(s);y(u.list||[])}catch(s){p.error("加载账单失败",{description:s.message})}finally{f(!1)}},[z,E,F]),D=c.useCallback(async()=>{I(!0);try{const s=await h.listAlertRules();ae(s.list||[])}catch(s){p.error("加载预警规则失败",{description:s.message})}finally{I(!1)}},[]);c.useEffect(()=>{N()},[N]),c.useEffect(()=>{n==="records"&&b()},[n,b]),c.useEffect(()=>{n==="alerts"&&D()},[n,D]);const me=()=>{M(null),L(!0)},xe=s=>{M(s),L(!0)},he=()=>{W(null),$(!0)},ge=s=>{W(s),$(!0)},je=async s=>{if(await d({title:"删除账单记录",description:"确定删除这条成本记录?",variant:"destructive"}))try{await h.remove(s),b(),N(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Be=async s=>{if(await d({title:"删除预警规则",description:"确定删除此预警规则?",variant:"destructive"}))try{await h.deleteAlertRule(s),D(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Ce=async s=>{try{await h.toggleAlertRule(s),D(),N()}catch(u){p.error("操作失败",{description:u.message})}};return e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:163:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:164:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/cloud/CloudBilling.tsx:165:9",className:"text-lg font-semibold text-slate-100",children:"云账单管理"}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:166:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:167:11",variant:"outline",size:"sm",onClick:()=>{N(),n==="records"&&b(),n==="alerts"&&D()},children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:168:13",className:"h-4 w-4 mr-1"}),"刷新"]}),n==="records"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:171:13",size:"sm",onClick:me,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:172:15",className:"h-4 w-4 mr-1"}),"记录成本"]}),n==="alerts"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:176:13",size:"sm",onClick:he,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:177:15",className:"h-4 w-4 mr-1"}),"添加规则"]})]})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:183:7",className:"flex gap-1 border-b border-slate-800",children:[{key:"overview",label:"概览统计"},{key:"records",label:"成本记录"},{key:"alerts",label:"预警规则"}].map(s=>e.jsx("button",{"code-path":"src/components/cloud/CloudBilling.tsx:189:11",onClick:()=>t(s.key),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${n===s.key?"text-blue-400 border-blue-400":"text-slate-400 border-transparent hover:text-slate-200"}`,children:s.label},s.key))}),n==="overview"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:204:9",className:"space-y-4",children:i?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:206:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:206:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):a?e.jsxs(e.Fragment,{children:[e.jsx(fe,{"code-path":"src/components/cloud/CloudBilling.tsx:209:15",items:[{label:"今日",value:g(a.today_cost||0),color:"blue"},{label:"本月",value:g(a.month_cost||0),color:"amber"},{label:"年度",value:g(a.year_cost||0),color:"purple"},{label:"预警",value:`${a.alerts?.length||0} 条`,color:a.alerts?.length>0?"red":"muted"}]}),a.alerts?.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:219:17",className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:220:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:221:21",className:"h-4 w-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:222:21",className:"text-sm font-medium text-amber-300",children:"成本预警"})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:224:19",className:"space-y-2",children:a.alerts.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:226:23",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:227:25",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/cloud/CloudBilling.tsx:228:27",variant:"outline",className:"border-amber-500/50 text-amber-300",children:s.rule_name}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:229:27",className:"text-slate-400",children:[s.provider," · ",s.metric==="daily"?"日":"月","成本"]})]}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:233:25",className:"text-slate-300",children:["当前 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:234:30",className:"text-amber-300 font-medium",children:g(s.current)})," ",s.operator," ","阈值 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:236:30",className:"text-red-400 font-medium",children:g(s.threshold)})]})]},u))})]}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:244:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:245:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:246:19",className:"text-sm font-medium text-slate-200 mb-4",children:"近 30 天成本趋势"}),e.jsx(De,{"code-path":"src/components/cloud/CloudBilling.tsx:247:19",data:a.month_trend||[]})]})}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:251:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:252:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:253:19",className:"text-sm font-medium text-slate-200 mb-4",children:"本月厂商成本分布"}),(a.provider_dist||[]).length===0?e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:255:21",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"}):e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:257:21",className:"space-y-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:258:23",className:"flex h-8 rounded-lg overflow-hidden",children:a.provider_dist.map((s,u)=>e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:260:27",className:`${V[s.provider]||"bg-slate-600"} flex items-center justify-center text-xs text-white font-medium`,style:{width:`${s.percent}%`},title:`${v[s.provider]||s.provider}: ${g(s.cost)} (${s.percent.toFixed(1)}%)`,children:s.percent>8?v[s.provider]||s.provider:""},u))}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:270:23",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:a.provider_dist.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:272:27",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:273:29",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:274:31",className:`w-3 h-3 rounded ${V[s.provider]||"bg-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:275:31",className:"text-slate-300",children:v[s.provider]||s.provider})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:277:29",className:"text-right",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:278:31",className:"text-slate-200 font-medium",children:g(s.cost)}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:279:31",className:"text-slate-500 ml-2",children:[s.percent.toFixed(1),"%"]})]})]},u))})]})]})})]}):null}),n==="records"&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:294:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:295:11",className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:296:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:297:15",className:"text-xs text-slate-400 mb-1",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/CloudBilling.tsx:298:15",value:z||"all",onValueChange:s=>te(s==="all"?"":s),children:[e.jsx(w,{"code-path":"src/components/cloud/CloudBilling.tsx:299:17",className:"w-32 h-9",children:e.jsx(S,{"code-path":"src/components/cloud/CloudBilling.tsx:299:53"})}),e.jsxs(k,{"code-path":"src/components/cloud/CloudBilling.tsx:300:17",children:[e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:301:19",value:"all",children:"全部"}),Object.entries(v).map(([s,u])=>e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:303:21",value:s,children:u},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:308:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:309:15",className:"text-xs text-slate-400 mb-1",children:"开始日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:310:15",type:"date",className:"w-40 h-9",value:E,onChange:s=>ce(s.target.value)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:312:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:313:15",className:"text-xs text-slate-400 mb-1",children:"结束日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:314:15",type:"date",className:"w-40 h-9",value:F,onChange:s=>ne(s.target.value)})]}),e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:316:13",variant:"outline",size:"sm",onClick:b,children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:317:15",className:"h-4 w-4 mr-1"}),"查询"]})]}),l?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:322:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:322:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):C.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:324:13",className:"py-20 text-center text-slate-500",children:[e.jsx(be,{"code-path":"src/components/cloud/CloudBilling.tsx:325:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:326:15",className:"text-sm",children:"暂无成本记录"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:329:13",className:"overflow-x-auto rounded-lg border border-slate-800",children:e.jsxs("table",{"code-path":"src/components/cloud/CloudBilling.tsx:330:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/cloud/CloudBilling.tsx:331:17",className:"bg-slate-900/80 text-slate-400",children:e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:332:19",children:[e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:333:21",className:"px-4 py-2.5 text-left font-medium",children:"日期"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:334:21",className:"px-4 py-2.5 text-left font-medium",children:"厂商"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:335:21",className:"px-4 py-2.5 text-left font-medium",children:"服务"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:336:21",className:"px-4 py-2.5 text-left font-medium",children:"区域"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:337:21",className:"px-4 py-2.5 text-left font-medium",children:"账号"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:338:21",className:"px-4 py-2.5 text-right font-medium",children:"费用"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:339:21",className:"px-4 py-2.5 text-left font-medium",children:"说明"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:340:21",className:"px-4 py-2.5 text-center font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/cloud/CloudBilling.tsx:343:17",children:C.map(s=>e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:345:21",className:"border-t border-slate-800 hover:bg-slate-800/30",children:[e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:346:23",className:"px-4 py-2.5 text-slate-300",children:s.billing_date}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:347:23",className:"px-4 py-2.5",children:e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:348:25",className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:349:27",className:`w-2 h-2 rounded-full ${V[s.provider]||"bg-slate-500"}`}),v[s.provider]||s.provider]})}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:353:23",className:"px-4 py-2.5 text-slate-400",children:s.service||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:354:23",className:"px-4 py-2.5 text-slate-400",children:s.region||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:355:23",className:"px-4 py-2.5 text-slate-400",children:s.account_name||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:356:23",className:"px-4 py-2.5 text-right text-slate-200 font-medium",children:g(s.cost)}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:357:23",className:"px-4 py-2.5 text-slate-500 max-w-xs truncate",children:s.description||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:358:23",className:"px-4 py-2.5",children:e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:359:25",className:"flex items-center justify-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:360:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>xe(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:361:29",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:363:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>je(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:364:29",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})})]}),n==="alerts"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:378:9",className:"space-y-3",children:ie?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:380:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:380:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):P.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:382:13",className:"py-20 text-center text-slate-500",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:383:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:384:15",className:"text-sm",children:"暂无预警规则"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:387:13",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:P.map(s=>e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:389:17",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:390:19",className:"pt-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:391:21",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:392:23",className:"flex items-center gap-2",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:393:25",className:`h-4 w-4 ${s.enabled?"text-amber-400":"text-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:394:25",className:"text-sm font-medium text-slate-200",children:s.name})]}),e.jsx(oe,{"code-path":"src/components/cloud/CloudBilling.tsx:396:23",checked:s.enabled,onCheckedChange:()=>Ce(s.id)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:398:21",className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:399:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:400:25",className:"text-slate-500",children:"厂商"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:401:25",className:"ml-2 text-slate-300",children:s.provider?v[s.provider]||s.provider:"全部"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:403:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:404:25",className:"text-slate-500",children:"指标"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:405:25",className:"ml-2 text-slate-300",children:s.metric==="daily"?"日成本":"月累计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:407:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:408:25",className:"text-slate-500",children:"阈值"}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:409:25",className:"ml-2 text-amber-300 font-medium",children:[s.operator," ",g(s.threshold)]})]}),s.last_triggered&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:412:25",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:413:27",className:"text-slate-500",children:"最后触发"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:414:27",className:"ml-2 text-slate-400",children:new Date(s.last_triggered).toLocaleString("zh-CN")})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:418:21",className:"flex justify-end gap-1 mt-3",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:419:23",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ge(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:420:25",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:422:23",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>Be(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:423:25",className:"h-3.5 w-3.5"})})]})]})},s.id))})}),e.jsx(ye,{"code-path":"src/components/cloud/CloudBilling.tsx:434:7",open:de,onOpenChange:L,editingRecord:re,onSuccess:()=>{b(),N()}}),e.jsx(Re,{"code-path":"src/components/cloud/CloudBilling.tsx:440:7",open:pe,onOpenChange:$,editingRule:ue,onSuccess:()=>{D(),N()}})]})}export{Oe as CloudBilling}; +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,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:110:15",className:"text-sm text-slate-300",children:"日期 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:111:15",type:"date",className:"mt-1",value:o.billing_date,onChange:l=>i({...o,billing_date:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:114:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:115:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:116:15",className:"text-sm text-slate-300",children:"费用(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:117:15",type:"number",step:"0.01",className:"mt-1",placeholder:"0.00",value:o.cost,onChange:l=>i({...o,cost:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:119:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:120:15",className:"text-sm text-slate-300",children:"服务"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:121:15",className:"mt-1",placeholder:"ECS, RDS...",value:o.service,onChange:l=>i({...o,service:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:124:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:125:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:126:15",className:"text-sm text-slate-300",children:"区域"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:127:15",className:"mt-1",placeholder:"cn-hangzhou",value:o.region,onChange:l=>i({...o,region:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:130:15",className:"text-sm text-slate-300",children:"账号名称"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:131:15",className:"mt-1",placeholder:"主账号",value:o.account_name,onChange:l=>i({...o,account_name:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:134:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:135:13",className:"text-sm text-slate-300",children:"备注"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:136:13",className:"mt-1",placeholder:"可选",value:o.description,onChange:l=>i({...o,description:l.target.value})})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}const U={name:"",provider:"",metric:"daily",threshold:"",operator:">",enabled:!0};function Re({open:d,onOpenChange:n,editingRule:t,onSuccess:a}){const[o,i]=c.useState(U),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{name:t.name,provider:t.provider||"",metric:t.metric||"daily",threshold:t.threshold,operator:t.operator||">",enabled:t.enabled}:{...U})},[d,t]);const y=async()=>{if(!o.name||!o.threshold){p.error("请填写规则名称和阈值");return}C(!0);try{const l={...o,threshold:parseFloat(o.threshold)};t?await h.updateAlertRule(t.id,l):await h.createAlertRule(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:81:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:82:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:83:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:84:11",children:t?"编辑预警规则":"添加预警规则"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:85:11",children:"设置成本阈值,超标时自动预警"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:87:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:88:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:89:13",className:"text-sm text-slate-300",children:"规则名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:90:13",className:"mt-1",placeholder:"如:日成本超 500 元预警",value:o.name,onChange:l=>i({...o,name:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:92:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:93:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:94:15",className:"text-sm text-slate-300",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:95:15",value:o.provider||"all",onValueChange:l=>i({...o,provider:l==="all"?"":l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:97:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:98:19",value:"all",children:"全部厂商"}),Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:100:21",value:l,children:f},l))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:105:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:106:15",className:"text-sm text-slate-300",children:"指标"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:107:15",value:o.metric,onValueChange:l=>i({...o,metric:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:109:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:110:19",value:"daily",children:"日成本"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:111:19",value:"monthly",children:"月累计"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:116:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:117:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:118:15",className:"text-sm text-slate-300",children:"比较"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:119:15",value:o.operator,onValueChange:l=>i({...o,operator:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:121:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:122:19",value:">",children:"大于 >"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:123:19",value:">=",children:"大于等于 ≥"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:124:19",value:"<",children:"小于 <"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:125:19",value:"<=",children:"小于等于 ≤"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:130:15",className:"text-sm text-slate-300",children:"阈值(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:131:15",type:"number",step:"0.01",className:"mt-1",placeholder:"500.00",value:o.threshold,onChange:l=>i({...o,threshold:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:134:11",className:"flex items-center gap-2",children:[e.jsx(oe,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:135:13",checked:o.enabled,onCheckedChange:l=>i({...o,enabled:l})}),e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:136:13",className:"text-sm text-slate-300",children:"启用"})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}function Oe(){const d=ve(),[n,t]=c.useState("overview"),[a,o]=c.useState(null),[i,B]=c.useState(!0),[C,y]=c.useState([]),[l,f]=c.useState(!0),[z,te]=c.useState(""),[E,ce]=c.useState(""),[F,ne]=c.useState(""),[P,ae]=c.useState([]),[ie,I]=c.useState(!0),[de,L]=c.useState(!1),[re,M]=c.useState(null),[pe,$]=c.useState(!1),[ue,W]=c.useState(null),N=c.useCallback(async()=>{B(!0);try{const s=await h.getStats();o(s)}catch(s){p.error("加载统计失败",{description:s.message})}finally{B(!1)}},[]),b=c.useCallback(async()=>{f(!0);try{const s={};z&&(s.provider=z),E&&(s.start_date=E),F&&(s.end_date=F);const u=await h.list(s);y(u.list||[])}catch(s){p.error("加载账单失败",{description:s.message})}finally{f(!1)}},[z,E,F]),D=c.useCallback(async()=>{I(!0);try{const s=await h.listAlertRules();ae(s.list||[])}catch(s){p.error("加载预警规则失败",{description:s.message})}finally{I(!1)}},[]);c.useEffect(()=>{N()},[N]),c.useEffect(()=>{n==="records"&&b()},[n,b]),c.useEffect(()=>{n==="alerts"&&D()},[n,D]);const me=()=>{M(null),L(!0)},xe=s=>{M(s),L(!0)},he=()=>{W(null),$(!0)},ge=s=>{W(s),$(!0)},je=async s=>{if(await d({title:"删除账单记录",description:"确定删除这条成本记录?",variant:"destructive"}))try{await h.remove(s),b(),N(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Be=async s=>{if(await d({title:"删除预警规则",description:"确定删除此预警规则?",variant:"destructive"}))try{await h.deleteAlertRule(s),D(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Ce=async s=>{try{await h.toggleAlertRule(s),D(),N()}catch(u){p.error("操作失败",{description:u.message})}};return e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:163:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:164:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/cloud/CloudBilling.tsx:165:9",className:"text-lg font-semibold text-slate-100",children:"云账单管理"}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:166:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:167:11",variant:"outline",size:"sm",onClick:()=>{N(),n==="records"&&b(),n==="alerts"&&D()},children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:168:13",className:"h-4 w-4 mr-1"}),"刷新"]}),n==="records"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:171:13",size:"sm",onClick:me,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:172:15",className:"h-4 w-4 mr-1"}),"记录成本"]}),n==="alerts"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:176:13",size:"sm",onClick:he,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:177:15",className:"h-4 w-4 mr-1"}),"添加规则"]})]})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:183:7",className:"flex gap-1 border-b border-slate-800",children:[{key:"overview",label:"概览统计"},{key:"records",label:"成本记录"},{key:"alerts",label:"预警规则"}].map(s=>e.jsx("button",{"code-path":"src/components/cloud/CloudBilling.tsx:189:11",onClick:()=>t(s.key),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${n===s.key?"text-blue-400 border-blue-400":"text-slate-400 border-transparent hover:text-slate-200"}`,children:s.label},s.key))}),n==="overview"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:204:9",className:"space-y-4",children:i?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:206:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:206:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):a?e.jsxs(e.Fragment,{children:[e.jsx(fe,{"code-path":"src/components/cloud/CloudBilling.tsx:209:15",items:[{label:"今日",value:g(a.today_cost||0),color:"blue"},{label:"本月",value:g(a.month_cost||0),color:"amber"},{label:"年度",value:g(a.year_cost||0),color:"purple"},{label:"预警",value:`${a.alerts?.length||0} 条`,color:a.alerts?.length>0?"red":"muted"}]}),a.alerts?.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:219:17",className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:220:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:221:21",className:"h-4 w-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:222:21",className:"text-sm font-medium text-amber-300",children:"成本预警"})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:224:19",className:"space-y-2",children:a.alerts.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:226:23",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:227:25",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/cloud/CloudBilling.tsx:228:27",variant:"outline",className:"border-amber-500/50 text-amber-300",children:s.rule_name}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:229:27",className:"text-slate-400",children:[s.provider," · ",s.metric==="daily"?"日":"月","成本"]})]}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:233:25",className:"text-slate-300",children:["当前 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:234:30",className:"text-amber-300 font-medium",children:g(s.current)})," ",s.operator," ","阈值 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:236:30",className:"text-red-400 font-medium",children:g(s.threshold)})]})]},u))})]}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:244:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:245:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:246:19",className:"text-sm font-medium text-slate-200 mb-4",children:"近 30 天成本趋势"}),e.jsx(De,{"code-path":"src/components/cloud/CloudBilling.tsx:247:19",data:a.month_trend||[]})]})}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:251:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:252:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:253:19",className:"text-sm font-medium text-slate-200 mb-4",children:"本月厂商成本分布"}),(a.provider_dist||[]).length===0?e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:255:21",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"}):e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:257:21",className:"space-y-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:258:23",className:"flex h-8 rounded-lg overflow-hidden",children:a.provider_dist.map((s,u)=>e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:260:27",className:`${V[s.provider]||"bg-slate-600"} flex items-center justify-center text-xs text-white font-medium`,style:{width:`${s.percent}%`},title:`${v[s.provider]||s.provider}: ${g(s.cost)} (${s.percent.toFixed(1)}%)`,children:s.percent>8?v[s.provider]||s.provider:""},u))}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:270:23",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:a.provider_dist.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:272:27",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:273:29",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:274:31",className:`w-3 h-3 rounded ${V[s.provider]||"bg-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:275:31",className:"text-slate-300",children:v[s.provider]||s.provider})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:277:29",className:"text-right",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:278:31",className:"text-slate-200 font-medium",children:g(s.cost)}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:279:31",className:"text-slate-500 ml-2",children:[s.percent.toFixed(1),"%"]})]})]},u))})]})]})})]}):null}),n==="records"&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:294:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:295:11",className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:296:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:297:15",className:"text-xs text-slate-400 mb-1",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/CloudBilling.tsx:298:15",value:z||"all",onValueChange:s=>te(s==="all"?"":s),children:[e.jsx(w,{"code-path":"src/components/cloud/CloudBilling.tsx:299:17",className:"w-32 h-9",children:e.jsx(S,{"code-path":"src/components/cloud/CloudBilling.tsx:299:53"})}),e.jsxs(k,{"code-path":"src/components/cloud/CloudBilling.tsx:300:17",children:[e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:301:19",value:"all",children:"全部"}),Object.entries(v).map(([s,u])=>e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:303:21",value:s,children:u},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:308:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:309:15",className:"text-xs text-slate-400 mb-1",children:"开始日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:310:15",type:"date",className:"w-40 h-9",value:E,onChange:s=>ce(s.target.value)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:312:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:313:15",className:"text-xs text-slate-400 mb-1",children:"结束日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:314:15",type:"date",className:"w-40 h-9",value:F,onChange:s=>ne(s.target.value)})]}),e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:316:13",variant:"outline",size:"sm",onClick:b,children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:317:15",className:"h-4 w-4 mr-1"}),"查询"]})]}),l?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:322:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:322:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):C.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:324:13",className:"py-20 text-center text-slate-500",children:[e.jsx(be,{"code-path":"src/components/cloud/CloudBilling.tsx:325:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:326:15",className:"text-sm",children:"暂无成本记录"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:329:13",className:"overflow-x-auto rounded-lg border border-slate-800",children:e.jsxs("table",{"code-path":"src/components/cloud/CloudBilling.tsx:330:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/cloud/CloudBilling.tsx:331:17",className:"bg-slate-900/80 text-slate-400",children:e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:332:19",children:[e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:333:21",className:"px-4 py-2.5 text-left font-medium",children:"日期"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:334:21",className:"px-4 py-2.5 text-left font-medium",children:"厂商"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:335:21",className:"px-4 py-2.5 text-left font-medium",children:"服务"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:336:21",className:"px-4 py-2.5 text-left font-medium",children:"区域"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:337:21",className:"px-4 py-2.5 text-left font-medium",children:"账号"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:338:21",className:"px-4 py-2.5 text-right font-medium",children:"费用"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:339:21",className:"px-4 py-2.5 text-left font-medium",children:"说明"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:340:21",className:"px-4 py-2.5 text-center font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/cloud/CloudBilling.tsx:343:17",children:C.map(s=>e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:345:21",className:"border-t border-slate-800 hover:bg-slate-800/30",children:[e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:346:23",className:"px-4 py-2.5 text-slate-300",children:s.billing_date}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:347:23",className:"px-4 py-2.5",children:e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:348:25",className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:349:27",className:`w-2 h-2 rounded-full ${V[s.provider]||"bg-slate-500"}`}),v[s.provider]||s.provider]})}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:353:23",className:"px-4 py-2.5 text-slate-400",children:s.service||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:354:23",className:"px-4 py-2.5 text-slate-400",children:s.region||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:355:23",className:"px-4 py-2.5 text-slate-400",children:s.account_name||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:356:23",className:"px-4 py-2.5 text-right text-slate-200 font-medium",children:g(s.cost)}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:357:23",className:"px-4 py-2.5 text-slate-500 max-w-xs truncate",children:s.description||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:358:23",className:"px-4 py-2.5",children:e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:359:25",className:"flex items-center justify-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:360:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>xe(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:361:29",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:363:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>je(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:364:29",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})})]}),n==="alerts"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:378:9",className:"space-y-3",children:ie?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:380:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:380:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):P.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:382:13",className:"py-20 text-center text-slate-500",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:383:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:384:15",className:"text-sm",children:"暂无预警规则"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:387:13",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:P.map(s=>e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:389:17",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:390:19",className:"pt-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:391:21",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:392:23",className:"flex items-center gap-2",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:393:25",className:`h-4 w-4 ${s.enabled?"text-amber-400":"text-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:394:25",className:"text-sm font-medium text-slate-200",children:s.name})]}),e.jsx(oe,{"code-path":"src/components/cloud/CloudBilling.tsx:396:23",checked:s.enabled,onCheckedChange:()=>Ce(s.id)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:398:21",className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:399:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:400:25",className:"text-slate-500",children:"厂商"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:401:25",className:"ml-2 text-slate-300",children:s.provider?v[s.provider]||s.provider:"全部"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:403:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:404:25",className:"text-slate-500",children:"指标"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:405:25",className:"ml-2 text-slate-300",children:s.metric==="daily"?"日成本":"月累计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:407:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:408:25",className:"text-slate-500",children:"阈值"}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:409:25",className:"ml-2 text-amber-300 font-medium",children:[s.operator," ",g(s.threshold)]})]}),s.last_triggered&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:412:25",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:413:27",className:"text-slate-500",children:"最后触发"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:414:27",className:"ml-2 text-slate-400",children:new Date(s.last_triggered).toLocaleString("zh-CN")})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:418:21",className:"flex justify-end gap-1 mt-3",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:419:23",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ge(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:420:25",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:422:23",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>Be(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:423:25",className:"h-3.5 w-3.5"})})]})]})},s.id))})}),e.jsx(ye,{"code-path":"src/components/cloud/CloudBilling.tsx:434:7",open:de,onOpenChange:L,editingRecord:re,onSuccess:()=>{b(),N()}}),e.jsx(Re,{"code-path":"src/components/cloud/CloudBilling.tsx:440:7",open:pe,onOpenChange:$,editingRule:ue,onSuccess:()=>{D(),N()}})]})}export{Oe as CloudBilling}; diff --git a/backend/static/assets/ClusterOverviewPage-CiOj2OGK.js b/backend/static/assets/ClusterOverviewPage-CBfjCIXY.js similarity index 98% rename from backend/static/assets/ClusterOverviewPage-CiOj2OGK.js rename to backend/static/assets/ClusterOverviewPage-CBfjCIXY.js index e524a2c..bf36533 100644 --- a/backend/static/assets/ClusterOverviewPage-CiOj2OGK.js +++ b/backend/static/assets/ClusterOverviewPage-CBfjCIXY.js @@ -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 text-emerald-400",children:N.length})]}),e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:120:15",className:"h-8 w-8 opacity-30 text-emerald-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:124:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:125:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:126:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:20",className:"text-sm text-slate-500",children:"版本"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:64",className:"text-lg font-bold text-slate-300",children:d?.version||"-"})]}),e.jsx(T,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:128:15",className:"h-8 w-8 opacity-30 text-slate-400"})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:135:7",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:136:9",className:"text-lg font-semibold text-slate-100 mb-3 flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:137:11",className:"h-4 w-4 text-blue-400"}),"节点列表"]}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:139:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:140:11",className:"p-0",children:e.jsxs(H,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:141:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:142:15",children:e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:143:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:144:19",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:145:19",className:"text-slate-400",children:"角色"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:146:19",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:147:19",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:148:19",className:"text-slate-400",children:"OS"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:149:19",className:"text-slate-400",children:"Kubelet"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:150:19",className:"text-slate-400",children:"CPU"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:151:19",className:"text-slate-400",children:"内存"})]})}),e.jsx(D,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:154:15",children:p?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:97",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):m.length===0?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:97",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无节点"]})}):m.map(s=>{const t=s.cpu||0,o=s.cpu_usage_m?parseFloat(s.cpu_usage_m.replace("m","")):0,l=t>0?o/1e3/t*100:0,h=s.memory_mb||0,b=s.mem_usage_mi?parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi","")):0,U=s.mem_usage_mi?.includes("Ki")?b/1024:s.mem_usage_mi?.includes("Gi")?b*1024:b,g=h>0?U/h*100:0,S=$=>$>80?"bg-red-500":$>60?"bg-yellow-500":"bg-emerald-500";return e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:171:21",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>B(`/kubernetes/${r}/nodes/${s.name}`),children:[e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:173:23",className:"font-medium text-blue-400 hover:text-blue-300",children:s.name}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:34",className:L(s),children:s.role||"worker"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:34",className:s.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s.status||"Unknown"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:176:23",className:"text-sm text-slate-400",children:s.ip||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:177:23",className:"text-sm text-slate-400 max-w-[200px] truncate",children:s.os||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:178:23",className:"text-sm text-slate-400",children:s.kubelet_version||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:179:23",className:"text-xs",children:s.cpu_usage_m?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:181:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:182:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:183:31",className:`h-full rounded-full ${S(l)}`,style:{width:`${Math.min(l,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:185:29",className:"text-slate-400",children:[l.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:188:27",className:"text-slate-500",children:[t," 核"]})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:191:23",className:"text-xs",children:s.mem_usage_mi?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:193:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:194:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:195:31",className:`h-full rounded-full ${S(g)}`,style:{width:`${Math.min(g,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:197:29",className:"text-slate-400",children:[g.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:200:27",className:"text-slate-500",children:[h,"Mi"]})})]},s.name)})})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:214:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:215:9",className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:216:11",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:217:13",className:"h-4 w-4 text-emerald-400"}),"命名空间"]}),e.jsxs(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:219:11",to:`/kubernetes/${r}/namespaces`,className:"text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",children:["管理全部 ",e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:220:18",className:"h-3 w-3"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:223:9",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:N.map(s=>{const t=Y[s]||X;return e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:227:15",to:`/kubernetes/${r}/namespace/${s}`,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:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:231:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:232:19",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:233:21",className:"h-5 w-5 text-slate-500 group-hover:text-slate-300 transition-colors"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:234:21",className:"text-sm font-medium text-slate-300 group-hover:text-slate-100 transition-colors",children:s})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:236:19",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]})},s)})})]})]})}export{oe as default}; +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 text-emerald-400",children:N.length})]}),e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:120:15",className:"h-8 w-8 opacity-30 text-emerald-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:124:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:125:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:126:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:20",className:"text-sm text-slate-500",children:"版本"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:64",className:"text-lg font-bold text-slate-300",children:d?.version||"-"})]}),e.jsx(T,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:128:15",className:"h-8 w-8 opacity-30 text-slate-400"})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:135:7",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:136:9",className:"text-lg font-semibold text-slate-100 mb-3 flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:137:11",className:"h-4 w-4 text-blue-400"}),"节点列表"]}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:139:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:140:11",className:"p-0",children:e.jsxs(H,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:141:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:142:15",children:e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:143:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:144:19",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:145:19",className:"text-slate-400",children:"角色"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:146:19",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:147:19",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:148:19",className:"text-slate-400",children:"OS"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:149:19",className:"text-slate-400",children:"Kubelet"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:150:19",className:"text-slate-400",children:"CPU"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:151:19",className:"text-slate-400",children:"内存"})]})}),e.jsx(D,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:154:15",children:p?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:97",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):m.length===0?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:97",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无节点"]})}):m.map(s=>{const t=s.cpu||0,o=s.cpu_usage_m?parseFloat(s.cpu_usage_m.replace("m","")):0,l=t>0?o/1e3/t*100:0,h=s.memory_mb||0,b=s.mem_usage_mi?parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi","")):0,U=s.mem_usage_mi?.includes("Ki")?b/1024:s.mem_usage_mi?.includes("Gi")?b*1024:b,g=h>0?U/h*100:0,S=$=>$>80?"bg-red-500":$>60?"bg-yellow-500":"bg-emerald-500";return e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:171:21",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>B(`/kubernetes/${r}/nodes/${s.name}`),children:[e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:173:23",className:"font-medium text-blue-400 hover:text-blue-300",children:s.name}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:34",className:L(s),children:s.role||"worker"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:34",className:s.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s.status||"Unknown"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:176:23",className:"text-sm text-slate-400",children:s.ip||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:177:23",className:"text-sm text-slate-400 max-w-[200px] truncate",children:s.os||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:178:23",className:"text-sm text-slate-400",children:s.kubelet_version||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:179:23",className:"text-xs",children:s.cpu_usage_m?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:181:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:182:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:183:31",className:`h-full rounded-full ${S(l)}`,style:{width:`${Math.min(l,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:185:29",className:"text-slate-400",children:[l.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:188:27",className:"text-slate-500",children:[t," 核"]})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:191:23",className:"text-xs",children:s.mem_usage_mi?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:193:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:194:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:195:31",className:`h-full rounded-full ${S(g)}`,style:{width:`${Math.min(g,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:197:29",className:"text-slate-400",children:[g.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:200:27",className:"text-slate-500",children:[h,"Mi"]})})]},s.name)})})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:214:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:215:9",className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:216:11",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:217:13",className:"h-4 w-4 text-emerald-400"}),"命名空间"]}),e.jsxs(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:219:11",to:`/kubernetes/${r}/namespaces`,className:"text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",children:["管理全部 ",e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:220:18",className:"h-3 w-3"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:223:9",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:N.map(s=>{const t=Y[s]||X;return e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:227:15",to:`/kubernetes/${r}/namespace/${s}`,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:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:231:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:232:19",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:233:21",className:"h-5 w-5 text-slate-500 group-hover:text-slate-300 transition-colors"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:234:21",className:"text-sm font-medium text-slate-300 group-hover:text-slate-100 transition-colors",children:s})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:236:19",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]})},s)})})]})]})}export{oe as default}; diff --git a/backend/static/assets/CredentialManager-CSa9vb54.js b/backend/static/assets/CredentialManager-VPjoE2mR.js similarity index 99% rename from backend/static/assets/CredentialManager-CSa9vb54.js rename to backend/static/assets/CredentialManager-VPjoE2mR.js index e17b14c..3cfd195 100644 --- a/backend/static/assets/CredentialManager-CSa9vb54.js +++ b/backend/static/assets/CredentialManager-VPjoE2mR.js @@ -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,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:72:7",className:"sm:max-w-[680px] max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Ge,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:73:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:74:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[f?e.jsx(f.icon,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:20",className:`h-5 w-5 ${f.color}`}):e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:70",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"凭据详情"]})}),h?e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:80:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"加载中..."}):v?e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:82:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:84:13",className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:20",className:"text-[var(--dg-text-muted)]",children:"名称:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:76",className:"text-[var(--dg-text-primary)] font-medium",children:l?.name})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:20",className:"text-[var(--dg-text-muted)]",children:"类型:"}),e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:87:17",variant:"outline",className:`text-xs ml-1 ${aa[s]||""}`,children:f?.label||s})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:20",className:"text-[var(--dg-text-muted)]",children:"状态:"}),l?.is_active?e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:21",className:"bg-green-500/20 text-green-400 text-xs ml-1",children:[e.jsx(We,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:84",className:"h-3 w-3 mr-0.5"}),"启用"]}):e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:21",className:"bg-red-500/20 text-red-400 text-xs ml-1",children:[e.jsx(Xe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:80",className:"h-3 w-3 mr-0.5"}),"禁用"]}),l?.expires_at&&new Date(l.expires_at)_(l?.env_prefix||""),children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:98:17",className:"text-[var(--dg-text-muted)]",children:"引用ID:"}),e.jsx("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:99:17",className:"text-[var(--dg-blue)] font-mono text-xs",children:l?.env_prefix||"无"}),e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:100:17",className:"h-3 w-3 inline ml-1 text-[var(--dg-text-muted)]"})]}),l?.tags?.length>0&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:103:17",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:104:19",className:"text-[var(--dg-text-muted)]",children:"标签:"}),(l?.tags).map(m=>e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:106:21",variant:"outline",className:"text-xs ml-1 border-[var(--dg-border)]",children:m},m))]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:15",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:43",className:"text-[var(--dg-text-muted)]",children:"描述:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:99",className:"text-[var(--dg-text-secondary)]",children:l?.description||"无"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:20",className:"text-[var(--dg-text-muted)]",children:"创建:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.created_at).toLocaleString()})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:20",className:"text-[var(--dg-text-muted)]",children:"更新:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.updated_at).toLocaleString()})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:116:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:117:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)] font-medium mb-3",children:[e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:118:17",className:"h-4 w-4 text-yellow-500"}),"密钥数据"]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:120:15",className:"p-3 rounded-md bg-yellow-500/5 border border-yellow-500/20 mb-3",children:e.jsx("p",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:121:17",className:"text-xs text-yellow-400/80",children:"以下内容包含敏感信息,请妥善保管,不要泄露给他人。"})}),s==="ssh"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:125:17",label:"SSH 用户",value:o.ssh_user}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:126:17",label:"SSH 端口",value:o.ssh_port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:127:17",label:"SSH 密码",value:o.password,sensitive:!0,fieldKey:"ssh_password"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:128:17",label:"私钥",value:o.private_key,sensitive:!0,fieldKey:"ssh_private_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:129:17",label:"公钥",value:o.public_key,fieldKey:"ssh_public_key"})]}),s==="docker"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:132:17",label:"Registry 地址",value:o.server}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:133:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:134:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"docker_password"})]}),s==="tls"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:137:17",label:"证书",value:o.cert,sensitive:!0,fieldKey:"tls_cert"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:138:17",label:"私钥",value:o.key,sensitive:!0,fieldKey:"tls_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:139:17",label:"CA 证书",value:o.ca,sensitive:!0,fieldKey:"tls_ca"})]}),s==="aksk"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:142:17",label:"Access Key ID",value:o.access_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:143:17",label:"Secret Access Key",value:o.secret_key,sensitive:!0,fieldKey:"aksk_secret_key"})]}),s==="database"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:146:17",label:"数据库类型",value:String(o.db_type||"").toUpperCase()}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:147:17",label:"主机",value:o.host}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:148:17",label:"端口",value:o.port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:149:17",label:"数据库名",value:o.db_name}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:150:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:151:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"db_password"})]}),s==="api"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:154:17",label:"API Key",value:o.api_key,sensitive:!0,fieldKey:"api_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:155:17",label:"API 端点",value:o.endpoint})]}),s==="generic"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:158:17",label:"Key",value:o.generic_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:159:17",label:"Value",value:o.generic_value,sensitive:!0,fieldKey:"generic_value"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:164:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:165:15",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:"在流水线/脚本中引用此凭据:"}),e.jsxs("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:166:15",className:"text-xs bg-[var(--dg-bg-tertiary)] px-3 py-1.5 rounded block text-[var(--dg-blue)]",children:["${",String(l?.variable_name||String(l?.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_")),"}"]})]})]}):e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:172:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"未找到凭据数据"}),e.jsx(Qe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:174:9",children:e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:175:11",variant:"outline",onClick:d,children:"关闭"})})]})})}function _a({open:c,onClose:d,onSaved:u,editData:x}){const g=!!x,[v,h]=t.useState(""),[D,_]=t.useState(""),[s,f]=t.useState("ssh"),[o,n]=t.useState(""),[l,m]=t.useState(""),[y,k]=t.useState(!0),[K,I]=t.useState(!1),[T,O]=t.useState({}),[E,L]=t.useState("root"),[r,b]=t.useState("22"),[A,q]=t.useState(""),[F,B]=t.useState(""),[G,U]=t.useState(""),[Q,$]=t.useState(""),[Y,Z]=t.useState(""),[W,X]=t.useState(""),[J,ee]=t.useState(""),[ae,te]=t.useState(""),[re,se]=t.useState(""),[,Te]=t.useState(""),[oe,ne]=t.useState(""),[ce,de]=t.useState(""),[,Ie]=t.useState(""),[le,ie]=t.useState("mysql"),[pe,me]=t.useState(""),[xe,ge]=t.useState("3306"),[he,ye]=t.useState(""),[ve,Ce]=t.useState(""),[ue,De]=t.useState(""),[be,je]=t.useState(""),[Ne,fe]=t.useState(""),[Fe,Se]=t.useState(""),[we,_e]=t.useState("");t.useEffect(()=>{c&&(x?(h(x.name),_(x.variable_name||""),f(x.secret_type),n(x.description||""),m((x.tags||[]).join(", ")),k(x.is_active),L(""),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")):(h(""),_(""),f("ssh"),n(""),m(""),k(!0),L("root"),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")),O({}))},[x,c]);const ta=a=>O(C=>({...C,[a]:!C[a]})),ra=async()=>{if(!v.trim()){S.error("请填写凭据名称");return}I(!0);try{const a={name:v.trim(),secret_type:s,description:o.trim(),tags:l.split(",").map(C=>C.trim()).filter(Boolean),is_active:y};D.trim()&&(a.variable_name=D.trim()),s==="ssh"?(E.trim()&&(a.ssh_user=E.trim()),r&&(a.ssh_port=parseInt(r)||22),A.trim()&&(a.ssh_password=A.trim()),F.trim()&&(a.ssh_private_key=F.trim()),G.trim()&&(a.ssh_public_key=G.trim())):s==="docker"?(Q.trim()&&(a.docker_server=Q.trim()),Y.trim()&&(a.docker_username=Y.trim()),W.trim()&&(a.docker_password=W.trim())):s==="tls"?(J.trim()&&(a.tls_cert=J.trim()),ae.trim()&&(a.tls_key=ae.trim()),re.trim()&&(a.tls_ca=re.trim())):s==="aksk"?(oe.trim()&&(a.aksk_access_key=oe.trim()),ce.trim()&&(a.aksk_secret_key=ce.trim())):s==="database"?(le.trim()&&(a.db_type=le.trim()),pe.trim()&&(a.db_host=pe.trim()),xe&&(a.db_port=parseInt(xe)||3306),he.trim()&&(a.db_name=he.trim()),ve.trim()&&(a.db_username=ve.trim()),ue.trim()&&(a.db_password=ue.trim())):s==="api"?(be.trim()&&(a.api_key=be.trim()),Ne.trim()&&(a.api_endpoint=Ne.trim())):s==="generic"&&(Fe.trim()&&(a.generic_key=Fe.trim()),we.trim()&&(a.generic_value=we.trim())),g?(await P.update(x.id,a),S.success("已更新")):(await P.create(a),S.success("已创建")),u(),d()}catch(a){const C=a;S.error(C?.response?.data?.message||"操作失败")}finally{I(!1)}},j=({label:a,value:C,onChange:Le,placeholder:qe,fieldKey:He,required:sa,isLong:oa})=>{const Oe=T[He];return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:163:7",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:9",className:"text-[var(--dg-text-secondary)] text-xs",children:[a,sa&&!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:99",className:"text-red-400",children:" *"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:165:9",className:"relative",children:[oa?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:167:13",value:C,onChange:ke=>Le(ke.target.value),placeholder:qe,rows:5,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-sm font-mono placeholder:text-[var(--dg-text-muted)]"}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:171:13",value:C,onChange:ke=>Le(ke.target.value),type:Oe?"text":"password",placeholder:qe,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] pr-10 font-mono text-sm"}),e.jsx("button",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:175:11",type:"button",onClick:()=>ta(He),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] text-xs",children:Oe?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:21",className:"h-3.5 w-3.5"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:58",className:"h-3.5 w-3.5"})})]})]})},R=H[s],Ee=R?.icon||z;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:188:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:189:7",className:"sm:max-w-[620px] max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(Ge,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:190:9",children:[e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:191:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:192:13",className:`h-5 w-5 ${R?.color||""}`}),g?"编辑凭据":"新增凭据"]}),e.jsx(ca,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:195:11",className:"text-[var(--dg-text-muted)] text-xs",children:R?.desc||"管理敏感凭据信息"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:199:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:201:11",className:"border-b border-[var(--dg-border)] pb-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:202:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2",children:"基本信息"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:203:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:204:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["凭据名称 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:206:17",value:v,onChange:a=>h(a.target.value),placeholder:"如:生产环境 SSH",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:209:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:210:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"变量别名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:211:17",value:D,onChange:a=>_(a.target.value),placeholder:"如:MYSQL_PROD",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:214:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["类型",!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:90",className:"text-red-400",children:" *"})]}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:216:17",value:s,onValueChange:a=>f(a),disabled:g,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:217:19",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:218:21"})}),e.jsx(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:220:19",className:"max-h-[300px]",children:Object.entries(H).map(([a,C])=>e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:222:23",value:a,children:e.jsxs("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:25",className:"flex items-center gap-2",children:[e.jsx(C.icon,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:67",className:"h-4 w-4"}),C.label]})},a))})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:229:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:230:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"标签"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:231:17",value:l,onChange:a=>m(a.target.value),placeholder:"生产环境, 阿里云",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:235:13",className:"mt-2 space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:236:15",className:"text-[var(--dg-text-secondary)] text-xs",children:"描述"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:237:15",value:o,onChange:a=>n(a.target.value),placeholder:"可选备注信息",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:243:11",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:244:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:245:15",className:"h-3.5 w-3.5"}),R?.label||s," 配置",g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:246:26",className:"text-[var(--dg-text-muted)]",children:"(仅填写需要修改的字段)"})]}),s==="ssh"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:250:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:251:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:252:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 用户"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:253:19",value:E,onChange:a=>L(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:256:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:257:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:258:19",value:r,onChange:a=>b(a.target.value),placeholder:"22",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:261:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:262:19",label:"SSH 密码",value:A,onChange:q,placeholder:"密码(或留空用密钥)",fieldKey:"ssh_pwd"})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:265:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:266:19",label:"私钥内容",value:F,onChange:B,placeholder:"粘贴 SSH 私钥...",fieldKey:"ssh_pk",isLong:!0})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:269:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:270:19",label:"公钥内容",value:G,onChange:U,placeholder:"粘贴 SSH 公钥...",fieldKey:"ssh_pub",isLong:!0})})]}),s==="docker"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:277:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:278:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Registry 地址 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:90",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:280:19",value:Q,onChange:a=>$(a.target.value),placeholder:"registry.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:283:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:284:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:285:19",value:Y,onChange:a=>Z(a.target.value),placeholder:"admin",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:22",label:"密码",value:W,onChange:X,placeholder:"Registry 密码",fieldKey:"docker_pwd",required:!0})})]}),s==="tls"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:294:15",className:"space-y-3",children:[e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:295:17",label:"证书 (PEM)",value:J,onChange:ee,placeholder:"-----BEGIN CERTIFICATE-----",fieldKey:"tls_cert",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:297:17",label:"私钥 (PEM)",value:ae,onChange:te,placeholder:"-----BEGIN PRIVATE KEY-----",fieldKey:"tls_key",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:299:17",label:"CA 证书",value:re,onChange:se,placeholder:"CA 证书内容...",fieldKey:"tls_ca",isLong:!0})]}),s==="aksk"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:305:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:306:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Access Key ID ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:92",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:308:19",value:oe,onChange:a=>ne(a.target.value),placeholder:"AKIDxxxx...",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:311:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:312:19",label:"Secret Access Key",value:ce,onChange:de,placeholder:"输入 Secret Key",fieldKey:"aksk_sk",required:!0})})]}),s==="database"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:319:15",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:320:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:321:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库类型"}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:322:19",value:le,onValueChange:ie,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:323:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:324:23"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:326:21",children:[e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:327:23",value:"mysql",children:"MySQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:328:23",value:"postgres",children:"PostgreSQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:329:23",value:"mongodb",children:"MongoDB"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:330:23",value:"redis",children:"Redis"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:331:23",value:"mssql",children:"SQL Server"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:332:23",value:"oracle",children:"Oracle"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:336:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["主机 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:338:19",value:pe,onChange:a=>me(a.target.value),placeholder:"10.0.0.1",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:341:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:342:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:343:19",value:xe,onChange:a=>ge(a.target.value),placeholder:"3306",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:346:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:347:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:348:19",value:he,onChange:a=>ye(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/credential-manager/CredFormDialog.tsx:351:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:352:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:353:19",value:ve,onChange:a=>Ce(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:22",label:"密码",value:ue,onChange:De,placeholder:"数据库密码",fieldKey:"db_pwd"})})]}),s==="api"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:362:15",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:363:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:364:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"API 端点"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:365:19",value:Ne,onChange:a=>fe(a.target.value),placeholder:"https://api.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:368:17",label:"API Key / Token",value:be,onChange:je,placeholder:"sk-xxxx...",fieldKey:"api_key",required:!0})]}),s==="generic"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:374:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Key ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:82",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:377:19",value:Fe,onChange:a=>Se(a.target.value),placeholder:"MY_SECRET",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:380:17",label:"Value",value:we,onChange:_e,placeholder:"密钥值",fieldKey:"generic_val",required:!0})]})]})]}),e.jsxs(Qe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:386:9",children:[e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:387:11",variant:"outline",onClick:d,children:"取消"}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:388:11",onClick:ra,disabled:K,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/80",children:K?"保存中...":g?"更新":"创建"})]})]})})}function Oa(){const c=da(),[d,u]=t.useState(!1),[x,g]=t.useState(null),[v,h]=t.useState(null),[D,_]=t.useState(!1),[s,f]=t.useState("all"),[o,n]=t.useState(""),l={page_size:100,...o?{search:o}:{},...s&&s!=="all"?{secret_type:s}:{}},{data:m=[],isLoading:y,refetch:k}=fa(l),{deleteMutation:K,toggleActiveMutation:I}=Sa(),T=async r=>{if(await c({title:"删除凭据",description:`确定删除凭据「${r.name}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await K.mutateAsync(r.id),S.success("已删除")}catch{S.error("删除失败")}},O=async r=>{try{await I.mutateAsync({id:r.id,isActive:!r.is_active}),S.success(r.is_active?"已禁用":"已启用")}catch{S.error("操作失败")}},E=r=>{navigator.clipboard.writeText(r),S.success("引用 ID 已复制")},L=Object.entries(H);return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:68:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:69:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:70:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/CredentialManager.tsx:71:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"凭据管理"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:72:11",className:"text-sm text-[var(--dg-text-muted)] mt-0.5",children:"统一管理 SSH 密钥、Docker 密码、AKSK、数据库等敏感凭据(AES 加密存储)"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:76:9",className:"flex items-center gap-2",children:[e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:77:11",variant:"outline",size:"sm",onClick:()=>k(),children:[e.jsx(Ca,{"code-path":"src/components/deploy/CredentialManager.tsx:78:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:80:11",size:"sm",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:81:13",className:"w-4 h-4 mr-1"}),"新增凭据"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:87:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(Me,{"code-path":"src/components/deploy/CredentialManager.tsx:88:9",value:s,onValueChange:f,children:[e.jsx(Ke,{"code-path":"src/components/deploy/CredentialManager.tsx:89:11",className:"w-[140px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm",children:e.jsx(Ae,{"code-path":"src/components/deploy/CredentialManager.tsx:90:13",placeholder:"全部类型"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/CredentialManager.tsx:92:11",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:93:13",value:"all",children:"全部类型"}),L.map(([r,b])=>e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:95:15",value:r,children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:96:17",className:"flex items-center gap-2",children:[e.jsx(b.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:96:59",className:"h-3.5 w-3.5"}),b.label]})},r))]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:101:9",className:"relative flex-1 max-w-xs",children:[e.jsx(ua,{"code-path":"src/components/deploy/CredentialManager.tsx:102:11",className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(p,{"code-path":"src/components/deploy/CredentialManager.tsx:103:11",value:o,onChange:r=>n(r.target.value),placeholder:"搜索名称、描述...",className:"pl-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm"})]}),e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:107:9",className:"text-xs text-[var(--dg-text-muted)]",children:[m.length," 个凭据"]})]}),y?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(Da,{"code-path":"src/components/deploy/CredentialManager.tsx:112:11",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-blue)]"}),"加载中..."]}):m.length===0?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:115:9",className:"text-center py-16 border border-dashed border-[var(--dg-border)] rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/deploy/CredentialManager.tsx:116:11",className:"w-12 h-12 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:117:11",className:"text-[var(--dg-text-secondary)] mb-2",children:"暂无凭据"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:118:11",className:"text-xs text-[var(--dg-text-muted)] mb-4",children:"创建 SSH、Docker、AKSK 等类型的凭据,供流水线和服务器使用"}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:119:11",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:120:13",className:"w-4 h-4 mr-1"}),"创建第一个凭据"]})]}):e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:124:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/CredentialManager.tsx:125:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",children:[e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:128:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:129:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:130:17",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/CredentialManager.tsx:131:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden lg:table-cell",children:"标签"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:132:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden xl:table-cell",children:"引用ID"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:133:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:134:17",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/CredentialManager.tsx:137:13",children:m.map(r=>{const b=r.secret_type,A=H[b],q=r.expires_at&&new Date(r.expires_at){h(r.id),_(!0)},children:[e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:146:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:147:23",className:"flex items-center gap-2",children:[A?e.jsx(A.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:148:32",className:`h-4 w-4 ${A.color} shrink-0`}):e.jsx(z,{"code-path":"src/components/deploy/CredentialManager.tsx:148:91",className:"h-4 w-4 text-[var(--dg-text-muted)] shrink-0"}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:149:25",children:[e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:150:27",className:"font-medium text-[var(--dg-text-primary)]",children:r.name}),r.variable_name&&e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:152:29",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:r.variable_name})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:157:21",className:"px-3 py-2.5",children:e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:158:23",variant:"outline",className:`text-xs ${aa[b]||""}`,children:A?.label||b})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:162:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] text-xs hidden md:table-cell max-w-[180px] truncate font-mono",children:r.summary||"-"}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:165:21",className:"px-3 py-2.5 hidden lg:table-cell",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:166:23",className:"flex gap-1 flex-wrap",children:[(r.tags||[]).slice(0,3).map(F=>e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:168:27",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:F},F)),(r.tags||[]).length>3&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:171:27",className:"text-xs text-[var(--dg-text-muted)]",children:["+",r.tags.length-3]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:175:21",className:"px-3 py-2.5 hidden xl:table-cell",children:e.jsx("code",{"code-path":"src/components/deploy/CredentialManager.tsx:176:23",className:"text-xs text-[var(--dg-blue)] cursor-pointer font-mono",onClick:F=>{F.stopPropagation(),E(r.env_prefix)},children:r.env_prefix})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:181:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:182:23",className:"flex items-center gap-1",children:[r.is_active?e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:184:27",className:"bg-green-500/20 text-green-400 text-xs border-0",children:"启用"}):e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:186:27",className:"bg-red-500/20 text-red-400 text-xs border-0",children:"禁用"}),q&&e.jsxs(w,{"code-path":"src/components/deploy/CredentialManager.tsx:189:27",className:"bg-yellow-500/20 text-yellow-400 text-xs border-0",children:[e.jsx(ba,{"code-path":"src/components/deploy/CredentialManager.tsx:189:96",className:"h-2.5 w-2.5 mr-0.5"}),"过期"]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:193:21",className:"px-3 py-2.5 text-right",onClick:F=>F.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:194:23",className:"flex justify-end gap-1",children:[e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:195:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{g(r),u(!0)},title:"编辑",children:e.jsx(ja,{"code-path":"src/components/deploy/CredentialManager.tsx:197:27",className:"w-3.5 h-3.5"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:199:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>O(r),title:r.is_active?"禁用":"启用",children:r.is_active?e.jsx(Xe,{"code-path":"src/components/deploy/CredentialManager.tsx:202:45",className:"w-3.5 h-3.5 text-yellow-500"}):e.jsx(We,{"code-path":"src/components/deploy/CredentialManager.tsx:202:99",className:"w-3.5 h-3.5 text-green-500"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:204:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>T(r),title:"删除",children:e.jsx(Na,{"code-path":"src/components/deploy/CredentialManager.tsx:206:27",className:"w-3.5 h-3.5"})})]})})]},r.id)})})]})}),e.jsx(_a,{"code-path":"src/components/deploy/CredentialManager.tsx:218:7",open:d,onClose:()=>u(!1),onSaved:()=>k(),editData:x}),e.jsx(wa,{"code-path":"src/components/deploy/CredentialManager.tsx:219:7",open:D,onClose:()=>_(!1),credId:v})]})}export{Oa as default}; +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,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:72:7",className:"sm:max-w-[680px] max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Ge,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:73:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:74:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[f?e.jsx(f.icon,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:20",className:`h-5 w-5 ${f.color}`}):e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:70",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"凭据详情"]})}),h?e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:80:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"加载中..."}):v?e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:82:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:84:13",className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:20",className:"text-[var(--dg-text-muted)]",children:"名称:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:76",className:"text-[var(--dg-text-primary)] font-medium",children:l?.name})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:20",className:"text-[var(--dg-text-muted)]",children:"类型:"}),e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:87:17",variant:"outline",className:`text-xs ml-1 ${aa[s]||""}`,children:f?.label||s})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:20",className:"text-[var(--dg-text-muted)]",children:"状态:"}),l?.is_active?e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:21",className:"bg-green-500/20 text-green-400 text-xs ml-1",children:[e.jsx(We,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:84",className:"h-3 w-3 mr-0.5"}),"启用"]}):e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:21",className:"bg-red-500/20 text-red-400 text-xs ml-1",children:[e.jsx(Xe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:80",className:"h-3 w-3 mr-0.5"}),"禁用"]}),l?.expires_at&&new Date(l.expires_at)_(l?.env_prefix||""),children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:98:17",className:"text-[var(--dg-text-muted)]",children:"引用ID:"}),e.jsx("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:99:17",className:"text-[var(--dg-blue)] font-mono text-xs",children:l?.env_prefix||"无"}),e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:100:17",className:"h-3 w-3 inline ml-1 text-[var(--dg-text-muted)]"})]}),l?.tags?.length>0&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:103:17",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:104:19",className:"text-[var(--dg-text-muted)]",children:"标签:"}),(l?.tags).map(m=>e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:106:21",variant:"outline",className:"text-xs ml-1 border-[var(--dg-border)]",children:m},m))]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:15",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:43",className:"text-[var(--dg-text-muted)]",children:"描述:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:99",className:"text-[var(--dg-text-secondary)]",children:l?.description||"无"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:20",className:"text-[var(--dg-text-muted)]",children:"创建:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.created_at).toLocaleString()})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:20",className:"text-[var(--dg-text-muted)]",children:"更新:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.updated_at).toLocaleString()})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:116:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:117:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)] font-medium mb-3",children:[e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:118:17",className:"h-4 w-4 text-yellow-500"}),"密钥数据"]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:120:15",className:"p-3 rounded-md bg-yellow-500/5 border border-yellow-500/20 mb-3",children:e.jsx("p",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:121:17",className:"text-xs text-yellow-400/80",children:"以下内容包含敏感信息,请妥善保管,不要泄露给他人。"})}),s==="ssh"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:125:17",label:"SSH 用户",value:o.ssh_user}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:126:17",label:"SSH 端口",value:o.ssh_port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:127:17",label:"SSH 密码",value:o.password,sensitive:!0,fieldKey:"ssh_password"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:128:17",label:"私钥",value:o.private_key,sensitive:!0,fieldKey:"ssh_private_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:129:17",label:"公钥",value:o.public_key,fieldKey:"ssh_public_key"})]}),s==="docker"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:132:17",label:"Registry 地址",value:o.server}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:133:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:134:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"docker_password"})]}),s==="tls"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:137:17",label:"证书",value:o.cert,sensitive:!0,fieldKey:"tls_cert"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:138:17",label:"私钥",value:o.key,sensitive:!0,fieldKey:"tls_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:139:17",label:"CA 证书",value:o.ca,sensitive:!0,fieldKey:"tls_ca"})]}),s==="aksk"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:142:17",label:"Access Key ID",value:o.access_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:143:17",label:"Secret Access Key",value:o.secret_key,sensitive:!0,fieldKey:"aksk_secret_key"})]}),s==="database"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:146:17",label:"数据库类型",value:String(o.db_type||"").toUpperCase()}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:147:17",label:"主机",value:o.host}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:148:17",label:"端口",value:o.port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:149:17",label:"数据库名",value:o.db_name}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:150:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:151:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"db_password"})]}),s==="api"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:154:17",label:"API Key",value:o.api_key,sensitive:!0,fieldKey:"api_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:155:17",label:"API 端点",value:o.endpoint})]}),s==="generic"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:158:17",label:"Key",value:o.generic_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:159:17",label:"Value",value:o.generic_value,sensitive:!0,fieldKey:"generic_value"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:164:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:165:15",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:"在流水线/脚本中引用此凭据:"}),e.jsxs("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:166:15",className:"text-xs bg-[var(--dg-bg-tertiary)] px-3 py-1.5 rounded block text-[var(--dg-blue)]",children:["${",String(l?.variable_name||String(l?.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_")),"}"]})]})]}):e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:172:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"未找到凭据数据"}),e.jsx(Qe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:174:9",children:e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:175:11",variant:"outline",onClick:d,children:"关闭"})})]})})}function _a({open:c,onClose:d,onSaved:u,editData:x}){const g=!!x,[v,h]=t.useState(""),[D,_]=t.useState(""),[s,f]=t.useState("ssh"),[o,n]=t.useState(""),[l,m]=t.useState(""),[y,k]=t.useState(!0),[K,I]=t.useState(!1),[T,O]=t.useState({}),[E,L]=t.useState("root"),[r,b]=t.useState("22"),[A,q]=t.useState(""),[F,B]=t.useState(""),[G,U]=t.useState(""),[Q,$]=t.useState(""),[Y,Z]=t.useState(""),[W,X]=t.useState(""),[J,ee]=t.useState(""),[ae,te]=t.useState(""),[re,se]=t.useState(""),[,Te]=t.useState(""),[oe,ne]=t.useState(""),[ce,de]=t.useState(""),[,Ie]=t.useState(""),[le,ie]=t.useState("mysql"),[pe,me]=t.useState(""),[xe,ge]=t.useState("3306"),[he,ye]=t.useState(""),[ve,Ce]=t.useState(""),[ue,De]=t.useState(""),[be,je]=t.useState(""),[Ne,fe]=t.useState(""),[Fe,Se]=t.useState(""),[we,_e]=t.useState("");t.useEffect(()=>{c&&(x?(h(x.name),_(x.variable_name||""),f(x.secret_type),n(x.description||""),m((x.tags||[]).join(", ")),k(x.is_active),L(""),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")):(h(""),_(""),f("ssh"),n(""),m(""),k(!0),L("root"),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")),O({}))},[x,c]);const ta=a=>O(C=>({...C,[a]:!C[a]})),ra=async()=>{if(!v.trim()){S.error("请填写凭据名称");return}I(!0);try{const a={name:v.trim(),secret_type:s,description:o.trim(),tags:l.split(",").map(C=>C.trim()).filter(Boolean),is_active:y};D.trim()&&(a.variable_name=D.trim()),s==="ssh"?(E.trim()&&(a.ssh_user=E.trim()),r&&(a.ssh_port=parseInt(r)||22),A.trim()&&(a.ssh_password=A.trim()),F.trim()&&(a.ssh_private_key=F.trim()),G.trim()&&(a.ssh_public_key=G.trim())):s==="docker"?(Q.trim()&&(a.docker_server=Q.trim()),Y.trim()&&(a.docker_username=Y.trim()),W.trim()&&(a.docker_password=W.trim())):s==="tls"?(J.trim()&&(a.tls_cert=J.trim()),ae.trim()&&(a.tls_key=ae.trim()),re.trim()&&(a.tls_ca=re.trim())):s==="aksk"?(oe.trim()&&(a.aksk_access_key=oe.trim()),ce.trim()&&(a.aksk_secret_key=ce.trim())):s==="database"?(le.trim()&&(a.db_type=le.trim()),pe.trim()&&(a.db_host=pe.trim()),xe&&(a.db_port=parseInt(xe)||3306),he.trim()&&(a.db_name=he.trim()),ve.trim()&&(a.db_username=ve.trim()),ue.trim()&&(a.db_password=ue.trim())):s==="api"?(be.trim()&&(a.api_key=be.trim()),Ne.trim()&&(a.api_endpoint=Ne.trim())):s==="generic"&&(Fe.trim()&&(a.generic_key=Fe.trim()),we.trim()&&(a.generic_value=we.trim())),g?(await P.update(x.id,a),S.success("已更新")):(await P.create(a),S.success("已创建")),u(),d()}catch(a){const C=a;S.error(C?.response?.data?.message||"操作失败")}finally{I(!1)}},j=({label:a,value:C,onChange:Le,placeholder:qe,fieldKey:He,required:sa,isLong:oa})=>{const Oe=T[He];return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:163:7",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:9",className:"text-[var(--dg-text-secondary)] text-xs",children:[a,sa&&!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:99",className:"text-red-400",children:" *"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:165:9",className:"relative",children:[oa?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:167:13",value:C,onChange:ke=>Le(ke.target.value),placeholder:qe,rows:5,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-sm font-mono placeholder:text-[var(--dg-text-muted)]"}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:171:13",value:C,onChange:ke=>Le(ke.target.value),type:Oe?"text":"password",placeholder:qe,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] pr-10 font-mono text-sm"}),e.jsx("button",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:175:11",type:"button",onClick:()=>ta(He),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] text-xs",children:Oe?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:21",className:"h-3.5 w-3.5"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:58",className:"h-3.5 w-3.5"})})]})]})},R=H[s],Ee=R?.icon||z;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:188:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:189:7",className:"sm:max-w-[620px] max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(Ge,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:190:9",children:[e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:191:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:192:13",className:`h-5 w-5 ${R?.color||""}`}),g?"编辑凭据":"新增凭据"]}),e.jsx(ca,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:195:11",className:"text-[var(--dg-text-muted)] text-xs",children:R?.desc||"管理敏感凭据信息"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:199:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:201:11",className:"border-b border-[var(--dg-border)] pb-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:202:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2",children:"基本信息"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:203:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:204:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["凭据名称 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:206:17",value:v,onChange:a=>h(a.target.value),placeholder:"如:生产环境 SSH",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:209:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:210:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"变量别名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:211:17",value:D,onChange:a=>_(a.target.value),placeholder:"如:MYSQL_PROD",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:214:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["类型",!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:90",className:"text-red-400",children:" *"})]}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:216:17",value:s,onValueChange:a=>f(a),disabled:g,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:217:19",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:218:21"})}),e.jsx(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:220:19",className:"max-h-[300px]",children:Object.entries(H).map(([a,C])=>e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:222:23",value:a,children:e.jsxs("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:25",className:"flex items-center gap-2",children:[e.jsx(C.icon,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:67",className:"h-4 w-4"}),C.label]})},a))})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:229:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:230:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"标签"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:231:17",value:l,onChange:a=>m(a.target.value),placeholder:"生产环境, 阿里云",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:235:13",className:"mt-2 space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:236:15",className:"text-[var(--dg-text-secondary)] text-xs",children:"描述"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:237:15",value:o,onChange:a=>n(a.target.value),placeholder:"可选备注信息",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:243:11",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:244:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:245:15",className:"h-3.5 w-3.5"}),R?.label||s," 配置",g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:246:26",className:"text-[var(--dg-text-muted)]",children:"(仅填写需要修改的字段)"})]}),s==="ssh"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:250:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:251:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:252:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 用户"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:253:19",value:E,onChange:a=>L(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:256:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:257:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:258:19",value:r,onChange:a=>b(a.target.value),placeholder:"22",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:261:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:262:19",label:"SSH 密码",value:A,onChange:q,placeholder:"密码(或留空用密钥)",fieldKey:"ssh_pwd"})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:265:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:266:19",label:"私钥内容",value:F,onChange:B,placeholder:"粘贴 SSH 私钥...",fieldKey:"ssh_pk",isLong:!0})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:269:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:270:19",label:"公钥内容",value:G,onChange:U,placeholder:"粘贴 SSH 公钥...",fieldKey:"ssh_pub",isLong:!0})})]}),s==="docker"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:277:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:278:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Registry 地址 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:90",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:280:19",value:Q,onChange:a=>$(a.target.value),placeholder:"registry.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:283:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:284:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:285:19",value:Y,onChange:a=>Z(a.target.value),placeholder:"admin",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:22",label:"密码",value:W,onChange:X,placeholder:"Registry 密码",fieldKey:"docker_pwd",required:!0})})]}),s==="tls"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:294:15",className:"space-y-3",children:[e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:295:17",label:"证书 (PEM)",value:J,onChange:ee,placeholder:"-----BEGIN CERTIFICATE-----",fieldKey:"tls_cert",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:297:17",label:"私钥 (PEM)",value:ae,onChange:te,placeholder:"-----BEGIN PRIVATE KEY-----",fieldKey:"tls_key",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:299:17",label:"CA 证书",value:re,onChange:se,placeholder:"CA 证书内容...",fieldKey:"tls_ca",isLong:!0})]}),s==="aksk"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:305:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:306:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Access Key ID ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:92",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:308:19",value:oe,onChange:a=>ne(a.target.value),placeholder:"AKIDxxxx...",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:311:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:312:19",label:"Secret Access Key",value:ce,onChange:de,placeholder:"输入 Secret Key",fieldKey:"aksk_sk",required:!0})})]}),s==="database"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:319:15",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:320:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:321:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库类型"}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:322:19",value:le,onValueChange:ie,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:323:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:324:23"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:326:21",children:[e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:327:23",value:"mysql",children:"MySQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:328:23",value:"postgres",children:"PostgreSQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:329:23",value:"mongodb",children:"MongoDB"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:330:23",value:"redis",children:"Redis"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:331:23",value:"mssql",children:"SQL Server"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:332:23",value:"oracle",children:"Oracle"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:336:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["主机 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:338:19",value:pe,onChange:a=>me(a.target.value),placeholder:"10.0.0.1",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:341:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:342:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:343:19",value:xe,onChange:a=>ge(a.target.value),placeholder:"3306",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:346:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:347:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:348:19",value:he,onChange:a=>ye(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/credential-manager/CredFormDialog.tsx:351:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:352:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:353:19",value:ve,onChange:a=>Ce(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:22",label:"密码",value:ue,onChange:De,placeholder:"数据库密码",fieldKey:"db_pwd"})})]}),s==="api"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:362:15",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:363:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:364:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"API 端点"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:365:19",value:Ne,onChange:a=>fe(a.target.value),placeholder:"https://api.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:368:17",label:"API Key / Token",value:be,onChange:je,placeholder:"sk-xxxx...",fieldKey:"api_key",required:!0})]}),s==="generic"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:374:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Key ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:82",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:377:19",value:Fe,onChange:a=>Se(a.target.value),placeholder:"MY_SECRET",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:380:17",label:"Value",value:we,onChange:_e,placeholder:"密钥值",fieldKey:"generic_val",required:!0})]})]})]}),e.jsxs(Qe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:386:9",children:[e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:387:11",variant:"outline",onClick:d,children:"取消"}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:388:11",onClick:ra,disabled:K,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/80",children:K?"保存中...":g?"更新":"创建"})]})]})})}function Oa(){const c=da(),[d,u]=t.useState(!1),[x,g]=t.useState(null),[v,h]=t.useState(null),[D,_]=t.useState(!1),[s,f]=t.useState("all"),[o,n]=t.useState(""),l={page_size:100,...o?{search:o}:{},...s&&s!=="all"?{secret_type:s}:{}},{data:m=[],isLoading:y,refetch:k}=fa(l),{deleteMutation:K,toggleActiveMutation:I}=Sa(),T=async r=>{if(await c({title:"删除凭据",description:`确定删除凭据「${r.name}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await K.mutateAsync(r.id),S.success("已删除")}catch{S.error("删除失败")}},O=async r=>{try{await I.mutateAsync({id:r.id,isActive:!r.is_active}),S.success(r.is_active?"已禁用":"已启用")}catch{S.error("操作失败")}},E=r=>{navigator.clipboard.writeText(r),S.success("引用 ID 已复制")},L=Object.entries(H);return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:68:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:69:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:70:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/CredentialManager.tsx:71:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"凭据管理"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:72:11",className:"text-sm text-[var(--dg-text-muted)] mt-0.5",children:"统一管理 SSH 密钥、Docker 密码、AKSK、数据库等敏感凭据(AES 加密存储)"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:76:9",className:"flex items-center gap-2",children:[e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:77:11",variant:"outline",size:"sm",onClick:()=>k(),children:[e.jsx(Ca,{"code-path":"src/components/deploy/CredentialManager.tsx:78:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:80:11",size:"sm",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:81:13",className:"w-4 h-4 mr-1"}),"新增凭据"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:87:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(Me,{"code-path":"src/components/deploy/CredentialManager.tsx:88:9",value:s,onValueChange:f,children:[e.jsx(Ke,{"code-path":"src/components/deploy/CredentialManager.tsx:89:11",className:"w-[140px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm",children:e.jsx(Ae,{"code-path":"src/components/deploy/CredentialManager.tsx:90:13",placeholder:"全部类型"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/CredentialManager.tsx:92:11",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:93:13",value:"all",children:"全部类型"}),L.map(([r,b])=>e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:95:15",value:r,children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:96:17",className:"flex items-center gap-2",children:[e.jsx(b.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:96:59",className:"h-3.5 w-3.5"}),b.label]})},r))]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:101:9",className:"relative flex-1 max-w-xs",children:[e.jsx(ua,{"code-path":"src/components/deploy/CredentialManager.tsx:102:11",className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(p,{"code-path":"src/components/deploy/CredentialManager.tsx:103:11",value:o,onChange:r=>n(r.target.value),placeholder:"搜索名称、描述...",className:"pl-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm"})]}),e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:107:9",className:"text-xs text-[var(--dg-text-muted)]",children:[m.length," 个凭据"]})]}),y?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(Da,{"code-path":"src/components/deploy/CredentialManager.tsx:112:11",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-blue)]"}),"加载中..."]}):m.length===0?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:115:9",className:"text-center py-16 border border-dashed border-[var(--dg-border)] rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/deploy/CredentialManager.tsx:116:11",className:"w-12 h-12 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:117:11",className:"text-[var(--dg-text-secondary)] mb-2",children:"暂无凭据"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:118:11",className:"text-xs text-[var(--dg-text-muted)] mb-4",children:"创建 SSH、Docker、AKSK 等类型的凭据,供流水线和服务器使用"}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:119:11",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:120:13",className:"w-4 h-4 mr-1"}),"创建第一个凭据"]})]}):e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:124:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/CredentialManager.tsx:125:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",children:[e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:128:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:129:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:130:17",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/CredentialManager.tsx:131:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden lg:table-cell",children:"标签"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:132:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden xl:table-cell",children:"引用ID"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:133:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:134:17",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/CredentialManager.tsx:137:13",children:m.map(r=>{const b=r.secret_type,A=H[b],q=r.expires_at&&new Date(r.expires_at){h(r.id),_(!0)},children:[e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:146:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:147:23",className:"flex items-center gap-2",children:[A?e.jsx(A.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:148:32",className:`h-4 w-4 ${A.color} shrink-0`}):e.jsx(z,{"code-path":"src/components/deploy/CredentialManager.tsx:148:91",className:"h-4 w-4 text-[var(--dg-text-muted)] shrink-0"}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:149:25",children:[e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:150:27",className:"font-medium text-[var(--dg-text-primary)]",children:r.name}),r.variable_name&&e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:152:29",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:r.variable_name})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:157:21",className:"px-3 py-2.5",children:e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:158:23",variant:"outline",className:`text-xs ${aa[b]||""}`,children:A?.label||b})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:162:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] text-xs hidden md:table-cell max-w-[180px] truncate font-mono",children:r.summary||"-"}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:165:21",className:"px-3 py-2.5 hidden lg:table-cell",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:166:23",className:"flex gap-1 flex-wrap",children:[(r.tags||[]).slice(0,3).map(F=>e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:168:27",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:F},F)),(r.tags||[]).length>3&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:171:27",className:"text-xs text-[var(--dg-text-muted)]",children:["+",r.tags.length-3]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:175:21",className:"px-3 py-2.5 hidden xl:table-cell",children:e.jsx("code",{"code-path":"src/components/deploy/CredentialManager.tsx:176:23",className:"text-xs text-[var(--dg-blue)] cursor-pointer font-mono",onClick:F=>{F.stopPropagation(),E(r.env_prefix)},children:r.env_prefix})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:181:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:182:23",className:"flex items-center gap-1",children:[r.is_active?e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:184:27",className:"bg-green-500/20 text-green-400 text-xs border-0",children:"启用"}):e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:186:27",className:"bg-red-500/20 text-red-400 text-xs border-0",children:"禁用"}),q&&e.jsxs(w,{"code-path":"src/components/deploy/CredentialManager.tsx:189:27",className:"bg-yellow-500/20 text-yellow-400 text-xs border-0",children:[e.jsx(ba,{"code-path":"src/components/deploy/CredentialManager.tsx:189:96",className:"h-2.5 w-2.5 mr-0.5"}),"过期"]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:193:21",className:"px-3 py-2.5 text-right",onClick:F=>F.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:194:23",className:"flex justify-end gap-1",children:[e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:195:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{g(r),u(!0)},title:"编辑",children:e.jsx(ja,{"code-path":"src/components/deploy/CredentialManager.tsx:197:27",className:"w-3.5 h-3.5"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:199:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>O(r),title:r.is_active?"禁用":"启用",children:r.is_active?e.jsx(Xe,{"code-path":"src/components/deploy/CredentialManager.tsx:202:45",className:"w-3.5 h-3.5 text-yellow-500"}):e.jsx(We,{"code-path":"src/components/deploy/CredentialManager.tsx:202:99",className:"w-3.5 h-3.5 text-green-500"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:204:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>T(r),title:"删除",children:e.jsx(Na,{"code-path":"src/components/deploy/CredentialManager.tsx:206:27",className:"w-3.5 h-3.5"})})]})})]},r.id)})})]})}),e.jsx(_a,{"code-path":"src/components/deploy/CredentialManager.tsx:218:7",open:d,onClose:()=>u(!1),onSaved:()=>k(),editData:x}),e.jsx(wa,{"code-path":"src/components/deploy/CredentialManager.tsx:219:7",open:D,onClose:()=>_(!1),credId:v})]})}export{Oa as default}; diff --git a/backend/static/assets/CronJobManager-BQpVfKVA.js b/backend/static/assets/CronJobManager-Dow5NQrR.js similarity index 98% rename from backend/static/assets/CronJobManager-BQpVfKVA.js rename to backend/static/assets/CronJobManager-Dow5NQrR.js index a63d4c1..29c4bf7 100644 --- a/backend/static/assets/CronJobManager-BQpVfKVA.js +++ b/backend/static/assets/CronJobManager-Dow5NQrR.js @@ -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-path":"src/components/automation/CronJobFormDialog.tsx:159:13",value:a.name,onChange:e=>d({...a,name:e.target.value}),placeholder:"例如: 数据库备份",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:168:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:169:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:170:13",value:a.description,onChange:e=>d({...a,description:e.target.value}),placeholder:"任务描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:180:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:181:13",className:"text-[var(--dg-text-primary)]",children:"Cron 表达式"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:182:13",className:"flex gap-2",children:[t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:183:15",value:a.cron_expr,onChange:e=>d({...a,cron_expr:e.target.value}),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"}),t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:189:15",onValueChange:e=>d({...a,cron_expr:e}),children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:190:17",className:"w-48 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:191:19",placeholder:"快速选择"})}),t.jsxs(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:193:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:194:19",value:"*/5 * * * *",className:"text-[var(--dg-text-primary)]",children:"每 5 分钟"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:195:19",value:"0 * * * *",className:"text-[var(--dg-text-primary)]",children:"每小时"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:196:19",value:"0 2 * * *",className:"text-[var(--dg-text-primary)]",children:"每天 02:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:197:19",value:"0 3 * * 0",className:"text-[var(--dg-text-primary)]",children:"每周日 03:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:198:19",value:"0 9 * * 1",className:"text-[var(--dg-text-primary)]",children:"每周一 09:00"})]})]})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:202:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"格式: 分 时 日 月 周"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:206:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:207:13",className:"text-[var(--dg-text-primary)]",children:"执行类型"}),t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:208:13",className:"grid grid-cols-3 gap-2 mt-1",children:Q.map(e=>t.jsx("button",{"code-path":"src/components/automation/CronJobFormDialog.tsx:210:17",type:"button",onClick:()=>T(e.value),className:`px-3 py-2 rounded-md border text-sm transition-colors text-left ${a.type===e.value?"border-[var(--dg-blue)] bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)]"}`,children:t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:220:19",className:"font-medium",children:e.label})},e.value))}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:224:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Q.find(e=>e.value===a.type)?.desc})]}),a.type==="shell"||a.type==="python"?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:231:13",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:232:15",children:[t.jsxs(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:233:17",className:"text-[var(--dg-text-primary)]",children:["选择脚本 ",t.jsx("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:234:24",className:"text-red-400",children:"*"})]}),M.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:237:19",className:"mt-1 px-3 py-4 rounded-md border border-dashed border-[var(--dg-border)] text-center",children:[t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:238:21",className:"text-sm text-[var(--dg-text-muted)]",children:["脚本库中没有 ",a.type==="shell"?"Shell":"Python"," 脚本"]}),t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:241:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:["请先到「脚本库」创建 ",a.type==="shell"?"Shell":"Python"," 脚本"]})]}):t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:246:19",value:a.script_id?String(a.script_id):"",onValueChange:E,children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:250:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:251:23",placeholder:"选择脚本库中的脚本..."})}),t.jsx(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:253:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:M.map(e=>t.jsxs(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:255:25",value:String(e.id),className:"text-[var(--dg-text-primary)]",children:[e.name,e.description?` — ${e.description}`:""]},e.id))})]})]}),r&&t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:266:17",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:267:19",className:"flex items-center gap-2 mb-1",children:[t.jsx(C,{"code-path":"src/components/automation/CronJobFormDialog.tsx:268:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:r.type==="shell"?"Shell":"Python"}),t.jsxs("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:271:21",className:"text-xs text-[var(--dg-text-muted)]",children:[(r.content||"").split(` +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-path":"src/components/automation/CronJobFormDialog.tsx:159:13",value:a.name,onChange:e=>d({...a,name:e.target.value}),placeholder:"例如: 数据库备份",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:168:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:169:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:170:13",value:a.description,onChange:e=>d({...a,description:e.target.value}),placeholder:"任务描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:180:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:181:13",className:"text-[var(--dg-text-primary)]",children:"Cron 表达式"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:182:13",className:"flex gap-2",children:[t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:183:15",value:a.cron_expr,onChange:e=>d({...a,cron_expr:e.target.value}),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"}),t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:189:15",onValueChange:e=>d({...a,cron_expr:e}),children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:190:17",className:"w-48 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:191:19",placeholder:"快速选择"})}),t.jsxs(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:193:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:194:19",value:"*/5 * * * *",className:"text-[var(--dg-text-primary)]",children:"每 5 分钟"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:195:19",value:"0 * * * *",className:"text-[var(--dg-text-primary)]",children:"每小时"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:196:19",value:"0 2 * * *",className:"text-[var(--dg-text-primary)]",children:"每天 02:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:197:19",value:"0 3 * * 0",className:"text-[var(--dg-text-primary)]",children:"每周日 03:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:198:19",value:"0 9 * * 1",className:"text-[var(--dg-text-primary)]",children:"每周一 09:00"})]})]})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:202:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"格式: 分 时 日 月 周"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:206:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:207:13",className:"text-[var(--dg-text-primary)]",children:"执行类型"}),t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:208:13",className:"grid grid-cols-3 gap-2 mt-1",children:Q.map(e=>t.jsx("button",{"code-path":"src/components/automation/CronJobFormDialog.tsx:210:17",type:"button",onClick:()=>T(e.value),className:`px-3 py-2 rounded-md border text-sm transition-colors text-left ${a.type===e.value?"border-[var(--dg-blue)] bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)]"}`,children:t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:220:19",className:"font-medium",children:e.label})},e.value))}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:224:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Q.find(e=>e.value===a.type)?.desc})]}),a.type==="shell"||a.type==="python"?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:231:13",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:232:15",children:[t.jsxs(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:233:17",className:"text-[var(--dg-text-primary)]",children:["选择脚本 ",t.jsx("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:234:24",className:"text-red-400",children:"*"})]}),M.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:237:19",className:"mt-1 px-3 py-4 rounded-md border border-dashed border-[var(--dg-border)] text-center",children:[t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:238:21",className:"text-sm text-[var(--dg-text-muted)]",children:["脚本库中没有 ",a.type==="shell"?"Shell":"Python"," 脚本"]}),t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:241:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:["请先到「脚本库」创建 ",a.type==="shell"?"Shell":"Python"," 脚本"]})]}):t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:246:19",value:a.script_id?String(a.script_id):"",onValueChange:E,children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:250:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:251:23",placeholder:"选择脚本库中的脚本..."})}),t.jsx(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:253:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:M.map(e=>t.jsxs(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:255:25",value:String(e.id),className:"text-[var(--dg-text-primary)]",children:[e.name,e.description?` — ${e.description}`:""]},e.id))})]})]}),r&&t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:266:17",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:267:19",className:"flex items-center gap-2 mb-1",children:[t.jsx(C,{"code-path":"src/components/automation/CronJobFormDialog.tsx:268:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:r.type==="shell"?"Shell":"Python"}),t.jsxs("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:271:21",className:"text-xs text-[var(--dg-text-muted)]",children:[(r.content||"").split(` `).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:23",children:tt(r.status)}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:84:23",className:"text-[var(--dg-text-secondary)]",children:r.duration?`${r.duration}ms`:"--"}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:85:23",className:"text-[var(--dg-text-secondary)]",children:r.started_at?new Date(r.started_at).toLocaleString():"--"}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:88:23",className:"text-[var(--dg-text-secondary)]",children:r.output?t.jsxs("span",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:90:27",className:"text-blue-400 text-xs flex items-center gap-1",children:[t.jsx(Z,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:91:29",className:"h-3 w-3"}),h===r.id?"收起":"查看"]}):"--"})]}),h===r.id&&r.output&&t.jsx(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:100:23",className:"border-[var(--dg-border)]",children:t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:101:25",colSpan:5,className:"bg-[var(--dg-bg-tertiary)] p-0",children:t.jsx("pre",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:102:27",className:"p-4 text-xs text-[var(--dg-text-primary)] font-mono whitespace-pre-wrap max-h-64 overflow-y-auto",children:r.output})})},`${r.id}-out`)]},r.id))})]})})]})})}function qt(){const[i,g]=n.useState(""),[s,D]=n.useState([]),[a,d]=n.useState(!0),[h,v]=n.useState(!1),[r,m]=n.useState(!1),[S,F]=n.useState(!1),[M,E]=n.useState(null),[T,H]=n.useState(null),[e,x]=n.useState([]),j=pt(),ot=()=>{H(null),m(!0)},et=o=>{H(o),m(!0)},u=n.useCallback(async()=>{v(!0);try{const o=await y.getJobs();D(o.list||[])}catch(o){console.error("Failed to load cron jobs:",o),l.error("加载失败")}finally{v(!1),d(!1)}},[]);n.useEffect(()=>{u()},[u]);const b=s.filter(o=>(o.name||"").toLowerCase().includes(i.toLowerCase())||(o.description||"").toLowerCase().includes(i.toLowerCase())),at=async o=>{try{await y.toggleJob(o),l.success("状态已切换"),u()}catch(c){console.error("Failed to toggle job:",c),l.error("操作失败")}},st=async o=>{E(o);try{const c=await y.executeJob(o);(c?.status||"success")==="success"?l.success("执行成功",{description:`耗时 ${c?.duration||0}ms`}):l.error("执行失败",{description:(c?.output||"").slice(0,100)}),u()}catch(c){console.error("Failed to execute job:",c),l.error("执行失败")}finally{E(null)}},rt=async o=>{if(await j({title:"删除定时任务",description:`确定删除「${o.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await y.deleteJob(o.id),l.success("任务已删除"),u()}catch(_){console.error("Failed to delete job:",_),l.error("删除失败")}},nt=o=>{x(c=>c.includes(o)?c.filter(_=>_!==o):[...c,o])},ct=()=>{e.length===b.length&&b.length>0?x([]):x(b.map(o=>o.id))},it=async()=>{if(!(e.length===0||!await j({title:"批量删除定时任务",description:`确定删除选中的 ${e.length} 个任务吗?此操作不可恢复。`,confirmText:"批量删除",variant:"destructive"})))try{await y.batchDelete(e),l.success(`已删除 ${e.length} 个任务`),x([]),u()}catch(c){console.error("Failed to batch delete jobs:",c),l.error("批量删除失败")}};return t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:165:5",className:"space-y-6",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:167:7",className:"flex items-center justify-between",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:168:9",children:[t.jsx("h1",{"code-path":"src/components/automation/CronJobManager.tsx:169:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"定时任务"}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:170:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Cron 任务管理与执行"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:172:9",className:"flex items-center gap-2",children:[t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:173:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>F(!0),children:[t.jsx(Y,{"code-path":"src/components/automation/CronJobManager.tsx:178:13",className:"h-4 w-4 mr-2"}),"执行历史"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:181:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>u(),disabled:h,children:[t.jsx(bt,{"code-path":"src/components/automation/CronJobManager.tsx:187:13",className:`h-4 w-4 mr-2 ${h?"animate-spin":""}`}),"刷新"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:190:11",className:"bg-blue-600 hover:bg-blue-700",onClick:ot,children:[t.jsx(vt,{"code-path":"src/components/automation/CronJobManager.tsx:191:13",className:"h-4 w-4 mr-2"}),"新建任务"]})]})]}),t.jsx(mt,{"code-path":"src/components/automation/CronJobManager.tsx:198:7",items:[{label:"任务总数",value:s.length,color:"blue"},{label:"已启用",value:s.filter(o=>o.enabled).length,color:"emerald"},{label:"累计成功",value:s.reduce((o,c)=>o+(c.success_count||0),0),color:"emerald"},{label:"累计失败",value:s.reduce((o,c)=>o+(c.fail_count||0),0),color:"red"}]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:208:7",className:"flex items-center justify-between flex-wrap gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:209:9",className:"flex items-center gap-3 flex-wrap",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:210:11",className:"relative flex-1 max-w-md",children:[t.jsx(yt,{"code-path":"src/components/automation/CronJobManager.tsx:211:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),t.jsx(P,{"code-path":"src/components/automation/CronJobManager.tsx:212:13",placeholder:"搜索任务...",value:i,onChange:o=>g(o.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),b.length>0&&t.jsxs("label",{"code-path":"src/components/automation/CronJobManager.tsx:220:13",className:"flex items-center gap-2 text-sm text-[var(--dg-text-secondary)] cursor-pointer select-none",children:[t.jsx(I,{"code-path":"src/components/automation/CronJobManager.tsx:221:15",checked:e.length===b.length&&b.length>0,onCheckedChange:ct,className:"border-[var(--dg-border)]"}),"全选"]})]}),e.length>0&&t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:233:11",className:"flex items-center gap-2",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:234:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["已选择 ",e.length," 项"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:235:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:it,children:[t.jsx(z,{"code-path":"src/components/automation/CronJobManager.tsx:241:15",className:"h-4 w-4 mr-2"}),"批量删除"]})]})]}),a?t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:249:9",className:"flex items-center justify-center py-12",children:t.jsx(k,{"code-path":"src/components/automation/CronJobManager.tsx:250:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):b.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:253:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-secondary)]",children:[t.jsx(Ct,{"code-path":"src/components/automation/CronJobManager.tsx:254:11",className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:255:11",className:"text-sm",children:"暂无定时任务"})]}):null,t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:260:7",className:"space-y-3",children:b.map(o=>t.jsx(lt,{"code-path":"src/components/automation/CronJobManager.tsx:262:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(dt,{"code-path":"src/components/automation/CronJobManager.tsx:263:13",className:"p-4",children:t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:264:15",className:"flex items-start justify-between gap-3",children:[t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:265:17",className:"flex items-center pt-1",children:t.jsx(I,{"code-path":"src/components/automation/CronJobManager.tsx:266:19",checked:e.includes(o.id),onCheckedChange:()=>nt(o.id),className:"border-[var(--dg-border)]"})}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:272:17",className:"flex-1 min-w-0",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:273:19",className:"flex items-center gap-3 flex-wrap",children:[t.jsx("h3",{"code-path":"src/components/automation/CronJobManager.tsx:274:21",className:"font-medium text-[var(--dg-text-primary)]",children:o.name}),t.jsx(C,{"code-path":"src/components/automation/CronJobManager.tsx:275:21",variant:"outline",className:o.enabled?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:o.enabled?"已启用":"已禁用"}),tt(o.last_status),t.jsx(C,{"code-path":"src/components/automation/CronJobManager.tsx:286:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:o.type==="shell"?"Shell":o.type==="python"?"Python":"命令"})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:290:19",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:o.description||"—"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:291:19",className:"flex items-center gap-4 mt-2 text-sm",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:292:21",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(jt,{"code-path":"src/components/automation/CronJobManager.tsx:293:23",className:"h-3 w-3"}),wt(o.cron_expr)]}),(o.type==="shell"||o.type==="python")&&o.script?.name?t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:297:23",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(Jt,{"code-path":"src/components/automation/CronJobManager.tsx:298:25",className:"h-3 w-3"}),t.jsx("span",{"code-path":"src/components/automation/CronJobManager.tsx:299:25",className:"text-xs",children:o.script.name})]}):o.content&&t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:302:23",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(Z,{"code-path":"src/components/automation/CronJobManager.tsx:303:25",className:"h-3 w-3"}),t.jsx("code",{"code-path":"src/components/automation/CronJobManager.tsx:304:25",className:"text-xs bg-[var(--dg-bg-tertiary)] px-2 py-0.5 rounded truncate max-w-xs",children:o.content})]})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:310:19",className:"flex items-center gap-4 mt-2 text-xs text-[var(--dg-text-muted)]",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:311:21",children:["上次执行: ",o.last_run_at?new Date(o.last_run_at).toLocaleString():"--"]}),t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:312:21",children:["成功: ",o.success_count||0," / 失败: ",o.fail_count||0]}),t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:313:21",children:["累计: ",o.run_count||0," 次"]})]})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:317:17",className:"flex items-center gap-2 shrink-0",children:[t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:318:19",variant:"outline",size:"sm",className:"border-emerald-600 text-emerald-400 hover:bg-emerald-600/20",disabled:M===o.id,onClick:()=>st(o.id),children:[M===o.id?t.jsx(k,{"code-path":"src/components/automation/CronJobManager.tsx:326:23",className:"h-4 w-4 mr-1 animate-spin"}):t.jsx(B,{"code-path":"src/components/automation/CronJobManager.tsx:328:23",className:"h-4 w-4 mr-1"}),"立即执行"]}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:332:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-blue-400",title:o.enabled?"禁用":"启用",onClick:()=>at(o.id),children:o.enabled?t.jsx(Nt,{"code-path":"src/components/automation/CronJobManager.tsx:339:36",className:"h-4 w-4"}):t.jsx(B,{"code-path":"src/components/automation/CronJobManager.tsx:339:68",className:"h-4 w-4"})}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:341:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-blue-400",title:"编辑",onClick:()=>et(o),children:t.jsx(ft,{"code-path":"src/components/automation/CronJobManager.tsx:348:21",className:"h-4 w-4"})}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:350:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-red-400",title:"删除",onClick:()=>rt(o),children:t.jsx(z,{"code-path":"src/components/automation/CronJobManager.tsx:357:21",className:"h-4 w-4"})})]})]})})},o.id))}),t.jsx(St,{"code-path":"src/components/automation/CronJobManager.tsx:367:7",open:r,onOpenChange:m,editJob:T,onSuccess:u}),t.jsx(Et,{"code-path":"src/components/automation/CronJobManager.tsx:375:7",open:S,onOpenChange:F})]})}export{qt as CronJobManager}; diff --git a/backend/static/assets/Dashboard-C3Mgk4Hy.js b/backend/static/assets/Dashboard-DQzWxW5H.js similarity index 99% rename from backend/static/assets/Dashboard-C3Mgk4Hy.js rename to backend/static/assets/Dashboard-DQzWxW5H.js index 10800ad..4a8fb21 100644 --- a/backend/static/assets/Dashboard-C3Mgk4Hy.js +++ b/backend/static/assets/Dashboard-DQzWxW5H.js @@ -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=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=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);r0&&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=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;rQe?c=o==="outer"?"start":"end":n<-Qe?c=o==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var e=this.props,o=e.cx,n=e.cy,c=e.radius,d=e.axisLine,l=e.axisLineType,i=Z(Z({},C(this.props,!1)),{},{fill:"none"},C(d,!1));if(l==="circle")return m.createElement(Lt,Y({className:"recharts-polar-angle-axis-line"},i,{cx:o,cy:n,r:c}));var p=this.props.ticks,x=p.map(function(b){return I(o,n,c,b.coordinate)});return m.createElement(ra,Y({className:"recharts-polar-angle-axis-line"},i,{points:x}))}},{key:"renderTicks",value:function(){var e=this,o=this.props,n=o.ticks,c=o.tick,d=o.tickLine,l=o.tickFormatter,i=o.stroke,p=C(this.props,!1),x=C(c,!1),b=Z(Z({},p),{},{fill:"none"},C(d,!1)),N=n.map(function(f,h){var v=e.getTickLineCoord(f),y=e.getTickTextAnchor(f),j=Z(Z(Z({textAnchor:y},p),{},{stroke:"none",fill:i},x),{},{index:h,payload:f,x:v.x2,y:v.y2});return m.createElement(T,Y({className:K("recharts-polar-angle-axis-tick",lt(c)),key:"tick-".concat(f.coordinate)},Te(e.props,f,h)),d&&m.createElement("line",Y({className:"recharts-polar-angle-axis-tick-line"},b,v)),c&&a.renderTickItem(c,j,l?l(f.value,h):f.value))});return m.createElement(T,{className:"recharts-polar-angle-axis-ticks"},N)}},{key:"render",value:function(){var e=this.props,o=e.ticks,n=e.radius,c=e.axisLine;return n<=0||!o||!o.length?null:m.createElement(T,{className:K("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(e,o,n){var c;return m.isValidElement(e)?c=m.cloneElement(e,o):X(e)?c=e(o):c=m.createElement(Ee,Y({},o,{className:"recharts-polar-angle-axis-tick-value"}),n),c}}])})(R.PureComponent);je(De,"displayName","PolarAngleAxis");je(De,"axisType","angleAxis");je(De,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ue;function ne(t){"@babel/helpers - typeof";return ne=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},ne(t)}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var a=1;a0?Mt(k,"paddingAngle",0):0;if(w){var F=Ue(w.endAngle-w.startAngle,k.endAngle-k.startAngle),D=g(g({},k),{},{startAngle:j+_,endAngle:j+F(h)+_});v.push(D),j=D.endAngle}else{var M=k.endAngle,O=k.startAngle,W=Ue(0,M-O),G=W(h),E=g(g({},k),{},{startAngle:j+_,endAngle:j+G+_});v.push(E),j=E.endAngle}}),m.createElement(T,null,e.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(e){var o=this;e.onkeydown=function(n){if(!n.altKey)switch(n.key){case"ArrowLeft":{var c=++o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[c].focus(),o.setState({sectorToFocus:c});break}case"ArrowRight":{var d=--o.state.sectorToFocus<0?o.sectorRefs.length-1:o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[d].focus(),o.setState({sectorToFocus:d});break}case"Escape":{o.sectorRefs[o.state.sectorToFocus].blur(),o.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var e=this.props,o=e.sectors,n=e.isAnimationActive,c=this.state.prevSectors;return n&&o&&o.length&&(!c||!Kt(c,o))?this.renderSectorsWithAnimation():this.renderSectorsStatically(o)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,o=this.props,n=o.hide,c=o.sectors,d=o.className,l=o.label,i=o.cx,p=o.cy,x=o.innerRadius,b=o.outerRadius,N=o.isAnimationActive,f=this.state.isAnimationFinished;if(n||!c||!c.length||!Q(i)||!Q(p)||!Q(x)||!Q(b))return null;var h=K("recharts-pie",d);return m.createElement(T,{tabIndex:this.props.rootTabIndex,className:h,ref:function(y){e.pieRef=y}},this.renderSectors(),l&&this.renderLabels(c),ht.renderCallByParent(this.props,null,!1),(!N||f)&&Bt.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(e,o){return o.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==o.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:o.curSectors,isAnimationFinished:!0}:e.sectors!==o.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,o){return e>o?"start":e=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",className:"text-2xl font-bold text-[var(--dg-text-primary)] tracking-tight",children:["¥",Number(n).toLocaleString()]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:134:13",className:u("text-xs font-medium mt-0.5",c.direction==="up"?"text-[var(--dg-green)]":c.direction==="down"?"text-[var(--dg-red)]":"text-[var(--dg-text-muted)]"),children:c.label})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:145:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:146:9",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:147:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:148:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"费用分布"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:149:13",className:"h-[180px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:150:15",width:"100%",height:"100%",children:s.jsxs($a,{"code-path":"src/components/dashboard/DashboardCharts.tsx:151:17",children:[s.jsx($,{"code-path":"src/components/dashboard/DashboardCharts.tsx:152:19",data:e,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",stroke:"none",children:e.map((d,l)=>s.jsx(pt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:163:23",fill:d.color},`cell-${l}`))}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:37"})})]})})})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:171:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:172:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"月度趋势"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:173:13",className:"h-[180px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:174:15",width:"100%",height:"100%",children:s.jsxs(Ia,{"code-path":"src/components/dashboard/DashboardCharts.tsx:175:17",data:o,margin:{top:5,right:5,left:0,bottom:5},children:[s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:176:19",strokeDasharray:"3 3",className:"chart-grid-stroke",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:177:19",dataKey:"month",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:178:19",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:37"})}),s.jsx(ut,{"code-path":"src/components/dashboard/DashboardCharts.tsx:180:19",dataKey:"cost",fill:"var(--dg-blue)",radius:[4,4,0,0]})]})})})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:186:9",className:"mt-4 space-y-2",children:e.map(d=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:188:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:189:15",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:190:17",className:"w-3 h-3 rounded-full",style:{backgroundColor:d.color}}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:191:17",className:"text-sm text-[var(--dg-text-secondary)]",children:d.name})]}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:193:15",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:["¥",Number(d.value).toLocaleString()]})]},d.name))})]})]})}function za({topUsage:t}){const a=(t?.cpu??[]).slice(0,5),r=(t?.memory??[]).slice(0,5),e=(t?.disk??[]).slice(0,5),o=(n,c,d,l,i)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:215:5",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:216:7",className:"flex items-center gap-2 mb-3",children:[l,s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:218:9",className:"text-sm font-semibold text-[var(--dg-text-secondary)]",children:i})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:220:7",className:"space-y-2.5",children:n.map((p,x)=>{const b=Number(p.usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:224:13",className:"flex items-center gap-2.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:225:15",className:"text-xs font-mono text-[var(--dg-text-muted)] w-5 text-center",children:x+1}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:228:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:229:17",className:"text-xs text-[var(--dg-text-secondary)] truncate font-medium",children:p.hostname}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:230:17",className:"flex items-center gap-2 mt-1",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:231:19",className:"flex-1 h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:232:21",className:u("h-full rounded-full transition-all duration-500",b>80?"bg-[var(--dg-red)]":b>60?"bg-[var(--dg-yellow)]":d),style:{width:`${Math.min(b,100)}%`}})}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:240:19",className:u("text-xs font-mono font-medium w-12 text-right",b>80?"text-[var(--dg-red)]":b>60?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]"),children:[b.toFixed(1),"%"]})]})]})]},p.id??x)})})]});return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:256:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:257:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:258:9",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:259:11",className:"text-[var(--dg-text-primary)]",children:"Top5 资源使用"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:260:11",className:"text-[var(--dg-text-muted)]",children:"CPU、内存、磁盘使用率最高"})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:263:7",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:264:9",className:"grid grid-cols-3 gap-4",children:[o(a,"blue","bg-[var(--dg-blue)]",s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:265:69",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CPU"),o(r,"emerald","bg-[var(--dg-green)]",s.jsx(St,{"code-path":"src/components/dashboard/DashboardCharts.tsx:266:76",className:"h-4 w-4 text-[var(--dg-green)]"}),"内存"),o(e,"purple","bg-[var(--dg-purple)]",s.jsx(Ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:267:74",className:"h-4 w-4 text-[var(--dg-purple)]"}),"磁盘")]})})]})}function Va({avgCpu:t,avgMemory:a,avgDisk:r,metrics:e}){const o=Ba(e??[],r),n=o.length>0?o:Ka(t,a,r,24);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:289:5",className:"dg-card",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:290:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:291:9",className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:292:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:293:13",className:"text-[var(--dg-text-primary)]",children:"资源使用率趋势"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:294:13",className:"text-[var(--dg-text-muted)]",children:"过去24小时系统资源使用情况"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:296:11",className:"flex items-center gap-2",children:[s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:297:13",variant:"outline",className:"dg-badge-blue border",children:[s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:298:15",className:"h-3 w-3 mr-1"}),"CPU"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:301:13",variant:"outline",className:"dg-badge-green border",children:[s.jsx(Rt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:302:15",className:"h-3 w-3 mr-1"}),"内存"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:305:13",variant:"outline",className:"dg-badge-purple border",children:[s.jsx(wt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:306:15",className:"h-3 w-3 mr-1"}),"磁盘"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:312:7",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:313:9",className:"h-[280px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:314:11",width:"100%",height:"100%",children:s.jsxs(Ht,{"code-path":"src/components/dashboard/DashboardCharts.tsx:315:13",data:n,margin:{top:10,right:10,left:0,bottom:0},children:[s.jsxs("defs",{"code-path":"src/components/dashboard/DashboardCharts.tsx:316:15",children:[s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:317:17",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:318:19",offset:"5%",stopColor:"var(--dg-blue)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:319:19",offset:"95%",stopColor:"var(--dg-blue)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:321:17",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:322:19",offset:"5%",stopColor:"var(--dg-green)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:323:19",offset:"95%",stopColor:"var(--dg-green)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:325:17",id:"colorDisk",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:326:19",offset:"5%",stopColor:"var(--dg-purple)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:327:19",offset:"95%",stopColor:"var(--dg-purple)",stopOpacity:0})]})]}),s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:330:15",strokeDasharray:"3 3",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:331:15",dataKey:"time",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:332:15",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1,unit:"%"}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:15",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:33"})}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:334:15",type:"monotone",dataKey:"cpu",stroke:"var(--dg-blue)",fillOpacity:1,fill:"url(#colorCpu)",strokeWidth:2,name:"CPU"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:335:15",type:"monotone",dataKey:"memory",stroke:"var(--dg-green)",fillOpacity:1,fill:"url(#colorMemory)",strokeWidth:2,name:"内存"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:336:15",type:"monotone",dataKey:"disk",stroke:"var(--dg-purple)",fillOpacity:1,fill:"url(#colorDisk)",strokeWidth:2,name:"磁盘"})]})})})})]})}function qa({severity:t}){return s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:31:5",className:u("w-2 h-2 rounded-full flex-shrink-0 mt-1.5",t==="critical"&&"bg-[var(--dg-red)]",t==="warning"&&"bg-[var(--dg-yellow)]",t==="info"&&"bg-[var(--dg-blue)]")})}function Wa({severity:t}){return s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:45:5",variant:"outline",className:u("text-xs font-medium",t==="critical"&&"dg-badge-red border",t==="warning"&&"dg-badge-yellow border",t==="info"&&"dg-badge-blue border"),children:t==="critical"?"严重":t==="warning"?"警告":"提示"})}function Ga({alerts:t}){const a=ie(),r=t.filter(e=>e.status==="firing").slice(0,8);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:64:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:65:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:66:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:67:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:68:13",className:"text-[var(--dg-text-primary)]",children:"告警消息"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:69:13",className:"text-[var(--dg-text-muted)]",children:"最近触发的告警事件"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:71:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/alerts"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:78:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:82:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:83:9",className:"h-[320px] scrollbar-thin",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:85:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-muted)]",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:86:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:87:15",className:"text-sm",children:"暂无告警事件"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:88:15",className:"text-xs mt-1 opacity-60",children:"所有系统运行正常"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:91:13",className:"space-y-1.5 pr-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:93:17",className:"flex items-start gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer group",onClick:()=>a("/alert-center"),children:[s.jsx(qa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:98:19",severity:e.severity||"info"}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:99:19",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:100:21",className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:101:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.rule_name}),s.jsx(Wa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:104:23",severity:e.severity||"info"})]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:106:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:e.target}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:107:21",className:"text-xs text-[var(--dg-text-muted)]/70 line-clamp-1",children:e.message})]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:109:19",className:"text-[11px] text-[var(--dg-text-muted)]/50 whitespace-nowrap flex-shrink-0",children:e.created_at?new Date(e.created_at).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""})]},e.id))})})})]})}function Ha({expCerts:t}){const a=(t??[]).map(o=>({...o,daysUntilExpiry:o.days_until_expiry??Math.ceil((new Date(o.expire_date).getTime()-Date.now())/864e5)})).sort((o,n)=>o.daysUntilExpiry-n.daysUntilExpiry),r=a.filter(o=>o.daysUntilExpiry<30).length,e=a.filter(o=>o.daysUntilExpiry>=30&&o.daysUntilExpiry<60).length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:134:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:135:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:136:9",className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:137:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:138:13",className:"text-[var(--dg-text-primary)]",children:"证书到期提醒"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:139:13",className:"text-[var(--dg-text-muted)]",children:"SSL证书到期时间监控"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:141:11",className:"flex items-center gap-2",children:[r>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:143:15",className:"dg-badge-red border",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:144:17",className:"h-3 w-3 mr-1"}),r," 即将过期"]}),e>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:149:15",className:"dg-badge-yellow border",children:[e," 30天内过期"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:156:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:157:9",className:"h-[280px] scrollbar-thin",children:a.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:159:13",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:160:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:161:15",className:"text-sm",children:"暂无证书数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:164:13",className:"space-y-1.5 pr-2",children:a.map(o=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:166:17",className:"flex items-center justify-between p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:170:19",className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:171:21",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",o.daysUntilExpiry<30?"bg-[var(--dg-red)]/10":o.daysUntilExpiry<60?"bg-[var(--dg-yellow)]/10":"bg-[var(--dg-green)]/10"),children:s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:179:23",className:u("h-4 w-4",o.daysUntilExpiry<30?"text-[var(--dg-red)]":o.daysUntilExpiry<60?"text-[var(--dg-yellow)]":"text-[var(--dg-green)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:186:21",className:"min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:187:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:o.name}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:188:23",className:"text-xs text-[var(--dg-text-muted)]",children:["到期: ",o.expire_date?.substring(0,10)]})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:191:19",variant:"outline",className:u("text-xs flex-shrink-0",o.daysUntilExpiry<30?"dg-badge-red border":o.daysUntilExpiry<60?"dg-badge-yellow border":"dg-badge-green border"),children:o.daysUntilExpiry<0?"已过期":`${o.daysUntilExpiry} 天`})]},o.id))})})})]})}function Za({releases:t}){const a=ie(),r=t?.slice(0,5)??[];return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:217:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:218:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:219:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:220:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:221:13",className:"text-[var(--dg-text-primary)]",children:"发布历史"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:222:13",className:"text-[var(--dg-text-muted)]",children:"今日应用发布记录"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:224:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/pipelines"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:231:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:235:7",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:237:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:238:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:239:13",className:"text-sm",children:"暂无发布记录"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:242:11",className:"space-y-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:244:15",className:"flex items-center gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:248:17",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",e.status==="success"?"bg-[var(--dg-green)]/10":e.status==="failed"?"bg-[var(--dg-red)]/10":e.status==="deploying"?"bg-[var(--dg-blue)]/10":"bg-[var(--dg-yellow)]/10"),children:s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:257:19",className:u("h-4 w-4",e.status==="success"?"text-[var(--dg-green)]":e.status==="failed"?"text-[var(--dg-red)]":e.status==="deploying"?"text-[var(--dg-blue)]":"text-[var(--dg-yellow)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:265:17",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:266:19",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:267:21",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.app_name}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:268:21",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)] flex-shrink-0",children:e.version})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:272:19",className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:273:21",className:"text-xs text-[var(--dg-text-muted)]",children:e.environment}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:274:21",className:"text-xs text-[var(--dg-border)]",children:"·"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:275:21",className:"text-xs text-[var(--dg-text-muted)] truncate",children:e.commit_id})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:278:17",variant:"outline",className:u("text-xs flex-shrink-0",e.status==="success"?"dg-badge-green border":e.status==="failed"?"dg-badge-red border":e.status==="deploying"?"dg-badge-blue border":"dg-badge-yellow border"),children:e.status==="success"?"成功":e.status==="failed"?"失败":e.status==="deploying"?"发布中":e.status==="rolled_back"?"已回滚":"构建中"})]},e.id))})})]})}function Xa({servers:t}){const a=ie(),r=t.filter(n=>n.status==="running").length,e=t.filter(n=>n.status==="stopped").length,o=t.filter(n=>n.status==="maintenance").length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:309:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:310:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:311:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:312:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:313:13",className:"text-[var(--dg-text-primary)]",children:"服务器状态"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:314:13",className:"text-[var(--dg-text-muted)]",children:"服务器运行状态分布"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:316:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/servers"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:323:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:327:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:329:9",className:"grid grid-cols-3 gap-3 mb-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:330:11",className:"text-center p-3 rounded-xl bg-[var(--dg-green)]/8 border border-[var(--dg-green)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:331:13",className:"text-2xl font-bold text-[var(--dg-green)]",children:r}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:332:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"运行中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:334:11",className:"text-center p-3 rounded-xl bg-[var(--dg-yellow)]/8 border border-[var(--dg-yellow)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:335:13",className:"text-2xl font-bold text-[var(--dg-yellow)]",children:o}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:336:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"维护中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:338:11",className:"text-center p-3 rounded-xl bg-[var(--dg-text-muted)]/8 border border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:339:13",className:"text-2xl font-bold text-[var(--dg-text-muted)]",children:e}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:340:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"已停止"})]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:345:9",className:"space-y-1.5",children:[t.slice(0,4).map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:347:13",className:"flex items-center gap-3 p-2.5 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx(Pt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:351:15",className:u("h-2.5 w-2.5 flex-shrink-0 fill-current",n.status==="running"?"text-[var(--dg-green)]":n.status==="maintenance"?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]")}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:359:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:360:17",className:"text-sm text-[var(--dg-text-primary)] truncate",children:n.hostname}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:361:17",className:"text-xs text-[var(--dg-text-muted)]",children:n.ip})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:363:15",className:"text-right flex-shrink-0",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:364:17",className:"text-xs text-[var(--dg-text-muted)]",children:["CPU ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:365:23",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.cpu_usage??0).toFixed(1),"%"]})]}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:367:17",className:"text-xs text-[var(--dg-text-muted)]",children:["内存 ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:368:22",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.memory_usage??0).toFixed(1),"%"]})]})]})]},n.id)),t.length===0&&s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:374:13",className:"flex flex-col items-center justify-center py-6 text-[var(--dg-text-muted)]",children:[s.jsx(ct,{"code-path":"src/components/dashboard/DashboardRecent.tsx:375:15",className:"h-8 w-8 mb-2 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:376:15",className:"text-sm",children:"暂无服务器"})]})]})]})]})}function Ya({clusters:t}){const a=ie();return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:389:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:390:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:391:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:392:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:393:13",className:"text-[var(--dg-text-primary)]",children:"Kubernetes 集群"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:394:13",className:"text-[var(--dg-text-muted)]",children:"Kubernetes集群健康状态"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:396:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/kubernetes"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:403:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:407:7",children:t.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:409:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:410:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:411:13",className:"text-sm",children:"暂无集群数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:414:11",className:"space-y-3",children:t.map(r=>{const e=Number(r.cpu_usage??0),o=Number(r.memory_usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:419:17",className:"p-3.5 rounded-xl bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer",onClick:()=>a(`/kubernetes/${r.code||r.id}`),children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:424:19",className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:425:21",className:"flex items-center gap-2.5",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:426:23",className:"h-4.5 w-4.5 text-[var(--dg-blue)]"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:427:23",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:r.name})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:429:21",variant:"outline",className:u("text-xs",r.status==="healthy"?"dg-badge-green border":r.status==="warning"?"dg-badge-yellow border":"dg-badge-red border"),children:r.status==="healthy"?"健康":r.status==="warning"?"警告":"异常"})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:441:19",className:"grid grid-cols-4 gap-2 text-center",children:[{label:"节点",value:r.node_count??0},{label:"Pod",value:r.pod_count??0},{label:"CPU",value:`${e.toFixed(1)}%`},{label:"内存",value:`${o.toFixed(1)}%`}].map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:448:23",className:"p-1.5 rounded-lg bg-[var(--dg-bg-primary)]/50",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:449:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:n.value}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:450:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:n.label})]},n.label))})]},r.id)})})})]})}function xe({variant:t="card",className:a}){const r="dg-skeleton";return t==="stat"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:22:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:23:9",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:24:11",className:"space-y-3 flex-1",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:25:13",className:u("h-4 w-24 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:26:13",className:u("h-8 w-16 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:28:11",className:u("h-10 w-10 rounded-lg",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:30:9",className:u("h-3 w-32 rounded",r)})]}):t==="chart"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:37:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:38:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:39:11",className:u("h-5 w-32 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:40:11",className:u("h-3 w-48 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:42:9",className:u("h-[200px] rounded-lg",r)})]}):t==="table"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:49:7",className:u("dg-card overflow-hidden",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:51:9",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:52:11",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((e,o)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:54:13",className:u("h-4 flex-1 rounded",r)},o))]}),Array.from({length:5}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:59:11",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)] last:border-0",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:60:13",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((n,c)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:62:15",className:u("h-4 flex-1 rounded",r)},c))]},o))]}):s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:72:5",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:73:7",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:74:9",className:u("h-5 w-40 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:75:9",className:u("h-3 w-56 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:77:7",className:"space-y-3",children:Array.from({length:4}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:79:11",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:80:13",className:u("h-8 w-8 rounded-lg",r)}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:81:13",className:"flex-1 space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:82:15",className:u("h-3 w-full rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:83:15",className:u("h-3 w-2/3 rounded",r)})]})]},o))})]})}function Ja({count:t=4}){return s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:97:5",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Array.from({length:t}).map((a,r)=>s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:99:9",variant:"stat"},r))})}function Qa(){return s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:110:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:112:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:113:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:114:11",className:"dg-skeleton h-7 w-24 rounded"}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:115:11",className:"dg-skeleton h-4 w-48 rounded"})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:117:9",className:"dg-skeleton h-9 w-20 rounded-lg"})]}),s.jsx(Ja,{"code-path":"src/components/layout/SkeletonCard.tsx:121:7",count:4}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:124:7",variant:"chart"}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:127:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:128:9",variant:"list"}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:129:9",variant:"list"})]})]})}function ls(){const t=ie(),[a,r]=R.useState(!0),[e,o]=R.useState(!1),[n,c]=R.useState(null),[d,l]=R.useState([]),[i,p]=R.useState([]),[x,b]=R.useState([]),[N,f]=R.useState([]),[h,v]=R.useState([]),[y,j]=R.useState([]),k=R.useCallback(async()=>{o(!0);try{const[D,M,O,W,G,E]=await Promise.all([he.getStats().catch(A=>(console.error("Failed to fetch dashboard stats:",A),null)),Ct.getServers({page:1,page_size:100}).catch(A=>(console.error("Failed to fetch servers:",A),null)),kt.getClusters().catch(A=>(console.error("Failed to fetch k8s clusters:",A),null)),he.getAlerts(10).catch(A=>(console.error("Failed to fetch dashboard alerts:",A),null)),he.getReleases(5).catch(A=>(console.error("Failed to fetch dashboard releases:",A),null)),he.getMetrics(6).catch(A=>(console.error("Failed to fetch metrics:",A),[]))]);c(D),l(M?.list??[]),p(O?.list??[]),b(Array.isArray(W)?W:[]),f(Array.isArray(G)?G:[]),v(D?.expiring_certs??[]),j(Array.isArray(E)?E:[])}catch(D){console.error("Failed to load dashboard data:",D)}finally{o(!1),r(!1)}},[]);if(R.useEffect(()=>{k();const D=setInterval(k,5e3);return()=>clearInterval(D)},[k]),a)return s.jsx(Qa,{"code-path":"src/components/dashboard/Dashboard.tsx:94:12"});const S=n?.server_stats,w=n?.kubernetes_stats,_=n?.alert_stats,F=n?.cost_stats;return s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:103:5",className:"dg-page",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:105:7",className:"dg-page-header",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:106:9",children:[s.jsx("h1",{"code-path":"src/components/dashboard/Dashboard.tsx:107:11",className:"dg-page-title",children:"仪表盘"}),s.jsxs("p",{"code-path":"src/components/dashboard/Dashboard.tsx:108:11",className:"dg-page-subtitle",children:["实时监控和运维概览 · 最后更新: ",new Date().toLocaleTimeString("zh-CN")]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:110:9",className:"dg-page-actions",children:[s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:111:11",variant:"outline",className:"dg-btn-secondary",onClick:k,disabled:e,children:[s.jsx(_t,{"code-path":"src/components/dashboard/Dashboard.tsx:117:13",className:u("h-4 w-4",e&&"animate-spin")}),e?"刷新中":"刷新"]}),s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:120:11",className:"dg-btn-primary",onClick:()=>t("/servers"),children:[s.jsx(ct,{"code-path":"src/components/dashboard/Dashboard.tsx:124:13",className:"h-4 w-4"}),"服务器",s.jsx(le,{"code-path":"src/components/dashboard/Dashboard.tsx:126:13",className:"h-3.5 w-3.5"})]})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:132:7",className:"animate-fade-in-delay-1",children:s.jsx(At,{"code-path":"src/components/dashboard/Dashboard.tsx:133:9",items:[{label:"服务器",value:S?.total??0,color:"blue"},{label:"运行中",value:S?.running??0,color:"emerald"},{label:"K8s 集群",value:w?.total??0,color:"purple"},{label:"健康集群",value:w?.healthy??0,color:"cyan"},{label:"告警",value:_?.firing??0,color:_?.firing>0?"red":"muted"},{label:"严重",value:_?.critical??0,color:"red"},{label:"本月成本",value:`¥${Number(F?.month_cost??0).toLocaleString()}`,color:"amber"}]})}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:147:7",className:"animate-fade-in-delay-2",children:s.jsx(Va,{"code-path":"src/components/dashboard/Dashboard.tsx:148:9",avgCpu:Number(S?.avg_cpu??0),avgMemory:Number(S?.avg_memory??0),avgDisk:Number(S?.avg_disk??0),metrics:y})}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:157:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ua,{"code-path":"src/components/dashboard/Dashboard.tsx:158:9",costStats:F}),s.jsx(za,{"code-path":"src/components/dashboard/Dashboard.tsx:159:9",topUsage:n?.top_resource_usage})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:163:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ga,{"code-path":"src/components/dashboard/Dashboard.tsx:164:9",alerts:x}),s.jsx(Ha,{"code-path":"src/components/dashboard/Dashboard.tsx:165:9",expCerts:h})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:169:7",className:"grid grid-cols-1 lg:grid-cols-3 gap-6 animate-fade-in-delay-4",children:[s.jsx(Za,{"code-path":"src/components/dashboard/Dashboard.tsx:170:9",releases:N}),s.jsx(Xa,{"code-path":"src/components/dashboard/Dashboard.tsx:171:9",servers:d}),s.jsx(Ya,{"code-path":"src/components/dashboard/Dashboard.tsx:172:9",clusters:i})]})]})}export{ls as Dashboard}; diff --git a/backend/static/assets/DatasourcePage-5YEOUPGv.js b/backend/static/assets/DatasourcePage-7FoNVKhF.js similarity index 99% rename from backend/static/assets/DatasourcePage-5YEOUPGv.js rename to backend/static/assets/DatasourcePage-7FoNVKhF.js index 4a4c210..1e2681d 100644 --- a/backend/static/assets/DatasourcePage-5YEOUPGv.js +++ b/backend/static/assets/DatasourcePage-7FoNVKhF.js @@ -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 Error?s.message:"测试失败";_({success:!1,message:u})}finally{k(!1)}},Q=M.isPending||w.isPending;return e.jsx(ie,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:147:5",open:a,onOpenChange:o,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:148:7",className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:149:9",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:150:11",className:"flex items-center gap-2 text-lg",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:151:13",className:"w-5 h-5 text-orange-400"}),l?"编辑数据源":"添加数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:154:11",children:"Prometheus 数据源配置 · 参考 Grafana 数据源管理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:159:9",className:"space-y-5 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:161:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:162:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:15",htmlFor:"ds-name",className:"text-sm",children:["Name ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:65",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:164:15",id:"ds-name",placeholder:"Prometheus 数据源名称",value:t.name,onChange:s=>i("name",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:172:13",className:"flex items-end pb-2",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:173:15",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:174:17",id:"ds-default",checked:t.is_default,onCheckedChange:s=>i("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:179:17",htmlFor:"ds-default",className:"text-sm cursor-pointer",children:"Default"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:185:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/50 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:186:13",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:187:15",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:189:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:15",htmlFor:"ds-url",className:"text-sm",children:["URL ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:63",className:"text-red-400",children:"*"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:191:15",className:"flex gap-2",children:[e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:192:17",value:t.access,onValueChange:s=>i("access",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:193:19",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:194:21"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:196:19",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:197:21",value:"server",children:"Server"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:198:21",value:"browser",children:"Browser"})]})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:201:17",id:"ds-url",placeholder:"http://localhost:9090",value:t.url,onChange:s=>i("url",s.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] font-mono text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:210:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["Access: ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:211:23",className:"text-[var(--dg-text-primary)]",children:t.access==="server"?"Server (default)":"Browser"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:216:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:217:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>Z(!N),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:222:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:223:17",className:"w-4 h-4"})," Auth"]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:63",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:228:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:229:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:230:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:231:21",id:"ds-basic-auth",checked:t.basic_auth,onCheckedChange:s=>i("basic_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:236:21",htmlFor:"ds-basic-auth",className:"text-sm cursor-pointer",children:"Basic auth"})]}),t.basic_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:239:21",className:"grid grid-cols-2 gap-3 ml-9",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:240:23",placeholder:"用户名",value:t.basic_auth_user,onChange:s=>i("basic_auth_user",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:246:23",type:"password",placeholder:"密码",value:t.basic_auth_pass,onChange:s=>i("basic_auth_pass",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:257:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:258:19",id:"ds-with-creds",checked:t.with_credentials,onCheckedChange:s=>i("with_credentials",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:263:19",htmlFor:"ds-with-creds",className:"text-sm cursor-pointer",children:"With Credentials"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:266:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:267:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:268:21",id:"ds-tls-auth",checked:t.tls_client_auth,onCheckedChange:s=>i("tls_client_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:273:21",htmlFor:"ds-tls-auth",className:"text-sm cursor-pointer",children:"TLS Client Auth"})]}),t.tls_client_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:276:21",className:"ml-9 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:277:23",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:278:25",id:"ds-ca-cert",checked:t.with_ca_cert,onCheckedChange:s=>i("with_ca_cert",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:283:25",htmlFor:"ds-ca-cert",className:"text-sm cursor-pointer",children:"With CA Cert"})]}),t.with_ca_cert&&e.jsx("textarea",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:286:25",placeholder:"PEM 格式的 CA 证书内容...",value:t.ca_cert,onChange:s=>i("ca_cert",s.target.value),rows:4,className:"w-full bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md p-3 text-xs font-mono text-[var(--dg-text-primary)] resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:298:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:299:19",id:"ds-skip-tls",checked:t.skip_tls_verify,onCheckedChange:s=>i("skip_tls_verify",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:304:19",htmlFor:"ds-skip-tls",className:"text-sm cursor-pointer",children:"Skip TLS Verify"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:307:17",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"Forward OAuth Identity"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:315:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:316:13",className:"flex items-center justify-between",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:317:15",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:318:17",className:"w-4 h-4"})," Custom HTTP Headers"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:320:15",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:U,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:321:17",className:"w-3 h-3 mr-1"})," Add header"]})]}),r.length===0?e.jsx("p",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:325:15",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"暂无自定义 Header"}):e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:327:15",className:"space-y-2",children:r.map((s,u)=>e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:329:19",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:330:21",placeholder:"Header",value:s.header,onChange:D=>H(u,"header",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:336:21",placeholder:"Value",value:s.value,onChange:D=>H(u,"value",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:342:21",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-400 hover:text-red-300",onClick:()=>g(u),children:e.jsx(Ae,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:346:23",className:"w-3.5 h-3.5"})})]},u))})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:355:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:356:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>f(!c),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:361:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(qe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:362:17",className:"w-4 h-4"})," Alerting"]}),c?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:67",className:"w-4 h-4"})]}),c&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:367:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:368:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:369:19",id:"ds-enable-alerting",checked:t.enable_alerting,onCheckedChange:s=>i("enable_alerting",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:374:19",htmlFor:"ds-enable-alerting",className:"text-sm cursor-pointer",children:"Manage alerts via Alerting UI"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:378:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:379:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Alertmanager data source"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:380:19",value:t.alertmanager_ds,onValueChange:s=>i("alertmanager_ds",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:381:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:382:23",placeholder:"Choose"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:384:21",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:385:23",value:"__none",children:"无"}),y.filter(s=>s.id!==l).map(s=>e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:387:25",value:String(s.id),children:s.name},s.id))]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:397:11",className:"grid grid-cols-2 gap-4 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:398:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:399:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:400:17",className:"w-3.5 h-3.5"})," Scrape interval"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:402:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:403:17",type:"number",min:1,value:t.scrape_interval,onChange:s=>i("scrape_interval",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:410:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:413:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:414:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:415:17",className:"w-3.5 h-3.5"})," Query timeout"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:417:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:418:17",type:"number",min:1,value:t.query_timeout,onChange:s=>i("query_timeout",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:425:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:431:11",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:432:13",className:"text-sm",children:"HTTP Method"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:433:13",value:t.http_method,onValueChange:s=>i("http_method",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:434:15",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:435:17"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:437:15",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:438:17",value:"POST",children:"POST"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:439:17",value:"GET",children:"GET"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:445:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:446:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>I(!S),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:451:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:452:17",className:"w-4 h-4"})," Misc"]}),S?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:63",className:"w-4 h-4"})]}),S&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:457:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:458:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:459:19",id:"ds-disable-lookup",checked:t.disable_metrics_lookup,onCheckedChange:s=>i("disable_metrics_lookup",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:464:19",htmlFor:"ds-disable-lookup",className:"text-sm cursor-pointer",children:"Disable metrics lookup"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:468:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:469:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Custom query parameters"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:470:19",placeholder:'例: {"timeout": "30s"}',value:t.custom_query_params,onChange:s=>i("custom_query_params",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm font-mono"})]})]})]}),b&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:483:13",className:`rounded-lg p-3 flex items-center gap-2 text-sm ${b.success?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[b.success?e.jsx(ze,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:489:19",className:"w-4 h-4 shrink-0"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:490:19",className:"w-4 h-4 shrink-0"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:492:15",children:b.message}),b.target_count!==void 0&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:494:17",variant:"secondary",className:"ml-auto text-xs",children:[b.target_count," targets"]})]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:502:9",className:"flex items-center gap-2 pt-2 border-t border-[var(--dg-border)]/50",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:503:11",variant:"outline",onClick:G,disabled:R||!t.url.trim(),className:"gap-2",children:[R?e.jsx(oe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:510:15",className:"w-4 h-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:512:15",className:"w-4 h-4"}),"Save & test"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:516:11",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:517:11",variant:"ghost",onClick:()=>o(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:520:11",onClick:V,disabled:Q,children:l?"更新":"保存"})]})]})})}function Ue(){const a=ge(),{data:o=[],isLoading:p,isError:y}=Ie(),{deleteMutation:M,setDefaultMutation:w}=fe(),[l,t]=d.useState(!1),[F,r]=d.useState(null);d.useEffect(()=>{y&&n.error("获取数据源列表失败")},[y]);const v=()=>{r(null),t(!0)},N=c=>{r(c),t(!0)},Z=async c=>{if(await a({title:"删除数据源",description:`确定删除数据源「${c.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await M.mutateAsync(c.id),n.success("已删除")}catch{n.error("删除失败")}},C=async c=>{try{await w.mutateAsync(c.id),n.success(`已将「${c.name}」设为默认数据源`)}catch{n.error("设置失败")}};return p?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:73:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:74:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:80:5",className:"p-6 space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:83:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:84:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Prometheus 数据源配置,用于指标监控与监控大屏"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:89:9",onClick:v,className:"gap-2",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:90:11",className:"w-4 h-4"}),"添加数据源"]})]}),e.jsxs(se,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:96:7",className:"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(Fe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:97:9",className:"pb-2",children:e.jsxs(Ze,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:98:11",className:"text-base flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:99:13",className:"w-4 h-4 text-blue-400"}),"已配置的数据源",e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:101:13",variant:"secondary",className:"ml-2",children:o.length})]})}),e.jsx(ae,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:104:9",className:"p-0",children:o.length===0?e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:106:13",className:"py-12 text-center text-[var(--dg-text-secondary)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:107:15",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:108:15",className:"text-sm",children:"暂无数据源"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:109:15",className:"text-xs mt-1",children:"点击「添加数据源」开始配置"})]}):e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:112:13",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:113:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:114:17",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:115:19",className:"text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:116:21",className:"text-left py-3 px-4 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:117:21",className:"text-left py-3 px-4 font-medium",children:"URL"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:118:21",className:"text-left py-3 px-4 font-medium w-20",children:"默认"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:119:21",className:"text-left py-3 px-4 font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:120:21",className:"text-right py-3 px-4 font-medium w-36",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:123:17",children:o.map(c=>e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:125:21",className:"border-b border-[var(--dg-border)]/50 hover:bg-[var(--dg-bg-tertiary)]/50 transition-colors",children:[e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:129:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:130:25",className:"flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:131:27",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",alt:"Prometheus",className:"w-5 h-5 rounded",onError:f=>{f.target.style.display="none"}}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:137:27",children:[e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:138:29",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:c.name}),c.basic_auth&&e.jsx(Ee,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:139:47",className:"w-3 h-3 inline ml-1.5 text-amber-400"})]})]})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:143:23",className:"py-3 px-4",children:e.jsx("code",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:144:25",className:"text-xs text-blue-300 bg-slate-800/50 px-2 py-0.5 rounded max-w-[320px] block truncate",title:c.url,children:c.url})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:149:23",className:"py-3 px-4",children:c.is_default?e.jsxs(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:151:27",variant:"default",className:"bg-amber-500/15 text-amber-400 border-amber-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:152:29",className:"w-3 h-3 mr-1"})," 默认"]}):e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:155:27",className:"text-xs text-[var(--dg-text-secondary)]",children:"--"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:158:23",className:"py-3 px-4",children:c.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:160:27",variant:"default",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30 text-xs",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:164:27",variant:"secondary",className:"text-xs",children:"禁用"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:167:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:168:25",className:"flex items-center justify-end gap-1",children:[e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:169:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>Be(c),title:"测试连接",children:e.jsx(re,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:175:29",className:"w-3.5 h-3.5"})}),!c.is_default&&e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:178:29",variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-400 hover:text-amber-300",onClick:()=>C(c),title:"设为默认",children:e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:184:31",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:187:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>N(c),children:e.jsx(_e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:192:29",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:194:27",variant:"ghost",size:"sm",className:"h-8 px-2 text-red-400 hover:text-red-300",onClick:()=>Z(c),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:199:29",className:"w-3.5 h-3.5"})})]})})]},c.id))})]})})})]}),e.jsx($e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:212:7",open:l,onOpenChange:t,editingDs:F,sources:o})]})}const de={name:"",url:"",username:"",password:"",trends_after:0,trends_range:0,trends_cache_ttl:3600,trends_timeout:30,direct_db:!1,disable_acknowledges:!1,disable_data_alignment:!1,is_default:!1};function Ve(){const a=ge(),[o,p]=d.useState([]),[y,M]=d.useState(!0),[w,l]=d.useState(!1),[t,F]=d.useState(null),[r,v]=d.useState({...de}),[N,Z]=d.useState(!1),[C,c]=d.useState(!1),[f,S]=d.useState(!1),[I,R]=d.useState(!1),[k,b]=d.useState(null),_=d.useCallback(async()=>{try{const s=await T.list();p(s?.data||s||[])}catch{n.error("获取数据源列表失败")}finally{M(!1)}},[]);d.useEffect(()=>{_()},[_]);const i=()=>{F(null),v({...de}),b(null),Z(!1),c(!1),S(!1),l(!0)},U=s=>{F(s.id),v({name:s.name,url:s.url,username:s.username||"",password:s.password||"",trends_after:s.trends_after||0,trends_range:s.trends_range||0,trends_cache_ttl:s.trends_cache_ttl||3600,trends_timeout:s.trends_timeout||30,direct_db:s.direct_db||!1,disable_acknowledges:s.disable_acknowledges||!1,disable_data_alignment:s.disable_data_alignment||!1,is_default:s.is_default||!1}),b(null),l(!0)},g=(s,u)=>{v(D=>({...D,[s]:u}))},H=async()=>{if(!r.name.trim()){n.error("请输入数据源名称");return}if(!r.url.trim()){n.error("请输入 Zabbix API URL");return}if(!r.username.trim()){n.error("请输入用户名");return}if(!r.password.trim()){n.error("请输入密码");return}try{t?(await T.update(t,r),n.success("数据源已更新")):(await T.create(r),n.success("数据源已创建")),l(!1),_()}catch(s){n.error(s?.message||"操作失败")}},V=async s=>{if(await a({title:"删除数据源",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await T.delete(s.id),n.success("已删除"),_()}catch{n.error("删除失败")}},G=async s=>{try{await T.setDefault(s.id),n.success(`已将「${s.name}」设为默认`),_()}catch{n.error("设置失败")}},Q=async()=>{if(!r.url.trim()||!r.username.trim()){n.error("请填写 URL 和用户名");return}R(!0),b(null);try{const s=await T.testConnection({url:r.url.trim(),username:r.username.trim(),password:r.password||""}),u=s?.data||s;b(u)}catch(s){b({success:!1,message:s?.message||"测试失败"})}finally{R(!1)}};return y?e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:183:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:184:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:190:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:191:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:192:9",children:[e.jsxs("h2",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:193:11",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:194:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-5 h-5 rounded",onError:s=>{s.target.style.display="none"}}),"Zabbix 数据源"]}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:201:11",className:"text-xs text-[var(--dg-text-muted)]",children:"配置 Zabbix API 连接,获取主机监控数据"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:203:9",onClick:i,size:"sm",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:204:11",className:"w-4 h-4 mr-1"}),"添加"]})]}),o.length===0?e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:209:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:210:11",className:"py-12 text-center text-[var(--dg-text-muted)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:211:13",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:212:13",className:"text-sm",children:"暂无 Zabbix 数据源"}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:213:13",size:"sm",className:"mt-4",onClick:i,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:214:15",className:"w-4 h-4 mr-1"}),"添加数据源"]})]})}):e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:219:9",className:"grid gap-3",children:o.map(s=>e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:221:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-orange-500/30 transition-colors",children:e.jsx(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:222:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:223:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:224:19",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:225:21",className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:226:23",className:`w-2 h-2 rounded-full ${s.status===1?"bg-emerald-400":"bg-slate-500"}`}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:227:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),s.is_default&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:41",className:"bg-amber-500/20 text-amber-400 text-[10px]",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:103",className:"w-3 h-3 mr-0.5"}),"默认"]}),s.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:230:27",className:"bg-emerald-500/20 text-emerald-400 text-[10px]",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:231:27",className:"bg-slate-500/20 text-slate-400 text-[10px]",children:"禁用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:233:21",className:"text-xs text-[var(--dg-text-muted)] space-x-3",children:[e.jsx("code",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:234:23",className:"text-orange-300",children:s.url}),e.jsxs("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:235:23",children:["用户: ",s.username]}),s.direct_db&&e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:236:40",variant:"outline",className:"text-[10px]",children:"直连DB"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:239:19",className:"flex items-center gap-1",children:[!s.is_default&&e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:241:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>G(s),children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:242:25",className:"w-3 h-3 mr-0.5"}),"默认"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:245:21",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>U(s),children:[e.jsx(_e,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:246:23",className:"w-3 h-3 mr-0.5"}),"编辑"]}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:248:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>V(s),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:249:23",className:"w-3 h-3"})})]})]})})},s.id))}),e.jsx(ie,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:260:7",open:w,onOpenChange:l,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:261:9",className:"max-w-xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:262:11",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:263:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:264:15",className:"h-5 w-5 text-orange-400"}),t?"编辑 Zabbix 数据源":"新建 Zabbix 数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:267:13",children:"配置 Zabbix API 连接,用于主机监控与告警数据获取"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:272:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:274:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:275:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:276:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"名称 *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:277:17",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"如:生产 Zabbix",value:r.name,onChange:s=>g("name",s.target.value)})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:280:15",className:"flex items-end pb-1",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:281:17",className:"flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:282:19",checked:r.is_default,onCheckedChange:s=>g("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:283:19",className:"text-xs cursor-pointer",children:"设为默认"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:289:13",className:"border border-[var(--dg-border)] rounded-lg p-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:290:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:291:17",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:293:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:294:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"URL *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:295:17",className:"mt-1 h-9 text-sm font-mono bg-[var(--dg-bg-primary)]",placeholder:"http://zabbix.example.com/api_jsonrpc.php",value:r.url,onChange:s=>g("url",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:302:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:303:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>Z(!N),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:305:17",className:"flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:306:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:307:19",children:"Zabbix API 认证"})]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:29",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:65",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:312:17",className:"px-3 pb-3 space-y-3",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:313:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"用户名 *",value:r.username,onChange:s=>g("username",s.target.value)}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:315:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",type:"password",placeholder:"密码 *",value:r.password,onChange:s=>g("password",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:322:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:323:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>c(!C),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:325:17",className:"flex items-center gap-2",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:326:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:327:19",children:"Trends 设置"})]}),C?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:67",className:"w-4 h-4"})]}),C&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:332:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:333:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:334:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:335:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"After (天)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:336:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_after,onChange:s=>g("trends_after",parseInt(s.target.value)||0)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:339:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:340:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Range (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:341:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_range,onChange:s=>g("trends_range",parseInt(s.target.value)||0)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:345:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:346:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:347:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Cache TTL (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:348:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_cache_ttl,onChange:s=>g("trends_cache_ttl",parseInt(s.target.value)||3600)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:351:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:352:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Timeout (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:353:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:1,value:r.trends_timeout,onChange:s=>g("trends_timeout",parseInt(s.target.value)||30)})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:362:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:363:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>S(!f),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:365:17",className:"flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:366:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:367:19",children:"其他设置"})]}),f?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:30",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:66",className:"w-4 h-4"})]}),f&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:372:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:373:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:374:21",className:"text-xs",children:"Direct DB Connection"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:375:21",checked:r.direct_db,onCheckedChange:s=>g("direct_db",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:377:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:378:21",className:"text-xs",children:"只读用户禁用确认"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:379:21",checked:r.disable_acknowledges,onCheckedChange:s=>g("disable_acknowledges",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:381:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:382:21",className:"text-xs",children:"禁用数据对齐"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:383:21",checked:r.disable_data_alignment,onCheckedChange:s=>g("disable_data_alignment",s)})]})]})]}),k&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:391:15",className:`flex items-center gap-2 p-2.5 rounded text-sm ${k.success?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"}`,children:[k.success?e.jsx(Le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:39",className:"h-4 w-4"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:78",className:"h-4 w-4"}),k.message]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:400:11",className:"gap-2",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:401:13",variant:"outline",size:"sm",onClick:Q,disabled:I,children:[e.jsx(re,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:402:15",className:`w-4 h-4 mr-1 ${I?"animate-pulse":""}`}),"测试连接"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:405:13",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:406:13",variant:"ghost",size:"sm",onClick:()=>l(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:407:13",size:"sm",onClick:H,children:"保存"})]})]})})]})}function ns(){const[a,o]=d.useState("prometheus");return e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:12:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:13:7",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:14:9",className:"h-5 w-5 text-blue-400"}),e.jsx("h1",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:15:9",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"})]}),e.jsxs(ye,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:18:7",value:a,onValueChange:o,children:[e.jsxs(Me,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:19:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:20:11",value:"prometheus",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:21:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Prometheus"]}),e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:28:11",value:"zabbix",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:29:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Zabbix"]})]}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:38:9",value:"prometheus",className:"mt-4",children:e.jsx(Ue,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:39:11"})}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:41:9",value:"zabbix",className:"mt-4",children:e.jsx(Ve,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:42:11"})})]})]})}export{ns as default}; +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 Error?s.message:"测试失败";_({success:!1,message:u})}finally{k(!1)}},Q=M.isPending||w.isPending;return e.jsx(ie,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:147:5",open:a,onOpenChange:o,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:148:7",className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:149:9",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:150:11",className:"flex items-center gap-2 text-lg",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:151:13",className:"w-5 h-5 text-orange-400"}),l?"编辑数据源":"添加数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:154:11",children:"Prometheus 数据源配置 · 参考 Grafana 数据源管理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:159:9",className:"space-y-5 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:161:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:162:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:15",htmlFor:"ds-name",className:"text-sm",children:["Name ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:65",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:164:15",id:"ds-name",placeholder:"Prometheus 数据源名称",value:t.name,onChange:s=>i("name",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:172:13",className:"flex items-end pb-2",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:173:15",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:174:17",id:"ds-default",checked:t.is_default,onCheckedChange:s=>i("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:179:17",htmlFor:"ds-default",className:"text-sm cursor-pointer",children:"Default"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:185:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/50 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:186:13",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:187:15",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:189:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:15",htmlFor:"ds-url",className:"text-sm",children:["URL ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:63",className:"text-red-400",children:"*"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:191:15",className:"flex gap-2",children:[e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:192:17",value:t.access,onValueChange:s=>i("access",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:193:19",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:194:21"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:196:19",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:197:21",value:"server",children:"Server"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:198:21",value:"browser",children:"Browser"})]})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:201:17",id:"ds-url",placeholder:"http://localhost:9090",value:t.url,onChange:s=>i("url",s.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] font-mono text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:210:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["Access: ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:211:23",className:"text-[var(--dg-text-primary)]",children:t.access==="server"?"Server (default)":"Browser"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:216:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:217:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>Z(!N),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:222:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:223:17",className:"w-4 h-4"})," Auth"]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:63",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:228:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:229:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:230:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:231:21",id:"ds-basic-auth",checked:t.basic_auth,onCheckedChange:s=>i("basic_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:236:21",htmlFor:"ds-basic-auth",className:"text-sm cursor-pointer",children:"Basic auth"})]}),t.basic_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:239:21",className:"grid grid-cols-2 gap-3 ml-9",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:240:23",placeholder:"用户名",value:t.basic_auth_user,onChange:s=>i("basic_auth_user",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:246:23",type:"password",placeholder:"密码",value:t.basic_auth_pass,onChange:s=>i("basic_auth_pass",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:257:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:258:19",id:"ds-with-creds",checked:t.with_credentials,onCheckedChange:s=>i("with_credentials",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:263:19",htmlFor:"ds-with-creds",className:"text-sm cursor-pointer",children:"With Credentials"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:266:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:267:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:268:21",id:"ds-tls-auth",checked:t.tls_client_auth,onCheckedChange:s=>i("tls_client_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:273:21",htmlFor:"ds-tls-auth",className:"text-sm cursor-pointer",children:"TLS Client Auth"})]}),t.tls_client_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:276:21",className:"ml-9 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:277:23",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:278:25",id:"ds-ca-cert",checked:t.with_ca_cert,onCheckedChange:s=>i("with_ca_cert",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:283:25",htmlFor:"ds-ca-cert",className:"text-sm cursor-pointer",children:"With CA Cert"})]}),t.with_ca_cert&&e.jsx("textarea",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:286:25",placeholder:"PEM 格式的 CA 证书内容...",value:t.ca_cert,onChange:s=>i("ca_cert",s.target.value),rows:4,className:"w-full bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md p-3 text-xs font-mono text-[var(--dg-text-primary)] resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:298:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:299:19",id:"ds-skip-tls",checked:t.skip_tls_verify,onCheckedChange:s=>i("skip_tls_verify",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:304:19",htmlFor:"ds-skip-tls",className:"text-sm cursor-pointer",children:"Skip TLS Verify"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:307:17",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"Forward OAuth Identity"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:315:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:316:13",className:"flex items-center justify-between",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:317:15",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:318:17",className:"w-4 h-4"})," Custom HTTP Headers"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:320:15",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:U,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:321:17",className:"w-3 h-3 mr-1"})," Add header"]})]}),r.length===0?e.jsx("p",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:325:15",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"暂无自定义 Header"}):e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:327:15",className:"space-y-2",children:r.map((s,u)=>e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:329:19",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:330:21",placeholder:"Header",value:s.header,onChange:D=>H(u,"header",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:336:21",placeholder:"Value",value:s.value,onChange:D=>H(u,"value",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:342:21",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-400 hover:text-red-300",onClick:()=>g(u),children:e.jsx(Ae,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:346:23",className:"w-3.5 h-3.5"})})]},u))})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:355:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:356:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>f(!c),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:361:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(qe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:362:17",className:"w-4 h-4"})," Alerting"]}),c?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:67",className:"w-4 h-4"})]}),c&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:367:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:368:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:369:19",id:"ds-enable-alerting",checked:t.enable_alerting,onCheckedChange:s=>i("enable_alerting",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:374:19",htmlFor:"ds-enable-alerting",className:"text-sm cursor-pointer",children:"Manage alerts via Alerting UI"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:378:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:379:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Alertmanager data source"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:380:19",value:t.alertmanager_ds,onValueChange:s=>i("alertmanager_ds",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:381:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:382:23",placeholder:"Choose"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:384:21",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:385:23",value:"__none",children:"无"}),y.filter(s=>s.id!==l).map(s=>e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:387:25",value:String(s.id),children:s.name},s.id))]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:397:11",className:"grid grid-cols-2 gap-4 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:398:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:399:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:400:17",className:"w-3.5 h-3.5"})," Scrape interval"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:402:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:403:17",type:"number",min:1,value:t.scrape_interval,onChange:s=>i("scrape_interval",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:410:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:413:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:414:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:415:17",className:"w-3.5 h-3.5"})," Query timeout"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:417:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:418:17",type:"number",min:1,value:t.query_timeout,onChange:s=>i("query_timeout",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:425:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:431:11",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:432:13",className:"text-sm",children:"HTTP Method"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:433:13",value:t.http_method,onValueChange:s=>i("http_method",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:434:15",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:435:17"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:437:15",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:438:17",value:"POST",children:"POST"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:439:17",value:"GET",children:"GET"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:445:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:446:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>I(!S),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:451:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:452:17",className:"w-4 h-4"})," Misc"]}),S?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:63",className:"w-4 h-4"})]}),S&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:457:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:458:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:459:19",id:"ds-disable-lookup",checked:t.disable_metrics_lookup,onCheckedChange:s=>i("disable_metrics_lookup",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:464:19",htmlFor:"ds-disable-lookup",className:"text-sm cursor-pointer",children:"Disable metrics lookup"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:468:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:469:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Custom query parameters"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:470:19",placeholder:'例: {"timeout": "30s"}',value:t.custom_query_params,onChange:s=>i("custom_query_params",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm font-mono"})]})]})]}),b&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:483:13",className:`rounded-lg p-3 flex items-center gap-2 text-sm ${b.success?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[b.success?e.jsx(ze,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:489:19",className:"w-4 h-4 shrink-0"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:490:19",className:"w-4 h-4 shrink-0"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:492:15",children:b.message}),b.target_count!==void 0&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:494:17",variant:"secondary",className:"ml-auto text-xs",children:[b.target_count," targets"]})]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:502:9",className:"flex items-center gap-2 pt-2 border-t border-[var(--dg-border)]/50",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:503:11",variant:"outline",onClick:G,disabled:R||!t.url.trim(),className:"gap-2",children:[R?e.jsx(oe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:510:15",className:"w-4 h-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:512:15",className:"w-4 h-4"}),"Save & test"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:516:11",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:517:11",variant:"ghost",onClick:()=>o(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:520:11",onClick:V,disabled:Q,children:l?"更新":"保存"})]})]})})}function Ue(){const a=ge(),{data:o=[],isLoading:p,isError:y}=Ie(),{deleteMutation:M,setDefaultMutation:w}=fe(),[l,t]=d.useState(!1),[F,r]=d.useState(null);d.useEffect(()=>{y&&n.error("获取数据源列表失败")},[y]);const v=()=>{r(null),t(!0)},N=c=>{r(c),t(!0)},Z=async c=>{if(await a({title:"删除数据源",description:`确定删除数据源「${c.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await M.mutateAsync(c.id),n.success("已删除")}catch{n.error("删除失败")}},C=async c=>{try{await w.mutateAsync(c.id),n.success(`已将「${c.name}」设为默认数据源`)}catch{n.error("设置失败")}};return p?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:73:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:74:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:80:5",className:"p-6 space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:83:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:84:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Prometheus 数据源配置,用于指标监控与监控大屏"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:89:9",onClick:v,className:"gap-2",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:90:11",className:"w-4 h-4"}),"添加数据源"]})]}),e.jsxs(se,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:96:7",className:"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(Fe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:97:9",className:"pb-2",children:e.jsxs(Ze,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:98:11",className:"text-base flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:99:13",className:"w-4 h-4 text-blue-400"}),"已配置的数据源",e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:101:13",variant:"secondary",className:"ml-2",children:o.length})]})}),e.jsx(ae,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:104:9",className:"p-0",children:o.length===0?e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:106:13",className:"py-12 text-center text-[var(--dg-text-secondary)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:107:15",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:108:15",className:"text-sm",children:"暂无数据源"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:109:15",className:"text-xs mt-1",children:"点击「添加数据源」开始配置"})]}):e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:112:13",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:113:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:114:17",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:115:19",className:"text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:116:21",className:"text-left py-3 px-4 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:117:21",className:"text-left py-3 px-4 font-medium",children:"URL"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:118:21",className:"text-left py-3 px-4 font-medium w-20",children:"默认"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:119:21",className:"text-left py-3 px-4 font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:120:21",className:"text-right py-3 px-4 font-medium w-36",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:123:17",children:o.map(c=>e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:125:21",className:"border-b border-[var(--dg-border)]/50 hover:bg-[var(--dg-bg-tertiary)]/50 transition-colors",children:[e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:129:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:130:25",className:"flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:131:27",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",alt:"Prometheus",className:"w-5 h-5 rounded",onError:f=>{f.target.style.display="none"}}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:137:27",children:[e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:138:29",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:c.name}),c.basic_auth&&e.jsx(Ee,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:139:47",className:"w-3 h-3 inline ml-1.5 text-amber-400"})]})]})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:143:23",className:"py-3 px-4",children:e.jsx("code",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:144:25",className:"text-xs text-blue-300 bg-slate-800/50 px-2 py-0.5 rounded max-w-[320px] block truncate",title:c.url,children:c.url})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:149:23",className:"py-3 px-4",children:c.is_default?e.jsxs(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:151:27",variant:"default",className:"bg-amber-500/15 text-amber-400 border-amber-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:152:29",className:"w-3 h-3 mr-1"})," 默认"]}):e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:155:27",className:"text-xs text-[var(--dg-text-secondary)]",children:"--"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:158:23",className:"py-3 px-4",children:c.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:160:27",variant:"default",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30 text-xs",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:164:27",variant:"secondary",className:"text-xs",children:"禁用"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:167:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:168:25",className:"flex items-center justify-end gap-1",children:[e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:169:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>Be(c),title:"测试连接",children:e.jsx(re,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:175:29",className:"w-3.5 h-3.5"})}),!c.is_default&&e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:178:29",variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-400 hover:text-amber-300",onClick:()=>C(c),title:"设为默认",children:e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:184:31",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:187:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>N(c),children:e.jsx(_e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:192:29",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:194:27",variant:"ghost",size:"sm",className:"h-8 px-2 text-red-400 hover:text-red-300",onClick:()=>Z(c),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:199:29",className:"w-3.5 h-3.5"})})]})})]},c.id))})]})})})]}),e.jsx($e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:212:7",open:l,onOpenChange:t,editingDs:F,sources:o})]})}const de={name:"",url:"",username:"",password:"",trends_after:0,trends_range:0,trends_cache_ttl:3600,trends_timeout:30,direct_db:!1,disable_acknowledges:!1,disable_data_alignment:!1,is_default:!1};function Ve(){const a=ge(),[o,p]=d.useState([]),[y,M]=d.useState(!0),[w,l]=d.useState(!1),[t,F]=d.useState(null),[r,v]=d.useState({...de}),[N,Z]=d.useState(!1),[C,c]=d.useState(!1),[f,S]=d.useState(!1),[I,R]=d.useState(!1),[k,b]=d.useState(null),_=d.useCallback(async()=>{try{const s=await T.list();p(s?.data||s||[])}catch{n.error("获取数据源列表失败")}finally{M(!1)}},[]);d.useEffect(()=>{_()},[_]);const i=()=>{F(null),v({...de}),b(null),Z(!1),c(!1),S(!1),l(!0)},U=s=>{F(s.id),v({name:s.name,url:s.url,username:s.username||"",password:s.password||"",trends_after:s.trends_after||0,trends_range:s.trends_range||0,trends_cache_ttl:s.trends_cache_ttl||3600,trends_timeout:s.trends_timeout||30,direct_db:s.direct_db||!1,disable_acknowledges:s.disable_acknowledges||!1,disable_data_alignment:s.disable_data_alignment||!1,is_default:s.is_default||!1}),b(null),l(!0)},g=(s,u)=>{v(D=>({...D,[s]:u}))},H=async()=>{if(!r.name.trim()){n.error("请输入数据源名称");return}if(!r.url.trim()){n.error("请输入 Zabbix API URL");return}if(!r.username.trim()){n.error("请输入用户名");return}if(!r.password.trim()){n.error("请输入密码");return}try{t?(await T.update(t,r),n.success("数据源已更新")):(await T.create(r),n.success("数据源已创建")),l(!1),_()}catch(s){n.error(s?.message||"操作失败")}},V=async s=>{if(await a({title:"删除数据源",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await T.delete(s.id),n.success("已删除"),_()}catch{n.error("删除失败")}},G=async s=>{try{await T.setDefault(s.id),n.success(`已将「${s.name}」设为默认`),_()}catch{n.error("设置失败")}},Q=async()=>{if(!r.url.trim()||!r.username.trim()){n.error("请填写 URL 和用户名");return}R(!0),b(null);try{const s=await T.testConnection({url:r.url.trim(),username:r.username.trim(),password:r.password||""}),u=s?.data||s;b(u)}catch(s){b({success:!1,message:s?.message||"测试失败"})}finally{R(!1)}};return y?e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:183:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:184:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:190:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:191:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:192:9",children:[e.jsxs("h2",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:193:11",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:194:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-5 h-5 rounded",onError:s=>{s.target.style.display="none"}}),"Zabbix 数据源"]}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:201:11",className:"text-xs text-[var(--dg-text-muted)]",children:"配置 Zabbix API 连接,获取主机监控数据"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:203:9",onClick:i,size:"sm",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:204:11",className:"w-4 h-4 mr-1"}),"添加"]})]}),o.length===0?e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:209:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:210:11",className:"py-12 text-center text-[var(--dg-text-muted)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:211:13",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:212:13",className:"text-sm",children:"暂无 Zabbix 数据源"}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:213:13",size:"sm",className:"mt-4",onClick:i,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:214:15",className:"w-4 h-4 mr-1"}),"添加数据源"]})]})}):e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:219:9",className:"grid gap-3",children:o.map(s=>e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:221:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-orange-500/30 transition-colors",children:e.jsx(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:222:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:223:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:224:19",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:225:21",className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:226:23",className:`w-2 h-2 rounded-full ${s.status===1?"bg-emerald-400":"bg-slate-500"}`}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:227:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),s.is_default&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:41",className:"bg-amber-500/20 text-amber-400 text-[10px]",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:103",className:"w-3 h-3 mr-0.5"}),"默认"]}),s.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:230:27",className:"bg-emerald-500/20 text-emerald-400 text-[10px]",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:231:27",className:"bg-slate-500/20 text-slate-400 text-[10px]",children:"禁用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:233:21",className:"text-xs text-[var(--dg-text-muted)] space-x-3",children:[e.jsx("code",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:234:23",className:"text-orange-300",children:s.url}),e.jsxs("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:235:23",children:["用户: ",s.username]}),s.direct_db&&e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:236:40",variant:"outline",className:"text-[10px]",children:"直连DB"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:239:19",className:"flex items-center gap-1",children:[!s.is_default&&e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:241:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>G(s),children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:242:25",className:"w-3 h-3 mr-0.5"}),"默认"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:245:21",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>U(s),children:[e.jsx(_e,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:246:23",className:"w-3 h-3 mr-0.5"}),"编辑"]}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:248:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>V(s),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:249:23",className:"w-3 h-3"})})]})]})})},s.id))}),e.jsx(ie,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:260:7",open:w,onOpenChange:l,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:261:9",className:"max-w-xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:262:11",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:263:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:264:15",className:"h-5 w-5 text-orange-400"}),t?"编辑 Zabbix 数据源":"新建 Zabbix 数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:267:13",children:"配置 Zabbix API 连接,用于主机监控与告警数据获取"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:272:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:274:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:275:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:276:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"名称 *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:277:17",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"如:生产 Zabbix",value:r.name,onChange:s=>g("name",s.target.value)})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:280:15",className:"flex items-end pb-1",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:281:17",className:"flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:282:19",checked:r.is_default,onCheckedChange:s=>g("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:283:19",className:"text-xs cursor-pointer",children:"设为默认"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:289:13",className:"border border-[var(--dg-border)] rounded-lg p-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:290:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:291:17",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:293:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:294:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"URL *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:295:17",className:"mt-1 h-9 text-sm font-mono bg-[var(--dg-bg-primary)]",placeholder:"http://zabbix.example.com/api_jsonrpc.php",value:r.url,onChange:s=>g("url",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:302:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:303:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>Z(!N),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:305:17",className:"flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:306:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:307:19",children:"Zabbix API 认证"})]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:29",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:65",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:312:17",className:"px-3 pb-3 space-y-3",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:313:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"用户名 *",value:r.username,onChange:s=>g("username",s.target.value)}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:315:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",type:"password",placeholder:"密码 *",value:r.password,onChange:s=>g("password",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:322:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:323:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>c(!C),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:325:17",className:"flex items-center gap-2",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:326:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:327:19",children:"Trends 设置"})]}),C?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:67",className:"w-4 h-4"})]}),C&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:332:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:333:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:334:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:335:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"After (天)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:336:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_after,onChange:s=>g("trends_after",parseInt(s.target.value)||0)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:339:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:340:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Range (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:341:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_range,onChange:s=>g("trends_range",parseInt(s.target.value)||0)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:345:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:346:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:347:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Cache TTL (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:348:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_cache_ttl,onChange:s=>g("trends_cache_ttl",parseInt(s.target.value)||3600)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:351:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:352:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Timeout (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:353:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:1,value:r.trends_timeout,onChange:s=>g("trends_timeout",parseInt(s.target.value)||30)})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:362:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:363:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>S(!f),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:365:17",className:"flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:366:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:367:19",children:"其他设置"})]}),f?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:30",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:66",className:"w-4 h-4"})]}),f&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:372:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:373:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:374:21",className:"text-xs",children:"Direct DB Connection"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:375:21",checked:r.direct_db,onCheckedChange:s=>g("direct_db",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:377:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:378:21",className:"text-xs",children:"只读用户禁用确认"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:379:21",checked:r.disable_acknowledges,onCheckedChange:s=>g("disable_acknowledges",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:381:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:382:21",className:"text-xs",children:"禁用数据对齐"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:383:21",checked:r.disable_data_alignment,onCheckedChange:s=>g("disable_data_alignment",s)})]})]})]}),k&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:391:15",className:`flex items-center gap-2 p-2.5 rounded text-sm ${k.success?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"}`,children:[k.success?e.jsx(Le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:39",className:"h-4 w-4"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:78",className:"h-4 w-4"}),k.message]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:400:11",className:"gap-2",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:401:13",variant:"outline",size:"sm",onClick:Q,disabled:I,children:[e.jsx(re,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:402:15",className:`w-4 h-4 mr-1 ${I?"animate-pulse":""}`}),"测试连接"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:405:13",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:406:13",variant:"ghost",size:"sm",onClick:()=>l(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:407:13",size:"sm",onClick:H,children:"保存"})]})]})})]})}function ns(){const[a,o]=d.useState("prometheus");return e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:12:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:13:7",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:14:9",className:"h-5 w-5 text-blue-400"}),e.jsx("h1",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:15:9",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"})]}),e.jsxs(ye,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:18:7",value:a,onValueChange:o,children:[e.jsxs(Me,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:19:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:20:11",value:"prometheus",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:21:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Prometheus"]}),e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:28:11",value:"zabbix",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:29:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Zabbix"]})]}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:38:9",value:"prometheus",className:"mt-4",children:e.jsx(Ue,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:39:11"})}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:41:9",value:"zabbix",className:"mt-4",children:e.jsx(Ve,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:42:11"})})]})]})}export{ns as default}; diff --git a/backend/static/assets/DeployCredentials-BunsdfYH.js b/backend/static/assets/DeployCredentials-C7pbsNa2.js similarity index 99% rename from backend/static/assets/DeployCredentials-BunsdfYH.js rename to backend/static/assets/DeployCredentials-C7pbsNa2.js index 466bc77..b3c3066 100644 --- a/backend/static/assets/DeployCredentials-BunsdfYH.js +++ b/backend/static/assets/DeployCredentials-C7pbsNa2.js @@ -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/密码等)":"选择 Docker 密码凭据"})}),e.jsxs(X,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:119:15",children:[e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:120:17",value:"__none",children:"不关联凭证"}),t.map(a=>e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:122:19",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:123:21",className:"flex items-center gap-1.5",children:[e.jsx(de,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:124:23",className:"h-3 w-3 opacity-60"}),a.name," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:125:46",className:"text-[10px] opacity-50",children:["(",a.summary,")"]})]})},a.id))]})]}),t.length===0&&e.jsxs("p",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:132:15",className:"text-xs text-amber-400 flex items-center gap-1 mt-1",children:[e.jsx(G,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:133:17",className:"h-3 w-3"}),"暂无",c?"":"Docker 密码","类型凭证,请在凭证配置页面新增"]})]})]}),e.jsxs(te,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:139:9",children:[e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:140:11",variant:"outline",onClick:()=>b(!1),children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:141:11",onClick:$,disabled:x,children:x?"保存中...":"保存"})]})]})})}const Ce={build:"构建",deploy:"部署",automation:"自动化",other:"其他"},q={build:"bg-amber-500/20 text-amber-400 border-amber-500/30",deploy:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",automation:"bg-purple-500/20 text-purple-400 border-purple-500/30",other:"bg-slate-500/20 text-slate-400 border-slate-500/30"},be=["jdk","nodejs","maven"];function je(){const[S,b]=o.useState([]),[L,n]=o.useState(!1),[h,j]=o.useState(null),[m,c]=o.useState(null),[g,u]=o.useState(""),[C,f]=o.useState(null),p=async()=>{n(!0);try{const s=await i.getTools();b(s?.list||[])}catch{r.error("获取工具配置失败")}finally{n(!1)}};o.useEffect(()=>{p()},[]);const v=async s=>{try{const x=(await i.getToolVersions(s.id))?.versions||[];if(x.length===0){y(s);return}c({tool:s,versions:x}),u(s.default_version||x[0]?.version||"")}catch{y(s)}},y=async(s,l)=>{j(s.id);try{const x=l||s.default_version;await i.installTool(s.id,x),r.success(`${s.display_name}${x?` (${x})`:""} 安装已触发`),c(null),setTimeout(async()=>{try{await i.checkTool(s.id),p()}catch{}j(null)},3e3)}catch{r.error("触发安装失败"),j(null)}},N=async s=>{try{const l=await i.checkTool(s.id);r.success(l?.available?`${s.display_name} 可用`:`${s.display_name} 不可用`),p()}catch{r.error("检测失败")}},D=async(s,l)=>{try{await i.updateTool(s.id,{install_method:l}),r.success("已更新"),p()}catch{r.error("更新失败")}},T=async s=>{f(s.id);const l=Date.now();try{const x=await i.getToolVersions(s.id),V=((Date.now()-l)/1e3).toFixed(1);x?.versions?.length>0?r.success(`${s.display_name} 镜像可访问 (${V}s)`):r(`${s.display_name} 无法获取版本列表`,{description:"请检查网络连接"})}catch{r.error(`${s.display_name} 网络不可达`)}f(null)};return e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:137:5",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("p",{"code-path":"src/components/deploy/ToolConfigTab.tsx:139:9",className:"text-xs text-[var(--dg-text-secondary)]",children:"管理 DevOps 工具的安装策略:预装在镜像中、首次使用自动下载(懒加载)、或禁用不安装"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:142:9",variant:"outline",size:"sm",onClick:p,children:[e.jsx(ee,{"code-path":"src/components/deploy/ToolConfigTab.tsx:143:11",className:"w-3.5 h-3.5 mr-1"}),"刷新"]})]}),L?e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:148:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:149:11",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):S.length===0?e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:152:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无工具配置,请检查后端种子数据"}):e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:156:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/ToolConfigTab.tsx:157:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/ToolConfigTab.tsx:158:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:159:15",children:[e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:160:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"工具"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:161:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"分类"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:162:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"安装方式"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:163:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:164:17",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/ToolConfigTab.tsx:167:13",children:S.map(s=>{const l=be.includes(s.name);return e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:171:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:172:21",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:173:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.display_name}),e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:174:23",className:"text-xs text-[var(--dg-text-secondary)] font-mono",children:s.name}),s.description&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:176:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5 max-w-[220px] leading-tight",children:s.description}),s.installed_version&&s.status==="installed"&&e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:179:25",className:"text-xs text-emerald-400 font-mono mt-0.5",children:["v",s.installed_version]}),s.error_msg&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:182:25",className:"text-xs text-red-400 mt-0.5 max-w-[200px] truncate",title:s.error_msg,children:s.error_msg})]}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:185:21",className:"px-3 py-2 hidden sm:table-cell",children:e.jsx(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:186:23",className:`text-xs ${q[s.category]||q.other}`,children:Ce[s.category]||s.category})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:190:21",className:"px-3 py-2",children:e.jsxs(M,{"code-path":"src/components/deploy/ToolConfigTab.tsx:191:23",value:s.install_method,onValueChange:x=>D(s,x),children:[e.jsx(Q,{"code-path":"src/components/deploy/ToolConfigTab.tsx:195:25",className:"h-7 w-[90px] text-xs",children:e.jsx(W,{"code-path":"src/components/deploy/ToolConfigTab.tsx:196:27"})}),e.jsxs(X,{"code-path":"src/components/deploy/ToolConfigTab.tsx:198:25",children:[e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:199:27",value:"preinstall",children:"预装"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:200:27",value:"lazy",children:"懒加载"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:201:27",value:"disabled",children:"禁用"})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:205:21",className:"px-3 py-2",children:s.status==="installed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:207:25",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-xs gap-1",children:[e.jsx(re,{"code-path":"src/components/deploy/ToolConfigTab.tsx:208:27",className:"w-3 h-3"}),"已安装"]}):s.status==="installing"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:211:25",className:"bg-amber-500/20 text-amber-400 border-amber-500/30 text-xs gap-1",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:212:27",className:"w-3 h-3 animate-spin"}),"安装中"]}):s.status==="failed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:215:25",className:"bg-red-500/20 text-red-400 border-red-500/30 text-xs gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:216:27",className:"w-3 h-3"}),"失败"]}):e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:219:25",className:"bg-slate-500/20 text-slate-400 border-slate-500/30 text-xs gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/ToolConfigTab.tsx:220:27",className:"w-3 h-3"}),"未安装"]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:224:21",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:225:23",className:"flex justify-end gap-1",children:[s.install_method==="lazy"&&s.status!=="installed"&&(l?e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:228:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>v(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:234:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:236:33",className:"w-3 h-3 mr-1"}),"安装"]}):e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:241:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>y(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:247:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:249:33",className:"w-3 h-3 mr-1"}),"安装"]})),s.install_method==="lazy"&&e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:256:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-text-secondary)]",onClick:()=>T(s),disabled:C===s.id,children:[C===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:262:31",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(xe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:264:31",className:"w-3 h-3 mr-1"}),"测试"]}),e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:269:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(s),title:"检测",children:e.jsx(me,{"code-path":"src/components/deploy/ToolConfigTab.tsx:270:27",className:"w-3.5 h-3.5"})})]})})]},s.id)})})]})}),e.jsx(A,{"code-path":"src/components/deploy/ToolConfigTab.tsx:283:7",open:!!m,onOpenChange:()=>c(null),children:e.jsxs(H,{"code-path":"src/components/deploy/ToolConfigTab.tsx:284:9",className:"max-w-sm",children:[e.jsxs(J,{"code-path":"src/components/deploy/ToolConfigTab.tsx:285:11",children:[e.jsx(K,{"code-path":"src/components/deploy/ToolConfigTab.tsx:286:13",children:"选择安装版本"}),e.jsxs(oe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:287:13",children:[m?.tool.display_name," — 请选择要安装的版本"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:291:11",className:"space-y-4 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:292:13",className:"space-y-2",children:m?.versions.map((s,l)=>e.jsxs("button",{"code-path":"src/components/deploy/ToolConfigTab.tsx:294:17",onClick:()=>u(s.version),className:`w-full flex items-center justify-between px-3 py-2.5 rounded-lg text-sm border transition-all ${g===s.version?"border-indigo-400/50 bg-indigo-400/10 text-[var(--dg-text-primary)]":"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-secondary)] hover:border-[var(--dg-text-secondary)]/30"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:303:19",children:s.label}),e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:304:19",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:s.version})]},s.version))}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:308:13",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:[e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:309:15",variant:"outline",size:"sm",onClick:()=>c(null),children:"取消"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:310:15",size:"sm",onClick:()=>m&&y(m.tool,g),disabled:!g||h===m?.tool.id,children:[h===m?.tool.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:316:19",className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:318:19",className:"w-3.5 h-3.5 mr-1"}),"安装"]})]})]})]})})]})}function ue({open:S,onClose:b,onSaved:L,editData:n}){const[h,j]=o.useState(""),[m,c]=o.useState(""),[g,u]=o.useState("development"),[C,f]=o.useState("#3B82F6"),[p,v]=o.useState(""),[y,N]=o.useState(50),[D,T]=o.useState(!1);o.useEffect(()=>{n?(j(n.name),c(n.display_name),u(n.type),f(n.color),v(n.description||""),N(n.sort_order)):(j(""),c(""),u("development"),f("#3B82F6"),v(""),N(50))},[n,S]);const s=async()=>{if(!h.trim()||!m.trim()){r.error("请填写名称");return}T(!0);try{n?await i.updateEnvironment(n.id,{name:h,display_name:m,type:g,color:C,sort_order:y,description:p}):await i.createEnvironment({name:h,display_name:m,type:g,color:C,sort_order:y,description:p}),r.success(n?"已更新":"已创建"),L(),b()}catch{r.error("操作失败")}finally{T(!1)}};return e.jsx(A,{"code-path":"src/components/deploy/DeployCredentials.tsx:67:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/DeployCredentials.tsx:68:7",children:[e.jsx(J,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:9",children:e.jsx(K,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:23",children:n?"编辑环境":"新增环境"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:70:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:71:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:38",children:"环境标识"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:57",value:h,onChange:l=>j(l.target.value),placeholder:"production"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:72:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:38",children:"显示名称"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:57",value:m,onChange:l=>c(l.target.value),placeholder:"生产环境"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:73:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:73:38",children:"环境类型"}),e.jsxs(M,{"code-path":"src/components/deploy/DeployCredentials.tsx:74:13",value:g,onValueChange:u,children:[e.jsx(Q,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:15",children:e.jsx(W,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:30"})}),e.jsxs(X,{"code-path":"src/components/deploy/DeployCredentials.tsx:76:15",children:[e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:77:17",value:"production",children:"生产环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:78:17",value:"staging",children:"预发布"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:79:17",value:"testing",children:"测试环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:80:17",value:"development",children:"开发环境"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:84:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:38",children:"标志颜色"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:57",value:C,onChange:l=>f(l.target.value),type:"color",className:"w-16 h-9 p-1"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:85:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:38",children:"排序序号"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:57",value:y,onChange:l=>N(Number(l.target.value)),type:"number"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:86:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:38",children:"描述"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:55",value:p,onChange:l=>v(l.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:88:9",className:"flex justify-end gap-2 mt-4",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:89:11",variant:"outline",onClick:b,children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:90:11",onClick:s,disabled:D,children:D?"...":n?"保存":"创建"})]})]})})}function Re(){const S=ae(),[b,L]=o.useState([]),[n,h]=o.useState([]),[j,m]=o.useState([]),[c,g]=o.useState(!1),[u,C]=o.useState(!1),[f,p]=o.useState("repo"),[v,y]=o.useState(null),[N,D]=o.useState(!1),[T,s]=o.useState(null),l=async()=>{g(!0);try{const[t,F,$]=await Promise.all([i.getRepos(),i.getRegistries(),i.getEnvironments()]);L(t?.list||[]),h(F?.list||[]),m($?.list||[])}catch{r.error("获取数据失败")}finally{g(!1)}};o.useEffect(()=>{l()},[]);const x=async(t,F)=>{if(await S({title:"删除",description:`确定删除「${F.name||F.display_name}」?`,confirmText:"删除",variant:"destructive"}))try{t==="repo"?await i.deleteRepo(F.id):t==="registry"?await i.deleteRegistry(F.id):await i.deleteEnvironment(F.id),r.success("已删除"),l()}catch{r.error("删除失败")}},V={production:"生产",staging:"预发布",testing:"测试",development:"开发"};return e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:137:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/deploy/DeployCredentials.tsx:139:9",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"发布配置管理"}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:140:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:11",variant:"outline",size:"sm",onClick:l,children:[e.jsx(ee,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:66",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:142:11",size:"sm",onClick:()=>{p("repo"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:143:13",className:"w-4 h-4 mr-1"}),"新增 Git 仓库"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:145:11",size:"sm",variant:"secondary",onClick:()=>{p("registry"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:146:13",className:"w-4 h-4 mr-1"}),"新增镜像仓库"]})]})]}),e.jsxs(ne,{"code-path":"src/components/deploy/DeployCredentials.tsx:151:7",defaultValue:"repos",children:[e.jsxs(le,{"code-path":"src/components/deploy/DeployCredentials.tsx:152:9",children:[e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:11",value:"repos",className:"gap-1",children:[e.jsx(ye,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:56",className:"w-4 h-4"}),"Git 仓库 (",b.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:11",value:"registries",className:"gap-1",children:[e.jsx(Z,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:61",className:"w-4 h-4"}),"镜像仓库 (",n.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:11",value:"environments",className:"gap-1",children:[e.jsx(Y,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:63",className:"w-4 h-4"}),"环境管理 (",j.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:11",value:"tools",className:"gap-1",children:[e.jsx(he,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:56",className:"w-4 h-4"}),"工具配置"]})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:159:9",value:"repos",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:160:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:160:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):b.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:161:34",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无 Git 仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:163:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:164:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:165:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:166:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:167:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:168:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"仓库 URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:169:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证方式"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:170:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:171:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:174:17",children:b.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:176:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:177:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:178:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[300px] truncate",children:t.url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:179:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:179:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:180:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:181:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:183:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:184:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("repo"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:165",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("repo",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:136",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:197:9",value:"registries",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:198:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:198:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):n.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:199:39",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无镜像仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:201:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:202:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:203:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:204:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:205:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:206:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"Registry URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:207:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:208:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:209:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:210:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:213:17",children:n.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:215:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:216:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:217:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[250px] truncate",children:t.registry_url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:218:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden sm:table-cell",children:t.namespace||"-"}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:219:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:219:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:220:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:221:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:223:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:224:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("registry"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:169",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("registry",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:140",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsxs(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:238:9",value:"environments",className:"mt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:239:11",className:"flex items-center justify-end mb-3",children:e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:240:13",size:"sm",onClick:()=>{s(null),D(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:241:15",className:"w-4 h-4 mr-1"}),"新增环境"]})}),c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:244:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:244:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):j.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:245:41",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:'暂无环境配置,点击"新增环境"创建'}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:247:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:248:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:249:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:250:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:251:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"环境标识"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:252:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"显示名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:253:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:254:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"颜色"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:255:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"排序"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:256:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:257:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:260:17",children:j.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:262:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:263:23",className:"px-3 py-2 font-mono text-xs font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:264:23",className:"px-3 py-2 text-[var(--dg-text-primary)]",children:e.jsxs("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:265:25",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:266:27",className:"w-2.5 h-2.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.display_name]})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:270:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:270:49",variant:"secondary",className:"text-xs",children:V[t.type]||t.type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:23",className:"px-3 py-2",children:e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:49",className:"w-6 h-6 rounded border",style:{backgroundColor:t.color}})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:272:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:t.sort_order}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:273:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:274:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:276:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:277:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{s(t),D(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:144",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("env",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:137",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:291:9",value:"tools",className:"mt-3",children:e.jsx(je,{"code-path":"src/components/deploy/DeployCredentials.tsx:292:11"})})]}),e.jsx(ge,{"code-path":"src/components/deploy/DeployCredentials.tsx:296:7",open:u,onOpenChange:C,type:f,editId:v,repos:b,registries:n,onSave:l}),e.jsx(ue,{"code-path":"src/components/deploy/DeployCredentials.tsx:301:7",open:N,onClose:()=>D(!1),onSaved:l,editData:T})]})}export{Re as default}; +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/密码等)":"选择 Docker 密码凭据"})}),e.jsxs(X,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:119:15",children:[e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:120:17",value:"__none",children:"不关联凭证"}),t.map(a=>e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:122:19",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:123:21",className:"flex items-center gap-1.5",children:[e.jsx(de,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:124:23",className:"h-3 w-3 opacity-60"}),a.name," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:125:46",className:"text-[10px] opacity-50",children:["(",a.summary,")"]})]})},a.id))]})]}),t.length===0&&e.jsxs("p",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:132:15",className:"text-xs text-amber-400 flex items-center gap-1 mt-1",children:[e.jsx(G,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:133:17",className:"h-3 w-3"}),"暂无",c?"":"Docker 密码","类型凭证,请在凭证配置页面新增"]})]})]}),e.jsxs(te,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:139:9",children:[e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:140:11",variant:"outline",onClick:()=>b(!1),children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:141:11",onClick:$,disabled:x,children:x?"保存中...":"保存"})]})]})})}const Ce={build:"构建",deploy:"部署",automation:"自动化",other:"其他"},q={build:"bg-amber-500/20 text-amber-400 border-amber-500/30",deploy:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",automation:"bg-purple-500/20 text-purple-400 border-purple-500/30",other:"bg-slate-500/20 text-slate-400 border-slate-500/30"},be=["jdk","nodejs","maven"];function je(){const[S,b]=o.useState([]),[L,n]=o.useState(!1),[h,j]=o.useState(null),[m,c]=o.useState(null),[g,u]=o.useState(""),[C,f]=o.useState(null),p=async()=>{n(!0);try{const s=await i.getTools();b(s?.list||[])}catch{r.error("获取工具配置失败")}finally{n(!1)}};o.useEffect(()=>{p()},[]);const v=async s=>{try{const x=(await i.getToolVersions(s.id))?.versions||[];if(x.length===0){y(s);return}c({tool:s,versions:x}),u(s.default_version||x[0]?.version||"")}catch{y(s)}},y=async(s,l)=>{j(s.id);try{const x=l||s.default_version;await i.installTool(s.id,x),r.success(`${s.display_name}${x?` (${x})`:""} 安装已触发`),c(null),setTimeout(async()=>{try{await i.checkTool(s.id),p()}catch{}j(null)},3e3)}catch{r.error("触发安装失败"),j(null)}},N=async s=>{try{const l=await i.checkTool(s.id);r.success(l?.available?`${s.display_name} 可用`:`${s.display_name} 不可用`),p()}catch{r.error("检测失败")}},D=async(s,l)=>{try{await i.updateTool(s.id,{install_method:l}),r.success("已更新"),p()}catch{r.error("更新失败")}},T=async s=>{f(s.id);const l=Date.now();try{const x=await i.getToolVersions(s.id),V=((Date.now()-l)/1e3).toFixed(1);x?.versions?.length>0?r.success(`${s.display_name} 镜像可访问 (${V}s)`):r(`${s.display_name} 无法获取版本列表`,{description:"请检查网络连接"})}catch{r.error(`${s.display_name} 网络不可达`)}f(null)};return e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:137:5",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("p",{"code-path":"src/components/deploy/ToolConfigTab.tsx:139:9",className:"text-xs text-[var(--dg-text-secondary)]",children:"管理 DevOps 工具的安装策略:预装在镜像中、首次使用自动下载(懒加载)、或禁用不安装"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:142:9",variant:"outline",size:"sm",onClick:p,children:[e.jsx(ee,{"code-path":"src/components/deploy/ToolConfigTab.tsx:143:11",className:"w-3.5 h-3.5 mr-1"}),"刷新"]})]}),L?e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:148:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:149:11",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):S.length===0?e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:152:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无工具配置,请检查后端种子数据"}):e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:156:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/ToolConfigTab.tsx:157:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/ToolConfigTab.tsx:158:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:159:15",children:[e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:160:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"工具"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:161:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"分类"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:162:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"安装方式"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:163:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:164:17",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/ToolConfigTab.tsx:167:13",children:S.map(s=>{const l=be.includes(s.name);return e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:171:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:172:21",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:173:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.display_name}),e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:174:23",className:"text-xs text-[var(--dg-text-secondary)] font-mono",children:s.name}),s.description&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:176:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5 max-w-[220px] leading-tight",children:s.description}),s.installed_version&&s.status==="installed"&&e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:179:25",className:"text-xs text-emerald-400 font-mono mt-0.5",children:["v",s.installed_version]}),s.error_msg&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:182:25",className:"text-xs text-red-400 mt-0.5 max-w-[200px] truncate",title:s.error_msg,children:s.error_msg})]}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:185:21",className:"px-3 py-2 hidden sm:table-cell",children:e.jsx(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:186:23",className:`text-xs ${q[s.category]||q.other}`,children:Ce[s.category]||s.category})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:190:21",className:"px-3 py-2",children:e.jsxs(M,{"code-path":"src/components/deploy/ToolConfigTab.tsx:191:23",value:s.install_method,onValueChange:x=>D(s,x),children:[e.jsx(Q,{"code-path":"src/components/deploy/ToolConfigTab.tsx:195:25",className:"h-7 w-[90px] text-xs",children:e.jsx(W,{"code-path":"src/components/deploy/ToolConfigTab.tsx:196:27"})}),e.jsxs(X,{"code-path":"src/components/deploy/ToolConfigTab.tsx:198:25",children:[e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:199:27",value:"preinstall",children:"预装"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:200:27",value:"lazy",children:"懒加载"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:201:27",value:"disabled",children:"禁用"})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:205:21",className:"px-3 py-2",children:s.status==="installed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:207:25",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-xs gap-1",children:[e.jsx(re,{"code-path":"src/components/deploy/ToolConfigTab.tsx:208:27",className:"w-3 h-3"}),"已安装"]}):s.status==="installing"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:211:25",className:"bg-amber-500/20 text-amber-400 border-amber-500/30 text-xs gap-1",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:212:27",className:"w-3 h-3 animate-spin"}),"安装中"]}):s.status==="failed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:215:25",className:"bg-red-500/20 text-red-400 border-red-500/30 text-xs gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:216:27",className:"w-3 h-3"}),"失败"]}):e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:219:25",className:"bg-slate-500/20 text-slate-400 border-slate-500/30 text-xs gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/ToolConfigTab.tsx:220:27",className:"w-3 h-3"}),"未安装"]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:224:21",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:225:23",className:"flex justify-end gap-1",children:[s.install_method==="lazy"&&s.status!=="installed"&&(l?e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:228:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>v(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:234:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:236:33",className:"w-3 h-3 mr-1"}),"安装"]}):e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:241:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>y(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:247:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:249:33",className:"w-3 h-3 mr-1"}),"安装"]})),s.install_method==="lazy"&&e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:256:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-text-secondary)]",onClick:()=>T(s),disabled:C===s.id,children:[C===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:262:31",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(xe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:264:31",className:"w-3 h-3 mr-1"}),"测试"]}),e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:269:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(s),title:"检测",children:e.jsx(me,{"code-path":"src/components/deploy/ToolConfigTab.tsx:270:27",className:"w-3.5 h-3.5"})})]})})]},s.id)})})]})}),e.jsx(A,{"code-path":"src/components/deploy/ToolConfigTab.tsx:283:7",open:!!m,onOpenChange:()=>c(null),children:e.jsxs(H,{"code-path":"src/components/deploy/ToolConfigTab.tsx:284:9",className:"max-w-sm",children:[e.jsxs(J,{"code-path":"src/components/deploy/ToolConfigTab.tsx:285:11",children:[e.jsx(K,{"code-path":"src/components/deploy/ToolConfigTab.tsx:286:13",children:"选择安装版本"}),e.jsxs(oe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:287:13",children:[m?.tool.display_name," — 请选择要安装的版本"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:291:11",className:"space-y-4 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:292:13",className:"space-y-2",children:m?.versions.map((s,l)=>e.jsxs("button",{"code-path":"src/components/deploy/ToolConfigTab.tsx:294:17",onClick:()=>u(s.version),className:`w-full flex items-center justify-between px-3 py-2.5 rounded-lg text-sm border transition-all ${g===s.version?"border-indigo-400/50 bg-indigo-400/10 text-[var(--dg-text-primary)]":"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-secondary)] hover:border-[var(--dg-text-secondary)]/30"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:303:19",children:s.label}),e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:304:19",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:s.version})]},s.version))}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:308:13",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:[e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:309:15",variant:"outline",size:"sm",onClick:()=>c(null),children:"取消"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:310:15",size:"sm",onClick:()=>m&&y(m.tool,g),disabled:!g||h===m?.tool.id,children:[h===m?.tool.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:316:19",className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:318:19",className:"w-3.5 h-3.5 mr-1"}),"安装"]})]})]})]})})]})}function ue({open:S,onClose:b,onSaved:L,editData:n}){const[h,j]=o.useState(""),[m,c]=o.useState(""),[g,u]=o.useState("development"),[C,f]=o.useState("#3B82F6"),[p,v]=o.useState(""),[y,N]=o.useState(50),[D,T]=o.useState(!1);o.useEffect(()=>{n?(j(n.name),c(n.display_name),u(n.type),f(n.color),v(n.description||""),N(n.sort_order)):(j(""),c(""),u("development"),f("#3B82F6"),v(""),N(50))},[n,S]);const s=async()=>{if(!h.trim()||!m.trim()){r.error("请填写名称");return}T(!0);try{n?await i.updateEnvironment(n.id,{name:h,display_name:m,type:g,color:C,sort_order:y,description:p}):await i.createEnvironment({name:h,display_name:m,type:g,color:C,sort_order:y,description:p}),r.success(n?"已更新":"已创建"),L(),b()}catch{r.error("操作失败")}finally{T(!1)}};return e.jsx(A,{"code-path":"src/components/deploy/DeployCredentials.tsx:67:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/DeployCredentials.tsx:68:7",children:[e.jsx(J,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:9",children:e.jsx(K,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:23",children:n?"编辑环境":"新增环境"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:70:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:71:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:38",children:"环境标识"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:57",value:h,onChange:l=>j(l.target.value),placeholder:"production"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:72:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:38",children:"显示名称"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:57",value:m,onChange:l=>c(l.target.value),placeholder:"生产环境"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:73:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:73:38",children:"环境类型"}),e.jsxs(M,{"code-path":"src/components/deploy/DeployCredentials.tsx:74:13",value:g,onValueChange:u,children:[e.jsx(Q,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:15",children:e.jsx(W,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:30"})}),e.jsxs(X,{"code-path":"src/components/deploy/DeployCredentials.tsx:76:15",children:[e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:77:17",value:"production",children:"生产环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:78:17",value:"staging",children:"预发布"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:79:17",value:"testing",children:"测试环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:80:17",value:"development",children:"开发环境"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:84:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:38",children:"标志颜色"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:57",value:C,onChange:l=>f(l.target.value),type:"color",className:"w-16 h-9 p-1"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:85:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:38",children:"排序序号"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:57",value:y,onChange:l=>N(Number(l.target.value)),type:"number"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:86:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:38",children:"描述"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:55",value:p,onChange:l=>v(l.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:88:9",className:"flex justify-end gap-2 mt-4",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:89:11",variant:"outline",onClick:b,children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:90:11",onClick:s,disabled:D,children:D?"...":n?"保存":"创建"})]})]})})}function Re(){const S=ae(),[b,L]=o.useState([]),[n,h]=o.useState([]),[j,m]=o.useState([]),[c,g]=o.useState(!1),[u,C]=o.useState(!1),[f,p]=o.useState("repo"),[v,y]=o.useState(null),[N,D]=o.useState(!1),[T,s]=o.useState(null),l=async()=>{g(!0);try{const[t,F,$]=await Promise.all([i.getRepos(),i.getRegistries(),i.getEnvironments()]);L(t?.list||[]),h(F?.list||[]),m($?.list||[])}catch{r.error("获取数据失败")}finally{g(!1)}};o.useEffect(()=>{l()},[]);const x=async(t,F)=>{if(await S({title:"删除",description:`确定删除「${F.name||F.display_name}」?`,confirmText:"删除",variant:"destructive"}))try{t==="repo"?await i.deleteRepo(F.id):t==="registry"?await i.deleteRegistry(F.id):await i.deleteEnvironment(F.id),r.success("已删除"),l()}catch{r.error("删除失败")}},V={production:"生产",staging:"预发布",testing:"测试",development:"开发"};return e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:137:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/deploy/DeployCredentials.tsx:139:9",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"发布配置管理"}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:140:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:11",variant:"outline",size:"sm",onClick:l,children:[e.jsx(ee,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:66",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:142:11",size:"sm",onClick:()=>{p("repo"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:143:13",className:"w-4 h-4 mr-1"}),"新增 Git 仓库"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:145:11",size:"sm",variant:"secondary",onClick:()=>{p("registry"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:146:13",className:"w-4 h-4 mr-1"}),"新增镜像仓库"]})]})]}),e.jsxs(ne,{"code-path":"src/components/deploy/DeployCredentials.tsx:151:7",defaultValue:"repos",children:[e.jsxs(le,{"code-path":"src/components/deploy/DeployCredentials.tsx:152:9",children:[e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:11",value:"repos",className:"gap-1",children:[e.jsx(ye,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:56",className:"w-4 h-4"}),"Git 仓库 (",b.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:11",value:"registries",className:"gap-1",children:[e.jsx(Z,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:61",className:"w-4 h-4"}),"镜像仓库 (",n.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:11",value:"environments",className:"gap-1",children:[e.jsx(Y,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:63",className:"w-4 h-4"}),"环境管理 (",j.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:11",value:"tools",className:"gap-1",children:[e.jsx(he,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:56",className:"w-4 h-4"}),"工具配置"]})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:159:9",value:"repos",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:160:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:160:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):b.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:161:34",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无 Git 仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:163:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:164:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:165:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:166:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:167:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:168:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"仓库 URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:169:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证方式"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:170:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:171:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:174:17",children:b.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:176:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:177:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:178:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[300px] truncate",children:t.url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:179:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:179:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:180:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:181:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:183:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:184:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("repo"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:165",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("repo",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:136",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:197:9",value:"registries",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:198:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:198:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):n.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:199:39",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无镜像仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:201:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:202:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:203:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:204:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:205:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:206:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"Registry URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:207:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:208:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:209:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:210:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:213:17",children:n.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:215:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:216:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:217:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[250px] truncate",children:t.registry_url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:218:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden sm:table-cell",children:t.namespace||"-"}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:219:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:219:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:220:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:221:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:223:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:224:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("registry"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:169",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("registry",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:140",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsxs(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:238:9",value:"environments",className:"mt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:239:11",className:"flex items-center justify-end mb-3",children:e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:240:13",size:"sm",onClick:()=>{s(null),D(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:241:15",className:"w-4 h-4 mr-1"}),"新增环境"]})}),c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:244:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:244:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):j.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:245:41",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:'暂无环境配置,点击"新增环境"创建'}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:247:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:248:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:249:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:250:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:251:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"环境标识"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:252:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"显示名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:253:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:254:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"颜色"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:255:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"排序"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:256:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:257:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:260:17",children:j.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:262:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:263:23",className:"px-3 py-2 font-mono text-xs font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:264:23",className:"px-3 py-2 text-[var(--dg-text-primary)]",children:e.jsxs("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:265:25",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:266:27",className:"w-2.5 h-2.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.display_name]})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:270:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:270:49",variant:"secondary",className:"text-xs",children:V[t.type]||t.type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:23",className:"px-3 py-2",children:e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:49",className:"w-6 h-6 rounded border",style:{backgroundColor:t.color}})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:272:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:t.sort_order}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:273:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:274:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:276:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:277:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{s(t),D(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:144",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("env",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:137",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:291:9",value:"tools",className:"mt-3",children:e.jsx(je,{"code-path":"src/components/deploy/DeployCredentials.tsx:292:11"})})]}),e.jsx(ge,{"code-path":"src/components/deploy/DeployCredentials.tsx:296:7",open:u,onOpenChange:C,type:f,editId:v,repos:b,registries:n,onSave:l}),e.jsx(ue,{"code-path":"src/components/deploy/DeployCredentials.tsx:301:7",open:N,onClose:()=>D(!1),onSaved:l,editData:T})]})}export{Re as default}; diff --git a/backend/static/assets/DeployRBAC-DCJ4MkVI.js b/backend/static/assets/DeployRBAC-XP_74TOu.js similarity index 98% rename from backend/static/assets/DeployRBAC-DCJ4MkVI.js rename to backend/static/assets/DeployRBAC-XP_74TOu.js index 6090817..cb49d8b 100644 --- a/backend/static/assets/DeployRBAC-DCJ4MkVI.js +++ b/backend/static/assets/DeployRBAC-XP_74TOu.js @@ -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",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:191:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"流水线命中预览"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:192:13",className:"text-xs text-[var(--dg-text-muted)]",children:"— 选择一个角色查看哪些流水线会被匹配"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:194:11",className:"flex gap-2 mb-3 flex-wrap",children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:195:13",variant:n===null?"secondary":"ghost",size:"sm",onClick:()=>k(null),children:["全部 (",y.length,")"]}),p.map(s=>e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:197:15",variant:n===s.id?"secondary":"ghost",size:"sm",onClick:()=>k(s.id),className:s.status===0?"opacity-40":"",children:[s.name," (",B[s.id]?.length||0,")"]},s.id))]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:203:11",className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:[n===null?y.map(s=>e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:36",variant:"secondary",className:"text-xs",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:94",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)):y.map(s=>{const t=oe.includes(s.code);return e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:209:21",variant:t?"default":"secondary",className:`text-xs ${t?"bg-purple-500/20 text-purple-300 border-purple-500/30":"opacity-30"}`,children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:211:23",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)}),n!==null&&oe.length===0&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:217:15",className:"text-xs text-red-400",children:"无匹配 — 请调整正则表达式"})]})]})}),q&&e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:225:9",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:226:11",className:"p-4 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:227:13",className:"flex items-center justify-between",children:[e.jsxs("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:228:15",className:"text-sm font-medium text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:228:107",className:"w-4 h-4"}),"新建 Item Role"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:229:15",variant:"ghost",size:"sm",onClick:()=>z(!1),children:"取消"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:231:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:232:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:42",className:"text-xs",children:"名称"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:79",value:P,onChange:s=>H(s.target.value),placeholder:"如: backend",className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:233:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:42",className:"text-xs",children:"代码 (唯一标识)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:86",value:E,onChange:s=>K(s.target.value),placeholder:"如: backend",className:"h-8 text-sm font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:235:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:236:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:17",className:"text-xs flex items-center gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:68",className:"w-3 h-3"}),"正则匹配 Pattern"]}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:238:17",value:C,onChange:s=>{O(s.target.value)},placeholder:"如: ^cex-.*",className:"h-8 text-sm font-mono"}),C&&e.jsxs("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:240:19",className:"text-xs text-[var(--dg-text-muted)]",children:["实时匹配: ",(()=>{try{const s=y.filter(t=>new RegExp(C).test(t.code)).length;return s>0?`✅ 命中 ${s} 条流水线`:"⚠️ 无匹配"}catch{return"❌ 正则语法错误"}})()]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:245:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:246:17",className:"text-xs",children:"角色"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:247:17",value:Q,onValueChange:W,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:19",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:58"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:249:19",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:250:21",value:"owner",children:"拥有者 (owner)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:251:21",value:"editor",children:"编辑者 (editor)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:252:21",value:"viewer",children:"查看者 (viewer)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:257:13",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:40",className:"text-xs",children:"描述 (可选)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:82",value:Y,onChange:s=>Z(s.target.value),placeholder:"简要说明此角色的用途",className:"h-8 text-sm"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:258:13",onClick:ue,disabled:S,className:"w-full",children:[S?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:25",className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:77",className:"w-4 h-4 mr-1"}),S?"创建中...":"创建"]})]})}),p.length===0?e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:268:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:269:11",className:"w-10 h-10 mx-auto mb-2 opacity-20"}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:270:11",className:"text-sm",children:"暂无 Item Role"})]}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:273:9",className:"space-y-2",children:p.map(s=>e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:275:13",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${s.status===0?"opacity-50":""}`,children:e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:276:15",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:277:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:278:19",className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:279:21",className:"w-9 h-9 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:280:23",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:282:21",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:283:23",className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:284:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:s.name}),e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:285:25",className:`text-xs border ${ce(s.role)}`,children:s.role==="owner"?"拥有者":s.role==="editor"?"编辑者":"查看者"}),s.status===0&&e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:286:47",variant:"secondary",className:"text-xs text-red-400",children:"已禁用"}),e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:287:25",variant:"secondary",className:"text-xs cursor-pointer",onClick:()=>k(n===s.id?null:s.id),children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:288:27",className:"w-3 h-3 mr-0.5"}),B[s.id]?.length||0," 条"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:291:23",className:"text-xs text-[var(--dg-text-secondary)] mt-0.5 truncate",children:[e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:292:25",className:"font-mono text-purple-400 bg-purple-500/10 px-1 rounded",children:s.code}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:293:25",className:"mx-1",children:"→"}),e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:294:25",className:"font-mono text-blue-400 bg-blue-500/10 px-1 rounded",children:s.pattern}),s.description&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:295:46",className:"ml-2 opacity-60",children:s.description})]})]})]}),e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:299:19",className:"flex items-center gap-1 shrink-0",children:Ce===s.id?e.jsxs(e.Fragment,{children:[e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:302:25",value:$,onChange:t=>ee(t.target.value),className:"h-7 w-36 text-xs font-mono",placeholder:"正则表达式"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:303:25",value:se,onValueChange:te,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:27",className:"h-7 w-20 text-xs",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:71"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:305:27",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:306:29",value:"owner",children:"拥有者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:307:29",value:"editor",children:"编辑者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:308:29",value:"viewer",children:"查看者"})]})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-green-400",onClick:()=>Ae(s.id),children:e.jsx(we,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:134",className:"w-3.5 h-3.5"})}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(null),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:127",className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{U(s.id),ee(s.pattern),te(s.role)},children:[e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:178",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:317:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>Be(s),children:s.status?"禁用":"启用"}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>je(s),children:e.jsx(be,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:129",className:"w-3.5 h-3.5"})})]})})]})})},s.id))}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:330:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:331:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:332:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:333:13",className:"w-4 h-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:334:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"分配角色给用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:336:11",className:"flex gap-3 items-end mb-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:337:13",className:"space-y-1 flex-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:338:15",className:"text-xs",children:"选择用户"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:339:15",value:l,onValueChange:he,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:56",placeholder:"选择用户..."})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:341:17",className:"max-h-60",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:342:19",className:"px-2 py-1.5 sticky top-0 bg-popover z-10",children:e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:342:77",placeholder:"搜索用户...",className:"h-7 text-xs"})}),J.map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:344:21",value:String(s.id),children:[s.real_name||s.username," (",s.username,")",I.some(t=>t.user_id===s.id)&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:346:69",className:"ml-2 text-xs text-purple-400",children:"已分配"})]},s.id))]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:352:13",className:"space-y-1 w-48",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:353:15",className:"text-xs",children:"Item Role"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:354:15",value:j,onValueChange:M,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:56",placeholder:"选择角色"})}),e.jsx(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:356:17",children:p.filter(s=>s.status===1).map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:358:21",value:String(s.id),children:[s.name," (",s.role,")"]},s.id))})]})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:363:13",className:"h-8",onClick:De,disabled:G||!l||!j,children:[G?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:32",className:"w-3.5 h-3.5 mr-1 animate-spin"}):e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:88",className:"w-3.5 h-3.5 mr-1"}),"分配"]})]}),V&&e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:371:13",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:372:15",className:"flex items-center gap-2 mb-2",children:[e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:373:17",variant:"secondary",className:"text-xs",children:[e.jsx(Se,{"code-path":"src/components/deploy/DeployRBAC.tsx:374:19",className:"w-3 h-3 mr-1"}),V.real_name||V.username]}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:376:17",className:"text-xs text-[var(--dg-text-muted)]",children:"已分配角色:"})]}),I.length===0?e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:379:17",className:"text-xs text-[var(--dg-text-muted)] py-2",children:"该用户尚未分配任何 Item Role"}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:381:17",className:"space-y-1",children:I.map(s=>{const t=s.item_role||p.find(d=>d.id===s.item_role_id);return e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:385:23",className:"flex items-center justify-between py-1.5 px-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:386:25",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:387:27",className:`text-xs border ${ce(t?.role||"viewer")}`,children:t?.role==="owner"?"拥有者":t?.role==="editor"?"编辑者":"查看者"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:390:27",className:"text-[var(--dg-text-primary)]",children:t?.name||`#${s.item_role_id}`}),t&&e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:392:29",className:"font-mono text-[var(--dg-text-muted)] bg-[var(--dg-bg-primary)] px-1 rounded text-xs",children:t.pattern})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:397:25",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400",onClick:()=>ge(s.id),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:398:27",className:"w-3 h-3"})})]},s.id)})})]})]})})]})}export{Je as default}; +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",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:191:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"流水线命中预览"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:192:13",className:"text-xs text-[var(--dg-text-muted)]",children:"— 选择一个角色查看哪些流水线会被匹配"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:194:11",className:"flex gap-2 mb-3 flex-wrap",children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:195:13",variant:n===null?"secondary":"ghost",size:"sm",onClick:()=>k(null),children:["全部 (",y.length,")"]}),p.map(s=>e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:197:15",variant:n===s.id?"secondary":"ghost",size:"sm",onClick:()=>k(s.id),className:s.status===0?"opacity-40":"",children:[s.name," (",B[s.id]?.length||0,")"]},s.id))]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:203:11",className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:[n===null?y.map(s=>e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:36",variant:"secondary",className:"text-xs",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:94",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)):y.map(s=>{const t=oe.includes(s.code);return e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:209:21",variant:t?"default":"secondary",className:`text-xs ${t?"bg-purple-500/20 text-purple-300 border-purple-500/30":"opacity-30"}`,children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:211:23",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)}),n!==null&&oe.length===0&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:217:15",className:"text-xs text-red-400",children:"无匹配 — 请调整正则表达式"})]})]})}),q&&e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:225:9",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:226:11",className:"p-4 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:227:13",className:"flex items-center justify-between",children:[e.jsxs("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:228:15",className:"text-sm font-medium text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:228:107",className:"w-4 h-4"}),"新建 Item Role"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:229:15",variant:"ghost",size:"sm",onClick:()=>z(!1),children:"取消"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:231:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:232:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:42",className:"text-xs",children:"名称"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:79",value:P,onChange:s=>H(s.target.value),placeholder:"如: backend",className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:233:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:42",className:"text-xs",children:"代码 (唯一标识)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:86",value:E,onChange:s=>K(s.target.value),placeholder:"如: backend",className:"h-8 text-sm font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:235:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:236:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:17",className:"text-xs flex items-center gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:68",className:"w-3 h-3"}),"正则匹配 Pattern"]}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:238:17",value:C,onChange:s=>{O(s.target.value)},placeholder:"如: ^cex-.*",className:"h-8 text-sm font-mono"}),C&&e.jsxs("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:240:19",className:"text-xs text-[var(--dg-text-muted)]",children:["实时匹配: ",(()=>{try{const s=y.filter(t=>new RegExp(C).test(t.code)).length;return s>0?`✅ 命中 ${s} 条流水线`:"⚠️ 无匹配"}catch{return"❌ 正则语法错误"}})()]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:245:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:246:17",className:"text-xs",children:"角色"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:247:17",value:Q,onValueChange:W,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:19",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:58"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:249:19",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:250:21",value:"owner",children:"拥有者 (owner)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:251:21",value:"editor",children:"编辑者 (editor)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:252:21",value:"viewer",children:"查看者 (viewer)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:257:13",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:40",className:"text-xs",children:"描述 (可选)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:82",value:Y,onChange:s=>Z(s.target.value),placeholder:"简要说明此角色的用途",className:"h-8 text-sm"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:258:13",onClick:ue,disabled:S,className:"w-full",children:[S?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:25",className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:77",className:"w-4 h-4 mr-1"}),S?"创建中...":"创建"]})]})}),p.length===0?e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:268:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:269:11",className:"w-10 h-10 mx-auto mb-2 opacity-20"}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:270:11",className:"text-sm",children:"暂无 Item Role"})]}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:273:9",className:"space-y-2",children:p.map(s=>e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:275:13",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${s.status===0?"opacity-50":""}`,children:e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:276:15",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:277:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:278:19",className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:279:21",className:"w-9 h-9 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:280:23",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:282:21",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:283:23",className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:284:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:s.name}),e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:285:25",className:`text-xs border ${ce(s.role)}`,children:s.role==="owner"?"拥有者":s.role==="editor"?"编辑者":"查看者"}),s.status===0&&e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:286:47",variant:"secondary",className:"text-xs text-red-400",children:"已禁用"}),e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:287:25",variant:"secondary",className:"text-xs cursor-pointer",onClick:()=>k(n===s.id?null:s.id),children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:288:27",className:"w-3 h-3 mr-0.5"}),B[s.id]?.length||0," 条"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:291:23",className:"text-xs text-[var(--dg-text-secondary)] mt-0.5 truncate",children:[e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:292:25",className:"font-mono text-purple-400 bg-purple-500/10 px-1 rounded",children:s.code}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:293:25",className:"mx-1",children:"→"}),e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:294:25",className:"font-mono text-blue-400 bg-blue-500/10 px-1 rounded",children:s.pattern}),s.description&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:295:46",className:"ml-2 opacity-60",children:s.description})]})]})]}),e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:299:19",className:"flex items-center gap-1 shrink-0",children:Ce===s.id?e.jsxs(e.Fragment,{children:[e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:302:25",value:$,onChange:t=>ee(t.target.value),className:"h-7 w-36 text-xs font-mono",placeholder:"正则表达式"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:303:25",value:se,onValueChange:te,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:27",className:"h-7 w-20 text-xs",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:71"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:305:27",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:306:29",value:"owner",children:"拥有者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:307:29",value:"editor",children:"编辑者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:308:29",value:"viewer",children:"查看者"})]})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-green-400",onClick:()=>Ae(s.id),children:e.jsx(we,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:134",className:"w-3.5 h-3.5"})}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(null),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:127",className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{U(s.id),ee(s.pattern),te(s.role)},children:[e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:178",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:317:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>Be(s),children:s.status?"禁用":"启用"}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>je(s),children:e.jsx(be,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:129",className:"w-3.5 h-3.5"})})]})})]})})},s.id))}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:330:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:331:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:332:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:333:13",className:"w-4 h-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:334:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"分配角色给用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:336:11",className:"flex gap-3 items-end mb-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:337:13",className:"space-y-1 flex-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:338:15",className:"text-xs",children:"选择用户"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:339:15",value:l,onValueChange:he,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:56",placeholder:"选择用户..."})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:341:17",className:"max-h-60",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:342:19",className:"px-2 py-1.5 sticky top-0 bg-popover z-10",children:e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:342:77",placeholder:"搜索用户...",className:"h-7 text-xs"})}),J.map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:344:21",value:String(s.id),children:[s.real_name||s.username," (",s.username,")",I.some(t=>t.user_id===s.id)&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:346:69",className:"ml-2 text-xs text-purple-400",children:"已分配"})]},s.id))]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:352:13",className:"space-y-1 w-48",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:353:15",className:"text-xs",children:"Item Role"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:354:15",value:j,onValueChange:M,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:56",placeholder:"选择角色"})}),e.jsx(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:356:17",children:p.filter(s=>s.status===1).map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:358:21",value:String(s.id),children:[s.name," (",s.role,")"]},s.id))})]})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:363:13",className:"h-8",onClick:De,disabled:G||!l||!j,children:[G?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:32",className:"w-3.5 h-3.5 mr-1 animate-spin"}):e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:88",className:"w-3.5 h-3.5 mr-1"}),"分配"]})]}),V&&e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:371:13",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:372:15",className:"flex items-center gap-2 mb-2",children:[e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:373:17",variant:"secondary",className:"text-xs",children:[e.jsx(Se,{"code-path":"src/components/deploy/DeployRBAC.tsx:374:19",className:"w-3 h-3 mr-1"}),V.real_name||V.username]}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:376:17",className:"text-xs text-[var(--dg-text-muted)]",children:"已分配角色:"})]}),I.length===0?e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:379:17",className:"text-xs text-[var(--dg-text-muted)] py-2",children:"该用户尚未分配任何 Item Role"}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:381:17",className:"space-y-1",children:I.map(s=>{const t=s.item_role||p.find(d=>d.id===s.item_role_id);return e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:385:23",className:"flex items-center justify-between py-1.5 px-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:386:25",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:387:27",className:`text-xs border ${ce(t?.role||"viewer")}`,children:t?.role==="owner"?"拥有者":t?.role==="editor"?"编辑者":"查看者"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:390:27",className:"text-[var(--dg-text-primary)]",children:t?.name||`#${s.item_role_id}`}),t&&e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:392:29",className:"font-mono text-[var(--dg-text-muted)] bg-[var(--dg-bg-primary)] px-1 rounded text-xs",children:t.pattern})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:397:25",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400",onClick:()=>ge(s.id),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:398:27",className:"w-3 h-3"})})]},s.id)})})]})]})})]})}export{Je as default}; diff --git a/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js b/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js new file mode 100644 index 0000000..45b1806 --- /dev/null +++ b/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js @@ -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{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:"h-4 w-4"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(i.status)}22`,color:pt(i.status),border:`1px solid ${pt(i.status)}44`},children:i.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${v}`,"_blank"),children:v||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:i.ip||i.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",i.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(S.startTime||i.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(i),children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(i),children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>n(i),children:[e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),l&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:58:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(ms,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:i}),i.containers&&i.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:i.containers.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:64:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:66:29",className:"font-medium text-[var(--dg-text-primary)]",children:g.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:g.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:g.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:27",className:"text-[var(--dg-text-muted)] mt-1",children:g.image}),g.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:71:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:31",children:["CPU: ",g.resources?.requests?.cpu||"0","/",g.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",g.resources?.requests?.memory||"0","/",g.resources?.limits?.memory||"-"]})]})]},A))})]})]})},i.name)})})}function Us({services:t,ingresses:s,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(a.selector).map(([n,c])=>e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:43:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[n,"=",c]},n))})]},a.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ds,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78:21",className:"text-xs text-[var(--dg-text-muted)]",children:a.rules.flatMap(n=>(n.http?.paths||n.paths||[]).map(c=>c.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Ys({events:t,loading:s}){return s==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:15:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:18:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:19:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:21:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:24:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:25:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:26:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:27:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:32:13",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:33:15",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:34:17",variant:"outline",className:o.type==="Warning"?"text-[var(--dg-yellow)] border-[var(--dg-yellow)]/30":"text-[var(--dg-text-muted)] border-[var(--dg-border)]",children:o.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:38:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:39:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md whitespace-normal break-words",children:o.message}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:40:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:41:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:42:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(o.lastTimestamp)})]},a))})]})})}function Js({hpas:t,cronHpas:s,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,c)=>{const d=n.spec?.minReplicas??n.minReplicas??1,i=n.spec?.maxReplicas??n.maxReplicas??10,S=n.spec?.metrics||n.metrics||[],l=n.status?.currentReplicas??n.currentReplicas??0,A=(n.status?.conditions||n.conditions||[]).find(b=>b.type==="AbleToScale")?.status==="True";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[d," → ",i]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:S.map((b,E)=>{const f=b.resource||b.object?.metric?.name||"",w=b.resource?.target?.averageUtilization||b.resource?.target?.averageValue||b.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[f?.name||f,": ",w,b.resource?.target?.averageUtilization?"%":""]},E)})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:l}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:A?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:A?"正常":"异常"})})]},n.name||c)})})]})})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,c)=>{const d=n.spec?.jobs||n.jobs||[],i=n.spec?.timezone||"UTC";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:d.map(S=>S.targetSize||S.targetReplicas||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:d.map(S=>S.schedule||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:i}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||c)})})]})})})]})]})}function Ks({revisions:t,rollbackLoading:s,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,n)=>{const c=a.revision??a.revision_number??a.number??n+1,d=n===0;return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",c]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:d?e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(a.created_at||a.time)}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:d||s!==null,onClick:()=>o(a),children:[s===c?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ps,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},c)})})]})})}function Xs(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:c,onRefresh:d}=t,{toast:i}=Te(),S=nt(),[l,v]=p.useState("pods"),[g,A]=p.useState(null),[b,E]=p.useState(null),[f,w]=p.useState(a?.replicas||0),[_,I]=p.useState(!1),[Z,q]=p.useState([]),[Q,$]=p.useState([]),[U,Y]=p.useState([]),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState([]),ee=a?.ready_replicas??a?.readyReplicas??0,le=a?.replicas??0,ke=ee===le&&le>0;p.useEffect(()=>{l==="services"&&(z("services"),Promise.all([ce.getNamespaceServices(s,o).catch(()=>[]),ce.getNamespaceIngresses(s,o).catch(()=>[])]).then(([r,h])=>{const N=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],O=N(r),B=N(h),J=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},de=O.filter(R=>{const ae=R.spec?.selector||R.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([fe,Se])=>J[fe]===Se)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"",ports:(R.spec?.ports||R.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),Ce=new Set(de.map(R=>R.name)),pe=B.filter(R=>(R.spec?.rules||R.rules||[]).some(fe=>(fe.http?.paths||fe.paths||[]).some(Se=>{const C=Se.backend?.service?.name||Se.backendService||"";return Ce.has(C)}))).map(R=>({name:R.name||R.metadata?.name,className:R.spec?.ingressClassName||R.ingressClass||"-",hosts:(R.spec?.rules||R.rules||[]).map(ae=>ae.host).filter(Boolean),rules:R.spec?.rules||R.rules||[],age:R.age||""}));q(de),$(pe)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a]),p.useEffect(()=>{l==="events"&&(z("events"),ce.getEvents(s,o,void 0).then(r=>{const h=Array.isArray(r)?r:r?.list||r?.items||r?.data||[],N=a?.name||"",O=h.filter(B=>{const J=String(B.object||"");if(!N||!J)return!1;if(J.endsWith(`/${N}`))return!0;const de=J.split("/").pop()||"";return de===N||de.startsWith(`${N}-`)}).map(B=>({type:B.type||"Normal",reason:B.reason||"",message:B.message||"",source:B.object||B.source?.component||B.sourceComponent||"-",firstTimestamp:B.first_time||B.firstTimestamp||B.first_timestamp||"",lastTimestamp:B.last_time||B.lastTimestamp||B.last_timestamp||"",count:B.count||1}));Y(O)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]),p.useEffect(()=>{l==="scale"&&(z("scale"),Promise.all([ce.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([r])=>{const N=(B=>Array.isArray(B)?B:B?.list||B?.items||B?.data||[])(r),O=a?.name||"";H(N.filter(B=>(B.scaleTargetRef?.name||B.targetRef?.name||"")===O)),M([])}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]);const ge=async r=>{const h=r.revision??r.revision_number??r.number;if(await S({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){E(h);try{await ce.rollbackDeployment(s,o,a.name,Number(h)),i({title:"回滚已下发",description:`正在回滚到 #${h}`}),d()}catch(O){i({title:"回滚失败",description:O?.message||String(O),variant:"destructive"})}finally{E(null)}}},m=async()=>{I(!0);try{await ce.scaleDeployment(s,o,a.name,f),i({title:"伸缩已提交",description:`副本数 → ${f}`}),d()}catch(r){i({title:"伸缩失败",description:r?.message||String(r),variant:"destructive"})}finally{I(!1)}},k=[{key:"pods",label:"容器组",icon:Fe,count:n.length},{key:"services",label:"访问方式",icon:Ae,count:Z.length},{key:"events",label:"事件",icon:ss,count:U.length},{key:"scale",label:"容器伸缩",icon:oe},{key:"history",label:"历史版本",icon:As,count:c.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:7",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:189:13",label:"状态",value:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:190:15",style:{background:`${ke?we.green:we.orange}22`,color:ke?we.green:we.orange,border:`1px solid ${ke?we.green:we.orange}44`},children:ke?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:41",className:"font-mono",children:[ee,"/",le]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:198:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:199:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${s}/nodes/${n[0].node_name||n[0].node}`,"_blank"),children:n[0].node_name||n[0].node||"-"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",label:"创建时间",value:Ve(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:209:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(ms,{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:217:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(r=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:219:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${l===r.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>v(r.key),children:[e.jsx(r.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:13",className:"h-4 w-4"}),r.label,r.key==="pods"&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:r.count})]},r.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:233:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_||f<=0,onClick:()=>w(r=>Math.max(0,r-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:13",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:11",type:"number",min:0,value:f,onChange:r=>w(Math.max(0,Number(r.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_,onClick:()=>w(r=>r+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",className:"h-4 w-4"})}),f!==le&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:250:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:_,onClick:m,children:_?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),l==="pods"&&e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:26",...t,expandedPod:g,setExpandedPod:A}),l==="services"&&e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:30",services:Z,ingresses:Q,loading:P,namespace:o}),l==="events"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:28",events:U,loading:P}),l==="scale"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:9",hpas:x,cronHpas:G,loading:P,replicas:le}),l==="history"&&e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:29",revisions:c,rollbackLoading:b,onRollback:ge})]})}async function rt(t,s,o,a){const n=await Es(a);await ce.updateResourceYaml(t,s,"deployments",o,n)}function Xe(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function Re(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState(1),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState([]),[Q,$]=p.useState([]);p.useEffect(()=>{const r=a;if(!r){v(!1);return}A(r),E(r?.spec?.replicas??1),w(Xe(r?.metadata?.labels)),I(Xe(r?.metadata?.annotations)),q(Xe(r?.spec?.selector?.matchLabels)),$(Xe(r?.spec?.template?.metadata?.labels)),v(!1)},[a]);const U=(r,h)=>{w(N=>N.map((O,B)=>B===r?{...O,...h}:O))},Y=()=>w(r=>[...r,{key:"",value:""}]),P=r=>w(h=>h.filter((N,O)=>O!==r)),z=(r,h)=>{I(N=>N.map((O,B)=>B===r?{...O,...h}:O))},x=()=>I(r=>[...r,{key:"",value:""}]),H=r=>I(h=>h.filter((N,O)=>O!==r)),G=(r,h)=>{q(N=>N.map((O,B)=>B===r?{...O,...h}:O))},M=()=>q(r=>[...r,{key:"",value:""}]),ee=r=>q(h=>h.filter((N,O)=>O!==r)),le=(r,h)=>{$(N=>N.map((O,B)=>B===r?{...O,...h}:O))},ke=()=>$(r=>[...r,{key:"",value:""}]),ge=r=>$(h=>h.filter((N,O)=>O!==r)),m=()=>{const r=Re(Z);$(h=>{const N={...Re(h),...r};return Object.entries(N).map(([O,B])=>({key:O,value:B}))}),d({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},k=async()=>{S(!0);try{const r=JSON.parse(JSON.stringify(g));r.spec=r.spec||{},r.spec.replicas=b;const h=Re(f);r.metadata=r.metadata||{},r.metadata.labels=Object.keys(h).length>0?h:void 0;const N=Re(_);r.metadata.annotations=Object.keys(N).length>0?N:void 0;const O=Re(Z);Object.keys(O).length>0&&(r.spec.selector=r.spec.selector||{},r.spec.selector.matchLabels=O);const B=Re(Q);r.spec.template=r.spec.template||{},r.spec.template.metadata=r.spec.template.metadata||{},Object.keys(B).length>0?r.spec.template.metadata.labels=B:delete r.spec.template.metadata.labels,await rt(t,s,o,r),d({title:"基本信息已保存",description:`${o} 更新已提交`}),n(r)}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ts,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:b,onChange:r=>E(Math.max(0,Number(r.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:187:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:f.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Y,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[f.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),f.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:r.key,placeholder:"app",onChange:N=>U(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:r.value,placeholder:"nginx",onChange:N=>U(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>P(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:M,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),Z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),Z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:r.key,placeholder:"app",onChange:N=>G(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:r.value,placeholder:"nginx",onChange:N=>G(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ee(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:m,children:"从 Selector 同步"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ke,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),Q.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),Q.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:r.key,placeholder:"app",onChange:N=>le(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:r.value,placeholder:"nginx",onChange:N=>le(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ge(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:_.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:x,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[_.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),_.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:r.key,placeholder:"deployment.kubernetes.io/revision",onChange:N=>z(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:r.value,placeholder:"1",onChange:N=>z(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>H(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:k,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function zt(t){const s=n=>{if(!n)return null;let c="none";return n.httpGet?c="httpGet":n.tcpSocket?c="tcpSocket":n.exec&&(c="exec"),{type:c,httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",httpHost:n.httpGet?.host||"",tcpPort:n.tcpSocket?.port??"",execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` +`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let 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.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:o.ports.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},c)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:a,children:[e.jsx(Hs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159:13",value:o.resources.requests?.cpu||"",placeholder:"100m",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165:13",value:o.resources.limits?.cpu||"",placeholder:"500m",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171:13",value:o.resources.requests?.memory||"",placeholder:"128Mi",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177:13",value:o.resources.limits?.memory||"",placeholder:"512Mi",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:a,children:[e.jsx(Ms,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(en,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:o[n],onChange:c=>s({[n]:c})},n))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:a,children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:n=>s({lifecycle:{...o.lifecycle,postStart:n}})}),e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204:11",label:"终止前 (preStop)",handler:o.lifecycle?.preStop,onChange:n=>s({lifecycle:{...o.lifecycle,preStop:n}})})]}),!o.lifecycle&&e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:208:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>s({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:a,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223:17",type:"number",value:o.securityContext.runAsUser??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsUser:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229:17",type:"number",value:o.securityContext.runAsGroup??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsGroup:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235:17",value:(o.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesAdd:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241:17",value:(o.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesDrop:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...o.securityContext,runAsNonRoot:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!o.securityContext.privileged,onChange:n=>s({securityContext:{...o.securityContext,privileged:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...o.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...o.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:a,children:[e.jsx(Bs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({volumeMounts:[...o.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[o.volumeMounts.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,name:d.target.value},s({volumeMounts: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:284:15",value:n.mountPath,placeholder:"/data",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,mountPath:d.target.value},s({volumeMounts: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:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,subPath:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:d=>{const i=[...o.volumeMounts];i[c]={...n,readOnly:d},s({volumeMounts:i})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:o.volumeMounts.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},c)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function en({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},c=d=>o({...n,...d});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:d=>o(d?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:n.type||"httpGet",onValueChange:d=>c({type:d}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:d=>c({httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:d=>c({httpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:d=>c({httpHost:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),n.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:d=>c({tcpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),n.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:d=>c({execCommand:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:d=>c({initialDelaySeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:d=>c({periodSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:d=>c({timeoutSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:d=>c({successThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:d=>c({failureThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function qt({label:t,handler:s,onChange:o}){const a=s||{type:"none"},n=!a.type||a.type==="none"?"__none":a.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:n,onValueChange:c=>o({...a,type:c==="__none"?"none":c}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423:9",value:a.execCommand||"",placeholder:"每行一个命令片段",onChange:c=>o({...a,execCommand:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),a.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:c=>o({...a,httpPath:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:c=>o({...a,httpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),a.type==="tcpSocket"&&e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:c=>o({...a,tcpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Qe({label:t,value:s,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:s,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Ut({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:c,onRemove:d,onUpdate:i,onDuplicate:S}){const l=nt(),[v,g]=p.useState(new Set([0])),A=f=>{g(w=>{const _=new Set(w);return _.has(f)?_.delete(f):_.add(f),_})},b=n==="blue"?"border-blue-500/30":"border-purple-500/30",E=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[o,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:c,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((f,w)=>{const _=v.has(w)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${b} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${E} cursor-pointer`,onClick:()=>A(w),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[_?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx(Fe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:f.name||"(未命名)"}),f.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:f.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:I=>I.stopPropagation(),children:[S&&e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>S(w),children:e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await l({title:"删除容器",description:`确认删除容器「${f.name}」?`,confirmText:"删除",variant:"destructive"})&&d(w)},children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),_&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Zs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:f,onUpdate:I=>i(w,I)})})]},w)})]})]})}function tn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const x=a?.spec?.template?.spec||{};E((Array.isArray(x.containers)?x.containers:[]).map(zt)),w((Array.isArray(x.initContainers)?x.initContainers:[]).map(zt)),I((Array.isArray(x.imagePullSecrets)?x.imagePullSecrets:[]).map(H=>H.name||"")),v(!1)},[a]);const Z=(x,H)=>{E(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},q=()=>{E(x=>[...x,$t(`container-${x.length+1}`)])},Q=x=>{E(H=>H.filter((G,M)=>M!==x))},$=x=>{E(H=>{const G=JSON.parse(JSON.stringify(H[x]));G.name=`${G.name}-copy`;const M=[...H];return M.splice(x+1,0,G),M})},U=(x,H)=>{w(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},Y=()=>{w(x=>[...x,$t(`init-${x.length+1}`)])},P=x=>{w(H=>H.filter((G,M)=>M!==x))},z=async()=>{for(const x of[...f,...b]){if(!x.name.trim()){d({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!x.image.trim()){d({title:"保存失败",description:`容器 ${x.name} 的镜像不能为空`,variant:"destructive"});return}}S(!0);try{const x=JSON.parse(JSON.stringify(g));x.spec=x.spec||{},x.spec.template=x.spec.template||{},x.spec.template.spec=x.spec.template.spec||{},x.spec.template.spec.containers=b.map(Gt),x.spec.template.spec.initContainers=f.length>0?f.map(Gt):void 0,x.spec.template.spec.imagePullSecrets=_.filter(H=>H.trim()).length>0?_.filter(H=>H.trim()).map(H=>({name:H})):void 0,await rt(t,s,o,x),d({title:"容器配置已保存",description:`${o} 更新已提交`}),n(x)}catch(x){d({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[_.map((x,H)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145:17",className:"text-xs text-slate-300 font-mono",children:x}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>I(G=>G.filter((M,ee)=>ee!==H)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},H)),_.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:x=>{if(x.key==="Enter"){const H=x.target.value.trim();H&&(I(G=>[...G,H]),x.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>I(x=>[...x,""]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:f,accentColor:"purple",onAdd:Y,onRemove:P,onUpdate:U}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:b,accentColor:"blue",onAdd:q,onRemove:Q,onUpdate:Z,onDuplicate:$}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:f.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:b.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:z,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function sn(t=""){return{volume:{name:"",type:"emptyDir"},containerName:t,mountPath:"",subPath:"",readOnly:!1}}const nn=["kube-api-access-","default-token-","kube-"];function yt(t){if(!t||typeof t!="object")return!1;const s=String(t.name||"");return nn.some(o=>s.startsWith(o))?!0:!!(t.projected||t.downwardAPI||t.csi||t.ephemeral)}function Yt(t){const s=t?.trim();if(!s)return;if(s.startsWith("["))try{const a=JSON.parse(s);if(Array.isArray(a))return a.filter(n=>n?.key&&n?.path)}catch{}const o=s.split(",").map(a=>a.trim()).filter(Boolean).map(a=>{const n=a.indexOf(":");return n<=0?null:{key:a.slice(0,n).trim(),path:a.slice(n+1).trim()}}).filter(Boolean);return o.length?o:void 0}function on(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||""}:t.emptyDir!=null?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:yt(t)?{name:s,type:"custom",_raw:t}:{name:s,type:"custom",_raw:t}}function xs(t){if(t.type==="custom"&&t._raw)return JSON.parse(JSON.stringify(t._raw));const s=t.name?.trim();if(!s)return null;const o={name:s};switch(t.type){case"emptyDir":{const a={};t.medium?.trim()&&(a.medium=t.medium.trim()),t.sizeLimit?.trim()&&(a.sizeLimit=t.sizeLimit.trim()),o.emptyDir=a;break}case"hostPath":{const a={path:t.path?.trim()||"/"};t.pathType?.trim()&&(a.type=t.pathType.trim()),o.hostPath=a;break}case"configMap":{const a=t.configMapName?.trim();if(!a)return null;const n={name:a},c=Yt(t.cmItems);c&&(n.items=c),o.configMap=n;break}case"secret":{const a=t.secretName?.trim();if(!a)return null;const n={secretName:a},c=Yt(t.secItems);c&&(n.items=c),o.secret=n;break}case"persistentVolumeClaim":{const a=t.pvcName?.trim();if(!a)return null;const n={claimName:a};t.pvcReadOnly&&(n.readOnly=!0),o.persistentVolumeClaim=n;break}case"nfs":{const a=t.nfsServer?.trim(),n=t.nfsPath?.trim();if(!a||!n)return null;const c={server:a,path:n};t.nfsReadOnly&&(c.readOnly=!0),o.nfs=c;break}default:return null}return o}function an(t,s){return{containerName:t,volumeName:s.name||"",mountPath:s.mountPath||"",subPath:s.subPath||"",readOnly:!!s.readOnly}}function rn(t){if(!t.volumeName?.trim()||!t.mountPath?.trim())return null;const s={name:t.volumeName.trim(),mountPath:t.mountPath.trim()};return t.subPath?.trim()&&(s.subPath=t.subPath.trim()),t.readOnly&&(s.readOnly=!0),s}const cn=["/var/run/secrets/kubernetes.io/serviceaccount"];function hs(t,s){if(!t)return!1;if(s.has(t.name))return!0;const o=t.mountPath||"";return cn.some(a=>o.startsWith(a))}function ln(t){const s=t?.spec?.template?.spec||{},o=Array.isArray(s.volumes)?s.volumes:[],a=o.filter(yt),n=o.filter(l=>!yt(l)),c=[...Array.isArray(s.containers)?s.containers:[],...Array.isArray(s.initContainers)?s.initContainers:[]],d=c.map(l=>l.name||"(unnamed)"),i=new Set(a.map(l=>l.name)),S=[];for(const l of c){const v=l.name||"(unnamed)",g=Array.isArray(l.volumeMounts)?l.volumeMounts:[];for(const A of g)hs(A,i)||S.push(an(v,A))}return{volumes:n.map(on),mounts:S,containers:d,passthroughVolumes:a}}function dn(t){const{volumes:s,mounts:o,containers:a,passthroughVolumes:n}=ln(t),c=a.find(i=>i!=="(unnamed)")||a[0]||"";return{entries:s.map(i=>{const l=o.filter(v=>v.volumeName===i.name)[0];return{volume:i,containerName:l?.containerName||c,mountPath:l?.mountPath||"",subPath:l?.subPath||"",readOnly:l?.readOnly??!1}}),containers:a,passthroughVolumes:n}}function pn(t){const s=t.map(a=>a.volume),o=t.filter(a=>a.volume.name.trim()&&a.mountPath.trim()).map(a=>({containerName:a.containerName,volumeName:a.volume.name.trim(),mountPath:a.mountPath.trim(),subPath:a.subPath.trim(),readOnly:a.readOnly}));return{volumes:s,mounts:o}}function mn(t,s,o,a){const n=JSON.parse(JSON.stringify(t));n.spec=n.spec||{},n.spec.template=n.spec.template||{},n.spec.template.spec=n.spec.template.spec||{};const c=n.spec.template.spec,d=s.map(xs).filter(Boolean),i=[...a,...d];i.length>0?c.volumes=i:delete c.volumes;const S=new Set(a.map(v=>v.name)),l=v=>{const g=v.name||"(unnamed)",b=(Array.isArray(v.volumeMounts)?v.volumeMounts:[]).filter(w=>hs(w,S)),E=o.filter(w=>w.containerName===g).map(rn).filter(Boolean),f=[...b,...E];f.length>0?v.volumeMounts=f:delete v.volumeMounts};return(c.containers||[]).forEach(l),(c.initContainers||[]).forEach(l),n}const Jt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:et,color:"text-emerald-400"},{key:"emptyDir",label:"临时目录",icon:Is,color:"text-slate-400"},{key:"hostPath",label:"HostPath",icon:ts,color:"text-amber-400"},{key:"nfs",label:"NFS",icon:jt,color:"text-purple-400"},{key:"configMap",label:"配置字典",icon:Os,color:"text-blue-400"},{key:"secret",label:"密文",icon:os,color:"text-rose-400"}];function xn({vol:t,onChange:s}){return t.type==="persistentVolumeClaim"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:44:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:45:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"PVC 名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:46:9",value:t.pvcName||"",onChange:o=>s({pvcName:o.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"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:48:9",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:49:11",type:"checkbox",checked:!!t.pvcReadOnly,onChange:o=>s({pvcReadOnly:o.target.checked}),className:"accent-blue-500"}),"卷只读"]})]}):t.type==="emptyDir"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:57:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:58:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"介质"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:59:9",value:t.medium||"",onChange:o=>s({medium:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:61:11",value:"",children:"默认磁盘"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:62:11",value:"Memory",children:"Memory"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:64:9",value:t.sizeLimit||"",onChange:o=>s({sizeLimit:o.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"})]}):t.type==="hostPath"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:71:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:72:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"主机路径"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:73:9",value:t.path||"",onChange:o=>s({path:o.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"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:75:9",value:t.pathType||"Directory",onChange:o=>s({pathType:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:77:11",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:78:11",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:79:11",value:"",children:"默认"})]})]}):t.type==="nfs"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:86:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:87:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"NFS"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:88:9",value:t.nfsServer||"",onChange:o=>s({nfsServer:o.target.value}),placeholder:"Server IP",className:"h-7 w-36 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:90:9",value:t.nfsPath||"",onChange:o=>s({nfsPath:o.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"})]}):t.type==="configMap"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:97:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:98:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"ConfigMap"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:99:9",value:t.configMapName||"",onChange:o=>s({configMapName:o.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"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:101:9",value:t.cmItems||"",onChange:o=>s({cmItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="secret"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:108:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:109:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"Secret"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:110:9",value:t.secretName||"",onChange:o=>s({secretName:o.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"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:112:9",value:t.secItems||"",onChange:o=>s({secItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):null}function hn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const P=dn(a);E(P.entries),w(P.containers),I(P.passthroughVolumes),v(!1)},[a]);const Z=f.find(P=>P!=="(unnamed)")||f[0]||"",q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,...z}:H)),Q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,volume:{...H.volume,...z}}:H)),$=()=>E(P=>[...P,sn(Z)]),U=P=>E(z=>z.filter((x,H)=>H!==P)),Y=async()=>{for(const P of b){if(!P.volume.name.trim()){d({title:"请填写数据卷名称",variant:"destructive"});return}if(!xs(P.volume)){d({title:"数据卷配置不完整",description:`请补全「${P.volume.name}」的类型必填项`,variant:"destructive"});return}if(!P.mountPath.trim()){d({title:"请填写挂载路径",description:`数据卷「${P.volume.name}」需指定挂载到容器的路径`,variant:"destructive"});return}}S(!0);try{const{volumes:P,mounts:z}=pn(b),x=mn(g,P,z,_);await rt(t,s,o,x),d({title:"存储配置已保存",description:`${o} 更新已提交`}),n(x)}catch(P){d({title:"保存失败",description:P?.message||String(P),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:180:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:181:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:182:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:183:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:198:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:199:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:200:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:11",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:202:13",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:203:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:204:17",className:"h-4 w-4 text-emerald-400"}),"数据卷",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:206:17",variant:"outline",className:"border-slate-700 text-slate-400",children:b.length})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:208:15",className:"text-[11px] text-slate-500 mt-1",children:"定义数据卷,并将其挂载到工作负载的容器中"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:210:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs shrink-0",onClick:$,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:211:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:9",className:"pt-0 space-y-4",children:b.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:13",className:"text-center py-10 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷,点击「添加数据卷」开始"]}):b.map((P,z)=>{const x=P.volume,H=Jt.find(M=>M.key===x.type),G=H?.icon||Ls;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:226:15",className:"bg-slate-950/60 border border-slate-800 rounded-lg overflow-hidden",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:228:17",className:"p-3 space-y-2.5 border-b border-slate-800/80",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:229:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:230:21",className:`h-4 w-4 ${H?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:21",className:"text-xs text-slate-400 shrink-0",children:"数据卷名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:232:21",value:x.name,onChange:M=>{const ee=M.target.value,le={name:ee};x.type==="configMap"&&!x.configMapName&&(le.configMapName=ee),x.type==="secret"&&!x.secretName&&(le.secretName=ee),x.type==="persistentVolumeClaim"&&!x.pvcName&&(le.pvcName=ee),Q(z,le)},placeholder:"如 config / uploads / data",className:"h-8 w-40 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"}),e.jsxs($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:245:21",value:x.type,onValueChange:M=>Q(z,{type:M}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:246:23",className:"h-8 w-[128px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:247:25",children:H?.label||x.type})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:23",children:Jt.map(M=>e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:251:27",value:M.key,children:M.label},M.key))})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:255:21",size:"icon",variant:"ghost",className:"h-8 w-8 text-red-400 ml-auto",onClick:()=>U(z),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:256:23",className:"h-4 w-4"})})]}),e.jsx(xn,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:19",vol:x,onChange:M=>Q(z,M)})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:263:17",className:"px-3 py-2.5 bg-slate-900/40 space-y-2",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:264:19",className:"text-[11px] text-slate-500 flex items-center gap-1.5",children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:265:21",className:"h-3.5 w-3.5 text-blue-400"}),"将上述数据卷挂载到容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:268:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:269:21",value:P.containerName,onChange:M=>q(z,{containerName:M.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",children:[f.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:274:51",value:"",children:"(无容器)"}),f.map(M=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:275:47",value:M,children:M},M))]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:21",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:278:23",type:"button",onClick:()=>q(z,{readOnly:!0}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500 hover:text-slate-300"}`,children:"只读"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:282:23",type:"button",onClick:()=>q(z,{readOnly:!1}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"text-slate-500 hover:text-slate-300":"bg-blue-500/20 text-blue-300"}`,children:"读写"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:287:21",value:P.mountPath,onChange:M=>q(z,{mountPath:M.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"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:295:21",className:"text-[11px] text-slate-500 shrink-0",children:"子路径 subPath"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:296:21",value:P.subPath,onChange:M=>q(z,{subPath:M.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"})]})]})]},z)})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:310:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:312:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:Y,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:191:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:192:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式。"})})}const un=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function bn({scheduleMode:t,onScheduleModeChange:s,nodeName:o,onNodeNameChange:a,availableNodes:n,nodesLoading:c,labelSelectorKv:d,onAddLabelSelector:i,onRemoveLabelSelector:S,onUpdateLabelSelector:l,nodeLabels:v}){return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:un.map(g=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(g.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===g.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:g.label},g.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),c?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:o,onChange:g=>a(g.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),n.map(g=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:g.name,children:[g.name," ",g.ip?`(${g.ip})`:""]},g.name))]}),o&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:o})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},A))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},A))]})]})]})}function yn({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:n,onDnsOptionsChange:c,hostAliases:d,onHostAliasesChange:i}){const S=()=>c([...n,{name:"",value:""}]),l=(E,f)=>c(n.map((w,_)=>_===E?{...w,...f}:w)),v=E=>c(n.filter((f,w)=>w!==E)),g=()=>i([...d,{ip:"",hostnames:""}]),A=(E,f)=>i(d.map((w,_)=>_===E?{...w,...f}:w)),b=E=>i(d.filter((f,w)=>w!==E));return e.jsxs(e.Fragment,{children:[e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:E=>s(E.target.value),placeholder:`8.8.8.8 +114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(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/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},f))]})]})]})}function vn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState("RollingUpdate"),[f,w]=p.useState("25%"),[_,I]=p.useState("25%"),[Z,q]=p.useState("10"),[Q,$]=p.useState("600"),[U,Y]=p.useState("nodeSelector"),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState(!1),[ee,le]=p.useState([]),[ke,ge]=p.useState({}),[m,k]=p.useState([]),[r,h]=p.useState("ClusterFirst"),[N,O]=p.useState("Always"),[B,J]=p.useState("default-scheduler"),[de,Ce]=p.useState("30"),[pe,R]=p.useState(""),[ae,fe]=p.useState(""),[Se,C]=p.useState(""),[be,De]=p.useState(""),[je,He]=p.useState(!1),[ct,qe]=p.useState(!1),[lt,Ue]=p.useState(!1),[Pe,ft]=p.useState(!1),[St,Et]=p.useState(!1),[wt,Ct]=p.useState([]),[Dt,Pt]=p.useState(""),[At,Tt]=p.useState(""),[Ht,Mt]=p.useState([]);p.useEffect(()=>{const j=a;if(!j){v(!1);return}A(j);const D=j?.spec||{},W=D?.template?.spec||{},se=D.strategy||{};E(se.type||"RollingUpdate");const re=se.rollingUpdate||{};w(String(re.maxSurge??"25%")),I(String(re.maxUnavailable??"25%")),q(D.revisionHistoryLimit!=null?String(D.revisionHistoryLimit):"10"),$(D.progressDeadlineSeconds!=null?String(D.progressDeadlineSeconds):"600");const ye=W.nodeSelector||{},_e=Object.entries(ye).map(([ie,Bt])=>({key:ie,value:String(Bt)}));le(_e),z(W.nodeName||""),W.nodeName?Y("nodeName"):W.affinity?.nodeAffinity?Y("nodeAffinity"):_e.length>0&&Y("nodeSelector"),t&&(M(!0),ce.getClusterNodes(t).then(ie=>{const Rt=(Array.isArray(ie)?ie:ie?.items||ie?.list||[]).map(Je=>{const Me=Je.metadata||{},Ke=Je.status||{},ks=(Array.isArray(Ke.addresses)?Ke.addresses:[]).find(gs=>gs.type==="InternalIP")?.address||"";return{name:Me.name||"",ip:ks,labels:Me.labels||{}}});H(Rt);const ze={};for(const Je of Rt)for(const[Me,Ke]of Object.entries(Je.labels)){const it=String(Ke);ze[Me]||(ze[Me]=[]),ze[Me].includes(it)||ze[Me].push(it)}ge(ze)}).catch(()=>{}).finally(()=>M(!1)));const Ye=Array.isArray(W.tolerations)?W.tolerations:[];k(Ye.map(ie=>({key:ie.key||"",operator:ie.operator||"Equal",value:ie.value||"",effect:ie.effect||"",tolerationSeconds:ie.tolerationSeconds!=null?String(ie.tolerationSeconds):""}))),h(W.dnsPolicy||"ClusterFirst"),O(W.restartPolicy||"Always"),J(W.schedulerName||"default-scheduler"),Ce(W.terminationGracePeriodSeconds!=null?String(W.terminationGracePeriodSeconds):"30"),R(W.serviceAccountName||"");const Ee=W.securityContext||{};fe(Ee.fsGroup!=null?String(Ee.fsGroup):""),C(Ee.runAsUser!=null?String(Ee.runAsUser):""),De(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),He(!!Ee.runAsNonRoot),qe(!!W.hostNetwork),Ue(!!W.hostIPC),ft(!!W.hostPID),Et(!!W.shareProcessNamespace);const L=Array.isArray(W.hostAliases)?W.hostAliases:[];Ct(L.map(ie=>({ip:ie.ip||"",hostnames:Array.isArray(ie.hostnames)?ie.hostnames.join(", "):""})));const ne=W.dnsConfig||{};Pt(Array.isArray(ne.nameservers)?ne.nameservers.join(` +`):""),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:"number",value:Z,onChange:j=>q(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:Q,onChange:j=>$(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>k(j=>[...j,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[m.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),m.map((j,D)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:j.key,placeholder:"key",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,key:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:j.operator,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,operator:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:j.value,placeholder:"value",disabled:j.operator==="Exists",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,value:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:j.effect,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,effect:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:j.tolerationSeconds,placeholder:"秒",disabled:j.effect!=="NoExecute",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,tolerationSeconds:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>k(W=>W.filter((se,re)=>re!==D)),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},D))]})]}),e.jsx(bn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:U,onScheduleModeChange:Y,nodeName:P,onNodeNameChange:z,availableNodes:x,nodesLoading:G,labelSelectorKv:ee,onAddLabelSelector:us,onRemoveLabelSelector:bs,onUpdateLabelSelector:ys,nodeLabels:ke}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:r,onChange:j=>h(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:N,onChange:j=>O(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:B,onChange:j=>J(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:490:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:de,onChange:j=>Ce(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:11",className:"col-span-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:pe,onChange:j=>R(j.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:ae,onChange:j=>fe(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:Se,onChange:j=>C(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:be,onChange:j=>De(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:528:15",type:"checkbox",checked:je,onChange:j=>He(j.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:545:13",type:"checkbox",checked:ct,onChange:j=>qe(j.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:550:13",type:"checkbox",checked:lt,onChange:j=>Ue(j.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:555:13",type:"checkbox",checked:Pe,onChange:j=>ft(j.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:560:13",type:"checkbox",checked:St,onChange:j=>Et(j.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(yn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:Dt,onDnsNameserversChange:Pt,dnsSearches:At,onDnsSearchesChange:Tt,dnsOptions:Ht,onDnsOptionsChange:Mt,hostAliases:wt,onHostAliasesChange:Ct}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:vs,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const kn=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Kt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function gn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),i=nt(),[S,l]=p.useState(!0),[v,g]=p.useState([]),[A,b]=p.useState([]),[E,f]=p.useState({}),[w,_]=p.useState(null),[I,Z]=p.useState(null),[q,Q]=p.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[$,U]=p.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),Y=m=>{Q(k=>({...k,ports:[...k.ports,m?{name:m.name,port:String(m.port),targetPort:String(m.targetPort),protocol:m.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},P=(m,k,r)=>{Q(h=>({...h,ports:h.ports.map((N,O)=>O===m?{...N,[k]:r}:N)}))},z=m=>{q.ports.length<=1||Q(k=>({...k,ports:k.ports.filter((r,h)=>h!==m)}))},x=p.useCallback(async()=>{l(!0);try{const m=a?.spec?.selector?.matchLabels||a?.selector||{};f(m);const[k,r]=await Promise.all([ce.getNamespaceServices(t,s).catch(()=>[]),ce.getNamespaceIngresses(t,s).catch(()=>[])]),h=Kt(k),N=Kt(r),O=h.map(J=>{const de=J.spec||{},Ce=Array.isArray(de.ports)?de.ports.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):Array.isArray(J.portList)?J.portList.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):[];return{name:J.name||J.metadata?.name||"",type:de.type||J.type||"ClusterIP",clusterIP:de.clusterIP||J.cluster_ip||"",externalIP:Array.isArray(de.externalIPs)?de.externalIPs.join(","):"",ports:Ce,selector:de.selector||J.selector||{},age:J.age||J.created_at||"",raw:J}}),B=N.map(J=>{const de=J.spec||{},pe=(Array.isArray(de.rules)?de.rules:Array.isArray(J.rules)?J.rules:[]).map(R=>({host:R.host||"",paths:(R.http?.paths||R.paths||[]).map(ae=>({path:ae.path||"/",backend:{service:ae.backend?.service?.name||ae.backendService||"",port:ae.backend?.service?.port?.number||ae.backend?.service?.port?.name||ae.backendPort||""}}))}));return{name:J.name||J.metadata?.name||"",className:de.ingressClassName||J.ingressClass||"",hosts:pe.map(R=>R.host).filter(Boolean),rules:pe,raw:J}});g(O),b(B)}catch(m){console.error("M9 load error:",m)}finally{l(!1)}},[t,s,a]);p.useEffect(()=>{x()},[x]);const H=m=>Object.keys(m).length===0?!1:Object.entries(m).every(([k,r])=>E[k]===r),G=v.filter(m=>H(m.selector)),M=new Set(G.map(m=>m.name)),ee=A.filter(m=>m.rules.some(k=>k.paths.some(r=>M.has(r.backend.service)))),le=async()=>{const m=q.name.trim()||`${o}-svc`,k=q.ports.map(h=>{const N={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return q.type==="NodePort"&&h.nodePort&&(N.nodePort=Number(h.nodePort)),N}),r={apiVersion:"v1",kind:"Service",metadata:{name:m,namespace:s,labels:{app:o}},spec:{type:q.type,selector:E,ports:k}};try{const h=await It(r);await ce.applyYAML(t,h),d({title:"Service 已创建",description:m}),Z(null),x()}catch(h){d({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},ke=async()=>{const m=$.name.trim()||`${o}-ingress`,k=G[0]?.name||`${o}-svc`,r=Number($.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:m,namespace:s,labels:{app:o}},spec:{ingressClassName:$.className||void 0,rules:[{host:$.host||void 0,http:{paths:[{path:$.path||"/",pathType:$.pathType||"Prefix",backend:{service:{name:k,port:{number:r}}}}]}}]}};$.className||delete h.spec.ingressClassName;try{const N=await It(h);await ce.applyYAML(t,N),d({title:"Ingress 已创建",description:m}),Z(null),x()}catch(N){d({title:"创建失败",description:N?.message||String(N),variant:"destructive"})}},ge=async(m,k)=>{if(await i({title:"删除资源",description:`确认删除 ${m==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=m==="service"?"services":"ingresses";await ce.deleteResourceYaml(t,s,h,k),d({title:"已删除",description:`${m==="service"?"Service":"Ingress"} ${k} 已删除`}),x()}catch(h){d({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return S?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[m,"=",k]},m)),Object.keys(E).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:x,children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[G.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Q({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),Z("service")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[G.length===0&&I!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:G.map(m=>{const k=H(m.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:19",className:`rounded-lg border p-3 ${k?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.type}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:359:23",className:"text-[11px] text-slate-500 ml-auto",children:m.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>_({resource:"services",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>ge("service",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:m.ports.map((r,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[r.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[r.name,": "]}),r.port,"→",r.targetPort,r.nodePort?`/NodePort:${r.nodePort}`:"","/",r.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(m.selector).map(([r,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[r,"=",h]},r))]})]},m.name)})}),I==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:q.name,onChange:m=>Q(k=>({...k,name:m.target.value})),placeholder:`${o}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:q.type,onChange:m=>Q(k=>({...k,type:m.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:kn.map(m=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>Y(m),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium + bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(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/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[ee.length,"/",A.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{U(m=>({...m,name:`${o}-ingress`,svcPort:String(G[0]?.ports[0]?.port||80)})),Z("ingress")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[A.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:A.map(m=>{const k=ee.includes(m);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:19",className:`rounded-lg border p-3 ${k?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.className}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>_({resource:"ingresses",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>ge("ingress",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:m.rules.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:r.host||"*"}),r.paths.map((N,O)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[N.path," → ",N.backend?.service,":",N.backend?.port]},O))]},h))})]},m.name)})}),I==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:$.name,onChange:m=>U(k=>({...k,name:m.target.value})),placeholder:`${o}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:$.className,onChange:m=>U(k=>({...k,className:m.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:$.host,onChange:m=>U(k=>({...k,host:m.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:$.path,onChange:m=>U(k=>({...k,path:m.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:$.svcPort,onChange:m=>U(k=>({...k,svcPort:m.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:ke,children:"创建"})]})]})]})]}),w&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:s,resource:w.resource,name:w.name,onClose:()=>_(null),onSaved:()=>{_(null),x()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:c,children:"返回查看"})})]})}function jn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const[d,i]=p.useState("basic"),[S,l]=p.useState(a);p.useEffect(()=>{a&&l(a)},[a]);const v=b=>{b&&l(b),n()},g=[{key:"basic",label:"基本信息",icon:ut},{key:"containers",label:"容器信息",icon:Fe},{key:"storage",label:"存储挂载",icon:et},{key:"advanced",label:"高级设置",icon:ut},{key:"service",label:"服务/应用路由",icon:Ae}],A={clusterCode:t,namespace:s,deploymentName:o,manifest:S,onSaved:v,onCancel:c};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:g.map(b=>{const E=d===b.key,f=b.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>i(b.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${E?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(f,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),b.label]},b.key)})}),d==="basic"&&e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...A}),d==="containers"&&e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...A}),d==="storage"&&e.jsx(hn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...A}),d==="advanced"&&e.jsx(vn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...A}),d==="service"&&e.jsx(gn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...A})]})}function Nn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Te(),n=vt(S=>S.token)||localStorage.getItem("token")||"",c=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${c}' \\ + -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/kubernetes/deployment-workload/PodLogsModal.tsx:64:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:o}),v&&e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:v})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:v,onChange:I=>g(I.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(I=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:I,children:I},I))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:S,onChange:I=>l(Number(I.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:w,disabled:A,children:A?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(at,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:_,disabled:E,children:E?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:d||"无日志内容"})})]})})}function Sn({modal:t,deployment:s,namespace:o,deploymentName:a,newImage:n,setNewImage:c,scaleValue:d,setScaleValue:i,actionLoading:S,onClose:l,onUpdateImage:v,onScaleTo:g,onDelete:A}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:s.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:b=>c(b.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="image"||!n.trim(),onClick:v,children:S==="image"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",s.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale"||d<=0,onClick:()=>i(b=>Math.max(0,b-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:d,onChange:b=>i(Math.max(0,Number(b.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale",onClick:()=>i(b=>b+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="scale",onClick:g,children:S==="scale"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(is,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[o,"/",a]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:S==="delete",onClick:A,children:[S==="delete"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(he,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function En({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:c}){const d=Xt(),{toast:i}=Te(),S=nt(),[l,v]=p.useState(null),[g,A]=p.useState(null),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState(!0),[Q,$]=p.useState(""),[U,Y]=p.useState(null),[P,z]=p.useState(""),[x,H]=p.useState(0),[G,M]=p.useState(null),[ee,le]=p.useState(null),ke=l?.cluster_id||l?.clusterId||t,ge=C=>Array.isArray(C)?C:C?.list||C?.items||C?.data||[],m=p.useCallback(async()=>{q(!0);try{const[C,be,De,je]=await Promise.all([ce.getDeployment(t,s,o).catch(()=>null),ce.getNamespacePods(t,s).catch(()=>[]),ce.getReplicaSets(t,s).catch(()=>[]),ce.getDeploymentRevisions(t,s,o).catch(()=>[])]),He=C||(Array.isArray(C)?C[0]:null);v(He),H(He?.replicas||0),z(He?.image||"");const qe=ge(be).filter(Pe=>Pe.namespace===s&&(Pe.name||"").startsWith(o));E(qe);const Ue=ge(De).filter(Pe=>Pe.namespace===s&&(Pe.owner_deployment===o||(Pe.name||"").startsWith(o)));w(Ue),I(ge(je))}catch(C){console.error("加载详情失败:",C)}finally{q(!1)}},[t,s,o]),k=p.useCallback(async()=>{try{const C=await ce.getResourceYaml(t,s,"deployments",o),{parseEditableManifest:be}=await js(async()=>{const{parseEditableManifest:je}=await import("./PodFileBrowser-Bs6KRfHw.js").then(He=>He.k);return{parseEditableManifest:je}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),{manifest:De}=await be(C);A(De||l)}catch(C){console.warn("加载 manifest 失败(编辑功能降级):",C),A(l)}},[t,s,o,l]);p.useEffect(()=>{m()},[m]),p.useEffect(()=>{a==="edit"&&!g&&k()},[a,g,k]);const r=async()=>{$("scale");try{await ce.scaleDeployment(t,s,o,x),i({title:"伸缩成功",description:`副本数已设置为 ${x}`}),Y(null),m()}catch(C){i({title:"操作失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},h=async()=>{if(await S({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){$("restart");try{await ce.restartDeployment(t,s,o),i({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(m,1500)}catch(be){i({title:"重启失败",description:be?.message||String(be),variant:"destructive"})}finally{$("")}}},N=async()=>{const C=!!l?.paused,be=C?"恢复":"暂停";if(await S({title:`${be}滚动更新`,description:`确认${be} Deployment "${o}" 的滚动更新?`,confirmText:be})){$(C?"resume":"pause");try{C?await ce.resumeDeployment(t,s,o):await ce.pauseDeployment(t,s,o),i({title:`${be}成功`,description:`Deployment 滚动更新已${be}`}),setTimeout(m,1e3)}catch(je){i({title:`${be}失败`,description:je?.message||String(je),variant:"destructive"})}finally{$("")}}},O=()=>{Y({kind:"cicd"})},B=async()=>{if(P.trim()){$("image");try{await ce.updateDeploymentImage(t,s,o,P),i({title:"镜像更新成功",description:`正在滚动更新为 ${P}`}),Y(null),m()}catch(C){i({title:"更新失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}}},J=async()=>{$("delete");try{const C=vt.getState().token||"",De=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,je=await fetch(De,{method:"DELETE",headers:{Authorization:`Bearer ${C}`}});if(!je.ok)throw new Error(`HTTP ${je.status}`);i({title:"删除成功",description:`${o} 已删除`}),Y(null),setTimeout(()=>d(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(C){i({title:"删除失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},de=C=>Y({kind:"podLogs",pod:C.name}),Ce=C=>Y({kind:"podYaml",pod:C.name}),pe=C=>{M(C.name)},R=C=>{le(C.name)};if(Z)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:229:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:230:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:231:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:232:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!l)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:9",className:"p-12 text-center",children:[e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:243:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:244:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const ae=l.ready_replicas||l.readyReplicas||0,fe=l.replicas||0,Se=ae===fe&&fe>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:256:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:258:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:259:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:264:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:265:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:267:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:15",className:Se?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[Se?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:30",className:"h-3 w-3 mr-1"}):e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:73",className:"h-3 w-3 mr-1"}),ae,"/",fe]}),l?.paused&&e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:282:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:19",className:"text-slate-400",children:l.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:303:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("yaml"),children:"YAML"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:311:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:m,title:"刷新",children:e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:312:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:316:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:317:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>Y({kind:"image"}),children:[e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:318:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:320:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:323:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!Q,onClick:N,children:l?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:O,children:[e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:335:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:337:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>Y({kind:"delete"}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:338:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:346:9",clusterCode:t,namespace:s,deployment:l,pods:b,replicaSets:f,revisions:_,onRefresh:m,onShowPodLogs:de,onShowPodTerminal:pe,onShowPodYaml:Ce,onShowPodFileBrowser:R}):a==="yaml"?e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:m,onClose:()=>c("view")}):e.jsx(jn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:373:9",clusterCode:t,namespace:s,deploymentName:o,manifest:g,onSaved:()=>{k(),m()},onCancel:()=>c("view")}),U?.kind==="yaml"&&e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:385:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>Y(null),onSaved:m}),e.jsx(Sn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:396:7",modal:U,deployment:l,namespace:s,deploymentName:o,newImage:P,setNewImage:z,scaleValue:x,setScaleValue:H,actionLoading:Q,onClose:()=>Y(null),onUpdateImage:B,onScaleTo:r,onDelete:J}),U?.kind==="cicd"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:414:9",title:"CI/CD Webhook",onClose:()=>Y(null),children:e.jsx(Nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:415:11",clusterCode:t,namespace:s,deploymentName:o})}),U?.kind==="podLogs"&&e.jsx(fn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:421:9",clusterCode:t,namespace:s,podName:U.pod,containers:(b.find(C=>C.name===U.pod)?.containers||[]).map(C=>C.name).filter(Boolean),onClose:()=>Y(null)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:7",open:!!G,onOpenChange:C=>{C||M(null)},clusterId:ke,namespace:s,podName:G||"",containers:(b.find(C=>C.name===G)?.containers||[]).map(C=>C.name).filter(Boolean)}),e.jsx(Cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:440:7",open:!!ee,onOpenChange:C=>{C||le(null)},clusterCode:t,namespace:s,podName:ee||"",containers:(b.find(C=>C.name===ee)?.containers||[]).map(C=>C.name).filter(Boolean)})]})}function Gn(){const t=Ns(),s=Xt(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",c=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",d=i=>{i!==c&&s(`/kubernetes/${o}/namespace/${a}/workload/${i}/Deployment/${n}`,{replace:!0})};return e.jsx(En,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:c,onBack:()=>s(-1),onModeChange:d})}export{Gn as default}; diff --git a/backend/static/assets/DeploymentDetailPage-KvjeNnqR.js b/backend/static/assets/DeploymentDetailPage-KvjeNnqR.js deleted file mode 100644 index f5ad5aa..0000000 --- a/backend/static/assets/DeploymentDetailPage-KvjeNnqR.js +++ /dev/null @@ -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{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:"h-4 w-4"}):e.jsx(es,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(i.status)}22`,color:pt(i.status),border:`1px solid ${pt(i.status)}44`},children:i.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${v}`,"_blank"),children:v||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:i.ip||i.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",i.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(D.startTime||i.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(i),children:[e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(i),children:[e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>s(i),children:[e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),l&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:58:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(xs,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:i}),i.containers&&i.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:i.containers.map((j,T)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:64:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:66:29",className:"font-medium text-[var(--dg-text-primary)]",children:j.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:j.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:j.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:27",className:"text-[var(--dg-text-muted)] mt-1",children:j.image}),j.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:71:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:31",children:["CPU: ",j.resources?.requests?.cpu||"0","/",j.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",j.resources?.requests?.memory||"0","/",j.resources?.limits?.memory||"-"]})]})]},T))})]})]})},i.name)})})}function Us({services:t,ingresses:n,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(a.selector).map(([s,c])=>e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:43:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[s,"=",c]},s))})]},a.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ps,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),n.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:n.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78:21",className:"text-xs text-[var(--dg-text-muted)]",children:a.rules.flatMap(s=>(s.http?.paths||s.paths||[]).map(c=>c.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Ys({events:t,loading:n}){return n==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:15:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:18:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:19:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:21:11",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:24:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:25:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:26:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:27:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:32:13",className:"border-[var(--dg-border)]",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:33:15",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:34:17",variant:"outline",className:o.type==="Warning"?"text-[var(--dg-yellow)] border-[var(--dg-yellow)]/30":"text-[var(--dg-text-muted)] border-[var(--dg-border)]",children:o.type})}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:38:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:39:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md whitespace-normal break-words",children:o.message}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:40:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:41:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:42:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(o.lastTimestamp)})]},a))})]})})}function Js({hpas:t,cronHpas:n,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((s,c)=>{const d=s.spec?.minReplicas??s.minReplicas??1,i=s.spec?.maxReplicas??s.maxReplicas??10,D=s.spec?.metrics||s.metrics||[],l=s.status?.currentReplicas??s.currentReplicas??0,T=(s.status?.conditions||s.conditions||[]).find(b=>b.type==="AbleToScale")?.status==="True";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:s.name||s.metadata?.name}),e.jsxs(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[d," → ",i]}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:D.map((b,w)=>{const E=b.resource||b.object?.metric?.name||"",C=b.resource?.target?.averageUtilization||b.resource?.target?.averageValue||b.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[E?.name||E,": ",C,b.resource?.target?.averageUtilization?"%":""]},w)})}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:l}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:T?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:T?"正常":"异常"})})]},s.name||c)})})]})})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:n.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:n.map((s,c)=>{const d=s.spec?.jobs||s.jobs||[],i=s.spec?.timezone||"UTC";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:s.name||s.metadata?.name}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:d.map(D=>D.targetSize||D.targetReplicas||"?").join(", ")}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:d.map(D=>D.schedule||"?").join(", ")}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:i}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},s.name||c)})})]})})})]})]})}function Ks({revisions:t,rollbackLoading:n,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,s)=>{const c=a.revision??a.revision_number??a.number??s+1,d=s===0;return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(Q,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",c]}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:d?e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(a.created_at||a.time)}),e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:d||n!==null,onClick:()=>o(a),children:[n===c?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(As,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},c)})})]})})}function Xs(t){const{clusterCode:n,namespace:o,deployment:a,pods:s,revisions:c,onRefresh:d}=t,{toast:i}=Te(),D=st(),[l,v]=p.useState("pods"),[j,T]=p.useState(null),[b,w]=p.useState(null),[E,C]=p.useState(a?.replicas||0),[z,L]=p.useState(!1),[se,Y]=p.useState([]),[oe,G]=p.useState([]),[O,J]=p.useState([]),[ee,Z]=p.useState(""),[k,W]=p.useState([]),[x,f]=p.useState([]),B=a?.ready_replicas??a?.readyReplicas??0,U=a?.replicas??0,H=B===U&&U>0;p.useEffect(()=>{l==="services"&&(Z("services"),Promise.all([de.getNamespaceServices(n,o).catch(()=>[]),de.getNamespaceIngresses(n,o).catch(()=>[])]).then(([r,h])=>{const S=I=>Array.isArray(I)?I:I?.list||I?.items||I?.data||[],_=S(r),R=S(h),K=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},ie=_.filter(I=>{const ce=I.spec?.selector||I.selector||{};return Object.keys(ce).length===0?!1:Object.entries(ce).every(([fe,Se])=>K[fe]===Se)}).map(I=>({name:I.name||I.metadata?.name,type:I.spec?.type||I.type||"ClusterIP",clusterIP:I.spec?.clusterIP||I.cluster_ip||"",ports:(I.spec?.ports||I.ports||[]).map(ce=>`${ce.port}${ce.targetPort?":"+ce.targetPort:""}/${ce.protocol||"TCP"}`),selector:I.spec?.selector||I.selector||{},age:I.age||""})),De=new Set(ie.map(I=>I.name)),he=R.filter(I=>(I.spec?.rules||I.rules||[]).some(fe=>(fe.http?.paths||fe.paths||[]).some(Se=>{const P=Se.backend?.service?.name||Se.backendService||"";return De.has(P)}))).map(I=>({name:I.name||I.metadata?.name,className:I.spec?.ingressClassName||I.ingressClass||"-",hosts:(I.spec?.rules||I.rules||[]).map(ce=>ce.host).filter(Boolean),rules:I.spec?.rules||I.rules||[],age:I.age||""}));Y(ie),G(he)}).catch(()=>{}).finally(()=>Z("")))},[l,n,o,a]),p.useEffect(()=>{l==="events"&&(Z("events"),de.getEvents(n,o,void 0).then(r=>{const h=Array.isArray(r)?r:r?.list||r?.items||r?.data||[],S=a?.name||"",_=h.filter(R=>{const K=String(R.object||"");if(!S||!K)return!1;if(K.endsWith(`/${S}`))return!0;const ie=K.split("/").pop()||"";return ie===S||ie.startsWith(`${S}-`)}).map(R=>({type:R.type||"Normal",reason:R.reason||"",message:R.message||"",source:R.object||R.source?.component||R.sourceComponent||"-",firstTimestamp:R.first_time||R.firstTimestamp||R.first_timestamp||"",lastTimestamp:R.last_time||R.lastTimestamp||R.last_timestamp||"",count:R.count||1}));J(_)}).catch(()=>{}).finally(()=>Z("")))},[l,n,o,a?.name]),p.useEffect(()=>{l==="scale"&&(Z("scale"),Promise.all([de.getHPAs(n,o).catch(()=>[]),Promise.resolve([])]).then(([r])=>{const S=(R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[])(r),_=a?.name||"";W(S.filter(R=>(R.scaleTargetRef?.name||R.targetRef?.name||"")===_)),f([])}).catch(()=>{}).finally(()=>Z("")))},[l,n,o,a?.name]);const ge=async r=>{const h=r.revision??r.revision_number??r.number;if(await D({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){w(h);try{await de.rollbackDeployment(n,o,a.name,Number(h)),i({title:"回滚已下发",description:`正在回滚到 #${h}`}),d()}catch(_){i({title:"回滚失败",description:_?.message||String(_),variant:"destructive"})}finally{w(null)}}},m=async()=>{L(!0);try{await de.scaleDeployment(n,o,a.name,E),i({title:"伸缩已提交",description:`副本数 → ${E}`}),d()}catch(r){i({title:"伸缩失败",description:r?.message||String(r),variant:"destructive"})}finally{L(!1)}},g=[{key:"pods",label:"容器组",icon:nt,count:s.length},{key:"services",label:"访问方式",icon:Ae,count:se.length},{key:"events",label:"事件",icon:ns,count:O.length},{key:"scale",label:"容器伸缩",icon:ne},{key:"history",label:"历史版本",icon:Ts,count:c.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:5",className:"space-y-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:7",className:"dg-card",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:189:13",label:"状态",value:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:190:15",style:{background:`${H?Ce.green:Ce.orange}22`,color:H?Ce.green:Ce.orange,border:`1px solid ${H?Ce.green:Ce.orange}44`},children:H?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:41",className:"font-mono",children:[B,"/",U]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:13",label:"策略",value:a?.strategy||"RollingUpdate"}),s[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:198:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:199:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${n}/nodes/${s[0].node_name||s[0].node}`,"_blank"),children:s[0].node_name||s[0].node||"-"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:49",className:"font-mono",children:s[0].ip||s[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",label:"创建时间",value:Ve(a?.created_at||a?.creationTimestamp)})]}),s[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:209:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(xs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:15",pod:s[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:217:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[g.map(r=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:219:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${l===r.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>v(r.key),children:[e.jsx(r.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:13",className:"h-4 w-4"}),r.label,r.key==="pods"&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:r.count})]},r.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:233:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z||E<=0,onClick:()=>C(r=>Math.max(0,r-1)),children:e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:13",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:11",type:"number",min:0,value:E,onChange:r=>C(Math.max(0,Number(r.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z,onClick:()=>C(r=>r+1),children:e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",className:"h-4 w-4"})}),E!==U&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:250:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:z,onClick:m,children:z?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),l==="pods"&&e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:26",...t,expandedPod:j,setExpandedPod:T}),l==="services"&&e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:30",services:se,ingresses:oe,loading:ee,namespace:o}),l==="events"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:28",events:O,loading:ee}),l==="scale"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:9",hpas:k,cronHpas:x,loading:ee,replicas:U}),l==="history"&&e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:29",revisions:c,rollbackLoading:b,onRollback:ge})]})}async function rt(t,n,o,a){const s=await Cs(a);await de.updateResourceYaml(t,n,"deployments",o,s)}function Ke(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([n,o])=>({key:n,value:String(o)}))}function Re(t){const n={};for(const{key:o,value:a}of t){const s=o.trim();s&&(n[s]=a)}return n}function Qs({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const{toast:d}=Te(),[i,D]=p.useState(!1),[l,v]=p.useState(!a),[j,T]=p.useState(a||{}),[b,w]=p.useState(1),[E,C]=p.useState([]),[z,L]=p.useState([]),[se,Y]=p.useState([]),[oe,G]=p.useState([]);p.useEffect(()=>{const r=a;if(!r){v(!1);return}T(r),w(r?.spec?.replicas??1),C(Ke(r?.metadata?.labels)),L(Ke(r?.metadata?.annotations)),Y(Ke(r?.spec?.selector?.matchLabels)),G(Ke(r?.spec?.template?.metadata?.labels)),v(!1)},[a]);const O=(r,h)=>{C(S=>S.map((_,R)=>R===r?{..._,...h}:_))},J=()=>C(r=>[...r,{key:"",value:""}]),ee=r=>C(h=>h.filter((S,_)=>_!==r)),Z=(r,h)=>{L(S=>S.map((_,R)=>R===r?{..._,...h}:_))},k=()=>L(r=>[...r,{key:"",value:""}]),W=r=>L(h=>h.filter((S,_)=>_!==r)),x=(r,h)=>{Y(S=>S.map((_,R)=>R===r?{..._,...h}:_))},f=()=>Y(r=>[...r,{key:"",value:""}]),B=r=>Y(h=>h.filter((S,_)=>_!==r)),U=(r,h)=>{G(S=>S.map((_,R)=>R===r?{..._,...h}:_))},H=()=>G(r=>[...r,{key:"",value:""}]),ge=r=>G(h=>h.filter((S,_)=>_!==r)),m=()=>{const r=Re(se);G(h=>{const S={...Re(h),...r};return Object.entries(S).map(([_,R])=>({key:_,value:R}))}),d({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},g=async()=>{D(!0);try{const r=JSON.parse(JSON.stringify(j));r.spec=r.spec||{},r.spec.replicas=b;const h=Re(E);r.metadata=r.metadata||{},r.metadata.labels=Object.keys(h).length>0?h:void 0;const S=Re(z);r.metadata.annotations=Object.keys(S).length>0?S:void 0;const _=Re(se);Object.keys(_).length>0&&(r.spec.selector=r.spec.selector||{},r.spec.selector.matchLabels=_);const R=Re(oe);r.spec.template=r.spec.template||{},r.spec.template.metadata=r.spec.template.metadata||{},Object.keys(R).length>0?r.spec.template.metadata.labels=R:delete r.spec.template.metadata.labels,await rt(t,n,o,r),d({title:"基本信息已保存",description:`${o} 更新已提交`}),s(r)}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{D(!1)}};return l?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Hs,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:b,onChange:r=>w(Math.max(0,Number(r.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:187:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:13",value:n,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:E.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:J,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[E.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),E.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:r.key,placeholder:"app",onChange:S=>O(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:r.value,placeholder:"nginx",onChange:S=>O(h,{value:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ee(h),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:f,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),se.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),se.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:r.key,placeholder:"app",onChange:S=>x(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:r.value,placeholder:"nginx",onChange:S=>x(h,{value:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>B(h),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:m,children:"从 Selector 同步"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:H,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),oe.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),oe.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:r.key,placeholder:"app",onChange:S=>U(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:r.value,placeholder:"nginx",onChange:S=>U(h,{value:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ge(h),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:z.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:k,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:r.key,placeholder:"deployment.kubernetes.io/revision",onChange:S=>Z(h,{key:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:r.value,placeholder:"1",onChange:S=>Z(h,{value:S.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>W(h),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:g,children:[i?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function $t(t){const n=s=>{if(!s)return null;let c="none";return s.httpGet?c="httpGet":s.tcpSocket?c="tcpSocket":s.exec&&(c="exec"),{type:c,httpPath:s.httpGet?.path||"",httpPort:s.httpGet?.port??"",httpHost:s.httpGet?.host||"",tcpPort:s.tcpSocket?.port??"",execCommand:Array.isArray(s.exec?.command)?s.exec.command.join(` -`):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.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>n({ports:o.ports.filter((d,i)=>i!==c)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},c)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:a,children:[e.jsx(Ms,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159:13",value:o.resources.requests?.cpu||"",placeholder:"100m",onChange:s=>n({resources:{...o.resources,requests:{...o.resources.requests,cpu:s.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165:13",value:o.resources.limits?.cpu||"",placeholder:"500m",onChange:s=>n({resources:{...o.resources,limits:{...o.resources.limits,cpu:s.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171:13",value:o.resources.requests?.memory||"",placeholder:"128Mi",onChange:s=>n({resources:{...o.resources,requests:{...o.resources.requests,memory:s.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177:13",value:o.resources.limits?.memory||"",placeholder:"512Mi",onChange:s=>n({resources:{...o.resources,limits:{...o.resources.limits,memory:s.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:a,children:[e.jsx(Bs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(s=>e.jsx(en,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[s],probe:o[s],onChange:c=>n({[s]:c})},s))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:a,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(Ut,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:s=>n({lifecycle:{...o.lifecycle,postStart:s}})}),e.jsx(Ut,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204:11",label:"终止前 (preStop)",handler:o.lifecycle?.preStop,onChange:s=>n({lifecycle:{...o.lifecycle,preStop:s}})})]}),!o.lifecycle&&e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:208:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>n({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:a,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223:17",type:"number",value:o.securityContext.runAsUser??"",placeholder:"1000",onChange:s=>n({securityContext:{...o.securityContext,runAsUser:s.target.value===""?void 0:Number(s.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229:17",type:"number",value:o.securityContext.runAsGroup??"",placeholder:"1000",onChange:s=>n({securityContext:{...o.securityContext,runAsGroup:s.target.value===""?void 0:Number(s.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235:17",value:(o.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:s=>n({securityContext:{...o.securityContext,capabilitiesAdd:s.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241:17",value:(o.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:s=>n({securityContext:{...o.securityContext,capabilitiesDrop:s.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:s=>n({securityContext:{...o.securityContext,runAsNonRoot:s}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!o.securityContext.privileged,onChange:s=>n({securityContext:{...o.securityContext,privileged:s}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:s=>n({securityContext:{...o.securityContext,readOnlyRootFilesystem:s}})}),e.jsx(Xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:s=>n({securityContext:{...o.securityContext,allowPrivilegeEscalation:s}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>n({securityContext:null}),children:[e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>n({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:a,children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>n({volumeMounts:[...o.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[o.volumeMounts.map((s,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:s.name,placeholder:"volume 名称",onChange:d=>{const i=[...o.volumeMounts];i[c]={...s,name:d.target.value},n({volumeMounts: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:284:15",value:s.mountPath,placeholder:"/data",onChange:d=>{const i=[...o.volumeMounts];i[c]={...s,mountPath:d.target.value},n({volumeMounts: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:287:15",value:s.subPath||"",placeholder:"subPath (可选)",onChange:d=>{const i=[...o.volumeMounts];i[c]={...s,subPath:d.target.value},n({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(ft,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!s.readOnly,onCheckedChange:d=>{const i=[...o.volumeMounts];i[c]={...s,readOnly:d},n({volumeMounts:i})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>n({volumeMounts:o.volumeMounts.filter((d,i)=>i!==c)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},c)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function en({label:t,probe:n,onChange:o}){const a=!!n,s=n||{type:"httpGet"},c=d=>o({...s,...d});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(ft,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:d=>o(d?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:s.type||"httpGet",onValueChange:d=>c({type:d}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),s.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:s.httpPath||"",placeholder:"/healthz",onChange:d=>c({httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:s.httpPort??"",placeholder:"8080",onChange:d=>c({httpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:s.httpHost||"",placeholder:"host (可选)",onChange:d=>c({httpHost:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),s.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:s.tcpPort??"",placeholder:"端口",onChange:d=>c({tcpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),s.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:s.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:d=>c({execCommand:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:s.initialDelaySeconds??"",placeholder:"10",onChange:d=>c({initialDelaySeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:s.periodSeconds??"",placeholder:"10",onChange:d=>c({periodSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:s.timeoutSeconds??"",placeholder:"1",onChange:d=>c({timeoutSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:s.successThreshold??"",placeholder:"1",onChange:d=>c({successThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:s.failureThreshold??"",placeholder:"3",onChange:d=>c({failureThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function Ut({label:t,handler:n,onChange:o}){const a=n||{type:"none"},s=!a.type||a.type==="none"?"__none":a.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:s,onValueChange:c=>o({...a,type:c==="__none"?"none":c}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ke,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423:9",value:a.execCommand||"",placeholder:"每行一个命令片段",onChange:c=>o({...a,execCommand:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),a.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:c=>o({...a,httpPath:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:c=>o({...a,httpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),a.type==="tcpSocket"&&e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:c=>o({...a,tcpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Xe({label:t,value:n,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(ft,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:n,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Yt({title:t,description:n,icon:o,containers:a,accentColor:s,onAdd:c,onRemove:d,onUpdate:i,onDuplicate:D}){const l=st(),[v,j]=p.useState(new Set([0])),T=E=>{j(C=>{const z=new Set(C);return z.has(E)?z.delete(E):z.add(E),z})},b=s==="blue"?"border-blue-500/30":"border-purple-500/30",w=s==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[o,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:c,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:n})]}),e.jsxs(q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((E,C)=>{const z=v.has(C)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${b} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${w} cursor-pointer`,onClick:()=>T(C),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[z?e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(es,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx(nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${s==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:E.name||"(未命名)"}),E.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:E.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:L=>L.stopPropagation(),children:[D&&e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>D(C),children:e.jsx(ls,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await l({title:"删除容器",description:`确认删除容器「${E.name}」?`,confirmText:"删除",variant:"destructive"})&&d(C)},children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),z&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Zs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:E,onUpdate:L=>i(C,L)})})]},C)})]})]})}function tn({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const{toast:d}=Te(),[i,D]=p.useState(!1),[l,v]=p.useState(!a),[j,T]=p.useState(a||{}),[b,w]=p.useState([]),[E,C]=p.useState([]),[z,L]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}T(a);const k=a?.spec?.template?.spec||{};w((Array.isArray(k.containers)?k.containers:[]).map($t)),C((Array.isArray(k.initContainers)?k.initContainers:[]).map($t)),L((Array.isArray(k.imagePullSecrets)?k.imagePullSecrets:[]).map(W=>W.name||"")),v(!1)},[a]);const se=(k,W)=>{w(x=>x.map((f,B)=>B===k?{...f,...W}:f))},Y=()=>{w(k=>[...k,Wt(`container-${k.length+1}`)])},oe=k=>{w(W=>W.filter((x,f)=>f!==k))},G=k=>{w(W=>{const x=JSON.parse(JSON.stringify(W[k]));x.name=`${x.name}-copy`;const f=[...W];return f.splice(k+1,0,x),f})},O=(k,W)=>{C(x=>x.map((f,B)=>B===k?{...f,...W}:f))},J=()=>{C(k=>[...k,Wt(`init-${k.length+1}`)])},ee=k=>{C(W=>W.filter((x,f)=>f!==k))},Z=async()=>{for(const k of[...E,...b]){if(!k.name.trim()){d({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!k.image.trim()){d({title:"保存失败",description:`容器 ${k.name} 的镜像不能为空`,variant:"destructive"});return}}D(!0);try{const k=JSON.parse(JSON.stringify(j));k.spec=k.spec||{},k.spec.template=k.spec.template||{},k.spec.template.spec=k.spec.template.spec||{},k.spec.template.spec.containers=b.map(Vt),k.spec.template.spec.initContainers=E.length>0?E.map(Vt):void 0,k.spec.template.spec.imagePullSecrets=z.filter(W=>W.trim()).length>0?z.filter(W=>W.trim()).map(W=>({name:W})):void 0,await rt(t,n,o,k),d({title:"容器配置已保存",description:`${o} 更新已提交`}),s(k)}catch(k){d({title:"保存失败",description:k?.message||String(k),variant:"destructive"})}finally{D(!1)}};return l?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Is,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[z.map((k,W)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145:17",className:"text-xs text-slate-300 font-mono",children:k}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>L(x=>x.filter((f,B)=>B!==W)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},W)),z.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:k=>{if(k.key==="Enter"){const W=k.target.value.trim();W&&(L(x=>[...x,W]),k.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>L(k=>[...k,""]),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Yt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:E,accentColor:"purple",onAdd:J,onRemove:ee,onUpdate:O}),e.jsx(Yt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:b,accentColor:"blue",onAdd:Y,onRemove:oe,onUpdate:se,onDuplicate:G}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:E.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:b.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:Z,children:[i?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const sn=["kube-api-access-","default-token-","kube-"];function vt(t){if(!t||typeof t!="object")return!1;const n=String(t.name||"");return sn.some(o=>n.startsWith(o))?!0:!!(t.projected||t.downwardAPI||t.csi||t.ephemeral)}function Jt(t){const n=t?.trim();if(!n)return;if(n.startsWith("["))try{const a=JSON.parse(n);if(Array.isArray(a))return a.filter(s=>s?.key&&s?.path)}catch{}const o=n.split(",").map(a=>a.trim()).filter(Boolean).map(a=>{const s=a.indexOf(":");return s<=0?null:{key:a.slice(0,s).trim(),path:a.slice(s+1).trim()}}).filter(Boolean);return o.length?o:void 0}function nn(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const n=t.name||"";return t.persistentVolumeClaim?{name:n,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:n,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:t.configMap?{name:n,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:n,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.hostPath?{name:n,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||""}:t.emptyDir!=null?{name:n,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:vt(t)?{name:n,type:"custom",_raw:t}:{name:n,type:"custom",_raw:t}}function hs(t){if(t.type==="custom"&&t._raw)return JSON.parse(JSON.stringify(t._raw));const n=t.name?.trim();if(!n)return null;const o={name:n};switch(t.type){case"emptyDir":{const a={};t.medium?.trim()&&(a.medium=t.medium.trim()),t.sizeLimit?.trim()&&(a.sizeLimit=t.sizeLimit.trim()),o.emptyDir=a;break}case"hostPath":{const a={path:t.path?.trim()||"/"};t.pathType?.trim()&&(a.type=t.pathType.trim()),o.hostPath=a;break}case"configMap":{const a=t.configMapName?.trim();if(!a)return null;const s={name:a},c=Jt(t.cmItems);c&&(s.items=c),o.configMap=s;break}case"secret":{const a=t.secretName?.trim();if(!a)return null;const s={secretName:a},c=Jt(t.secItems);c&&(s.items=c),o.secret=s;break}case"persistentVolumeClaim":{const a=t.pvcName?.trim();if(!a)return null;const s={claimName:a};t.pvcReadOnly&&(s.readOnly=!0),o.persistentVolumeClaim=s;break}case"nfs":{const a=t.nfsServer?.trim(),s=t.nfsPath?.trim();if(!a||!s)return null;const c={server:a,path:s};t.nfsReadOnly&&(c.readOnly=!0),o.nfs=c;break}default:return null}return o}function on(t,n){return{containerName:t,volumeName:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:!!n.readOnly}}function an(t){if(!t.volumeName?.trim()||!t.mountPath?.trim())return null;const n={name:t.volumeName.trim(),mountPath:t.mountPath.trim()};return t.subPath?.trim()&&(n.subPath=t.subPath.trim()),t.readOnly&&(n.readOnly=!0),n}const rn=["/var/run/secrets/kubernetes.io/serviceaccount"];function us(t,n){if(!t)return!1;if(n.has(t.name))return!0;const o=t.mountPath||"";return rn.some(a=>o.startsWith(a))}function cn(t){const n=t?.spec?.template?.spec||{},o=Array.isArray(n.volumes)?n.volumes:[],a=o.filter(vt),s=o.filter(l=>!vt(l)),c=[...Array.isArray(n.containers)?n.containers:[],...Array.isArray(n.initContainers)?n.initContainers:[]],d=c.map(l=>l.name||"(unnamed)"),i=new Set(a.map(l=>l.name)),D=[];for(const l of c){const v=l.name||"(unnamed)",j=Array.isArray(l.volumeMounts)?l.volumeMounts:[];for(const T of j)us(T,i)||D.push(on(v,T))}return{volumes:s.map(nn),mounts:D,containers:d,passthroughVolumes:a}}function ln(t,n,o,a){const s=JSON.parse(JSON.stringify(t));s.spec=s.spec||{},s.spec.template=s.spec.template||{},s.spec.template.spec=s.spec.template.spec||{};const c=s.spec.template.spec,d=n.map(hs).filter(Boolean),i=[...a,...d];i.length>0?c.volumes=i:delete c.volumes;const D=new Set(a.map(v=>v.name)),l=v=>{const j=v.name||"(unnamed)",b=(Array.isArray(v.volumeMounts)?v.volumeMounts:[]).filter(C=>us(C,D)),w=o.filter(C=>C.containerName===j).map(an).filter(Boolean),E=[...b,...w];E.length>0?v.volumeMounts=E:delete v.volumeMounts};return(c.containers||[]).forEach(l),(c.initContainers||[]).forEach(l),s}const Kt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:Ze,color:"text-emerald-400",desc:"PVC"},{key:"emptyDir",label:"临时目录",icon:Os,color:"text-slate-400",desc:"EmptyDir"},{key:"hostPath",label:"HostPath",icon:ss,color:"text-amber-400",desc:"主机路径"},{key:"nfs",label:"NFS",icon:Nt,color:"text-purple-400",desc:"网络存储"},{key:"configMap",label:"配置字典",icon:Ls,color:"text-blue-400",desc:"ConfigMap"},{key:"secret",label:"密文",icon:as,color:"text-rose-400",desc:"Secret"}];function dn({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const{toast:d}=Te(),[i,D]=p.useState(!1),[l,v]=p.useState(!a),[j,T]=p.useState(a||{}),[b,w]=p.useState([]),[E,C]=p.useState([]),[z,L]=p.useState([]),[se,Y]=p.useState([]);p.useEffect(()=>{const x=a;if(!x){v(!1);return}T(x);const f=cn(x);w(f.volumes),C(f.mounts),L(f.containers),Y(f.passthroughVolumes),v(!1)},[a]);const oe=()=>w(x=>[...x,{name:"",type:"emptyDir"}]),G=x=>{const f=b[x]?.name;w(B=>B.filter((U,H)=>H!==x)),f&&C(B=>B.filter(U=>U.volumeName!==f))},O=(x,f)=>w(B=>B.map((U,H)=>H===x?{...U,...f}:U)),J=()=>C(x=>[...x,{containerName:z[0]||"",volumeName:"",mountPath:"",subPath:"",readOnly:!1}]),ee=x=>C(f=>f.filter((B,U)=>U!==x)),Z=(x,f)=>C(B=>B.map((U,H)=>H===x?{...U,...f}:U)),k=async()=>{for(const x of b){if(!x.name.trim()){d({title:"请填写数据卷名称",variant:"destructive"});return}if(!hs(x)){d({title:"数据卷配置不完整",description:`请补全「${x.name}」的类型必填项`,variant:"destructive"});return}}D(!0);try{const x=ln(j,b,E,se);await rt(t,n,o,x),d({title:"存储配置已保存",description:`${o} 更新已提交`}),s(x)}catch(x){d({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{D(!1)}};if(l)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:103:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:104:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:105:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:106:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})});if(!a)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:114:7",className:"bg-slate-900 border-slate-800",children:e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:115:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})});const W=b.map(x=>x.name).filter(Boolean);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:125:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:127:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:128:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:129:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:130:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:131:15",className:"h-4 w-4 text-emerald-400"}),"定义数据卷",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:132:15",variant:"outline",className:"border-slate-700 text-slate-400",children:b.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:134:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:oe,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:135:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:139:9",className:"pt-0 space-y-3",children:b.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:141:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:142:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷"]}):b.map((x,f)=>{const B=Kt.find(H=>H.key===x.type),U=B?.icon||xt;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:149:15",className:"bg-slate-950/50 border border-slate-800 rounded-lg p-3 space-y-2.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:151:17",className:"flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:152:19",className:`h-4 w-4 ${B?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:153:19",className:"text-[10px] text-slate-500 w-16 shrink-0",children:"数据卷名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:154:19",value:x.name,onChange:H=>O(f,{name:H.target.value}),placeholder:"volume-name",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:157:19",value:x.type,onValueChange:H=>O(f,{type:H}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:158:21",className:"h-7 w-[120px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:159:23",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:160:25",className:"h-3 w-3"}),B?.label||x.type]})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:163:21",children:Kt.map(H=>{const ge=H.icon;return e.jsx(ke,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:167:27",value:H.key,children:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:168:29",className:"flex items-center gap-1.5 text-xs",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:169:31",className:"h-3 w-3"}),H.label]})},H.key)})})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:176:19",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>G(f),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:177:21",className:"h-3.5 w-3.5"})})]}),x.type==="persistentVolumeClaim"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:183:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:184:21",value:x.pvcName||"",onChange:H=>O(f,{pvcName:H.target.value}),placeholder:"PVC 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:186:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:187:23",type:"checkbox",checked:!!x.pvcReadOnly,onChange:H=>O(f,{pvcReadOnly:H.target.checked}),className:"accent-blue-500"}),"只读"]})]}),x.type==="emptyDir"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:195:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:196:21",value:x.medium||"",onChange:H=>O(f,{medium:H.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:198:23",value:"",children:"默认磁盘"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:199:23",value:"Memory",children:"Memory"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:21",value:x.sizeLimit||"",onChange:H=>O(f,{sizeLimit:H.target.value}),placeholder:"sizeLimit (如 512Mi)",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),x.type==="hostPath"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:208:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:209:21",value:x.path||"",onChange:H=>O(f,{path:H.target.value}),placeholder:"主机路径 /data/app",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:212:21",value:x.pathType||"Directory",onChange:H=>O(f,{pathType:H.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:214:23",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:23",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:216:23",value:"",children:"(默认)"})]})]}),x.type==="nfs"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:222:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:223:21",value:x.nfsServer||"",onChange:H=>O(f,{nfsServer:H.target.value}),placeholder:"NFS Server IP",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:226:21",className:"text-slate-600 text-xs",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:227:21",value:x.nfsPath||"",onChange:H=>O(f,{nfsPath:H.target.value}),placeholder:"/export/path",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:230:21",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:23",type:"checkbox",checked:!!x.nfsReadOnly,onChange:H=>O(f,{nfsReadOnly:H.target.checked}),className:"accent-blue-500"}),"只读"]})]}),x.type==="configMap"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:239:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:240:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"ConfigMap"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:241:21",value:x.configMapName||"",onChange:H=>O(f,{configMapName:H.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:244:21",value:x.cmItems||"",onChange:H=>O(f,{cmItems:H.target.value}),placeholder:"key:path 或 JSON",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),x.type==="secret"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:251:19",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:252:21",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"密文"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:253:21",value:x.secretName||"",onChange:H=>O(f,{secretName:H.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:256:21",value:x.secItems||"",onChange:H=>O(f,{secItems:H.target.value}),placeholder:"key:path 或 JSON",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]},f)})})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:268:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:269:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:270:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:271:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:272:15",className:"h-4 w-4 text-blue-400"}),"将数据卷挂载到容器",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:273:15",variant:"outline",className:"border-slate-700 text-slate-400",children:E.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:275:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:J,disabled:W.length===0||z.length===0,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:15",className:"h-3 w-3 mr-1"}),"添加挂载"]})]})}),e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:281:9",className:"pt-0 space-y-2",children:E.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:283:13",className:"text-center py-8 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:284:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),W.length===0?"请先定义数据卷":"未配置挂载点"]}):E.map((x,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:288:13",className:"flex items-center gap-2 bg-slate-950/50 border border-slate-800 rounded-lg p-2.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:290:15",className:"text-[10px] text-slate-500 whitespace-nowrap",children:"容器:"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:291:15",value:x.containerName,onChange:B=>Z(f,{containerName:B.target.value}),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[120px]",children:[z.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:293:45",value:"",children:"(无容器)"}),z.map(B=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:39",value:B,children:B},B))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:297:15",value:x.volumeName,onChange:B=>Z(f,{volumeName:B.target.value}),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 min-w-[100px]",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:299:17",value:"",children:"选择数据卷"}),W.map(B=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:300:40",value:B,children:B},B))]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:303:15",value:x.mountPath,onChange:B=>Z(f,{mountPath:B.target.value}),placeholder:"挂载路径 /app/data",className:"h-7 flex-1 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:306:15",value:x.subPath,onChange:B=>Z(f,{subPath:B.target.value}),placeholder:"subPath (可选)",className:"h-7 w-28 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:310:15",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:17",onClick:()=>Z(f,{readOnly:!1}),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${x.readOnly?"text-slate-500":"bg-blue-500/20 text-blue-300"}`,children:"读写"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:315:17",onClick:()=>Z(f,{readOnly:!0}),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-all ${x.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500"}`,children:"只读"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:320:15",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>ee(f),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:321:17",className:"h-3.5 w-3.5"})})]},f))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:329:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:330:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:331:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:k,children:[i?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:332:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:332:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]})}const pn=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function mn({scheduleMode:t,onScheduleModeChange:n,nodeName:o,onNodeNameChange:a,availableNodes:s,nodesLoading:c,labelSelectorKv:d,onAddLabelSelector:i,onRemoveLabelSelector:D,onUpdateLabelSelector:l,nodeLabels:v}){return e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:pn.map(j=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>n(j.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===j.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:j.label},j.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),c?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:o,onChange:j=>a(j.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),s.map(j=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:j.name,children:[j.name," ",j.ip?`(${j.ip})`:""]},j.name))]}),o&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:o})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):d.map((j,T)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:j.key,onChange:b=>l(T,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,w])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:b,children:[b," (",w.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:j.value,onChange:b=>l(T,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!j.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(v[j.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>D(T),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},T))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):d.map((j,T)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:j.key,onChange:b=>l(T,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,w])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:b,children:[b," (",w.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:j.value,onChange:b=>l(T,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!j.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(v[j.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>D(T),children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},T))]})]})]})}function xn({dnsNameservers:t,onDnsNameserversChange:n,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:s,onDnsOptionsChange:c,hostAliases:d,onHostAliasesChange:i}){const D=()=>c([...s,{name:"",value:""}]),l=(w,E)=>c(s.map((C,z)=>z===w?{...C,...E}:C)),v=w=>c(s.filter((E,C)=>C!==w)),j=()=>i([...d,{ip:"",hostnames:""}]),T=(w,E)=>i(d.map((C,z)=>z===w?{...C,...E}:C)),b=w=>i(d.filter((E,C)=>C!==w));return e.jsxs(e.Fragment,{children:[e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:w=>n(w.target.value),placeholder:`8.8.8.8 -114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(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/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},E))]})]})]})}function hn({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const{toast:d}=Te(),[i,D]=p.useState(!1),[l,v]=p.useState(!a),[j,T]=p.useState(a||{}),[b,w]=p.useState("RollingUpdate"),[E,C]=p.useState("25%"),[z,L]=p.useState("25%"),[se,Y]=p.useState("10"),[oe,G]=p.useState("600"),[O,J]=p.useState("nodeSelector"),[ee,Z]=p.useState(""),[k,W]=p.useState([]),[x,f]=p.useState(!1),[B,U]=p.useState([]),[H,ge]=p.useState({}),[m,g]=p.useState([]),[r,h]=p.useState("ClusterFirst"),[S,_]=p.useState("Always"),[R,K]=p.useState("default-scheduler"),[ie,De]=p.useState("30"),[he,I]=p.useState(""),[ce,fe]=p.useState(""),[Se,P]=p.useState(""),[ye,we]=p.useState(""),[je,He]=p.useState(!1),[ct,Fe]=p.useState(!1),[lt,qe]=p.useState(!1),[Pe,St]=p.useState(!1),[Et,Ct]=p.useState(!1),[Dt,wt]=p.useState([]),[Pt,At]=p.useState(""),[Tt,Ht]=p.useState(""),[Mt,Bt]=p.useState([]);p.useEffect(()=>{const N=a;if(!N){v(!1);return}T(N);const A=N?.spec||{},V=A?.template?.spec||{},ae=A.strategy||{};w(ae.type||"RollingUpdate");const le=ae.rollingUpdate||{};C(String(le.maxSurge??"25%")),L(String(le.maxUnavailable??"25%")),Y(A.revisionHistoryLimit!=null?String(A.revisionHistoryLimit):"10"),G(A.progressDeadlineSeconds!=null?String(A.progressDeadlineSeconds):"600");const ve=V.nodeSelector||{},_e=Object.entries(ve).map(([pe,Rt])=>({key:pe,value:String(Rt)}));U(_e),Z(V.nodeName||""),V.nodeName?J("nodeName"):V.affinity?.nodeAffinity?J("nodeAffinity"):_e.length>0&&J("nodeSelector"),t&&(f(!0),de.getClusterNodes(t).then(pe=>{const It=(Array.isArray(pe)?pe:pe?.items||pe?.list||[]).map(Ye=>{const Me=Ye.metadata||{},Je=Ye.status||{},gs=(Array.isArray(Je.addresses)?Je.addresses:[]).find(js=>js.type==="InternalIP")?.address||"";return{name:Me.name||"",ip:gs,labels:Me.labels||{}}});W(It);const ze={};for(const Ye of It)for(const[Me,Je]of Object.entries(Ye.labels)){const it=String(Je);ze[Me]||(ze[Me]=[]),ze[Me].includes(it)||ze[Me].push(it)}ge(ze)}).catch(()=>{}).finally(()=>f(!1)));const Ue=Array.isArray(V.tolerations)?V.tolerations:[];g(Ue.map(pe=>({key:pe.key||"",operator:pe.operator||"Equal",value:pe.value||"",effect:pe.effect||"",tolerationSeconds:pe.tolerationSeconds!=null?String(pe.tolerationSeconds):""}))),h(V.dnsPolicy||"ClusterFirst"),_(V.restartPolicy||"Always"),K(V.schedulerName||"default-scheduler"),De(V.terminationGracePeriodSeconds!=null?String(V.terminationGracePeriodSeconds):"30"),I(V.serviceAccountName||"");const Ee=V.securityContext||{};fe(Ee.fsGroup!=null?String(Ee.fsGroup):""),P(Ee.runAsUser!=null?String(Ee.runAsUser):""),we(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),He(!!Ee.runAsNonRoot),Fe(!!V.hostNetwork),qe(!!V.hostIPC),St(!!V.hostPID),Ct(!!V.shareProcessNamespace);const $=Array.isArray(V.hostAliases)?V.hostAliases:[];wt($.map(pe=>({ip:pe.ip||"",hostnames:Array.isArray(pe.hostnames)?pe.hostnames.join(", "):""})));const re=V.dnsConfig||{};At(Array.isArray(re.nameservers)?re.nameservers.join(` -`):""),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:"number",value:se,onChange:N=>Y(N.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:oe,onChange:N=>G(N.target.value),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:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>g(N=>[...N,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[m.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),m.map((N,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:N.key,placeholder:"key",onChange:V=>g(ae=>ae.map((le,ve)=>ve===A?{...le,key:V.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:N.operator,onChange:V=>g(ae=>ae.map((le,ve)=>ve===A?{...le,operator:V.target.value}:le)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:N.value,placeholder:"value",disabled:N.operator==="Exists",onChange:V=>g(ae=>ae.map((le,ve)=>ve===A?{...le,value:V.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:N.effect,onChange:V=>g(ae=>ae.map((le,ve)=>ve===A?{...le,effect:V.target.value}:le)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:N.tolerationSeconds,placeholder:"秒",disabled:N.effect!=="NoExecute",onChange:V=>g(ae=>ae.map((le,ve)=>ve===A?{...le,tolerationSeconds:V.target.value}:le)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>g(V=>V.filter((ae,le)=>le!==A)),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},A))]})]}),e.jsx(mn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:O,onScheduleModeChange:J,nodeName:ee,onNodeNameChange:Z,availableNodes:k,nodesLoading:x,labelSelectorKv:B,onAddLabelSelector:bs,onRemoveLabelSelector:ys,onUpdateLabelSelector:vs,nodeLabels:H}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:r,onChange:N=>h(N.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:S,onChange:N=>_(N.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:R,onChange:N=>K(N.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:490:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:ie,onChange:N=>De(N.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:11",className:"col-span-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:he,onChange:N=>I(N.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:ce,onChange:N=>fe(N.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:Se,onChange:N=>P(N.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:ye,onChange:N=>we(N.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:528:15",type:"checkbox",checked:je,onChange:N=>He(N.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:545:13",type:"checkbox",checked:ct,onChange:N=>Fe(N.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:550:13",type:"checkbox",checked:lt,onChange:N=>qe(N.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:555:13",type:"checkbox",checked:Pe,onChange:N=>St(N.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:560:13",type:"checkbox",checked:Et,onChange:N=>Ct(N.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(xn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:Pt,onDnsNameserversChange:At,dnsSearches:Tt,onDnsSearchesChange:Ht,dnsOptions:Mt,onDnsOptionsChange:Bt,hostAliases:Dt,onHostAliasesChange:wt}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:ks,children:[i?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const un=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Xt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function bn({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const{toast:d}=Te(),i=st(),[D,l]=p.useState(!0),[v,j]=p.useState([]),[T,b]=p.useState([]),[w,E]=p.useState({}),[C,z]=p.useState(null),[L,se]=p.useState(null),[Y,oe]=p.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[G,O]=p.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),J=m=>{oe(g=>({...g,ports:[...g.ports,m?{name:m.name,port:String(m.port),targetPort:String(m.targetPort),protocol:m.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},ee=(m,g,r)=>{oe(h=>({...h,ports:h.ports.map((S,_)=>_===m?{...S,[g]:r}:S)}))},Z=m=>{Y.ports.length<=1||oe(g=>({...g,ports:g.ports.filter((r,h)=>h!==m)}))},k=p.useCallback(async()=>{l(!0);try{const m=a?.spec?.selector?.matchLabels||a?.selector||{};E(m);const[g,r]=await Promise.all([de.getNamespaceServices(t,n).catch(()=>[]),de.getNamespaceIngresses(t,n).catch(()=>[])]),h=Xt(g),S=Xt(r),_=h.map(K=>{const ie=K.spec||{},De=Array.isArray(ie.ports)?ie.ports.map(he=>({port:he.port,targetPort:he.targetPort,protocol:he.protocol||"TCP",nodePort:he.nodePort,name:he.name})):Array.isArray(K.portList)?K.portList.map(he=>({port:he.port,targetPort:he.targetPort,protocol:he.protocol||"TCP",nodePort:he.nodePort,name:he.name})):[];return{name:K.name||K.metadata?.name||"",type:ie.type||K.type||"ClusterIP",clusterIP:ie.clusterIP||K.cluster_ip||"",externalIP:Array.isArray(ie.externalIPs)?ie.externalIPs.join(","):"",ports:De,selector:ie.selector||K.selector||{},age:K.age||K.created_at||"",raw:K}}),R=S.map(K=>{const ie=K.spec||{},he=(Array.isArray(ie.rules)?ie.rules:Array.isArray(K.rules)?K.rules:[]).map(I=>({host:I.host||"",paths:(I.http?.paths||I.paths||[]).map(ce=>({path:ce.path||"/",backend:{service:ce.backend?.service?.name||ce.backendService||"",port:ce.backend?.service?.port?.number||ce.backend?.service?.port?.name||ce.backendPort||""}}))}));return{name:K.name||K.metadata?.name||"",className:ie.ingressClassName||K.ingressClass||"",hosts:he.map(I=>I.host).filter(Boolean),rules:he,raw:K}});j(_),b(R)}catch(m){console.error("M9 load error:",m)}finally{l(!1)}},[t,n,a]);p.useEffect(()=>{k()},[k]);const W=m=>Object.keys(m).length===0?!1:Object.entries(m).every(([g,r])=>w[g]===r),x=v.filter(m=>W(m.selector)),f=new Set(x.map(m=>m.name)),B=T.filter(m=>m.rules.some(g=>g.paths.some(r=>f.has(r.backend.service)))),U=async()=>{const m=Y.name.trim()||`${o}-svc`,g=Y.ports.map(h=>{const S={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return Y.type==="NodePort"&&h.nodePort&&(S.nodePort=Number(h.nodePort)),S}),r={apiVersion:"v1",kind:"Service",metadata:{name:m,namespace:n,labels:{app:o}},spec:{type:Y.type,selector:w,ports:g}};try{const h=await Ot(r);await de.applyYAML(t,h),d({title:"Service 已创建",description:m}),se(null),k()}catch(h){d({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},H=async()=>{const m=G.name.trim()||`${o}-ingress`,g=x[0]?.name||`${o}-svc`,r=Number(G.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:m,namespace:n,labels:{app:o}},spec:{ingressClassName:G.className||void 0,rules:[{host:G.host||void 0,http:{paths:[{path:G.path||"/",pathType:G.pathType||"Prefix",backend:{service:{name:g,port:{number:r}}}}]}}]}};G.className||delete h.spec.ingressClassName;try{const S=await Ot(h);await de.applyYAML(t,S),d({title:"Ingress 已创建",description:m}),se(null),k()}catch(S){d({title:"创建失败",description:S?.message||String(S),variant:"destructive"})}},ge=async(m,g)=>{if(await i({title:"删除资源",description:`确认删除 ${m==="service"?"Service":"Ingress"} 「${g}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=m==="service"?"services":"ingresses";await de.deleteResourceYaml(t,n,h,g),d({title:"已删除",description:`${m==="service"?"Service":"Ingress"} ${g} 已删除`}),k()}catch(h){d({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return D?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(w).map(([m,g])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[m,"=",g]},m)),Object.keys(w).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:k,children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[x.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{oe({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),se("service")},children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[x.length===0&&L!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:x.map(m=>{const g=W(m.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:19",className:`rounded-lg border p-3 ${g?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:21",className:"flex items-center gap-2 flex-wrap",children:[g?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.type}),g&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:359:23",className:"text-[11px] text-slate-500 ml-auto",children:m.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>z({resource:"services",name:m.name}),children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>ge("service",m.name),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:m.ports.map((r,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[r.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[r.name,": "]}),r.port,"→",r.targetPort,r.nodePort?`/NodePort:${r.nodePort}`:"","/",r.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(m.selector).map(([r,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[r,"=",h]},r))]})]},m.name)})}),L==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:Y.name,onChange:m=>oe(g=>({...g,name:m.target.value})),placeholder:`${o}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:Y.type,onChange:m=>oe(g=>({...g,type:m.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:un.map(m=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>J(m),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium - bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(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/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[B.length,"/",T.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{O(m=>({...m,name:`${o}-ingress`,svcPort:String(x[0]?.ports[0]?.port||80)})),se("ingress")},children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[T.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:T.map(m=>{const g=B.includes(m);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:19",className:`rounded-lg border p-3 ${g?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:21",className:"flex items-center gap-2 flex-wrap",children:[g?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.className}),g&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>z({resource:"ingresses",name:m.name}),children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>ge("ingress",m.name),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:m.rules.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:r.host||"*"}),r.paths.map((S,_)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[S.path," → ",S.backend?.service,":",S.backend?.port]},_))]},h))})]},m.name)})}),L==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:G.name,onChange:m=>O(g=>({...g,name:m.target.value})),placeholder:`${o}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:G.className,onChange:m=>O(g=>({...g,className:m.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:G.host,onChange:m=>O(g=>({...g,host:m.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:G.path,onChange:m=>O(g=>({...g,path:m.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:G.svcPort,onChange:m=>O(g=>({...g,svcPort:m.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>se(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:H,children:"创建"})]})]})]})]}),C&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:n,resource:C.resource,name:C.name,onClose:()=>z(null),onSaved:()=>{z(null),k()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:c,children:"返回查看"})})]})}function yn({clusterCode:t,namespace:n,deploymentName:o,manifest:a,onSaved:s,onCancel:c}){const[d,i]=p.useState("basic"),[D,l]=p.useState(a);p.useEffect(()=>{a&&l(a)},[a]);const v=b=>{b&&l(b),s()},j=[{key:"basic",label:"基本信息",icon:bt},{key:"containers",label:"容器信息",icon:nt},{key:"storage",label:"存储挂载",icon:Ze},{key:"advanced",label:"高级设置",icon:bt},{key:"service",label:"服务/应用路由",icon:Ae}],T={clusterCode:t,namespace:n,deploymentName:o,manifest:D,onSaved:v,onCancel:c};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:j.map(b=>{const w=d===b.key,E=b.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>i(b.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${w?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(E,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),b.label]},b.key)})}),d==="basic"&&e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...T}),d==="containers"&&e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...T}),d==="storage"&&e.jsx(dn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...T}),d==="advanced"&&e.jsx(hn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...T}),d==="service"&&e.jsx(bn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...T})]})}function vn({clusterCode:t,namespace:n,deploymentName:o}){const{toast:a}=Te(),s=kt(D=>D.token)||localStorage.getItem("token")||"",c=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${n}/deployments/${o}/update-image`,d=`curl -X POST '${c}' \\ - -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/kubernetes/deployment-workload/PodLogsModal.tsx:64:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:L=>L.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:o}),v&&e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:v})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:v,onChange:L=>j(L.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(L=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:L,children:L},L))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:D,onChange:L=>l(Number(L.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:C,disabled:T,children:T?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(at,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:z,disabled:w,children:w?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:s,children:e.jsx(is,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:d||"无日志内容"})})]})})}function gn({modal:t,deployment:n,namespace:o,deploymentName:a,newImage:s,setNewImage:c,scaleValue:d,setScaleValue:i,actionLoading:D,onClose:l,onUpdateImage:v,onScaleTo:j,onDelete:T}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:n.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:s,onChange:b=>c(b.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:D==="image"||!s.trim(),onClick:v,children:D==="image"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",n.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:D==="scale"||d<=0,onClick:()=>i(b=>Math.max(0,b-1)),children:e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:d,onChange:b=>i(Math.max(0,Number(b.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:D==="scale",onClick:()=>i(b=>b+1),children:e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:D==="scale",onClick:j,children:D==="scale"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(ps,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[o,"/",a]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:D==="delete",onClick:T,children:[D==="delete"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function jn({clusterCode:t,namespace:n,deploymentName:o,mode:a,onBack:s,onModeChange:c}){const d=Qt(),{toast:i}=Te(),D=st(),[l,v]=p.useState(null),[j,T]=p.useState(null),[b,w]=p.useState([]),[E,C]=p.useState([]),[z,L]=p.useState([]),[se,Y]=p.useState(!0),[oe,G]=p.useState(""),[O,J]=p.useState(null),[ee,Z]=p.useState(""),[k,W]=p.useState(0),[x,f]=p.useState(null),[B,U]=p.useState(null),H=l?.cluster_id||l?.clusterId||t,ge=P=>Array.isArray(P)?P:P?.list||P?.items||P?.data||[],m=p.useCallback(async()=>{Y(!0);try{const[P,ye,we,je]=await Promise.all([de.getDeployment(t,n,o).catch(()=>null),de.getNamespacePods(t,n).catch(()=>[]),de.getReplicaSets(t,n).catch(()=>[]),de.getDeploymentRevisions(t,n,o).catch(()=>[])]),He=P||(Array.isArray(P)?P[0]:null);v(He),W(He?.replicas||0),Z(He?.image||"");const Fe=ge(ye).filter(Pe=>Pe.namespace===n&&(Pe.name||"").startsWith(o));w(Fe);const qe=ge(we).filter(Pe=>Pe.namespace===n&&(Pe.owner_deployment===o||(Pe.name||"").startsWith(o)));C(qe),L(ge(je))}catch(P){console.error("加载详情失败:",P)}finally{Y(!1)}},[t,n,o]),g=p.useCallback(async()=>{try{const P=await de.getResourceYaml(t,n,"deployments",o),{parseEditableManifest:ye}=await Ns(async()=>{const{parseEditableManifest:je}=await import("./PodFileBrowser-BPio7wxi.js").then(He=>He.k);return{parseEditableManifest:je}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),{manifest:we}=await ye(P);T(we||l)}catch(P){console.warn("加载 manifest 失败(编辑功能降级):",P),T(l)}},[t,n,o,l]);p.useEffect(()=>{m()},[m]),p.useEffect(()=>{a==="edit"&&!j&&g()},[a,j,g]);const r=async()=>{G("scale");try{await de.scaleDeployment(t,n,o,k),i({title:"伸缩成功",description:`副本数已设置为 ${k}`}),J(null),m()}catch(P){i({title:"操作失败",description:P?.message||String(P),variant:"destructive"})}finally{G("")}},h=async()=>{if(await D({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){G("restart");try{await de.restartDeployment(t,n,o),i({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(m,1500)}catch(ye){i({title:"重启失败",description:ye?.message||String(ye),variant:"destructive"})}finally{G("")}}},S=async()=>{const P=!!l?.paused,ye=P?"恢复":"暂停";if(await D({title:`${ye}滚动更新`,description:`确认${ye} Deployment "${o}" 的滚动更新?`,confirmText:ye})){G(P?"resume":"pause");try{P?await de.resumeDeployment(t,n,o):await de.pauseDeployment(t,n,o),i({title:`${ye}成功`,description:`Deployment 滚动更新已${ye}`}),setTimeout(m,1e3)}catch(je){i({title:`${ye}失败`,description:je?.message||String(je),variant:"destructive"})}finally{G("")}}},_=()=>{J({kind:"cicd"})},R=async()=>{if(ee.trim()){G("image");try{await de.updateDeploymentImage(t,n,o,ee),i({title:"镜像更新成功",description:`正在滚动更新为 ${ee}`}),J(null),m()}catch(P){i({title:"更新失败",description:P?.message||String(P),variant:"destructive"})}finally{G("")}}},K=async()=>{G("delete");try{const P=kt.getState().token||"",we=`/api/v1/kubernetes/${t}/namespace/${n}/deployments/${o}`,je=await fetch(we,{method:"DELETE",headers:{Authorization:`Bearer ${P}`}});if(!je.ok)throw new Error(`HTTP ${je.status}`);i({title:"删除成功",description:`${o} 已删除`}),J(null),setTimeout(()=>d(`/kubernetes/${t}/namespace/${n}/deployments`),800)}catch(P){i({title:"删除失败",description:P?.message||String(P),variant:"destructive"})}finally{G("")}},ie=P=>J({kind:"podLogs",pod:P.name}),De=P=>J({kind:"podYaml",pod:P.name}),he=P=>{f(P.name)},I=P=>{U(P.name)};if(se)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:229:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:230:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:231:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:232:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!l)return e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(q,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:9",className:"p-12 text-center",children:[e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:243:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:244:11",variant:"outline",className:"mt-4",onClick:s,children:"返回"})]})});const ce=l.ready_replicas||l.readyReplicas||0,fe=l.replicas||0,Se=ce===fe&&fe>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:256:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:258:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:259:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:s,children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:264:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:265:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:15",variant:"outline",className:"border-slate-700 text-slate-400",children:n}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:267:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:15",className:Se?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[Se?e.jsx(yt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:30",className:"h-3 w-3 mr-1"}):e.jsx(ps,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:73",className:"h-3 w-3 mr-1"}),ce,"/",fe]}),l?.paused&&e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:282:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:19",className:"text-slate-400",children:l.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:303:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("yaml"),children:"YAML"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:311:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:m,title:"刷新",children:e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:312:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:316:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:317:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>J({kind:"image"}),children:[e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:318:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:320:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:323:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!oe,onClick:S,children:l?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(zt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:_,children:[e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:335:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:337:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>J({kind:"delete"}),children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:338:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:346:9",clusterCode:t,namespace:n,deployment:l,pods:b,replicaSets:E,revisions:z,onRefresh:m,onShowPodLogs:ie,onShowPodTerminal:he,onShowPodYaml:De,onShowPodFileBrowser:I}):a==="yaml"?e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:9",clusterCode:t,namespace:n,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:m,onClose:()=>c("view")}):e.jsx(yn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:373:9",clusterCode:t,namespace:n,deploymentName:o,manifest:j,onSaved:()=>{g(),m()},onCancel:()=>c("view")}),O?.kind==="yaml"&&e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:385:9",clusterCode:t,namespace:n,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>J(null),onSaved:m}),e.jsx(gn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:396:7",modal:O,deployment:l,namespace:n,deploymentName:o,newImage:ee,setNewImage:Z,scaleValue:k,setScaleValue:W,actionLoading:oe,onClose:()=>J(null),onUpdateImage:R,onScaleTo:r,onDelete:K}),O?.kind==="cicd"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:414:9",title:"CI/CD Webhook",onClose:()=>J(null),children:e.jsx(vn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:415:11",clusterCode:t,namespace:n,deploymentName:o})}),O?.kind==="podLogs"&&e.jsx(kn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:421:9",clusterCode:t,namespace:n,podName:O.pod,containers:(b.find(P=>P.name===O.pod)?.containers||[]).map(P=>P.name).filter(Boolean),onClose:()=>J(null)}),e.jsx(Ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:7",open:!!x,onOpenChange:P=>{P||f(null)},clusterId:H,namespace:n,podName:x||"",containers:(b.find(P=>P.name===x)?.containers||[]).map(P=>P.name).filter(Boolean)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:440:7",open:!!B,onOpenChange:P=>{P||U(null)},clusterCode:t,namespace:n,podName:B||"",containers:(b.find(P=>P.name===B)?.containers||[]).map(P=>P.name).filter(Boolean)})]})}function _n(){const t=fs(),n=Qt(),o=t.clusterCode||"",a=t.namespace||"",s=t.name||"",c=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",d=i=>{i!==c&&n(`/kubernetes/${o}/namespace/${a}/workload/${i}/Deployment/${s}`,{replace:!0})};return e.jsx(jn,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:s,mode:c,onBack:()=>n(-1),onModeChange:d})}export{_n as default}; diff --git a/backend/static/assets/DomainManager-Bc2Y-tnO.js b/backend/static/assets/DomainManager-AazO_ekQ.js similarity index 98% rename from backend/static/assets/DomainManager-Bc2Y-tnO.js rename to backend/static/assets/DomainManager-AazO_ekQ.js index 5d4ff71..f043f0d 100644 --- a/backend/static/assets/DomainManager-Bc2Y-tnO.js +++ b/backend/static/assets/DomainManager-AazO_ekQ.js @@ -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/DomainManager.tsx:206:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(M,{"code-path":"src/components/cloud/DomainManager.tsx:207:11",className:"p-12 text-center text-slate-500",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:208:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):w.length===0?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:213:9",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:214:11",className:"p-12 text-center text-slate-500",children:"暂无域名数据"})}):e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:217:9",className:"space-y-3",children:w.map(s=>{const c=s.ssl_enabled||s.sslEnabled,o=s.expire_date||s.expireDate||"",C=s.ssl_expire_date||s.sslExpireDate||"",S=Q(o);return e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:224:15",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:225:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:226:19",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:227:21",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:228:23",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",children:e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:229:25",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:231:23",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:232:25",className:"flex items-center gap-2",children:[e.jsx("h3",{"code-path":"src/components/cloud/DomainManager.tsx:233:27",className:"font-medium text-slate-100 text-lg",children:s.name}),s.status==="active"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:235:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:236:31",className:"h-3 w-3 mr-1"}),"正常"]}),s.status==="expired"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:241:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(V,{"code-path":"src/components/cloud/DomainManager.tsx:242:31",className:"h-3 w-3 mr-1"}),"已过期"]}),s.status==="pending"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:247:29",className:"bg-yellow-500/20 text-yellow-400 border-0",children:[e.jsx(W,{"code-path":"src/components/cloud/DomainManager.tsx:248:31",className:"h-3 w-3 mr-1"}),"待审核"]}),c&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:253:29",className:"bg-cyan-500/20 text-cyan-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:254:31",className:"h-3 w-3 mr-1"}),"SSL"]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:259:25",className:"flex items-center gap-4 mt-1 text-sm text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:260:27",children:["注册商: ",s.registrar||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:261:27",children:["DNS: ",s.dns_provider||s.dnsProvider||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:262:27",children:["解析记录: ",s.record_count??s.recordCount??0,"条"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:266:21",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:267:23",className:"text-right",children:[e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:268:25",className:"text-sm text-slate-400",children:"到期时间"}),e.jsxs("p",{"code-path":"src/components/cloud/DomainManager.tsx:269:25",className:`text-sm font-medium ${S<30?"text-red-400":"text-slate-200"}`,children:[o?o.substring(0,10):"-",o&&` (${S}天)`,c&&C&&e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:272:29",className:"text-slate-500",children:[" · SSL: ",C.substring(0,10)]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:276:23",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:277:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>$(s),children:e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:283:27",className:"h-4 w-4"})}),e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:285:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>G(s.id),children:e.jsx(Y,{"code-path":"src/components/cloud/DomainManager.tsx:291:27",className:"h-4 w-4"})})]})]})]})})},s.id)})}),e.jsx(U,{"code-path":"src/components/cloud/DomainManager.tsx:304:7",open:I,onOpenChange:p,children:e.jsxs(A,{"code-path":"src/components/cloud/DomainManager.tsx:305:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(H,{"code-path":"src/components/cloud/DomainManager.tsx:306:11",children:[e.jsxs(X,{"code-path":"src/components/cloud/DomainManager.tsx:307:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:308:15",className:"h-5 w-5 text-blue-400"}),r?"编辑域名":"添加域名"]}),e.jsx(q,{"code-path":"src/components/cloud/DomainManager.tsx:311:13",className:"text-slate-400",children:r?"修改域名注册信息、DNS 配置和 SSL 证书状态":"录入域名信息,包括注册商、DNS 服务商和到期时间"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:316:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:317:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:318:15",className:"text-slate-300",children:"域名 *"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:319:15",placeholder:"example.com",value:a.name,onChange:s=>t({...a,name:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:327:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:328:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:329:17",className:"text-slate-300",children:"注册商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:330:17",placeholder:"阿里云 / Cloudflare ...",value:a.registrar,onChange:s=>t({...a,registrar:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:337:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:338:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:339:17",value:a.status,onChange:s=>t({...a,status:s.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:344:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:345:19",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:346:19",value:"pending",children:"待审核"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:351:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:352:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:353:17",className:"text-slate-300",children:"到期时间"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:354:17",type:"date",value:a.expire_date,onChange:s=>t({...a,expire_date:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:361:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:362:17",className:"text-slate-300",children:"DNS 服务商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:363:17",placeholder:"Cloudflare / DNSPod ...",value:a.dns_provider,onChange:s=>t({...a,dns_provider:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:372:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:373:15",className:"text-slate-300",children:"解析记录数"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:374:15",type:"number",placeholder:"0",value:a.record_count,onChange:s=>t({...a,record_count:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:383:13",className:"grid grid-cols-2 gap-4 items-end",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:384:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:385:17",className:"text-slate-300",children:"SSL 证书到期"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:386:17",type:"date",value:a.ssl_expire_date,onChange:s=>t({...a,ssl_expire_date:s.target.value}),disabled:!a.ssl_enabled,className:"bg-slate-900 border-slate-700 text-slate-100 disabled:opacity-40"})]}),e.jsxs("label",{"code-path":"src/components/cloud/DomainManager.tsx:394:15",className:"flex items-center gap-2 cursor-pointer pb-2",children:[e.jsx("input",{"code-path":"src/components/cloud/DomainManager.tsx:395:17",type:"checkbox",checked:a.ssl_enabled,onChange:s=>t({...a,ssl_enabled:s.target.checked}),className:"h-4 w-4 rounded border-slate-600 bg-slate-900 accent-cyan-500"}),e.jsx("span",{"code-path":"src/components/cloud/DomainManager.tsx:401:17",className:"text-slate-300 text-sm",children:"启用 SSL"})]})]})]}),e.jsxs(J,{"code-path":"src/components/cloud/DomainManager.tsx:406:11",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:407:13",variant:"outline",onClick:()=>p(!1),className:"border-slate-700 text-slate-300",children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:410:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!a.name.trim()||f,onClick:z,children:[f?e.jsx(Z,{"code-path":"src/components/cloud/DomainManager.tsx:415:29",className:"h-4 w-4 mr-2 animate-spin"}):r?e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:415:97",className:"h-4 w-4 mr-2"}):e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:415:134",className:"h-4 w-4 mr-2"}),r?"保存修改":"创建域名"]})]})]})})]})}export{le as DomainManager}; +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/DomainManager.tsx:206:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(M,{"code-path":"src/components/cloud/DomainManager.tsx:207:11",className:"p-12 text-center text-slate-500",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:208:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):w.length===0?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:213:9",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:214:11",className:"p-12 text-center text-slate-500",children:"暂无域名数据"})}):e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:217:9",className:"space-y-3",children:w.map(s=>{const c=s.ssl_enabled||s.sslEnabled,o=s.expire_date||s.expireDate||"",C=s.ssl_expire_date||s.sslExpireDate||"",S=Q(o);return e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:224:15",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:225:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:226:19",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:227:21",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:228:23",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",children:e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:229:25",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:231:23",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:232:25",className:"flex items-center gap-2",children:[e.jsx("h3",{"code-path":"src/components/cloud/DomainManager.tsx:233:27",className:"font-medium text-slate-100 text-lg",children:s.name}),s.status==="active"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:235:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:236:31",className:"h-3 w-3 mr-1"}),"正常"]}),s.status==="expired"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:241:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(V,{"code-path":"src/components/cloud/DomainManager.tsx:242:31",className:"h-3 w-3 mr-1"}),"已过期"]}),s.status==="pending"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:247:29",className:"bg-yellow-500/20 text-yellow-400 border-0",children:[e.jsx(W,{"code-path":"src/components/cloud/DomainManager.tsx:248:31",className:"h-3 w-3 mr-1"}),"待审核"]}),c&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:253:29",className:"bg-cyan-500/20 text-cyan-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:254:31",className:"h-3 w-3 mr-1"}),"SSL"]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:259:25",className:"flex items-center gap-4 mt-1 text-sm text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:260:27",children:["注册商: ",s.registrar||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:261:27",children:["DNS: ",s.dns_provider||s.dnsProvider||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:262:27",children:["解析记录: ",s.record_count??s.recordCount??0,"条"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:266:21",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:267:23",className:"text-right",children:[e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:268:25",className:"text-sm text-slate-400",children:"到期时间"}),e.jsxs("p",{"code-path":"src/components/cloud/DomainManager.tsx:269:25",className:`text-sm font-medium ${S<30?"text-red-400":"text-slate-200"}`,children:[o?o.substring(0,10):"-",o&&` (${S}天)`,c&&C&&e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:272:29",className:"text-slate-500",children:[" · SSL: ",C.substring(0,10)]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:276:23",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:277:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>$(s),children:e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:283:27",className:"h-4 w-4"})}),e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:285:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>G(s.id),children:e.jsx(Y,{"code-path":"src/components/cloud/DomainManager.tsx:291:27",className:"h-4 w-4"})})]})]})]})})},s.id)})}),e.jsx(U,{"code-path":"src/components/cloud/DomainManager.tsx:304:7",open:I,onOpenChange:p,children:e.jsxs(A,{"code-path":"src/components/cloud/DomainManager.tsx:305:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(H,{"code-path":"src/components/cloud/DomainManager.tsx:306:11",children:[e.jsxs(X,{"code-path":"src/components/cloud/DomainManager.tsx:307:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:308:15",className:"h-5 w-5 text-blue-400"}),r?"编辑域名":"添加域名"]}),e.jsx(q,{"code-path":"src/components/cloud/DomainManager.tsx:311:13",className:"text-slate-400",children:r?"修改域名注册信息、DNS 配置和 SSL 证书状态":"录入域名信息,包括注册商、DNS 服务商和到期时间"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:316:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:317:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:318:15",className:"text-slate-300",children:"域名 *"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:319:15",placeholder:"example.com",value:a.name,onChange:s=>t({...a,name:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:327:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:328:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:329:17",className:"text-slate-300",children:"注册商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:330:17",placeholder:"阿里云 / Cloudflare ...",value:a.registrar,onChange:s=>t({...a,registrar:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:337:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:338:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:339:17",value:a.status,onChange:s=>t({...a,status:s.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:344:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:345:19",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:346:19",value:"pending",children:"待审核"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:351:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:352:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:353:17",className:"text-slate-300",children:"到期时间"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:354:17",type:"date",value:a.expire_date,onChange:s=>t({...a,expire_date:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:361:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:362:17",className:"text-slate-300",children:"DNS 服务商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:363:17",placeholder:"Cloudflare / DNSPod ...",value:a.dns_provider,onChange:s=>t({...a,dns_provider:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:372:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:373:15",className:"text-slate-300",children:"解析记录数"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:374:15",type:"number",placeholder:"0",value:a.record_count,onChange:s=>t({...a,record_count:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:383:13",className:"grid grid-cols-2 gap-4 items-end",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:384:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:385:17",className:"text-slate-300",children:"SSL 证书到期"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:386:17",type:"date",value:a.ssl_expire_date,onChange:s=>t({...a,ssl_expire_date:s.target.value}),disabled:!a.ssl_enabled,className:"bg-slate-900 border-slate-700 text-slate-100 disabled:opacity-40"})]}),e.jsxs("label",{"code-path":"src/components/cloud/DomainManager.tsx:394:15",className:"flex items-center gap-2 cursor-pointer pb-2",children:[e.jsx("input",{"code-path":"src/components/cloud/DomainManager.tsx:395:17",type:"checkbox",checked:a.ssl_enabled,onChange:s=>t({...a,ssl_enabled:s.target.checked}),className:"h-4 w-4 rounded border-slate-600 bg-slate-900 accent-cyan-500"}),e.jsx("span",{"code-path":"src/components/cloud/DomainManager.tsx:401:17",className:"text-slate-300 text-sm",children:"启用 SSL"})]})]})]}),e.jsxs(J,{"code-path":"src/components/cloud/DomainManager.tsx:406:11",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:407:13",variant:"outline",onClick:()=>p(!1),className:"border-slate-700 text-slate-300",children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:410:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!a.name.trim()||f,onClick:z,children:[f?e.jsx(Z,{"code-path":"src/components/cloud/DomainManager.tsx:415:29",className:"h-4 w-4 mr-2 animate-spin"}):r?e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:415:97",className:"h-4 w-4 mr-2"}):e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:415:134",className:"h-4 w-4 mr-2"}),r?"保存修改":"创建域名"]})]})]})})]})}export{le as DomainManager}; diff --git a/backend/static/assets/EventsPage-BlM0_-X4.js b/backend/static/assets/EventsPage-UFe_ZFfW.js similarity index 98% rename from backend/static/assets/EventsPage-BlM0_-X4.js rename to backend/static/assets/EventsPage-UFe_ZFfW.js index 6424a47..55c0240 100644 --- a/backend/static/assets/EventsPage-BlM0_-X4.js +++ b/backend/static/assets/EventsPage-UFe_ZFfW.js @@ -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||"",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/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:180:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:181:7",className:"flex items-center gap-2 text-sm text-[var(--dg-text-muted)]",children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:182:9",to:"/kubernetes",className:"hover:text-[var(--dg-text-secondary)]",children:"集群"}),r&&e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:185:13",className:"h-3 w-3"}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:186:13",to:`/kubernetes/${r}`,className:"hover:text-[var(--dg-text-secondary)]",children:r})]}),e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:189:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:190:9",className:"text-[var(--dg-text-secondary)]",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:193:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:194:9",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/EventsPage.tsx:195:11",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:198:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:199:11",value:r,onValueChange:t=>{H(t),m(`/kubernetes/${t}/events`)},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:13",className:"w-40 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:57"})}),e.jsx(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:201:13",children:d.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:203:17",value:t.code||String(t.id),className:"text-xs",children:t.name||t.code},t.id))})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:207:11",value:u,onValueChange:t=>{Z(t),A(""),D("")},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:13",className:"w-36 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:57",placeholder:"命名空间"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:209:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:210:15",value:"all",className:"text-xs",children:"所有命名空间"}),Q.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:211:38",value:t,className:"text-xs",children:t},t))]})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:214:11",value:E,onValueChange:te,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:13",className:"w-32 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:57"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:216:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:217:15",value:"0",className:"text-xs",children:"全部时间"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:218:15",value:"1",className:"text-xs",children:"近 1 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:219:15",value:"6",className:"text-xs",children:"近 6 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:220:15",value:"24",className:"text-xs",children:"近 24 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:221:15",value:"168",className:"text-xs",children:"近 7 天"})]})]}),e.jsxs(de,{"code-path":"src/components/kubernetes/EventsPage.tsx:224:11",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{V(),B()},disabled:p,children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:225:13",className:`h-3 w-3 mr-1 ${p?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:232:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:233:9",className:"p-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:234:11",className:"grid grid-cols-2 md:grid-cols-4",children:[e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:235:13",label:"事件总数",value:o?.total??l.length}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:236:13",label:"告警事件",value:o?.warning_count??ae,hint:"Warning"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:237:13",label:"正常事件",value:o?.normal_count??re,hint:"Normal"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:238:13",label:"告警类型",value:I.length,hint:"不同 Reason"})]})})}),(g||h)&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:244:9",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:245:11",className:"text-[var(--dg-text-muted)]",children:"筛选:"}),g&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:247:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>A(""),children:["原因 ",g," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:248:35",className:"h-3 w-3"})]}),h&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:252:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>D(""),children:["类型 ",h," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:253:33",className:"h-3 w-3"})]})]}),I.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:260:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:261:11",title:"告警原因",items:I,selected:g,onSelect:A}),z.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:262:33",title:"命名空间",items:z}),X.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:264:13",title:"资源类型",items:X,selected:h,onSelect:D})]}),o?.recent_warnings?.length>0&&e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:270:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] border-l-2 border-l-[var(--dg-warning)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:271:11",className:"p-4",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:272:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/EventsPage.tsx:273:15",className:"h-4 w-4 text-[var(--dg-warning)]"}),"最新告警 (",o.recent_warnings.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:276:13",className:"space-y-1",children:o.recent_warnings.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:278:17",className:"text-xs py-1.5 px-2 rounded hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:279:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:280:21",className:"shrink-0 font-mono text-[var(--dg-warning)]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:281:21",className:"text-[var(--dg-text-muted)] font-mono truncate",children:t.object}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:282:21",className:"text-[var(--dg-text-muted)]",children:t.namespace}),e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:283:21",className:"text-[var(--dg-text-muted)]",children:["×",t.count]}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:284:21",className:"ml-auto text-[var(--dg-text-muted)]",children:w(t.last_time)})]}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:286:19",className:"text-[var(--dg-text-secondary)] truncate mt-0.5",title:t.message,children:t.message})]},a))})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:294:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:295:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:296:11",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:297:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["事件列表 (",j.length,")"]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:298:13",value:y,onValueChange:ee,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:15",className:"w-28 h-7 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:59"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:300:15",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:301:17",value:"all",className:"text-xs",children:"所有类型"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:302:17",value:"Warning",className:"text-xs",children:"Warning"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:303:17",value:"Normal",className:"text-xs",children:"Normal"})]})]})]}),e.jsxs(xe,{"code-path":"src/components/kubernetes/EventsPage.tsx:307:11",children:[e.jsx(le,{"code-path":"src/components/kubernetes/EventsPage.tsx:308:13",children:e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:309:15",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:310:17",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:311:17",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:312:17",className:"text-[var(--dg-text-muted)]",children:"对象"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:313:17",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:314:17",className:"text-[var(--dg-text-muted)] w-12",children:"次数"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:315:17",className:"text-[var(--dg-text-muted)] w-20",children:"命名空间"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:316:17",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(me,{"code-path":"src/components/kubernetes/EventsPage.tsx:319:13",children:j.length===0?e.jsx(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:321:17",children:e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:322:19",colSpan:7,className:"text-center text-[var(--dg-text-muted)] py-8",children:p?e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:323:32",className:"h-4 w-4 animate-spin mx-auto"}):"暂无事件"})}):j.slice(0,200).map((t,a)=>{const n=`${t.name}-${a}`,c=se===n,P=t.type==="Warning";return e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:331:19",className:`border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-tertiary)]/40 ${c?"bg-[var(--dg-bg-tertiary)]/30":""}`,onClick:()=>ne(c?null:n),children:[e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:336:21",children:e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:337:23",className:`text-xs font-medium ${P?"text-[var(--dg-warning)]":"text-[var(--dg-text-muted)]"}`,children:P?"Warning":"Normal"})}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:341:21",className:"text-xs text-[var(--dg-text-secondary)] font-medium",children:t.reason||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:342:21",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:t.object||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:343:21",className:"text-xs text-[var(--dg-text-secondary)] max-w-[400px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:344:23",className:`truncate ${c?"whitespace-normal":""}`,title:c?void 0:t.message,children:t.message||"-"}),c&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:348:25",className:"mt-1 pt-1 border-t border-[var(--dg-border)] text-[10px] text-[var(--dg-text-muted)] space-y-0.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:349:27",children:["首次: ",K(t.first_time)," (",w(t.first_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:350:27",children:["最后: ",K(t.last_time)," (",w(t.last_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:351:27",children:["名称: ",t.name]})]})]}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:355:21",className:"text-sm text-[var(--dg-text-muted)] text-center tabular-nums",children:t.count>1?t.count:1}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:356:21",className:"text-xs text-[var(--dg-text-muted)]",children:t.namespace||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:358:23",children:K(t.last_time)}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:359:23",className:"text-[10px]",children:w(t.last_time)})]})]},n)})})]}),j.length>200&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:367:13",className:"text-center py-2 text-xs text-[var(--dg-text-muted)] border-t border-[var(--dg-border)]",children:["仅显示前 200 条,共 ",j.length," 条"]})]})})]})}export{Pe as default}; +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||"",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/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:180:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:181:7",className:"flex items-center gap-2 text-sm text-[var(--dg-text-muted)]",children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:182:9",to:"/kubernetes",className:"hover:text-[var(--dg-text-secondary)]",children:"集群"}),r&&e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:185:13",className:"h-3 w-3"}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:186:13",to:`/kubernetes/${r}`,className:"hover:text-[var(--dg-text-secondary)]",children:r})]}),e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:189:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:190:9",className:"text-[var(--dg-text-secondary)]",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:193:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:194:9",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/EventsPage.tsx:195:11",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:198:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:199:11",value:r,onValueChange:t=>{H(t),m(`/kubernetes/${t}/events`)},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:13",className:"w-40 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:57"})}),e.jsx(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:201:13",children:d.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:203:17",value:t.code||String(t.id),className:"text-xs",children:t.name||t.code},t.id))})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:207:11",value:u,onValueChange:t=>{Z(t),A(""),D("")},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:13",className:"w-36 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:57",placeholder:"命名空间"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:209:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:210:15",value:"all",className:"text-xs",children:"所有命名空间"}),Q.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:211:38",value:t,className:"text-xs",children:t},t))]})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:214:11",value:E,onValueChange:te,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:13",className:"w-32 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:57"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:216:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:217:15",value:"0",className:"text-xs",children:"全部时间"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:218:15",value:"1",className:"text-xs",children:"近 1 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:219:15",value:"6",className:"text-xs",children:"近 6 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:220:15",value:"24",className:"text-xs",children:"近 24 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:221:15",value:"168",className:"text-xs",children:"近 7 天"})]})]}),e.jsxs(de,{"code-path":"src/components/kubernetes/EventsPage.tsx:224:11",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{V(),B()},disabled:p,children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:225:13",className:`h-3 w-3 mr-1 ${p?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:232:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:233:9",className:"p-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:234:11",className:"grid grid-cols-2 md:grid-cols-4",children:[e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:235:13",label:"事件总数",value:o?.total??l.length}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:236:13",label:"告警事件",value:o?.warning_count??ae,hint:"Warning"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:237:13",label:"正常事件",value:o?.normal_count??re,hint:"Normal"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:238:13",label:"告警类型",value:I.length,hint:"不同 Reason"})]})})}),(g||h)&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:244:9",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:245:11",className:"text-[var(--dg-text-muted)]",children:"筛选:"}),g&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:247:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>A(""),children:["原因 ",g," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:248:35",className:"h-3 w-3"})]}),h&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:252:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>D(""),children:["类型 ",h," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:253:33",className:"h-3 w-3"})]})]}),I.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:260:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:261:11",title:"告警原因",items:I,selected:g,onSelect:A}),z.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:262:33",title:"命名空间",items:z}),X.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:264:13",title:"资源类型",items:X,selected:h,onSelect:D})]}),o?.recent_warnings?.length>0&&e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:270:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] border-l-2 border-l-[var(--dg-warning)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:271:11",className:"p-4",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:272:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/EventsPage.tsx:273:15",className:"h-4 w-4 text-[var(--dg-warning)]"}),"最新告警 (",o.recent_warnings.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:276:13",className:"space-y-1",children:o.recent_warnings.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:278:17",className:"text-xs py-1.5 px-2 rounded hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:279:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:280:21",className:"shrink-0 font-mono text-[var(--dg-warning)]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:281:21",className:"text-[var(--dg-text-muted)] font-mono truncate",children:t.object}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:282:21",className:"text-[var(--dg-text-muted)]",children:t.namespace}),e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:283:21",className:"text-[var(--dg-text-muted)]",children:["×",t.count]}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:284:21",className:"ml-auto text-[var(--dg-text-muted)]",children:w(t.last_time)})]}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:286:19",className:"text-[var(--dg-text-secondary)] truncate mt-0.5",title:t.message,children:t.message})]},a))})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:294:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:295:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:296:11",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:297:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["事件列表 (",j.length,")"]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:298:13",value:y,onValueChange:ee,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:15",className:"w-28 h-7 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:59"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:300:15",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:301:17",value:"all",className:"text-xs",children:"所有类型"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:302:17",value:"Warning",className:"text-xs",children:"Warning"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:303:17",value:"Normal",className:"text-xs",children:"Normal"})]})]})]}),e.jsxs(xe,{"code-path":"src/components/kubernetes/EventsPage.tsx:307:11",children:[e.jsx(le,{"code-path":"src/components/kubernetes/EventsPage.tsx:308:13",children:e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:309:15",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:310:17",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:311:17",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:312:17",className:"text-[var(--dg-text-muted)]",children:"对象"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:313:17",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:314:17",className:"text-[var(--dg-text-muted)] w-12",children:"次数"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:315:17",className:"text-[var(--dg-text-muted)] w-20",children:"命名空间"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:316:17",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(me,{"code-path":"src/components/kubernetes/EventsPage.tsx:319:13",children:j.length===0?e.jsx(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:321:17",children:e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:322:19",colSpan:7,className:"text-center text-[var(--dg-text-muted)] py-8",children:p?e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:323:32",className:"h-4 w-4 animate-spin mx-auto"}):"暂无事件"})}):j.slice(0,200).map((t,a)=>{const n=`${t.name}-${a}`,c=se===n,P=t.type==="Warning";return e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:331:19",className:`border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-tertiary)]/40 ${c?"bg-[var(--dg-bg-tertiary)]/30":""}`,onClick:()=>ne(c?null:n),children:[e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:336:21",children:e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:337:23",className:`text-xs font-medium ${P?"text-[var(--dg-warning)]":"text-[var(--dg-text-muted)]"}`,children:P?"Warning":"Normal"})}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:341:21",className:"text-xs text-[var(--dg-text-secondary)] font-medium",children:t.reason||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:342:21",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:t.object||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:343:21",className:"text-xs text-[var(--dg-text-secondary)] max-w-[400px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:344:23",className:`truncate ${c?"whitespace-normal":""}`,title:c?void 0:t.message,children:t.message||"-"}),c&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:348:25",className:"mt-1 pt-1 border-t border-[var(--dg-border)] text-[10px] text-[var(--dg-text-muted)] space-y-0.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:349:27",children:["首次: ",K(t.first_time)," (",w(t.first_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:350:27",children:["最后: ",K(t.last_time)," (",w(t.last_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:351:27",children:["名称: ",t.name]})]})]}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:355:21",className:"text-sm text-[var(--dg-text-muted)] text-center tabular-nums",children:t.count>1?t.count:1}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:356:21",className:"text-xs text-[var(--dg-text-muted)]",children:t.namespace||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:358:23",children:K(t.last_time)}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:359:23",className:"text-[10px]",children:w(t.last_time)})]})]},n)})})]}),j.length>200&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:367:13",className:"text-center py-2 text-xs text-[var(--dg-text-muted)] border-t border-[var(--dg-border)]",children:["仅显示前 200 条,共 ",j.length," 条"]})]})})]})}export{Pe as default}; diff --git a/backend/static/assets/GrafanaDashboard-DwBz9b6M.js b/backend/static/assets/GrafanaDashboard-Cwk6bt47.js similarity index 99% rename from backend/static/assets/GrafanaDashboard-DwBz9b6M.js rename to backend/static/assets/GrafanaDashboard-Cwk6bt47.js index f2ff9a5..6f2bf64 100644 --- a/backend/static/assets/GrafanaDashboard-DwBz9b6M.js +++ b/backend/static/assets/GrafanaDashboard-Cwk6bt47.js @@ -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)},F=n=>{z===n?A(l=>l==="asc"?"desc":"asc"):(v(n),A("desc"))},T=[...g].sort((n,l)=>{const S=n[z]??"",j=l[z]??"";return typeof S=="number"?h==="asc"?S-j:j-S:h==="asc"?String(S).localeCompare(String(j)):String(j).localeCompare(String(S))}),$=({f:n})=>z!==n?a.jsx($a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:68:33",className:"w-3 h-3 text-slate-500"}):h==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:32",className:"w-3 h-3 text-blue-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:80",className:"w-3 h-3 text-blue-400"}),p=(n,l)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:73:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:74:7",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:75:9",className:`h-full rounded-full transition-all duration-500 ${n>=80?"bg-orange-500":"bg-blue-500"}`,style:{width:`${Math.min(n,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:77:7",className:`w-14 text-right text-xs font-mono tabular-nums ${n>=80?"text-orange-400":""}`,children:l})]}),f=n=>!n||n===0?"—":n>1e9?`${(n/1e9).toFixed(1)} GB/s`:n>1e6?`${(n/1e6).toFixed(1)} MB/s`:n>1e3?`${(n/1e3).toFixed(1)} KB/s`:`${n.toFixed(1)} B/s`;return!c&&!x&&!P?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:92:5",className:"bg-[var(--dg-bg-secondary)] border-blue-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:93:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:94:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:95:11",className:"h-4 w-4 text-blue-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:96:11",className:"text-sm font-medium",children:"Zabbix 主机监控"}),w&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:97:23",className:"text-[10px] bg-blue-500/10 text-blue-400",children:["v",w]}),c&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:98:25",className:"text-[10px] text-[var(--dg-text-muted)] ml-2",children:[g.length," 台"]}),c&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:25",className:"ml-auto flex gap-1",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:61",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:Z,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:146",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:102:7",className:"px-4 pb-3 pt-0",children:x?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-blue-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:127",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):P?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400 flex items-start gap-2",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:135",className:"h-4 w-4 mt-0.5"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:179",children:P})]}):g.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:33",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:95",className:"h-8 w-8 mx-auto mb-2 text-slate-600"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:153",className:"text-sm",children:"未找到被监控的 Zabbix 主机"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:107:11",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:108:13",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:a.jsx("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:96",children:[{f:"hostname",l:"主机名"},{f:"cpu_usage",l:"CPU"},{f:"memory_usage",l:"内存"},{f:"disk_usage",l:"磁盘"},{f:"load5",l:"Load5"},{f:"net_in_bps",l:"流入"},{f:"net_out_bps",l:"流出"},{f:"problem_count",l:"问题"},{f:"uptime_days",l:"运行"}].map(({f:n,l})=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:115:19",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>F(n),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:21",className:"flex items-center gap-1",children:[l,a.jsx($,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:65",f:n})]})},n))})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:118:15",children:T.map((n,l)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:120:19",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsxs("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:21",className:"px-3 py-2.5 whitespace-nowrap",children:[a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:67",className:`text-[10px] ${n.available==="1"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:193",className:"w-3 h-3 mr-1"}),n.available==="1"?"UP":"DOWN"]})," ",a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:272",className:"font-medium text-[var(--dg-text-primary)] ml-1",children:n.name||n.hostname})]}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:122:21",className:"px-3 py-2.5",children:p(Number(n.cpu_usage||0),`${Number(n.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:123:21",className:"px-3 py-2.5",children:p(Number(n.memory_usage||0),`${Number(n.memory_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:124:21",className:"px-3 py-2.5",children:p(Number(n.disk_usage||0),`${Number(n.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:125:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.load5>0?n.load5.toFixed(1):"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:126:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_in_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:127:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_out_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:21",className:"px-3 py-2.5 text-center",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:61",className:`font-mono font-bold ${n.problem_count>0?n.problem_count>2?"text-red-400":"text-amber-400":"text-emerald-400"}`,children:n.problem_count>0?a.jsxs(a.Fragment,{children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:230",className:"w-3 h-3 inline mr-1"}),n.problem_count]}):"0"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:129:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.uptime_days>0?`${n.uptime_days}d`:"—"})]},n.hostid||l))})]})})})]})},V=({val:s,label:r,color:e})=>{const c=Math.min(s,100);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:16:5",className:"flex items-center gap-1.5 min-w-[80px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:17:7",className:"flex-1 h-2 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:18:9",className:`h-full rounded-full ${e||"bg-purple-500"}`,style:{width:`${c}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:20:7",className:"w-14 text-right text-[11px] font-mono text-[var(--dg-text-secondary)]",children:r})]})},js=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB`:s>1e6?`${(s/1e6).toFixed(1)} MB`:`${(s/1e3).toFixed(1)} KB`:"—",Ca=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB/s`:s>1e6?`${(s/1e6).toFixed(1)} MB/s`:s>1e3?`${(s/1e3).toFixed(1)} KB/s`:`${s.toFixed(1)} B/s`:"—";function Ds(s){return(s||[]).map(r=>{const e={...r.metric||{}};return r.value&&(e.value=r.value[1]),e})}const Ns=s=>a.jsx("svg",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:26",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...s,children:a.jsx("path",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:211",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),vs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:50:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:51:5",items:[{label:"Pods",value:s.podCount?.[0]?.value||0,color:"purple"},{label:"Deployments",value:s.deployCount?.[0]?.value||0,color:"blue"},{label:"Nodes",value:s.nodeCount?.[0]?.value||0,color:"emerald"},{label:"Namespaces",value:s.nsPods?.length||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:59:5",className:"rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-3 max-h-60 overflow-y-auto",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:7",className:"text-xs font-medium mb-2 flex items-center gap-1",children:[a.jsx(Ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:73",className:"w-3 h-3 text-purple-400"}),"节点 CPU / 内存利用率"]}),(s.nodeCPU||[]).map((r,e)=>{const c=(s.nodeMem||[]).find(i=>i.node===r.node);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:16",className:"flex items-center gap-3 text-[11px] mb-1.5",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:84",className:"w-28 truncate",title:r.node,children:r.node}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:146",val:Number(r.value||0),label:`${Number(r.value||0).toFixed(1)}%`}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:226",val:Number(c?.value||0),label:`${Number(c?.value||0).toFixed(1)}%`,color:"bg-blue-500"})]},e)})]})]}),ys=({d:s})=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:70:3",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:71:5",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:7",className:"bg-[var(--dg-bg-tertiary)]",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:53",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:57",className:"px-3 py-2 text-left",children:"节点"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:100",className:"px-3 py-2 text-left",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:143",className:"px-3 py-2 text-left",children:"CPU"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:187",className:"px-3 py-2 text-left",children:"内存"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:230",className:"px-3 py-2 text-left",children:"磁盘"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:273",className:"px-3 py-2 text-left",children:"流入"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:316",className:"px-3 py-2 text-left",children:"流出"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:73:7",children:(s.nodes||[]).map((r,e)=>{const c=r.instance||r.exported_instance||"",i=(s.cpuUsage||[]).find(m=>m.instance===c),x=(s.memUsage||[]).find(m=>m.instance===c),b=(s.diskUsage||[]).find(m=>m.instance===c),g=(s.up||[]).find(m=>m.instance===c),N=(s.netRx||[]).find(m=>m.instance===c),w=(s.netTx||[]).find(m=>m.instance===c);return a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:82:18",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:83:13",className:"px-3 py-2 font-medium",children:r.nodename||c}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:13",className:"px-3 py-2",children:a.jsx(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:39",className:`text-[10px] ${g?.value===1?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:g?.value===1?"UP":"DOWN"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:39",val:Number(i?.value||0),label:`${Number(i?.value||0).toFixed(1)}%`})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:39",val:Number(x?.value||0),label:`${Number(x?.value||0).toFixed(1)}%`,color:"bg-blue-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:39",val:Number(b?.value||0),label:`${Number(b?.value||0).toFixed(1)}%`,color:"bg-amber-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:88:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(N?.value||0))}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:89:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(w?.value||0))})]},e)})})]})}),Gs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:98:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:99:5",items:[{label:"Running",value:s.running?.[0]?.value||0,color:"emerald"},{label:"Pending",value:s.pending?.[0]?.value||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:88",className:"text-xs font-medium mb-2",children:"CPU Top 10"}),(s.cpuTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:186",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:252",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:326",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:386",val:Number(r.value||0)*100,label:`${Number(r.value||0).toFixed(2)}c`,color:"bg-purple-500"})]},e))]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:88",className:"text-xs font-medium mb-2",children:"内存 Top 10"}),(s.memTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:185",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:251",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:325",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:385",className:"ml-auto",children:js(Number(r.value||0))})]},e))]})]}),ws=({d:s})=>{const r=Number(s.heapUsed?.[0]?.value||0),e=Number(s.uptime?.[0]?.value||0);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:114:5",className:"grid grid-cols-5 gap-3",children:[a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:92",className:"text-lg font-bold",children:e>86400?`${(e/86400).toFixed(1)}d`:`${(e/3600).toFixed(1)}h`}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:210",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Uptime"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:92",val:r,label:`${r.toFixed(1)}%`,color:r>80?"bg-orange-500":"bg-purple-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:183",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:92",val:Number(s.nonHeapUsed?.[0]?.value||0),label:`${Number(s.nonHeapUsed?.[0]?.value||0).toFixed(1)}%`,color:"bg-blue-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:228",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Non-Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:92",className:"text-lg font-bold text-emerald-400",children:s.threadCount?.[0]?.value||0}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:180",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Threads"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:92",className:"text-lg font-bold text-amber-400",children:Number(s.gcPause?.[0]?.value||0).toFixed(3)}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:193",className:"text-[10px] text-[var(--dg-text-muted)]",children:"GC Pause (s)"})]})})]})},Ps=({dsUrl:s})=>{const[r,e]=o.useState(!1),[c,i]=o.useState(!1),[x,b]=o.useState(0),[g,N]=o.useState(""),[w,m]=o.useState("kubernetes"),[P,y]=o.useState({}),[z,v]=o.useState({}),[h,A]=o.useState({}),[W,Z]=o.useState({});o.useEffect(()=>{s&&F(s)},[s]);const F=async p=>{i(!0),N("");try{const f=await Sa.connect(p);e(!0),b(f.targets||0),T(p)}catch(f){e(!1),N(f.message||"连接失败")}finally{i(!1)}},T=async p=>{for(const f of["kubernetes","node","pod","jvm"])try{const n=await Sa.dashboard(p,f),l={};for(const[S,j]of Object.entries(n||{}))l[S]=Array.isArray(j)?j:j?.data?.result?Ds(j.data.result):j;f==="kubernetes"&&y(l),f==="node"&&v(l),f==="pod"&&A(l),f==="jvm"&&Z(l)}catch{}},$=()=>{s&&F(s)};return!r&&!g?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:167:5",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:168:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:169:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:170:11",className:"h-4 w-4 text-purple-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:171:11",className:"text-sm font-medium",children:"Prometheus 监控"}),r&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:172:25",className:"text-[10px] bg-purple-500/10 text-purple-400",children:[x," targets"]}),r&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:25",className:"ml-auto",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:50",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:$,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:135",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:176:7",className:"px-4 pb-3 pt-0",children:c?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-purple-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:129",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):g?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:112",className:"h-4 w-4 inline mr-1"}),g]}):a.jsxs(Ua,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:180:11",value:w,onValueChange:m,children:[a.jsxs(Ha,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:181:13",className:"bg-[var(--dg-bg-tertiary)] mb-3",children:[a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:15",value:"kubernetes",className:"text-xs",children:[a.jsx(es,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:67",className:"w-3 h-3 mr-1"}),"Kubernetes"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:15",value:"node",className:"text-xs",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:61",className:"w-3 h-3 mr-1"}),"Node"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:15",value:"pod",className:"text-xs",children:[a.jsx(Ns,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:60",className:"w-3 h-3 mr-1"}),"Pod"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:15",value:"jvm",className:"text-xs",children:[a.jsx(ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:60",className:"w-3 h-3 mr-1"}),"JVM"]})]}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:13",value:"kubernetes",children:a.jsx(vs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:45",d:P})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:13",value:"node",children:a.jsx(ys,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:39",d:z})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:13",value:"pod",children:a.jsx(Gs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:38",d:h})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:13",value:"jvm",children:a.jsx(ws,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:38",d:W})})]})})]})};function As(s){return s?Array.isArray(s)?s:Array.isArray(s.list)?s.list:Array.isArray(s.items)?s.items:Array.isArray(s.data)?s.data:[]:[]}function Ss(){return typeof window<"u"&&window.location?{origin:window.location.origin,backend:`${window.location.protocol}//${window.location.hostname}:8080`}:{origin:"http://127.0.0.1",backend:"http://127.0.0.1:8080"}}function Cs({open:s,onOpenChange:r,server:e,onInstalled:c,onFailed:i}){const x=za(d=>d.token)||"",{origin:b,backend:g}=Ss(),[N,w]=o.useState(!1),[m,P]=o.useState(!1),[y,z]=o.useState(!1),[v,h]=o.useState("auto"),[A,W]=o.useState("root"),[Z,F]=o.useState(""),[T,$]=o.useState(""),[p,f]=o.useState("password"),n=e&&!e.has_auth,l=`curl -fsSL ${b}/agent/install.sh | bash -s -- --server ${g} --token ${x}`,S=()=>{const d=document.createElement("textarea");d.value=l,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.width="2em",d.style.height="2em",d.style.padding="0",d.style.border="none",d.style.outline="none",d.style.boxShadow="none",d.style.background="transparent",d.style.opacity="0",d.style.pointerEvents="none",d.style.zIndex="-1",d.style.fontSize="16px",d.contentEditable="true",d.readOnly=!0,document.body.appendChild(d),d.focus(),d.select(),d.setSelectionRange&&d.setSelectionRange(0,999999);let _=!1;try{_=document.execCommand("copy")}catch{}document.body.removeChild(d),_?(w(!0),u.success("安装命令已复制到剪贴板,粘贴到目标主机执行"),setTimeout(()=>w(!1),3e3)):(u.error("自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)"),P(!0))},j=`${b}/agent/aiops-agent-linux-amd64`,ha=[{icon:ns,title:"1. 下载二进制",commands:[`curl -fsSL ${j} -o /usr/local/bin/aiops-agent`]},{icon:ds,title:"2. 赋予执行权限",commands:["chmod +x /usr/local/bin/aiops-agent"]},{icon:Ta,title:"3. 创建 systemd 服务",commands:["cat > /etc/systemd/system/aiops-agent.service << 'EOF'","[Unit]","Description=AIOps Agent","After=network.target","","[Service]","Type=simple",`ExecStart=/usr/local/bin/aiops-agent --server ${g} --token ${x}`,"Restart=always","RestartSec=5","","[Install]","WantedBy=multi-user.target","EOF"]},{icon:cs,title:"4. 启动并设置开机自启",commands:["systemctl daemon-reload","systemctl enable --now aiops-agent","systemctl status aiops-agent"]}],I=async()=>{if(!(!e||!x)){if(n&&!Z&&!T){u.error("请填写 SSH 登录凭据(密码或密钥)");return}z(!0);try{const d=n?{username:A,password:Z,ssh_key:T,auth_type:p}:void 0;(await Wa.installAgent(e.id,x,d))?.installed||!1?(u.success(`${e.hostname} Agent 安装成功`),c?.(e.id),r(!1)):(u.warning(`${e.hostname}: Agent 安装命令已执行,但服务未检测到运行`),c?.(e.id),r(!1))}catch(d){const _=d?.message||"安装失败";u.error(`${e.hostname} ${_}`),i?.(e.id,_)}finally{z(!1)}}};return a.jsx(oa,{"code-path":"src/components/agent/AgentWizard.tsx:190:5",open:s,onOpenChange:r,children:a.jsxs(ra,{"code-path":"src/components/agent/AgentWizard.tsx:191:7",className:"max-w-2xl bg-slate-900 border-slate-800 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/agent/AgentWizard.tsx:192:9",children:[a.jsx(da,{"code-path":"src/components/agent/AgentWizard.tsx:193:11",className:"text-slate-100",children:e?`部署 Agent → ${e.hostname}`:"部署 Agent"}),a.jsx(ka,{"code-path":"src/components/agent/AgentWizard.tsx:196:11",className:"text-slate-400",children:e?`目标主机 ${e.hostname} (${e.ip}),选择安装方式:`:"在目标主机上执行以下命令即可完成 Agent 安装与注册"})]}),a.jsxs(Ua,{"code-path":"src/components/agent/AgentWizard.tsx:204:9",value:v,onValueChange:h,className:"w-full",children:[a.jsxs(Ha,{"code-path":"src/components/agent/AgentWizard.tsx:205:11",className:"bg-slate-800 border border-slate-700",children:[a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:206:13",value:"auto",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:207:15",className:"h-4 w-4 mr-1.5"}),"安装Agent"]}),e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:211:15",value:"ssh",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:212:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),!e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:217:15",value:"ssh",className:"data-[state=active]:bg-slate-700 opacity-50 cursor-not-allowed",disabled:!0,children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:218:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),a.jsx(R,{"code-path":"src/components/agent/AgentWizard.tsx:222:13",value:"manual",className:"data-[state=active]:bg-slate-700",children:"手动安装"})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:228:11",value:"auto",className:"mt-4 space-y-3",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:229:13",className:"text-sm text-slate-400",children:"在目标主机执行以下命令,Agent 将自动下载、安装并启动:"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:232:13",className:"relative rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsx("pre",{"code-path":"src/components/agent/AgentWizard.tsx:233:15",className:"text-xs text-emerald-400 font-mono whitespace-pre-wrap break-all pr-10",children:l}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:236:15",size:"icon",variant:"ghost",onClick:S,className:"absolute top-2 right-2 h-8 w-8 text-slate-400 hover:text-slate-100 hover:bg-slate-800",title:"复制到剪贴板",children:N?a.jsx(ts,{"code-path":"src/components/agent/AgentWizard.tsx:243:27",className:"h-4 w-4 text-emerald-400"}):a.jsx(os,{"code-path":"src/components/agent/AgentWizard.tsx:243:76",className:"h-4 w-4"})})]}),m&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:249:15",className:"rounded-lg bg-amber-950/30 border border-amber-800/50 p-4",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:250:17",className:"text-xs text-amber-400 mb-2",children:"⚠️ 自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:253:17",readOnly:!0,value:l,className:"w-full h-24 bg-slate-950 border border-amber-800/30 text-emerald-400 font-mono text-xs p-3 rounded resize-none focus:outline-none focus:border-amber-600",onClick:d=>d.target.select()})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:261:13",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:262:15",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:263:15",children:["服务器地址已自动检测 — 安装脚本通过 Nginx 代理 (",b,"),Agent 直连后端 (",g,")。安装成功后将自动连接并开始上报指标。"]})]})]}),!e&&a.jsx(K,{"code-path":"src/components/agent/AgentWizard.tsx:271:13",value:"ssh",className:"mt-4 space-y-4",children:a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:272:15",className:"text-center py-12 text-slate-400",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:273:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:274:17",className:"text-sm font-medium mb-1",children:"未选择目标主机"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:275:17",className:"text-xs",children:"请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面"})]})}),e&&a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:281:13",value:"ssh",className:"mt-4 space-y-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:282:15",className:"rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:283:17",className:"flex items-center gap-3 mb-3",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:284:19",className:"h-5 w-5 text-blue-400"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:285:19",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:286:21",className:"text-sm font-medium text-slate-200",children:e.hostname}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:287:21",className:"text-xs text-slate-400",children:e.ip})]})]}),n&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:293:19",className:"mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:294:21",className:"flex items-center gap-2 text-xs text-amber-300/80",children:[a.jsx(rs,{"code-path":"src/components/agent/AgentWizard.tsx:295:23",className:"h-3.5 w-3.5"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:296:23",children:"该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:298:21",className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:299:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:300:25",className:"text-xs text-slate-400",children:"用户名"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:301:25",value:A,onChange:d=>W(d.target.value),placeholder:"root",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:308:23",className:"flex items-end gap-1",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:309:25",className:"flex-1",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:310:27",className:"text-xs text-slate-400",children:"密码"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:311:27",type:"password",value:Z,onChange:d=>{F(d.target.value),f("password")},placeholder:"******",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:319:25",className:"text-xs text-slate-500 px-1 pb-1",children:"或"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:320:25",variant:"ghost",size:"sm",onClick:()=>{f("key"),F("")},className:`text-xs h-7 px-2 ${p==="key"?"text-blue-400":"text-slate-500"}`,children:"密钥"})]})]}),p==="key"&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:328:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:329:25",className:"text-xs text-slate-400",children:"SSH 私钥(PEM 格式)"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:330:25",value:T,onChange:d=>$(d.target.value),placeholder:`-----BEGIN OPENSSH PRIVATE KEY----- +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)},F=n=>{z===n?A(l=>l==="asc"?"desc":"asc"):(v(n),A("desc"))},T=[...g].sort((n,l)=>{const S=n[z]??"",j=l[z]??"";return typeof S=="number"?h==="asc"?S-j:j-S:h==="asc"?String(S).localeCompare(String(j)):String(j).localeCompare(String(S))}),$=({f:n})=>z!==n?a.jsx($a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:68:33",className:"w-3 h-3 text-slate-500"}):h==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:32",className:"w-3 h-3 text-blue-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:80",className:"w-3 h-3 text-blue-400"}),p=(n,l)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:73:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:74:7",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:75:9",className:`h-full rounded-full transition-all duration-500 ${n>=80?"bg-orange-500":"bg-blue-500"}`,style:{width:`${Math.min(n,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:77:7",className:`w-14 text-right text-xs font-mono tabular-nums ${n>=80?"text-orange-400":""}`,children:l})]}),f=n=>!n||n===0?"—":n>1e9?`${(n/1e9).toFixed(1)} GB/s`:n>1e6?`${(n/1e6).toFixed(1)} MB/s`:n>1e3?`${(n/1e3).toFixed(1)} KB/s`:`${n.toFixed(1)} B/s`;return!c&&!x&&!P?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:92:5",className:"bg-[var(--dg-bg-secondary)] border-blue-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:93:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:94:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:95:11",className:"h-4 w-4 text-blue-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:96:11",className:"text-sm font-medium",children:"Zabbix 主机监控"}),w&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:97:23",className:"text-[10px] bg-blue-500/10 text-blue-400",children:["v",w]}),c&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:98:25",className:"text-[10px] text-[var(--dg-text-muted)] ml-2",children:[g.length," 台"]}),c&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:25",className:"ml-auto flex gap-1",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:61",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:Z,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:146",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:102:7",className:"px-4 pb-3 pt-0",children:x?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-blue-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:127",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):P?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400 flex items-start gap-2",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:135",className:"h-4 w-4 mt-0.5"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:179",children:P})]}):g.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:33",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:95",className:"h-8 w-8 mx-auto mb-2 text-slate-600"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:153",className:"text-sm",children:"未找到被监控的 Zabbix 主机"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:107:11",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:108:13",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:a.jsx("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:96",children:[{f:"hostname",l:"主机名"},{f:"cpu_usage",l:"CPU"},{f:"memory_usage",l:"内存"},{f:"disk_usage",l:"磁盘"},{f:"load5",l:"Load5"},{f:"net_in_bps",l:"流入"},{f:"net_out_bps",l:"流出"},{f:"problem_count",l:"问题"},{f:"uptime_days",l:"运行"}].map(({f:n,l})=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:115:19",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>F(n),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:21",className:"flex items-center gap-1",children:[l,a.jsx($,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:65",f:n})]})},n))})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:118:15",children:T.map((n,l)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:120:19",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsxs("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:21",className:"px-3 py-2.5 whitespace-nowrap",children:[a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:67",className:`text-[10px] ${n.available==="1"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:193",className:"w-3 h-3 mr-1"}),n.available==="1"?"UP":"DOWN"]})," ",a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:272",className:"font-medium text-[var(--dg-text-primary)] ml-1",children:n.name||n.hostname})]}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:122:21",className:"px-3 py-2.5",children:p(Number(n.cpu_usage||0),`${Number(n.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:123:21",className:"px-3 py-2.5",children:p(Number(n.memory_usage||0),`${Number(n.memory_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:124:21",className:"px-3 py-2.5",children:p(Number(n.disk_usage||0),`${Number(n.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:125:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.load5>0?n.load5.toFixed(1):"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:126:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_in_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:127:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_out_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:21",className:"px-3 py-2.5 text-center",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:61",className:`font-mono font-bold ${n.problem_count>0?n.problem_count>2?"text-red-400":"text-amber-400":"text-emerald-400"}`,children:n.problem_count>0?a.jsxs(a.Fragment,{children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:230",className:"w-3 h-3 inline mr-1"}),n.problem_count]}):"0"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:129:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.uptime_days>0?`${n.uptime_days}d`:"—"})]},n.hostid||l))})]})})})]})},V=({val:s,label:r,color:e})=>{const c=Math.min(s,100);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:16:5",className:"flex items-center gap-1.5 min-w-[80px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:17:7",className:"flex-1 h-2 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:18:9",className:`h-full rounded-full ${e||"bg-purple-500"}`,style:{width:`${c}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:20:7",className:"w-14 text-right text-[11px] font-mono text-[var(--dg-text-secondary)]",children:r})]})},js=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB`:s>1e6?`${(s/1e6).toFixed(1)} MB`:`${(s/1e3).toFixed(1)} KB`:"—",Ca=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB/s`:s>1e6?`${(s/1e6).toFixed(1)} MB/s`:s>1e3?`${(s/1e3).toFixed(1)} KB/s`:`${s.toFixed(1)} B/s`:"—";function Ds(s){return(s||[]).map(r=>{const e={...r.metric||{}};return r.value&&(e.value=r.value[1]),e})}const Ns=s=>a.jsx("svg",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:26",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...s,children:a.jsx("path",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:211",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),vs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:50:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:51:5",items:[{label:"Pods",value:s.podCount?.[0]?.value||0,color:"purple"},{label:"Deployments",value:s.deployCount?.[0]?.value||0,color:"blue"},{label:"Nodes",value:s.nodeCount?.[0]?.value||0,color:"emerald"},{label:"Namespaces",value:s.nsPods?.length||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:59:5",className:"rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-3 max-h-60 overflow-y-auto",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:7",className:"text-xs font-medium mb-2 flex items-center gap-1",children:[a.jsx(Ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:73",className:"w-3 h-3 text-purple-400"}),"节点 CPU / 内存利用率"]}),(s.nodeCPU||[]).map((r,e)=>{const c=(s.nodeMem||[]).find(i=>i.node===r.node);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:16",className:"flex items-center gap-3 text-[11px] mb-1.5",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:84",className:"w-28 truncate",title:r.node,children:r.node}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:146",val:Number(r.value||0),label:`${Number(r.value||0).toFixed(1)}%`}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:226",val:Number(c?.value||0),label:`${Number(c?.value||0).toFixed(1)}%`,color:"bg-blue-500"})]},e)})]})]}),ys=({d:s})=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:70:3",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:71:5",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:7",className:"bg-[var(--dg-bg-tertiary)]",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:53",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:57",className:"px-3 py-2 text-left",children:"节点"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:100",className:"px-3 py-2 text-left",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:143",className:"px-3 py-2 text-left",children:"CPU"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:187",className:"px-3 py-2 text-left",children:"内存"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:230",className:"px-3 py-2 text-left",children:"磁盘"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:273",className:"px-3 py-2 text-left",children:"流入"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:316",className:"px-3 py-2 text-left",children:"流出"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:73:7",children:(s.nodes||[]).map((r,e)=>{const c=r.instance||r.exported_instance||"",i=(s.cpuUsage||[]).find(m=>m.instance===c),x=(s.memUsage||[]).find(m=>m.instance===c),b=(s.diskUsage||[]).find(m=>m.instance===c),g=(s.up||[]).find(m=>m.instance===c),N=(s.netRx||[]).find(m=>m.instance===c),w=(s.netTx||[]).find(m=>m.instance===c);return a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:82:18",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:83:13",className:"px-3 py-2 font-medium",children:r.nodename||c}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:13",className:"px-3 py-2",children:a.jsx(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:39",className:`text-[10px] ${g?.value===1?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:g?.value===1?"UP":"DOWN"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:39",val:Number(i?.value||0),label:`${Number(i?.value||0).toFixed(1)}%`})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:39",val:Number(x?.value||0),label:`${Number(x?.value||0).toFixed(1)}%`,color:"bg-blue-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:39",val:Number(b?.value||0),label:`${Number(b?.value||0).toFixed(1)}%`,color:"bg-amber-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:88:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(N?.value||0))}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:89:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(w?.value||0))})]},e)})})]})}),Gs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:98:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:99:5",items:[{label:"Running",value:s.running?.[0]?.value||0,color:"emerald"},{label:"Pending",value:s.pending?.[0]?.value||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:88",className:"text-xs font-medium mb-2",children:"CPU Top 10"}),(s.cpuTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:186",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:252",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:326",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:386",val:Number(r.value||0)*100,label:`${Number(r.value||0).toFixed(2)}c`,color:"bg-purple-500"})]},e))]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:88",className:"text-xs font-medium mb-2",children:"内存 Top 10"}),(s.memTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:185",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:251",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:325",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:385",className:"ml-auto",children:js(Number(r.value||0))})]},e))]})]}),ws=({d:s})=>{const r=Number(s.heapUsed?.[0]?.value||0),e=Number(s.uptime?.[0]?.value||0);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:114:5",className:"grid grid-cols-5 gap-3",children:[a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:92",className:"text-lg font-bold",children:e>86400?`${(e/86400).toFixed(1)}d`:`${(e/3600).toFixed(1)}h`}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:210",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Uptime"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:92",val:r,label:`${r.toFixed(1)}%`,color:r>80?"bg-orange-500":"bg-purple-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:183",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:92",val:Number(s.nonHeapUsed?.[0]?.value||0),label:`${Number(s.nonHeapUsed?.[0]?.value||0).toFixed(1)}%`,color:"bg-blue-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:228",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Non-Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:92",className:"text-lg font-bold text-emerald-400",children:s.threadCount?.[0]?.value||0}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:180",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Threads"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:92",className:"text-lg font-bold text-amber-400",children:Number(s.gcPause?.[0]?.value||0).toFixed(3)}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:193",className:"text-[10px] text-[var(--dg-text-muted)]",children:"GC Pause (s)"})]})})]})},Ps=({dsUrl:s})=>{const[r,e]=o.useState(!1),[c,i]=o.useState(!1),[x,b]=o.useState(0),[g,N]=o.useState(""),[w,m]=o.useState("kubernetes"),[P,y]=o.useState({}),[z,v]=o.useState({}),[h,A]=o.useState({}),[W,Z]=o.useState({});o.useEffect(()=>{s&&F(s)},[s]);const F=async p=>{i(!0),N("");try{const f=await Sa.connect(p);e(!0),b(f.targets||0),T(p)}catch(f){e(!1),N(f.message||"连接失败")}finally{i(!1)}},T=async p=>{for(const f of["kubernetes","node","pod","jvm"])try{const n=await Sa.dashboard(p,f),l={};for(const[S,j]of Object.entries(n||{}))l[S]=Array.isArray(j)?j:j?.data?.result?Ds(j.data.result):j;f==="kubernetes"&&y(l),f==="node"&&v(l),f==="pod"&&A(l),f==="jvm"&&Z(l)}catch{}},$=()=>{s&&F(s)};return!r&&!g?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:167:5",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:168:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:169:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:170:11",className:"h-4 w-4 text-purple-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:171:11",className:"text-sm font-medium",children:"Prometheus 监控"}),r&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:172:25",className:"text-[10px] bg-purple-500/10 text-purple-400",children:[x," targets"]}),r&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:25",className:"ml-auto",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:50",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:$,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:135",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:176:7",className:"px-4 pb-3 pt-0",children:c?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-purple-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:129",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):g?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:112",className:"h-4 w-4 inline mr-1"}),g]}):a.jsxs(Ua,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:180:11",value:w,onValueChange:m,children:[a.jsxs(Ha,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:181:13",className:"bg-[var(--dg-bg-tertiary)] mb-3",children:[a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:15",value:"kubernetes",className:"text-xs",children:[a.jsx(es,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:67",className:"w-3 h-3 mr-1"}),"Kubernetes"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:15",value:"node",className:"text-xs",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:61",className:"w-3 h-3 mr-1"}),"Node"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:15",value:"pod",className:"text-xs",children:[a.jsx(Ns,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:60",className:"w-3 h-3 mr-1"}),"Pod"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:15",value:"jvm",className:"text-xs",children:[a.jsx(ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:60",className:"w-3 h-3 mr-1"}),"JVM"]})]}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:13",value:"kubernetes",children:a.jsx(vs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:45",d:P})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:13",value:"node",children:a.jsx(ys,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:39",d:z})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:13",value:"pod",children:a.jsx(Gs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:38",d:h})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:13",value:"jvm",children:a.jsx(ws,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:38",d:W})})]})})]})};function As(s){return s?Array.isArray(s)?s:Array.isArray(s.list)?s.list:Array.isArray(s.items)?s.items:Array.isArray(s.data)?s.data:[]:[]}function Ss(){return typeof window<"u"&&window.location?{origin:window.location.origin,backend:`${window.location.protocol}//${window.location.hostname}:8080`}:{origin:"http://127.0.0.1",backend:"http://127.0.0.1:8080"}}function Cs({open:s,onOpenChange:r,server:e,onInstalled:c,onFailed:i}){const x=za(d=>d.token)||"",{origin:b,backend:g}=Ss(),[N,w]=o.useState(!1),[m,P]=o.useState(!1),[y,z]=o.useState(!1),[v,h]=o.useState("auto"),[A,W]=o.useState("root"),[Z,F]=o.useState(""),[T,$]=o.useState(""),[p,f]=o.useState("password"),n=e&&!e.has_auth,l=`curl -fsSL ${b}/agent/install.sh | bash -s -- --server ${g} --token ${x}`,S=()=>{const d=document.createElement("textarea");d.value=l,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.width="2em",d.style.height="2em",d.style.padding="0",d.style.border="none",d.style.outline="none",d.style.boxShadow="none",d.style.background="transparent",d.style.opacity="0",d.style.pointerEvents="none",d.style.zIndex="-1",d.style.fontSize="16px",d.contentEditable="true",d.readOnly=!0,document.body.appendChild(d),d.focus(),d.select(),d.setSelectionRange&&d.setSelectionRange(0,999999);let _=!1;try{_=document.execCommand("copy")}catch{}document.body.removeChild(d),_?(w(!0),u.success("安装命令已复制到剪贴板,粘贴到目标主机执行"),setTimeout(()=>w(!1),3e3)):(u.error("自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)"),P(!0))},j=`${b}/agent/aiops-agent-linux-amd64`,ha=[{icon:ns,title:"1. 下载二进制",commands:[`curl -fsSL ${j} -o /usr/local/bin/aiops-agent`]},{icon:ds,title:"2. 赋予执行权限",commands:["chmod +x /usr/local/bin/aiops-agent"]},{icon:Ta,title:"3. 创建 systemd 服务",commands:["cat > /etc/systemd/system/aiops-agent.service << 'EOF'","[Unit]","Description=AIOps Agent","After=network.target","","[Service]","Type=simple",`ExecStart=/usr/local/bin/aiops-agent --server ${g} --token ${x}`,"Restart=always","RestartSec=5","","[Install]","WantedBy=multi-user.target","EOF"]},{icon:cs,title:"4. 启动并设置开机自启",commands:["systemctl daemon-reload","systemctl enable --now aiops-agent","systemctl status aiops-agent"]}],I=async()=>{if(!(!e||!x)){if(n&&!Z&&!T){u.error("请填写 SSH 登录凭据(密码或密钥)");return}z(!0);try{const d=n?{username:A,password:Z,ssh_key:T,auth_type:p}:void 0;(await Wa.installAgent(e.id,x,d))?.installed||!1?(u.success(`${e.hostname} Agent 安装成功`),c?.(e.id),r(!1)):(u.warning(`${e.hostname}: Agent 安装命令已执行,但服务未检测到运行`),c?.(e.id),r(!1))}catch(d){const _=d?.message||"安装失败";u.error(`${e.hostname} ${_}`),i?.(e.id,_)}finally{z(!1)}}};return a.jsx(oa,{"code-path":"src/components/agent/AgentWizard.tsx:190:5",open:s,onOpenChange:r,children:a.jsxs(ra,{"code-path":"src/components/agent/AgentWizard.tsx:191:7",className:"max-w-2xl bg-slate-900 border-slate-800 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/agent/AgentWizard.tsx:192:9",children:[a.jsx(da,{"code-path":"src/components/agent/AgentWizard.tsx:193:11",className:"text-slate-100",children:e?`部署 Agent → ${e.hostname}`:"部署 Agent"}),a.jsx(ka,{"code-path":"src/components/agent/AgentWizard.tsx:196:11",className:"text-slate-400",children:e?`目标主机 ${e.hostname} (${e.ip}),选择安装方式:`:"在目标主机上执行以下命令即可完成 Agent 安装与注册"})]}),a.jsxs(Ua,{"code-path":"src/components/agent/AgentWizard.tsx:204:9",value:v,onValueChange:h,className:"w-full",children:[a.jsxs(Ha,{"code-path":"src/components/agent/AgentWizard.tsx:205:11",className:"bg-slate-800 border border-slate-700",children:[a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:206:13",value:"auto",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:207:15",className:"h-4 w-4 mr-1.5"}),"安装Agent"]}),e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:211:15",value:"ssh",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:212:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),!e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:217:15",value:"ssh",className:"data-[state=active]:bg-slate-700 opacity-50 cursor-not-allowed",disabled:!0,children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:218:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),a.jsx(R,{"code-path":"src/components/agent/AgentWizard.tsx:222:13",value:"manual",className:"data-[state=active]:bg-slate-700",children:"手动安装"})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:228:11",value:"auto",className:"mt-4 space-y-3",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:229:13",className:"text-sm text-slate-400",children:"在目标主机执行以下命令,Agent 将自动下载、安装并启动:"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:232:13",className:"relative rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsx("pre",{"code-path":"src/components/agent/AgentWizard.tsx:233:15",className:"text-xs text-emerald-400 font-mono whitespace-pre-wrap break-all pr-10",children:l}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:236:15",size:"icon",variant:"ghost",onClick:S,className:"absolute top-2 right-2 h-8 w-8 text-slate-400 hover:text-slate-100 hover:bg-slate-800",title:"复制到剪贴板",children:N?a.jsx(ts,{"code-path":"src/components/agent/AgentWizard.tsx:243:27",className:"h-4 w-4 text-emerald-400"}):a.jsx(os,{"code-path":"src/components/agent/AgentWizard.tsx:243:76",className:"h-4 w-4"})})]}),m&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:249:15",className:"rounded-lg bg-amber-950/30 border border-amber-800/50 p-4",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:250:17",className:"text-xs text-amber-400 mb-2",children:"⚠️ 自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:253:17",readOnly:!0,value:l,className:"w-full h-24 bg-slate-950 border border-amber-800/30 text-emerald-400 font-mono text-xs p-3 rounded resize-none focus:outline-none focus:border-amber-600",onClick:d=>d.target.select()})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:261:13",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:262:15",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:263:15",children:["服务器地址已自动检测 — 安装脚本通过 Nginx 代理 (",b,"),Agent 直连后端 (",g,")。安装成功后将自动连接并开始上报指标。"]})]})]}),!e&&a.jsx(K,{"code-path":"src/components/agent/AgentWizard.tsx:271:13",value:"ssh",className:"mt-4 space-y-4",children:a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:272:15",className:"text-center py-12 text-slate-400",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:273:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:274:17",className:"text-sm font-medium mb-1",children:"未选择目标主机"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:275:17",className:"text-xs",children:"请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面"})]})}),e&&a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:281:13",value:"ssh",className:"mt-4 space-y-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:282:15",className:"rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:283:17",className:"flex items-center gap-3 mb-3",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:284:19",className:"h-5 w-5 text-blue-400"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:285:19",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:286:21",className:"text-sm font-medium text-slate-200",children:e.hostname}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:287:21",className:"text-xs text-slate-400",children:e.ip})]})]}),n&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:293:19",className:"mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:294:21",className:"flex items-center gap-2 text-xs text-amber-300/80",children:[a.jsx(rs,{"code-path":"src/components/agent/AgentWizard.tsx:295:23",className:"h-3.5 w-3.5"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:296:23",children:"该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:298:21",className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:299:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:300:25",className:"text-xs text-slate-400",children:"用户名"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:301:25",value:A,onChange:d=>W(d.target.value),placeholder:"root",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:308:23",className:"flex items-end gap-1",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:309:25",className:"flex-1",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:310:27",className:"text-xs text-slate-400",children:"密码"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:311:27",type:"password",value:Z,onChange:d=>{F(d.target.value),f("password")},placeholder:"******",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:319:25",className:"text-xs text-slate-500 px-1 pb-1",children:"或"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:320:25",variant:"ghost",size:"sm",onClick:()=>{f("key"),F("")},className:`text-xs h-7 px-2 ${p==="key"?"text-blue-400":"text-slate-500"}`,children:"密钥"})]})]}),p==="key"&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:328:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:329:25",className:"text-xs text-slate-400",children:"SSH 私钥(PEM 格式)"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:330:25",value:T,onChange:d=>$(d.target.value),placeholder:`-----BEGIN OPENSSH PRIVATE KEY----- ... -----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((m-1)*y,m*y),Ka=({f:t})=>b!==t?a.jsx($a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:54",className:"w-3 h-3 text-slate-500"}):N==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:122",className:"w-3 h-3 text-emerald-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:173",className:"w-3 h-3 text-emerald-400"}),ma=(t,C)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:59",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:145",className:`h-full rounded-full transition-all duration-500 ${t>=80?"bg-orange-500":"bg-emerald-500"}`,style:{width:`${Math.min(t,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:310",className:`w-14 text-right text-xs font-mono tabular-nums ${t>=80?"text-orange-400":""}`,children:C})]}),Va=v.size===e.length&&e.length>0,ia=v.size>0,ea=[...v].map(Number).filter(t=>!isNaN(t)),Y=o.useMemo(()=>e.filter(t=>v.has(String(t.server_id))),[e,v]),M=o.useMemo(()=>Y.filter(t=>t.agent_status!=="online"),[Y]),E=o.useMemo(()=>Y.filter(t=>t.agent_status==="online"),[Y]),qa=()=>{l(!1),M.length>0&&E.length===0?f("install"):M.length===0&&E.length>0?f("upgrade"):f("install"),$(!0)},Ja=async()=>{if(!n){u.error("请先确认并勾选「我已知悉」");return}j(!0);const t=za.getState().token,C=Y.map(G=>G.server_id);I(new Set(C));try{if(p==="install"){if(!t){u.error("未登录");return}const G=M.map(la=>la.server_id);if(G.length===0){u.warning("所选主机均已安装 Agent,无需安装");return}const k=await Wa.batchInstallAgent(G,t);u.success(`已提交:批量安装 ${k?.total??G.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}else{const G=E.map(la=>la.server_id);if(G.length===0){u.warning("所选主机中没有在线 Agent,无法升级");return}const k=await fa.batchUpgrade(G);u.success(k?.message||`已提交:批量升级 ${G.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}$(!1)}catch{u.error("提交失败"),I(new Set)}finally{j(!1)}};return i?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:144",className:"text-xs",children:"加载中…"})]}):e.length?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:166:5",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:168:7",className:"flex items-center gap-2 mb-3 flex-wrap",children:[ia&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:169:20",className:"text-xs text-[var(--dg-text-secondary)]",children:["已选 ",v.size," 项"]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:170:9",className:"flex-1"}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:171:9",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{const t=ia?e.find(C=>v.has(String(C.server_id))):null;F(t?{id:t.server_id,hostname:t.hostname,ip:t.ip,has_auth:t.has_auth}:null),W(!0)},children:[a.jsx(is,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:176:11",className:"w-3 h-3"}),"安装 Agent"]}),ia&&a.jsxs(a.Fragment,{children:[a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:180:13",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-blue-500/30 text-blue-400 hover:bg-blue-500/10",onClick:qa,children:[a.jsx(Pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:181:15",className:"w-3 h-3"}),"批量部署 (",v.size,")"]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:183:13",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:sa,disabled:d,children:[a.jsx(ls,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:184:15",className:"w-3 h-3"}),"批量卸载 (",v.size,")"]})]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:188:9",size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:q,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:188:89",className:"w-3 h-3"}),"刷新"]})]}),a.jsx(Cs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:191:7",open:A,onOpenChange:W,server:Z,onInstalled:()=>{u.success("Agent 安装成功"),W(!1),q()},onFailed:()=>u.error("安装失败")}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:196:7",open:T,onOpenChange:t=>{t||($(!1),l(!1))},children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:197:9",className:"max-w-2xl max-h-[85vh] overflow-auto bg-slate-900 border-slate-700 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:198:11",children:[a.jsxs(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:199:13",className:"flex items-center gap-2 text-base",children:[a.jsx(Pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:200:15",className:"w-5 h-5 text-blue-400"}),"批量部署 Agent"]}),a.jsxs(ka,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:203:13",className:"text-slate-400 text-xs",children:["选中 ",Y.length," 台主机(需安装: ",M.length,",待升级: ",E.length,")"]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:208:11",className:"space-y-4",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:210:13",className:"flex items-center gap-2 p-1 rounded-lg bg-slate-800 border border-slate-700 w-fit",children:["install","upgrade"].map(t=>a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:212:17",disabled:t==="install"?M.length===0:E.length===0,onClick:()=>f(t),className:`px-4 py-1.5 rounded text-xs font-medium transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${p===t?"bg-blue-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:t==="install"?`⚡ 安装 (${M.length})`:`🔄 升级到最新版 (${E.length})`},t))}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:226:13",className:"rounded-md border border-slate-700 overflow-hidden",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:227:15",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:228:17",className:"bg-slate-800",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:229:19",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:230:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"主机名"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:231:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"IP"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:232:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:233:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"当前版本"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:234:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"操作"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:237:17",children:(p==="install"?M:E).map(t=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:239:21",className:"border-t border-slate-800 hover:bg-slate-800/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:240:23",className:"px-3 py-2 font-medium text-slate-200",children:t.hostname}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:241:23",className:"px-3 py-2 font-mono text-slate-400",children:t.ip}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:242:23",className:"px-3 py-2",children:t.agent_status==="online"?a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:244:29",className:"text-[10px] bg-emerald-500/20 text-emerald-400",children:"在线"}):a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:245:29",className:"text-[10px] bg-slate-500/20 text-slate-400",children:t.agent_status==="not_installed"?"未安装":t.agent_status||"离线"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:249:23",className:"px-3 py-2 font-mono text-slate-400",children:t.agent_version||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:250:23",className:"px-3 py-2",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:251:25",className:"text-blue-400 text-[11px]",children:p==="install"?"即将安装":"即将升级"})})]},t.server_id))})]})}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:262:13",className:"rounded-md border border-amber-500/30 bg-amber-500/5 p-3 space-y-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:263:15",className:"flex items-start gap-2",children:[a.jsx(xs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:264:17",className:"w-4 h-4 text-amber-400 mt-0.5 shrink-0"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:265:17",children:[a.jsxs("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:266:19",className:"text-xs font-medium text-amber-300 mb-1",children:[p==="install"?"本次安装":"本次升级",",主机监控探针将部署 AIOps Agent。AIOps Agent 是 AIOps 平台推出的新一代数据采集器,提供主机监控指标采集和可观测数据采集能力。"]}),a.jsxs("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:269:19",className:"text-[11px] text-amber-400/80 leading-relaxed",children:[p==="upgrade"&&"升级前请注意以下事项:",p==="install"&&"安装前请注意以下事项:"]}),a.jsxs("ul",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:273:19",className:"mt-1 space-y-0.5 text-[11px] text-slate-400 list-disc list-inside",children:[p==="upgrade"&&a.jsxs(a.Fragment,{children:[a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:276:25",children:"如果您的机器已经安装旧版 Agent,升级操作将停止旧版并替换为最新版本。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:277:25",children:"如果您的机器之前安装过 Agent 但已卸载,遗留有相关采集配置,本次升级可能导致配置重新生效。升级前请确保存量废弃配置已经移除。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:278:25",children:"如果您的机器采用自定义安装的 Agent(非 AIOps 提供的一键安装脚本),请不要直接使用批量升级。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:279:25",children:"批量升级前,请务必先单机灰度升级,确保升级成功且不影响业务后再操作。"})]}),p==="install"&&a.jsxs(a.Fragment,{children:[a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:284:25",children:"安装将自动检测目标主机架构(amd64/arm64),下载对应版本的 Agent 二进制并启动服务。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:285:25",children:"请确保目标主机的 SSH 端口(默认 22)可访问,且已关联有效的 SSH 凭据。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:286:25",children:"安装过程约 30-60 秒,期间目标主机 CPU 负载会短暂升高。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:287:25",children:"若安装失败,请检查目标主机的防火墙规则和 SSH 服务状态后重试。"})]}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:290:21",children:"操作不可回滚,请在操作前确认已备份关键配置。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:291:21",children:"操作将在后台异步执行,您可以在「任务执行记录」中查看详细进度。"})]})]})]})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:298:13",className:"flex items-center gap-2",children:[a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:299:15",id:"batch-ack",checked:n,onCheckedChange:t=>l(!!t)}),a.jsx("label",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:300:15",htmlFor:"batch-ack",className:"text-xs text-slate-300 cursor-pointer select-none",children:"我已知悉以上风险和注意事项"})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:304:11",className:"gap-2",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:305:13",variant:"outline",className:"border-slate-700 text-slate-300 h-8 text-xs",onClick:()=>{$(!1),l(!1)},children:"取消"}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:308:13",className:"bg-blue-600 hover:bg-blue-700 text-white h-8 text-xs gap-1",disabled:S||!n||(p==="install"?M.length===0:E.length===0),onClick:Ja,children:[S&&a.jsx(aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:313:35",className:"w-3 h-3 animate-spin"}),p==="install"?"确认安装":"确认升级"]})]})]})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:320:7",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:[a.jsxs("table",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:321:9",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:322:11",className:"bg-[var(--dg-bg-tertiary)] border-b",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:322:66",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:323:13",className:"px-2 py-2 w-8",children:a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:324:15",checked:Va,onCheckedChange:t=>h(t?new Set(e.map(C=>String(C.server_id))):new Set)})}),["hostname","agent_version","agent_status","cpu_usage","mem_usage","disk_usage","region","ip"].map(t=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:327:15",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>La(t),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:328:17",className:"flex items-center gap-1",children:[{hostname:"主机名",agent_version:"Agent版本",agent_status:"状态",cpu_usage:"CPU",mem_usage:"内存",disk_usage:"磁盘",region:"区域",ip:"IP"}[t],a.jsx(Ka,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:328:188",f:t})]})},t)),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:331:13",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] whitespace-nowrap",children:"操作"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:332:11",children:Ra.map((t,C)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:334:15",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:335:17",className:"px-2 py-2.5",children:a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:336:19",checked:v.has(String(t.server_id)),onCheckedChange:G=>{const k=new Set(v);G?k.add(String(t.server_id)):k.delete(String(t.server_id)),h(k)}})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:342:17",className:"px-3 py-2.5 font-medium text-[var(--dg-text-primary)]",children:t.hostname}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:343:17",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:ha.has(t.server_id)?a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:345:21",className:"inline-flex items-center gap-1 text-blue-400",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:346:23",className:"w-3 h-3 animate-spin"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:347:23",className:"text-[10px]",children:"部署中"})]}):t.agent_version||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:17",className:"px-3 py-2.5",children:t.agent_status==="online"?a.jsxs(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:72",className:"text-[10px] bg-emerald-500/20 text-emerald-400",children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:138",className:"w-3 h-3 mr-1"}),"在线"]}):t.agent_status==="not_installed"?a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:214",className:"text-[10px] bg-amber-500/20 text-amber-400",children:"未安装"}):a.jsxs(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:288",className:"text-[10px] bg-slate-500/10 text-slate-400",children:[a.jsx(ps,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:350",className:"w-3 h-3 mr-1"}),"离线"]})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:354:17",className:"px-3 py-2.5",children:ma(Number(t.cpu_usage||0),`${Number(t.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:355:17",className:"px-3 py-2.5",children:ma(Number(t.mem_usage||0),`${Number(t.mem_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:356:17",className:"px-3 py-2.5",children:ma(Number(t.disk_usage||0),`${Number(t.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:357:17",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:t.region||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:358:17",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:t.ip||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:359:17",className:"px-3 py-2.5",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:360:19",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10 px-2",onClick:()=>r(`/host-monitor?host=${encodeURIComponent(t.hostname)}`),children:[a.jsx(Ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:362:21",className:"w-3.5 h-3.5 mr-1"}),"图表"]})})]},t.hostname+C))})]}),e.length>y&&a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:370:11",className:"flex items-center justify-between px-3 py-2 bg-[var(--dg-bg-tertiary)] border-t border-[var(--dg-border)] text-xs",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:371:13",className:"flex items-center gap-2 text-[var(--dg-text-muted)]",children:[a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:372:15",children:["共 ",e.length," 条"]}),a.jsxs("select",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:373:15",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded px-2 py-0.5 text-xs",value:y,onChange:t=>{z(Number(t.target.value)),P(1)},children:[a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:374:17",value:10,children:"10/页"}),a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:375:17",value:20,children:"20/页"}),a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:376:17",value:30,children:"30/页"})]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:379:13",className:"flex items-center gap-1",children:[a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:380:15",className:"px-2 py-0.5 rounded hover:bg-[var(--dg-bg-primary)] disabled:opacity-30",disabled:m<=1,onClick:()=>P(t=>t-1),children:"上一页"}),a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:381:15",className:"px-2 text-[var(--dg-text-primary)]",children:[m," / ",wa]}),a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:382:15",className:"px-2 py-0.5 rounded hover:bg-[var(--dg-bg-primary)] disabled:opacity-30",disabled:m>=wa,onClick:()=>P(t=>t+1),children:"下一页"})]})]})]})]}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:29",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:92",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:135",className:"text-sm",children:"暂无服务器资产"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:169",className:"text-xs mt-1",children:"请先在「服务器管理」中添加主机,然后在此安装 Agent"})]})},Ws=()=>{const[s,r]=o.useState(null),[e,c]=o.useState(!0);return o.useEffect(()=>{Xa.list().then(i=>{const x=i?.data||i||[];r(x.find(b=>b.is_default)||x[0]||null)}).catch(()=>{}).finally(()=>c(!1))},[]),e?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:144",className:"text-xs",children:"加载数据源…"})]}):s?a.jsx(fs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:403:10",dsUrl:s.url,dsUsername:s.username,dsPassword:s.password}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:19",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:82",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:127",className:"text-sm",children:"未配置 Zabbix 数据源"}),a.jsxs("a",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:168",href:"/datasources",className:"text-xs text-blue-400 hover:underline inline-flex items-center gap-1",children:["前往配置 ",a.jsx(Ma,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:277",className:"w-3 h-3"})]})]})},_s=()=>{const[s,r]=o.useState(null),[e,c]=o.useState(!0);return o.useEffect(()=>{as.list().then(i=>{const x=i?.data||i||[];r(x.find(b=>b.is_default)||x[0]||null)}).catch(()=>{}).finally(()=>c(!1))},[]),e?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:144",className:"text-xs",children:"加载数据源…"})]}):s?a.jsx(Ps,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:417:10",dsUrl:s.url}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:19",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:82",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:127",className:"text-sm",children:"未配置 Prometheus 数据源"}),a.jsxs("a",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:172",href:"/datasources",className:"text-xs text-blue-400 hover:underline inline-flex items-center gap-1",children:["前往配置 ",a.jsx(Ma,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:281",className:"w-3 h-3"})]})]})},$s=()=>{const[s,r]=o.useState([]),[e,c]=o.useState(null),[i,x]=o.useState(!1),[b,g]=o.useState(!1),[N,w]=o.useState({name:"",description:"",datasource:"prometheus",datasourceUrl:""}),[m,P]=o.useState({title:"",type:"graph",query:"",width:6,height:4}),y=async()=>{try{const A=(await ga.getDashboards()).data||[];r(A),A.length>0&&!e&&c(A[0])}catch{}};o.useEffect(()=>{y()},[]);const z=async()=>{if(!N.name){u.error("请输入名称");return}try{await ga.createDashboard({...N,panels:[]}),u.success("创建成功"),x(!1),w({name:"",description:"",datasource:"prometheus",datasourceUrl:""}),y()}catch{u.error("创建失败")}},v=async()=>{if(!(!m.title||!m.query||!e))try{const h={id:Date.now().toString(),...m,datasource:e.datasource,x:0,y:0,options:{legend:!0,tooltip:!0,refreshInterval:30}};await ga.updateDashboard(e.id,{...e,panels:[...e.panels,h]}),u.success("面板添加成功"),g(!1),P({title:"",type:"graph",query:"",width:6,height:4}),y()}catch{u.error("添加失败")}};return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:451:5",className:"space-y-4",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:452:7",className:"flex items-center gap-2",children:[a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:453:9",value:e?.id,onValueChange:h=>{const A=s.find(W=>W.id===h);A&&c(A)},children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:454:11",className:"w-[240px] h-8 text-xs",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:454:60",placeholder:"选择仪表盘"})}),a.jsx(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:455:11",children:s.map(h=>a.jsxs(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:455:47",value:h.id,children:[h.name,h.isDefault?" (默认)":""]},h.id))})]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:457:9",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:y,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:457:89",className:"w-3 h-3 mr-1"}),"刷新"]}),e&&a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:458:20",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:()=>g(!0),children:[a.jsx(Aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:458:117",className:"w-3 h-3 mr-1"}),"添加面板"]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:459:9",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:()=>x(!0),children:[a.jsx(Aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:459:109",className:"w-3 h-3 mr-1"}),"新建"]})]}),e?e.panels.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:11",className:"text-center py-16 text-[var(--dg-text-muted)]",children:[a.jsx(Ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:74",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:133",className:"text-xs",children:"暂无面板"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:466:11",className:"grid grid-cols-12 gap-3",children:e.panels.map(h=>a.jsxs(U,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:468:15",style:{gridColumn:`span ${h.width}`,minHeight:`${h.height*80}px`},children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:469:17",className:"py-2 px-3",children:a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:469:51",className:"text-[11px] font-medium",children:h.title})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:470:17",className:"p-3 pt-0",children:a.jsx(gs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:470:51",panel:h})})]},h.id))}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:9",className:"text-center py-16 text-[var(--dg-text-muted)]",children:[a.jsx(Ia,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:72",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:129",className:"text-xs",children:"暂无仪表盘"})]}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:7",open:i,onOpenChange:x,children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:62",children:[a.jsx(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:77",children:a.jsx(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:91",children:"新建仪表盘"})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:9",className:"space-y-3",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:36",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:41",children:"名称"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:58",value:N.name,onChange:h=>w({...N,name:h.target.value})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:16",children:"数据源"}),a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:34",value:N.datasource,onValueChange:h=>w({...N,datasource:h}),children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:124",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:139"})}),a.jsxs(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:170",children:[a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:185",value:"prometheus",children:"Prometheus"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:239",value:"zabbix",children:"Zabbix"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:285",value:"skywalking",children:"SkyWalking"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:339",value:"custom",children:"自定义"})]})]})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:9",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:23",variant:"outline",onClick:()=>x(!1),children:"取消"}),a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:97",onClick:z,children:"创建"})]})]})}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:7",open:b,onOpenChange:g,children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:56",children:[a.jsx(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:71",children:a.jsx(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:85",children:"添加面板"})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:9",className:"space-y-3",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:36",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:41",children:"标题"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:58",value:m.title,onChange:h=>P({...m,title:h.target.value})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:16",children:"类型"}),a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:33",value:m.type,onValueChange:h=>P({...m,type:h}),children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:111",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:126"})}),a.jsxs(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:157",children:[a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:172",value:"graph",children:"折线图"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:214",value:"stat",children:"数值"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:254",value:"gauge",children:"仪表盘"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:296",value:"table",children:"表格"})]})]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:16",children:"查询"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:33",value:m.query,onChange:h=>P({...m,query:h.target.value})})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:9",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:23",variant:"outline",onClick:()=>g(!1),children:"取消"}),a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:94",onClick:v,children:"添加"})]})]})})]})},Xs=()=>{const[s,r]=o.useState("agent"),[e,c]=o.useState(!1);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:499:5",className:`space-y-4 ${e?"fixed inset-0 z-50 bg-background p-4 overflow-auto":""}`,children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:502:7",className:"flex items-center gap-1 p-1 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[zs.map(i=>a.jsxs("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:504:11",onClick:()=>r(i.id),className:`flex items-center gap-1.5 px-4 py-2 rounded-md text-xs font-medium transition-colors ${s===i.id?"bg-[var(--dg-bg-primary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,children:[i.icon,i.label]},i.id)),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:517:9",className:"ml-auto",children:a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:518:11",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>c(!e),children:e?a.jsx(hs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:519:27",className:"w-3.5 h-3.5"}):a.jsx(ms,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:519:67",className:"w-3.5 h-3.5"})})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:525:7",className:"min-h-[50vh]",children:[s==="agent"&&a.jsx(ks,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:526:29"}),s==="zabbix"&&a.jsx(Ws,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:527:30"}),s==="prometheus"&&a.jsx(_s,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:528:34"}),s==="dashboard"&&a.jsx($s,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:529:33"})]})]})};export{Xs as default}; diff --git a/backend/static/assets/HostMonitor-BVQwXwZu.js b/backend/static/assets/HostMonitor-D4f8NRVg.js similarity index 99% rename from backend/static/assets/HostMonitor-BVQwXwZu.js rename to backend/static/assets/HostMonitor-D4f8NRVg.js index b450b95..e21ada2 100644 --- a/backend/static/assets/HostMonitor-BVQwXwZu.js +++ b/backend/static/assets/HostMonitor-D4f8NRVg.js @@ -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;nM+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!=null?`${rt(i.read_bps)}`:c:n==="ioW"?i.write_bps!=null?`${rt(i.write_bps)}`:c:n==="swap"?l?.usage_percent!=null?`${l.usage_percent.toFixed(1)}%`:c:n==="fd"&&p?.usage_pct!=null?`${p.usage_pct.toFixed(1)}%`:c:c}function y({title:e,value:a,icon:i,data:l,color:p,unit:n,domain:c,aggType:d}){const m=l.map(s=>({...s,value:s[d]}));return t.jsx(C,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:26:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:27:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:28:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:11",className:"flex items-center gap-1.5",children:[i,t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:e})]})}),t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:31:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:32:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:a}),n&&t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:33:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:n})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:35:9",className:"h-48",children:m.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:37:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:39:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:40:15",data:m,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:41:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:42:19",id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:43:21",offset:"5%",stopColor:p,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:44:21",offset:"95%",stopColor:p,stopOpacity:0})]})}),t.jsx(ut,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:47:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:48:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:49:17",hide:!0,domain:c[1]==="auto"?[0,s=>s*1.1]:c}),t.jsx(vt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:50:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:s=>[`${s.toFixed(2)} ${n}`,e.replace(/\(.+\)/,"")],labelFormatter:s=>`时间: ${s}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:53:17",type:"monotone",dataKey:"value",stroke:p,strokeWidth:1.5,fill:`url(#grad-${e})`}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:54:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,m.length-Math.min(20,m.length))})]})})})]})})}function ce({title:e,currentRx:a,currentTx:i,rxData:l,txData:p,aggType:n,unit:c}){const d=l.map((x,N)=>({time:x.time,timestamp:x.timestamp,rx:x[n]??0,tx:p[N]?.[n]??0})),m=`grad-rx-${e.replace(/\s/g,"")}`,s=`grad-tx-${e.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:32:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:33:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:34:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:35:11",className:"flex items-center gap-1.5",children:[t.jsx(st,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:36:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:37:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:e})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:39:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-blue-400 mr-1 align-middle"}),"接收 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:108",className:"text-blue-300",children:a})]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-emerald-400 mr-1 align-middle"}),"发送 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:111",className:"text-emerald-300",children:i})]})]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:44:9",className:"h-56",children:d.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:46:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:48:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:49:15",data:d,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:50:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:51:19",id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:52:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:53:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:55:19",id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:56:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:57:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(ut,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:60:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:61:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:62:17",hide:!0,domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:63:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(x,N)=>[`${x.toFixed(2)} ${c}`,N==="rx"?"接收":"发送"],labelFormatter:x=>`时间: ${x}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:66:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${m})`,name:"rx"}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:67:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${s})`,name:"tx"}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:68:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,d.length-Math.min(20,d.length))})]})})})]})})}function ie({selectedHost:e}){const a=Bt(),i=Mt(),{data:l=[],refetch:p}=se(e),[n,c]=H.useState(!1),[d,m]=H.useState(null),[s,x]=H.useState(St()),N=()=>{m(null),x(St(e)),c(!0)},D=o=>{m(o),x({name:String(o.name||""),hostname:String(o.hostname||""),probe_type:String(o.probe_type||"http_get"),http_url:String(o.http_url||""),http_method:String(o.http_method||"GET"),http_expect_code:Number(o.http_expect_code)||200,http_expect_body:String(o.http_expect_body||""),tcp_host:String(o.tcp_host||""),tcp_port:Number(o.tcp_port)||3306,exec_command:String(o.exec_command||""),timeout:Number(o.timeout)||10,interval:Number(o.interval)||60,description:String(o.description||"")}),c(!0)},M=async()=>{if(!(!s.name||!s.hostname))try{d?await E.updateHealthProbe(d.id,s):await E.createHealthProbe(s),c(!1),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)})}catch{qt.error("保存失败")}},F=async o=>{await a({title:"删除探针",description:`确定删除探针「${o.name}」?`,confirmText:"删除",variant:"destructive"})&&(await E.deleteHealthProbe(o.id),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)}))};return t.jsxs(t.Fragment,{children:[t.jsxs(q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:88:7",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:89:9",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:90:11",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:91:11",className:"flex gap-2",children:[t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:92:13",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:()=>p(),children:[t.jsx(Ft,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:93:15",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:95:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:N,children:[t.jsx(Wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:96:15",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),l.length===0?t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:101:11",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:102:13",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:107:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:l.map(o=>t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:109:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${o.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:110:17",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:111:19",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:112:21",className:"flex items-center gap-2",children:[o.last_status==="up"?t.jsx(zt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:113:49",className:"w-4 h-4 text-emerald-400"}):o.last_status==="down"?t.jsx(ht,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:114:51",className:"w-4 h-4 text-red-400"}):t.jsx(ot,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:115:24",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:116:23",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:String(o.name)}),t.jsx(Q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:117:23",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:o.probe_type==="http_get"?"HTTP":o.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:121:21",className:"flex gap-1",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:122:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>D(o),children:t.jsx(Ut,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:123:25",className:"w-3 h-3"})}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:125:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:()=>F(o),children:t.jsx(Vt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:126:25",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:130:19",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[o.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:132:23",className:"truncate",children:["URL: ",String(o.http_url)]}),o.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:135:23",children:[String(o.tcp_host),":",String(o.tcp_port)]}),o.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:138:23",className:"truncate font-mono",children:String(o.exec_command)}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:140:21",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:23",children:["状态: ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:33",className:o.last_status==="up"?"text-emerald-400":o.last_status==="down"?"text-red-400":"text-slate-400",children:o.last_status?String(o.last_status).toUpperCase():"未检测"})]}),Number(o.last_latency_ms)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:144:57",children:["延迟: ",String(o.last_latency_ms),"ms"]}),Number(o.fail_count)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:145:52",className:"text-red-400",children:["连续失败: ",String(o.fail_count),"次"]}),o.last_checked_at&&t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:146:45",className:"text-[10px]",children:new Date(String(o.last_checked_at)).toLocaleString("zh-CN")})]})]})]})},String(o.id)))})]}),t.jsx(wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:156:7",open:n,onOpenChange:c,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:157:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:158:11",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:159:13",className:"text-[var(--dg-text-primary)]",children:d?"编辑探针":"添加探针"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:162:13",className:"text-[var(--dg-text-secondary)]",children:d?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:166:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:167:13",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:169:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.name,onChange:o=>x({...s,name:o.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:171:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:172:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:173:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.hostname,onChange:o=>x({...s,hostname:o.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:175:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:176:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:177:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.probe_type,onChange:o=>x({...s,probe_type:o.target.value}),children:[t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:178:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:179:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:180:17",value:"exec_command",children:"Exec Command"})]})]}),s.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:17",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:187:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_url,onChange:o=>x({...s,http_url:o.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:188:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:190:21",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_code,onChange:o=>x({...s,http_expect_code:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:192:21",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_body,onChange:o=>x({...s,http_expect_body:o.target.value})})]})]})]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:198:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:200:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_host,onChange:o=>x({...s,tcp_host:o.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:202:19",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_port,onChange:o=>x({...s,tcp_port:Number(o.target.value)})})]})]}),s.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:15",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:208:17",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs font-mono text-[var(--dg-text-primary)]",value:s.exec_command,onChange:o=>x({...s,exec_command:o.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:211:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:213:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.timeout,onChange:o=>x({...s,timeout:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:215:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.interval,onChange:o=>x({...s,interval:Number(o.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:219:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.description,onChange:o=>x({...s,description:o.target.value})})]})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:221:11",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:222:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>c(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:223:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:M,disabled:!s.name||!s.hostname,children:d?"保存":"创建"})]})]})})]})}function ne(e){const a=Number(e);return Number.isInteger(a)&&a>0&&a<=65535}function de(e){return e.split(",").map(a=>parseInt(a.trim(),10)).filter(a=>ne(a))}function le({open:e,onOpenChange:a,portPolicyMode:i,onModeChange:l,portWhitelist:p,onWhitelistChange:n,onSave:c,saving:d}){return t.jsx(wt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:30:5",open:e,onOpenChange:a,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:31:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:32:9",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:33:11",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:34:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:36:9",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:37:11",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:38:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:39:13",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:40:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="whitelist"?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:46:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="blacklist"?"bg-amber-500/20 border-amber-500 text-amber-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:53:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:i==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:60:11",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:61:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:62:20",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),i==="whitelist"&&t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:63:50",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:65:13",className:`w-full h-20 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 py-1.5 text-xs font-mono resize-none ${i==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:p.join(","),onChange:m=>{if(i==="whitelist")return;const s=m.target.value;n(de(s))},placeholder:i==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:i==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:78:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",p.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:83:11",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:84:13",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:85:35",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:89:9",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:90:11",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>a(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:91:11",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:c,disabled:d,children:d?"保存中…":"保存策略"})]})]})})}function xe({selectedHost:e,serverInfo:a,latest:i,heartbeatInfo:l,portInfoCount:p}){const n=i?.disk_info?v(i.disk_info):null,c=n?Array.isArray(n)?n:n.partitions||[]:[];return t.jsxs(q,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:22:5",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:23:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:24:9",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:25:11",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",a?.hostname||e],["IP 地址",a?.ip||"—"],["操作系统",a?.os||"—"],["内核版本",a?.kernel||"—"],["CPU 核心数",a?.cpu_cores||"—"],["总内存",a?.mem_total?`${a.mem_total.toFixed(0)} GB`:"—"],["已用内存",a?.mem_used?`${a.mem_used.toFixed(1)} GB`:"—"],["运行时长",a?.uptime?`${Math.floor(a.uptime/86400)}天 ${Math.floor(a.uptime%86400/3600)}时`:"—"],["Agent 版本",l?.version||a?.agent_version||"—"],["Agent 序列号",l?.report_seq!=null?String(l.report_seq):"—"],["监听端口数",p>0?`${p}`:"—"],["Agent RSS",l?.self_rss_mb?`${l.self_rss_mb.toFixed(1)} MB`:"—"]].map(([d,m])=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:40:15",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:41:17",className:"text-[var(--dg-text-muted)]",children:[d,":"]}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:42:17",className:"text-[var(--dg-text-primary)] font-mono",children:m})]},d))})})}),i&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:50:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:51:11",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:52:13",className:"flex items-center gap-2 mb-2",children:[t.jsx($t,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:53:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:54:15",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:56:13",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:20",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:78",className:"text-sm font-bold text-slate-200",children:i.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:20",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:78",className:"text-sm font-bold text-slate-200",children:i.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:20",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:79",className:"text-sm font-bold text-slate-200",children:i.load15??"--"})]})]})]})}),c.length>0&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:66:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:67:11",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:13",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-2 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:108",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:69:13",className:"space-y-1.5",children:c.map((d,m)=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:71:17",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:72:19",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:d.mount||d.mountpoint||d.device||`disk${m}`}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:73:19",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:74:21",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(d.usage_percent||d.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:76:19",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(d.used_gb??0).toFixed(1),"/",(d.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:77:19",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(d.usage_percent??d.used_percent??0).toFixed(1),"%"]})]},m))})]})})]})}function He(){const e=Mt(),[a]=Kt(),i=a.get("host")||"",[l,p]=H.useState(i),[n,c]=H.useState("basic"),[d,m]=H.useState(1),[s,x]=H.useState("avg"),[N,D]=H.useState("whitelist"),[M,F]=H.useState([]),[o,B]=H.useState(!1),[X,z]=H.useState(!1),{data:$=[],isLoading:J}=te(),{data:w=[],isLoading:g}=ee(l,d),{data:h,refetch:it}=oe(l);H.useEffect(()=>{h&&(D(h.port_filter_mode),F(h.port_whitelist))},[h]),H.useEffect(()=>{if($.length>0&&!l){const r=i?$.find(T=>T.hostname===i):null;p(String(r?.hostname||$[0]?.hostname||""))}},[$,l,i]);const O=async()=>{if(l){z(!0);try{await E.savePortPolicy(l,{port_filter_mode:N,port_whitelist:M}),B(!1),e.invalidateQueries({queryKey:K.hostMonitor.portPolicy(l)})}catch{}finally{z(!1)}}},_=xt.find(r=>r.hours===d)||xt[0],U=J||g,P=$.find(r=>r.hostname===l)||null,b=H.useMemo(()=>{const r=P||{};return w.length===0?r:{...r,...w[w.length-1]}},[P,w]),u=H.useMemo(()=>ae(w,_),[w,_]),f=v(b?.net_info),Y=Array.isArray(b?.port_info)?b.port_info:Array.isArray(v(b?.port_info))?v(b?.port_info):[],nt=v(b?.disk_io_info),At=v(b?.swap_info),dt=Array.isArray(v(b?.process_top_info))?v(b?.process_top_info):[],I=v(b?.fd_info),S=v(b?.cs_info),It=v(b?.heartbeat_info),A=(r,T="--")=>re(b,f,nt,At,I,r,T);return U&&!w.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:98:12",className:"flex items-center justify-center h-64",children:t.jsx(Qt,{"code-path":"src/pages/HostMonitor.tsx:98:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:102:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:103:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:104:9",className:"flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:105:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:106:11",value:l,onValueChange:p,children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:107:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:108:15",placeholder:"选择主机..."})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:110:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:$.map(r=>t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:112:17",value:r.hostname,children:r.hostname},r.hostname))})]}),P&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:117:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[String(P.os||""),P.cpu_cores?` | ${P.cpu_cores} 核`:"",P.mem_total?` | ${P.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:122:9",className:"flex items-center gap-2",children:[t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:123:11",value:s,onValueChange:r=>x(r),children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:124:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:125:15"})}),t.jsxs(Ht,{"code-path":"src/pages/HostMonitor.tsx:127:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:128:15",value:"avg",children:"平均值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:129:15",value:"max",children:"最大值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:130:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:133:11",className:"flex items-center gap-1",children:xt.map(r=>t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:135:15",variant:d===r.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>m(r.hours),children:r.label},r.hours))})]})]}),t.jsxs(Ot,{"code-path":"src/pages/HostMonitor.tsx:142:7",value:n,onValueChange:c,children:[t.jsx(Rt,{"code-path":"src/pages/HostMonitor.tsx:143:9",className:"h-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] gap-0 overflow-x-auto",children:[{id:"basic",label:"基础监控",icon:t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:145:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:146:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:147:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:148:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:149:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(Jt,{"code-path":"src/pages/HostMonitor.tsx:150:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:151:57",className:"w-3 h-3"})}].map(r=>t.jsxs(Gt,{"code-path":"src/pages/HostMonitor.tsx:153:13",value:r.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[r.icon,r.label]},r.id))}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:159:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:160:11",title:"CPU 使用率(%)",value:A("cpu"),icon:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:160:79",className:"h-4 w-4 text-blue-400"}),data:u.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:162:11",title:"CPU IO等待(%)",value:b?.cpu_iowait!=null?`${b.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:162:145",className:"h-4 w-4 text-orange-400"}),data:u.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:164:11",title:"内存使用率(%)",value:A("mem"),icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:164:77",className:"h-4 w-4 text-emerald-400"}),data:u.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:166:11",title:"可用内存(GB)",value:b?.mem_available!=null?`${b.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:166:149",className:"h-4 w-4 text-emerald-400"}),data:u.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:168:11",title:"Swap 使用率(%)",value:A("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:168:81",className:"h-4 w-4 text-red-400"}),data:u.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:170:11",title:"系统负载(1m)",value:A("load1"),icon:t.jsx($t,{"code-path":"src/pages/HostMonitor.tsx:170:79",className:"h-4 w-4 text-purple-400"}),data:u.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:s})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:174:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:175:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:176:13",title:"磁盘使用率(%)",value:A("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:176:80",className:"h-4 w-4 text-orange-400"}),data:u.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:178:13",title:"Inode 使用率(%)",value:(()=>{const r=Array.isArray(v(b?.disk_info))?v(b?.disk_info):[],T=r.find(R=>R.mount==="/")||r[0];return T?.inode_usage_pct!=null?`${T.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:182:25",className:"h-4 w-4 text-purple-400"}),data:u.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:184:13",title:"磁盘读取(KB/s)",value:A("ioR"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:184:81",className:"h-4 w-4 text-blue-400"}),data:u.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:186:13",title:"磁盘写入(KB/s)",value:A("ioW"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:186:81",className:"h-4 w-4 text-emerald-400"}),data:u.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:188:13",title:"磁盘IO繁忙度(%)",value:nt?.util!=null?`${nt.util.toFixed(1)}%`:"--",icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:188:130",className:"h-4 w-4 text-red-400"}),data:u.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:s})]})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:193:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:194:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:195:13",title:"TCP EST",value:A("tcp"),icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:195:78",className:"h-4 w-4 text-purple-400"}),data:u.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:197:13",title:"TCP TIME_WAIT",value:A("tw"),icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:197:83",className:"h-4 w-4 text-amber-400"}),data:u.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:199:13",title:"TCP CLOSE_WAIT",value:f?.tcp_close_wait!=null?String(f.tcp_close_wait):"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:199:139",className:"h-4 w-4 text-red-400"}),data:u.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:201:13",title:"TCP 总连接",value:f?String((f.tcp_established||0)+(f.tcp_time_wait||0)+(f.tcp_close_wait||0)):"--",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:201:169",className:"h-4 w-4 text-cyan-400"}),data:u.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:s})]}),t.jsx(ce,{"code-path":"src/pages/HostMonitor.tsx:204:11",title:"网卡带宽吞吐",currentRx:f?.net_rx_bps!=null?rt(f.net_rx_bps):"--",currentTx:f?.net_tx_bps!=null?rt(f.net_tx_bps):"--",rxData:u.rx,txData:u.tx,aggType:s,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:211:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:212:13",title:"网卡接收错误",value:f?.net_rx_errors!=null?String(f.net_rx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:212:129",className:"h-4 w-4 text-red-400"}),data:u.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:214:13",title:"网卡发送错误",value:f?.net_tx_errors!=null?String(f.net_tx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:214:129",className:"h-4 w-4 text-orange-400"}),data:u.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:s})]})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:219:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:220:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:221:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:222:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:223:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",Y.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:224:17",className:"ml-auto flex items-center gap-2",children:[N==="blacklist"&&M.length>0&&t.jsxs(Q,{"code-path":"src/pages/HostMonitor.tsx:226:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",M.join(",")]}),N==="whitelist"&&t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:231:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:235:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{it(),B(!0)},children:"策略配置"})]})]}),Y.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:242:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无端口数据"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:246:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:247:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:248:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:249:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:250:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:251:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:252:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:253:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:256:21",children:Y.map((r,T)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:258:25",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:259:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:r.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:260:27",className:"py-1.5",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:261:29",variant:"outline",className:"text-[10px] font-mono",children:r.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:265:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:r.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:266:27",className:"py-1.5 text-right",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:267:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},T))})]})})]})})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:281:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:282:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:283:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:284:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:285:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",dt.length]}),dt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:288:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"Agent v2.0+ 支持,等待数据上报…"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:292:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:293:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:294:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:295:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:296:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:297:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:298:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:299:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:300:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:303:21",children:dt.map((r,T)=>{const R=r.cmdline||r.name||"?",Z=r.cpu_pct!=null?Number(r.cpu_pct):null,tt=r.mem_pct!=null?Number(r.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:309:27",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:310:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:311:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:312:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:R,children:R}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:315:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async Et=>{Et.stopPropagation();try{await navigator.clipboard.writeText(R)}catch{const G=document.createElement("textarea");G.value=R,G.style.position="fixed",G.style.opacity="0",document.body.appendChild(G),G.select(),document.execCommand("copy"),document.body.removeChild(G)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:330:35",className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{"code-path":"src/pages/HostMonitor.tsx:331:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:332:37",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:337:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:338:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:339:31",className:tt!=null&&tt>50?"text-rose-400":"text-cyan-400",children:tt!=null?tt.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:343:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:344:31",className:Z!=null&&Z>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:Z!=null?Z.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:348:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.fd_count??"--"})]},T)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:360:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:361:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:362:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:363:19",className:"h-4 w-4 text-violet-400"}),"FD 文件句柄"]}),I?.allocated!=null?t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:367:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:368:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:369:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:370:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:372:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:373:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:374:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.max===-1?"无限制":I.max?.toLocaleString()||"—"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:376:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:377:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:378:25",className:`font-mono font-semibold ${I.usage_pct>80?"text-rose-400":"text-violet-400"}`,children:I.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:"—"})]})]}),u.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:384:23",className:"h-[120px]",children:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:385:25",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/HostMonitor.tsx:386:27",data:u.fd,children:[t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:387:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(bt,{"code-path":"src/pages/HostMonitor.tsx:388:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:389:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:390:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:391:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:392:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:393:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:394:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:397:29",type:"monotone",dataKey:s,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:404:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:409:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:410:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Ft,{"code-path":"src/pages/HostMonitor.tsx:412:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),S?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:415:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:416:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:417:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:418:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:419:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(S.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:420:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:422:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:424:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:425:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:426:25",className:"text-lg font-bold font-mono text-amber-400",children:[(S.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:427:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:429:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:432:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:433:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:434:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:435:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:437:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:S.ctx_per_sec+S.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:440:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(S.ctx_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:442:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(S.irq_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:450:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsx(xe,{"code-path":"src/pages/HostMonitor.tsx:457:9",selectedHost:l,serverInfo:P,latest:b,heartbeatInfo:It,portInfoCount:Y.length}),t.jsx(ie,{"code-path":"src/pages/HostMonitor.tsx:465:9",selectedHost:l})]}),t.jsx(le,{"code-path":"src/pages/HostMonitor.tsx:468:7",open:o,onOpenChange:B,portPolicyMode:N,onModeChange:D,portWhitelist:M,onWhitelistChange:F,onSave:O,saving:X})]})}export{He as HostMonitor}; +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;nM+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!=null?`${rt(i.read_bps)}`:c:n==="ioW"?i.write_bps!=null?`${rt(i.write_bps)}`:c:n==="swap"?l?.usage_percent!=null?`${l.usage_percent.toFixed(1)}%`:c:n==="fd"&&p?.usage_pct!=null?`${p.usage_pct.toFixed(1)}%`:c:c}function y({title:e,value:a,icon:i,data:l,color:p,unit:n,domain:c,aggType:d}){const m=l.map(s=>({...s,value:s[d]}));return t.jsx(C,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:26:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:27:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:28:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:11",className:"flex items-center gap-1.5",children:[i,t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:e})]})}),t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:31:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:32:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:a}),n&&t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:33:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:n})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:35:9",className:"h-48",children:m.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:37:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:39:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:40:15",data:m,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:41:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:42:19",id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:43:21",offset:"5%",stopColor:p,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:44:21",offset:"95%",stopColor:p,stopOpacity:0})]})}),t.jsx(ut,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:47:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:48:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:49:17",hide:!0,domain:c[1]==="auto"?[0,s=>s*1.1]:c}),t.jsx(vt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:50:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:s=>[`${s.toFixed(2)} ${n}`,e.replace(/\(.+\)/,"")],labelFormatter:s=>`时间: ${s}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:53:17",type:"monotone",dataKey:"value",stroke:p,strokeWidth:1.5,fill:`url(#grad-${e})`}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:54:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,m.length-Math.min(20,m.length))})]})})})]})})}function ce({title:e,currentRx:a,currentTx:i,rxData:l,txData:p,aggType:n,unit:c}){const d=l.map((x,N)=>({time:x.time,timestamp:x.timestamp,rx:x[n]??0,tx:p[N]?.[n]??0})),m=`grad-rx-${e.replace(/\s/g,"")}`,s=`grad-tx-${e.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:32:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:33:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:34:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:35:11",className:"flex items-center gap-1.5",children:[t.jsx(st,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:36:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:37:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:e})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:39:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-blue-400 mr-1 align-middle"}),"接收 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:108",className:"text-blue-300",children:a})]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-emerald-400 mr-1 align-middle"}),"发送 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:111",className:"text-emerald-300",children:i})]})]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:44:9",className:"h-56",children:d.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:46:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:48:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:49:15",data:d,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:50:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:51:19",id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:52:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:53:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:55:19",id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:56:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:57:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(ut,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:60:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:61:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:62:17",hide:!0,domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:63:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(x,N)=>[`${x.toFixed(2)} ${c}`,N==="rx"?"接收":"发送"],labelFormatter:x=>`时间: ${x}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:66:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${m})`,name:"rx"}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:67:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${s})`,name:"tx"}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:68:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,d.length-Math.min(20,d.length))})]})})})]})})}function ie({selectedHost:e}){const a=Bt(),i=Mt(),{data:l=[],refetch:p}=se(e),[n,c]=H.useState(!1),[d,m]=H.useState(null),[s,x]=H.useState(St()),N=()=>{m(null),x(St(e)),c(!0)},D=o=>{m(o),x({name:String(o.name||""),hostname:String(o.hostname||""),probe_type:String(o.probe_type||"http_get"),http_url:String(o.http_url||""),http_method:String(o.http_method||"GET"),http_expect_code:Number(o.http_expect_code)||200,http_expect_body:String(o.http_expect_body||""),tcp_host:String(o.tcp_host||""),tcp_port:Number(o.tcp_port)||3306,exec_command:String(o.exec_command||""),timeout:Number(o.timeout)||10,interval:Number(o.interval)||60,description:String(o.description||"")}),c(!0)},M=async()=>{if(!(!s.name||!s.hostname))try{d?await E.updateHealthProbe(d.id,s):await E.createHealthProbe(s),c(!1),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)})}catch{qt.error("保存失败")}},F=async o=>{await a({title:"删除探针",description:`确定删除探针「${o.name}」?`,confirmText:"删除",variant:"destructive"})&&(await E.deleteHealthProbe(o.id),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)}))};return t.jsxs(t.Fragment,{children:[t.jsxs(q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:88:7",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:89:9",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:90:11",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:91:11",className:"flex gap-2",children:[t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:92:13",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:()=>p(),children:[t.jsx(Ft,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:93:15",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:95:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:N,children:[t.jsx(Wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:96:15",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),l.length===0?t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:101:11",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:102:13",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:107:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:l.map(o=>t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:109:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${o.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:110:17",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:111:19",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:112:21",className:"flex items-center gap-2",children:[o.last_status==="up"?t.jsx(zt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:113:49",className:"w-4 h-4 text-emerald-400"}):o.last_status==="down"?t.jsx(ht,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:114:51",className:"w-4 h-4 text-red-400"}):t.jsx(ot,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:115:24",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:116:23",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:String(o.name)}),t.jsx(Q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:117:23",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:o.probe_type==="http_get"?"HTTP":o.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:121:21",className:"flex gap-1",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:122:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>D(o),children:t.jsx(Ut,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:123:25",className:"w-3 h-3"})}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:125:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:()=>F(o),children:t.jsx(Vt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:126:25",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:130:19",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[o.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:132:23",className:"truncate",children:["URL: ",String(o.http_url)]}),o.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:135:23",children:[String(o.tcp_host),":",String(o.tcp_port)]}),o.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:138:23",className:"truncate font-mono",children:String(o.exec_command)}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:140:21",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:23",children:["状态: ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:33",className:o.last_status==="up"?"text-emerald-400":o.last_status==="down"?"text-red-400":"text-slate-400",children:o.last_status?String(o.last_status).toUpperCase():"未检测"})]}),Number(o.last_latency_ms)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:144:57",children:["延迟: ",String(o.last_latency_ms),"ms"]}),Number(o.fail_count)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:145:52",className:"text-red-400",children:["连续失败: ",String(o.fail_count),"次"]}),o.last_checked_at&&t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:146:45",className:"text-[10px]",children:new Date(String(o.last_checked_at)).toLocaleString("zh-CN")})]})]})]})},String(o.id)))})]}),t.jsx(wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:156:7",open:n,onOpenChange:c,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:157:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:158:11",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:159:13",className:"text-[var(--dg-text-primary)]",children:d?"编辑探针":"添加探针"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:162:13",className:"text-[var(--dg-text-secondary)]",children:d?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:166:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:167:13",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:169:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.name,onChange:o=>x({...s,name:o.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:171:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:172:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:173:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.hostname,onChange:o=>x({...s,hostname:o.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:175:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:176:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:177:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.probe_type,onChange:o=>x({...s,probe_type:o.target.value}),children:[t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:178:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:179:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:180:17",value:"exec_command",children:"Exec Command"})]})]}),s.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:17",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:187:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_url,onChange:o=>x({...s,http_url:o.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:188:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:190:21",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_code,onChange:o=>x({...s,http_expect_code:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:192:21",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_body,onChange:o=>x({...s,http_expect_body:o.target.value})})]})]})]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:198:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:200:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_host,onChange:o=>x({...s,tcp_host:o.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:202:19",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_port,onChange:o=>x({...s,tcp_port:Number(o.target.value)})})]})]}),s.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:15",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:208:17",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs font-mono text-[var(--dg-text-primary)]",value:s.exec_command,onChange:o=>x({...s,exec_command:o.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:211:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:213:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.timeout,onChange:o=>x({...s,timeout:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:215:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.interval,onChange:o=>x({...s,interval:Number(o.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:219:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.description,onChange:o=>x({...s,description:o.target.value})})]})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:221:11",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:222:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>c(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:223:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:M,disabled:!s.name||!s.hostname,children:d?"保存":"创建"})]})]})})]})}function ne(e){const a=Number(e);return Number.isInteger(a)&&a>0&&a<=65535}function de(e){return e.split(",").map(a=>parseInt(a.trim(),10)).filter(a=>ne(a))}function le({open:e,onOpenChange:a,portPolicyMode:i,onModeChange:l,portWhitelist:p,onWhitelistChange:n,onSave:c,saving:d}){return t.jsx(wt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:30:5",open:e,onOpenChange:a,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:31:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:32:9",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:33:11",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:34:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:36:9",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:37:11",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:38:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:39:13",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:40:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="whitelist"?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:46:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="blacklist"?"bg-amber-500/20 border-amber-500 text-amber-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:53:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:i==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:60:11",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:61:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:62:20",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),i==="whitelist"&&t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:63:50",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:65:13",className:`w-full h-20 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 py-1.5 text-xs font-mono resize-none ${i==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:p.join(","),onChange:m=>{if(i==="whitelist")return;const s=m.target.value;n(de(s))},placeholder:i==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:i==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:78:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",p.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:83:11",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:84:13",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:85:35",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:89:9",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:90:11",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>a(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:91:11",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:c,disabled:d,children:d?"保存中…":"保存策略"})]})]})})}function xe({selectedHost:e,serverInfo:a,latest:i,heartbeatInfo:l,portInfoCount:p}){const n=i?.disk_info?v(i.disk_info):null,c=n?Array.isArray(n)?n:n.partitions||[]:[];return t.jsxs(q,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:22:5",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:23:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:24:9",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:25:11",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",a?.hostname||e],["IP 地址",a?.ip||"—"],["操作系统",a?.os||"—"],["内核版本",a?.kernel||"—"],["CPU 核心数",a?.cpu_cores||"—"],["总内存",a?.mem_total?`${a.mem_total.toFixed(0)} GB`:"—"],["已用内存",a?.mem_used?`${a.mem_used.toFixed(1)} GB`:"—"],["运行时长",a?.uptime?`${Math.floor(a.uptime/86400)}天 ${Math.floor(a.uptime%86400/3600)}时`:"—"],["Agent 版本",l?.version||a?.agent_version||"—"],["Agent 序列号",l?.report_seq!=null?String(l.report_seq):"—"],["监听端口数",p>0?`${p}`:"—"],["Agent RSS",l?.self_rss_mb?`${l.self_rss_mb.toFixed(1)} MB`:"—"]].map(([d,m])=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:40:15",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:41:17",className:"text-[var(--dg-text-muted)]",children:[d,":"]}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:42:17",className:"text-[var(--dg-text-primary)] font-mono",children:m})]},d))})})}),i&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:50:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:51:11",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:52:13",className:"flex items-center gap-2 mb-2",children:[t.jsx($t,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:53:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:54:15",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:56:13",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:20",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:78",className:"text-sm font-bold text-slate-200",children:i.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:20",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:78",className:"text-sm font-bold text-slate-200",children:i.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:20",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:79",className:"text-sm font-bold text-slate-200",children:i.load15??"--"})]})]})]})}),c.length>0&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:66:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:67:11",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:13",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-2 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:108",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:69:13",className:"space-y-1.5",children:c.map((d,m)=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:71:17",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:72:19",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:d.mount||d.mountpoint||d.device||`disk${m}`}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:73:19",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:74:21",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(d.usage_percent||d.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:76:19",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(d.used_gb??0).toFixed(1),"/",(d.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:77:19",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(d.usage_percent??d.used_percent??0).toFixed(1),"%"]})]},m))})]})})]})}function He(){const e=Mt(),[a]=Kt(),i=a.get("host")||"",[l,p]=H.useState(i),[n,c]=H.useState("basic"),[d,m]=H.useState(1),[s,x]=H.useState("avg"),[N,D]=H.useState("whitelist"),[M,F]=H.useState([]),[o,B]=H.useState(!1),[X,z]=H.useState(!1),{data:$=[],isLoading:J}=te(),{data:w=[],isLoading:g}=ee(l,d),{data:h,refetch:it}=oe(l);H.useEffect(()=>{h&&(D(h.port_filter_mode),F(h.port_whitelist))},[h]),H.useEffect(()=>{if($.length>0&&!l){const r=i?$.find(T=>T.hostname===i):null;p(String(r?.hostname||$[0]?.hostname||""))}},[$,l,i]);const O=async()=>{if(l){z(!0);try{await E.savePortPolicy(l,{port_filter_mode:N,port_whitelist:M}),B(!1),e.invalidateQueries({queryKey:K.hostMonitor.portPolicy(l)})}catch{}finally{z(!1)}}},_=xt.find(r=>r.hours===d)||xt[0],U=J||g,P=$.find(r=>r.hostname===l)||null,b=H.useMemo(()=>{const r=P||{};return w.length===0?r:{...r,...w[w.length-1]}},[P,w]),u=H.useMemo(()=>ae(w,_),[w,_]),f=v(b?.net_info),Y=Array.isArray(b?.port_info)?b.port_info:Array.isArray(v(b?.port_info))?v(b?.port_info):[],nt=v(b?.disk_io_info),At=v(b?.swap_info),dt=Array.isArray(v(b?.process_top_info))?v(b?.process_top_info):[],I=v(b?.fd_info),S=v(b?.cs_info),It=v(b?.heartbeat_info),A=(r,T="--")=>re(b,f,nt,At,I,r,T);return U&&!w.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:98:12",className:"flex items-center justify-center h-64",children:t.jsx(Qt,{"code-path":"src/pages/HostMonitor.tsx:98:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:102:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:103:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:104:9",className:"flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:105:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:106:11",value:l,onValueChange:p,children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:107:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:108:15",placeholder:"选择主机..."})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:110:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:$.map(r=>t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:112:17",value:r.hostname,children:r.hostname},r.hostname))})]}),P&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:117:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[String(P.os||""),P.cpu_cores?` | ${P.cpu_cores} 核`:"",P.mem_total?` | ${P.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:122:9",className:"flex items-center gap-2",children:[t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:123:11",value:s,onValueChange:r=>x(r),children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:124:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:125:15"})}),t.jsxs(Ht,{"code-path":"src/pages/HostMonitor.tsx:127:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:128:15",value:"avg",children:"平均值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:129:15",value:"max",children:"最大值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:130:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:133:11",className:"flex items-center gap-1",children:xt.map(r=>t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:135:15",variant:d===r.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>m(r.hours),children:r.label},r.hours))})]})]}),t.jsxs(Ot,{"code-path":"src/pages/HostMonitor.tsx:142:7",value:n,onValueChange:c,children:[t.jsx(Rt,{"code-path":"src/pages/HostMonitor.tsx:143:9",className:"h-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] gap-0 overflow-x-auto",children:[{id:"basic",label:"基础监控",icon:t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:145:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:146:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:147:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:148:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:149:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(Jt,{"code-path":"src/pages/HostMonitor.tsx:150:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:151:57",className:"w-3 h-3"})}].map(r=>t.jsxs(Gt,{"code-path":"src/pages/HostMonitor.tsx:153:13",value:r.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[r.icon,r.label]},r.id))}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:159:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:160:11",title:"CPU 使用率(%)",value:A("cpu"),icon:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:160:79",className:"h-4 w-4 text-blue-400"}),data:u.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:162:11",title:"CPU IO等待(%)",value:b?.cpu_iowait!=null?`${b.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:162:145",className:"h-4 w-4 text-orange-400"}),data:u.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:164:11",title:"内存使用率(%)",value:A("mem"),icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:164:77",className:"h-4 w-4 text-emerald-400"}),data:u.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:166:11",title:"可用内存(GB)",value:b?.mem_available!=null?`${b.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:166:149",className:"h-4 w-4 text-emerald-400"}),data:u.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:168:11",title:"Swap 使用率(%)",value:A("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:168:81",className:"h-4 w-4 text-red-400"}),data:u.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:170:11",title:"系统负载(1m)",value:A("load1"),icon:t.jsx($t,{"code-path":"src/pages/HostMonitor.tsx:170:79",className:"h-4 w-4 text-purple-400"}),data:u.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:s})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:174:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:175:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:176:13",title:"磁盘使用率(%)",value:A("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:176:80",className:"h-4 w-4 text-orange-400"}),data:u.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:178:13",title:"Inode 使用率(%)",value:(()=>{const r=Array.isArray(v(b?.disk_info))?v(b?.disk_info):[],T=r.find(R=>R.mount==="/")||r[0];return T?.inode_usage_pct!=null?`${T.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:182:25",className:"h-4 w-4 text-purple-400"}),data:u.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:184:13",title:"磁盘读取(KB/s)",value:A("ioR"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:184:81",className:"h-4 w-4 text-blue-400"}),data:u.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:186:13",title:"磁盘写入(KB/s)",value:A("ioW"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:186:81",className:"h-4 w-4 text-emerald-400"}),data:u.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:188:13",title:"磁盘IO繁忙度(%)",value:nt?.util!=null?`${nt.util.toFixed(1)}%`:"--",icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:188:130",className:"h-4 w-4 text-red-400"}),data:u.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:s})]})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:193:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:194:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:195:13",title:"TCP EST",value:A("tcp"),icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:195:78",className:"h-4 w-4 text-purple-400"}),data:u.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:197:13",title:"TCP TIME_WAIT",value:A("tw"),icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:197:83",className:"h-4 w-4 text-amber-400"}),data:u.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:199:13",title:"TCP CLOSE_WAIT",value:f?.tcp_close_wait!=null?String(f.tcp_close_wait):"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:199:139",className:"h-4 w-4 text-red-400"}),data:u.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:201:13",title:"TCP 总连接",value:f?String((f.tcp_established||0)+(f.tcp_time_wait||0)+(f.tcp_close_wait||0)):"--",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:201:169",className:"h-4 w-4 text-cyan-400"}),data:u.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:s})]}),t.jsx(ce,{"code-path":"src/pages/HostMonitor.tsx:204:11",title:"网卡带宽吞吐",currentRx:f?.net_rx_bps!=null?rt(f.net_rx_bps):"--",currentTx:f?.net_tx_bps!=null?rt(f.net_tx_bps):"--",rxData:u.rx,txData:u.tx,aggType:s,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:211:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:212:13",title:"网卡接收错误",value:f?.net_rx_errors!=null?String(f.net_rx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:212:129",className:"h-4 w-4 text-red-400"}),data:u.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:214:13",title:"网卡发送错误",value:f?.net_tx_errors!=null?String(f.net_tx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:214:129",className:"h-4 w-4 text-orange-400"}),data:u.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:s})]})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:219:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:220:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:221:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:222:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:223:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",Y.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:224:17",className:"ml-auto flex items-center gap-2",children:[N==="blacklist"&&M.length>0&&t.jsxs(Q,{"code-path":"src/pages/HostMonitor.tsx:226:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",M.join(",")]}),N==="whitelist"&&t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:231:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:235:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{it(),B(!0)},children:"策略配置"})]})]}),Y.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:242:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无端口数据"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:246:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:247:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:248:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:249:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:250:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:251:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:252:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:253:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:256:21",children:Y.map((r,T)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:258:25",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:259:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:r.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:260:27",className:"py-1.5",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:261:29",variant:"outline",className:"text-[10px] font-mono",children:r.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:265:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:r.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:266:27",className:"py-1.5 text-right",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:267:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},T))})]})})]})})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:281:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:282:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:283:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:284:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:285:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",dt.length]}),dt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:288:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"Agent v2.0+ 支持,等待数据上报…"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:292:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:293:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:294:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:295:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:296:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:297:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:298:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:299:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:300:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:303:21",children:dt.map((r,T)=>{const R=r.cmdline||r.name||"?",Z=r.cpu_pct!=null?Number(r.cpu_pct):null,tt=r.mem_pct!=null?Number(r.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:309:27",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:310:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:311:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:312:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:R,children:R}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:315:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async Et=>{Et.stopPropagation();try{await navigator.clipboard.writeText(R)}catch{const G=document.createElement("textarea");G.value=R,G.style.position="fixed",G.style.opacity="0",document.body.appendChild(G),G.select(),document.execCommand("copy"),document.body.removeChild(G)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:330:35",className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{"code-path":"src/pages/HostMonitor.tsx:331:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:332:37",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:337:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:338:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:339:31",className:tt!=null&&tt>50?"text-rose-400":"text-cyan-400",children:tt!=null?tt.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:343:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:344:31",className:Z!=null&&Z>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:Z!=null?Z.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:348:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.fd_count??"--"})]},T)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:360:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:361:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:362:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:363:19",className:"h-4 w-4 text-violet-400"}),"FD 文件句柄"]}),I?.allocated!=null?t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:367:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:368:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:369:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:370:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:372:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:373:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:374:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.max===-1?"无限制":I.max?.toLocaleString()||"—"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:376:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:377:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:378:25",className:`font-mono font-semibold ${I.usage_pct>80?"text-rose-400":"text-violet-400"}`,children:I.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:"—"})]})]}),u.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:384:23",className:"h-[120px]",children:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:385:25",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/HostMonitor.tsx:386:27",data:u.fd,children:[t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:387:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(bt,{"code-path":"src/pages/HostMonitor.tsx:388:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:389:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:390:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:391:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:392:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:393:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:394:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:397:29",type:"monotone",dataKey:s,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:404:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:409:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:410:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Ft,{"code-path":"src/pages/HostMonitor.tsx:412:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),S?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:415:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:416:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:417:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:418:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:419:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(S.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:420:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:422:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:424:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:425:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:426:25",className:"text-lg font-bold font-mono text-amber-400",children:[(S.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:427:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:429:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:432:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:433:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:434:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:435:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:437:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:S.ctx_per_sec+S.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:440:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(S.ctx_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:442:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(S.irq_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:450:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsx(xe,{"code-path":"src/pages/HostMonitor.tsx:457:9",selectedHost:l,serverInfo:P,latest:b,heartbeatInfo:It,portInfoCount:Y.length}),t.jsx(ie,{"code-path":"src/pages/HostMonitor.tsx:465:9",selectedHost:l})]}),t.jsx(le,{"code-path":"src/pages/HostMonitor.tsx:468:7",open:o,onOpenChange:B,portPolicyMode:N,onModeChange:D,portWhitelist:M,onWhitelistChange:F,onSave:O,saving:X})]})}export{He as HostMonitor}; diff --git a/backend/static/assets/K8sShortcutRedirect-fgkbx9Vp.js b/backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js similarity index 85% rename from backend/static/assets/K8sShortcutRedirect-fgkbx9Vp.js rename to backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js index 3432ced..a23be2d 100644 --- a/backend/static/assets/K8sShortcutRedirect-fgkbx9Vp.js +++ b/backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js @@ -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}; diff --git a/backend/static/assets/KubernetesClusters-BiMWp14A.js b/backend/static/assets/KubernetesClusters-DD7SeVKO.js similarity index 99% rename from backend/static/assets/KubernetesClusters-BiMWp14A.js rename to backend/static/assets/KubernetesClusters-DD7SeVKO.js index 6d0fadf..f2a5c66 100644 --- a/backend/static/assets/KubernetesClusters-BiMWp14A.js +++ b/backend/static/assets/KubernetesClusters-DD7SeVKO.js @@ -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.tsx:126:13",value:"events",className:"data-[state=active]:bg-slate-700",children:"事件"})]}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:131:11",value:"overview",className:"mt-4 space-y-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:132:13",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:133:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:134:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:135:19",className:"text-sm text-slate-400",children:"资源使用趋势"})}),e.jsxs(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:137:17",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:138:19",className:"h-[200px]",children:e.jsx(ct,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:139:21",width:"100%",height:"100%",children:e.jsxs(ot,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:140:23",data:[{time:"CPU",cpu:Number(h.cpuPct.toFixed(1)),memory:Number(h.memPct.toFixed(1))}],children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:143:25",children:[e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:144:27",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:145:29",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:146:29",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:148:27",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:149:29",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:150:29",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),e.jsx(lt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:153:25",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ut,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:154:25",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(dt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:155:25",stroke:"#475569",fontSize:12,domain:[0,100]}),e.jsx(it,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:156:25",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:164:25",type:"monotone",dataKey:"cpu",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorCpu)",name:"CPU(%)"}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:172:25",type:"monotone",dataKey:"memory",stroke:"#10b981",fillOpacity:1,fill:"url(#colorMemory)",name:"内存(%)"})]})})}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:183:19",className:"flex justify-center gap-6 mt-2 text-xs text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:21",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:32",className:"text-blue-400 font-bold",children:[h.cpuPct.toFixed(1),"%"]})]}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:21",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:31",className:"text-emerald-400 font-bold",children:[h.memPct.toFixed(1),"%"]})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:190:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:191:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:192:19",className:"text-sm text-slate-400",children:"资源分布"})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:194:17",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:195:19",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:196:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:197:23",className:"text-3xl font-bold text-blue-400",children:a.pod_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:198:23",className:"text-sm text-slate-500 mt-1",children:"Pod"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:200:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:201:23",className:"text-3xl font-bold text-emerald-400",children:a.service_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:202:23",className:"text-sm text-slate-500 mt-1",children:"Service"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:204:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:205:23",className:"text-3xl font-bold text-purple-400",children:a.deployment_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:206:23",className:"text-sm text-slate-500 mt-1",children:"Deployment"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:208:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:209:23",className:"text-3xl font-bold text-amber-400",children:a.node_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:210:23",className:"text-sm text-slate-500 mt-1",children:"节点"})]})]})})]})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:218:11",value:"nodes",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:219:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:220:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:221:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:222:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:223:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:224:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"角色"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:225:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:226:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:227:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:228:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Pod"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:229:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"操作系统"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:232:17",className:"divide-y divide-slate-800",children:r.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:234:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:235:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无节点数据"})}):r.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:239:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:240:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:241:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:242:25",variant:"outline",className:t.role==="master"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.role==="master"?"Master":"Worker"})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:253:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:254:25",variant:"outline",className:(t.status||"").toLowerCase()==="ready"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:(t.status||"").toLowerCase()==="ready"?"Ready":"NotReady"})}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:265:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.cpu_usage_m||"0m"," / ",t.cpu,"核"]}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:268:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.mem_usage_mi||"0Mi"," / ",t.memory_mb?(t.memory_mb/1024).toFixed(0)+"GB":"-"]}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:271:23",className:"px-4 py-3 text-sm text-slate-300",children:t.max_pods??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:272:23",className:"px-4 py-3 text-sm text-slate-400",children:t.os})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:281:11",value:"pods",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:282:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:283:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:284:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:285:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:286:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:287:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:288:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:289:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"重启次数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:290:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:291:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:292:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"节点"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:295:17",className:"divide-y divide-slate-800",children:s.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:297:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:298:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无Pod数据"})}):s.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:302:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:303:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:304:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:305:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:309:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:310:25",variant:"outline",className:(t.status||"").toLowerCase()==="running"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":(t.status||"").toLowerCase()==="pending"?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:t.status})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:323:23",className:"px-4 py-3 text-sm text-slate-300",children:t.restart_count??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:324:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cpu_usage_m||"0m"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:325:23",className:"px-4 py-3 text-sm text-slate-300",children:t.mem_usage_mi||"0Mi"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:326:23",className:"px-4 py-3 text-sm text-slate-400",children:t.node_name})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:335:11",value:"deployments",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:336:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:337:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:338:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:339:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:340:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:341:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:342:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"副本数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:343:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"可用副本"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:344:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"镜像"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:345:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"创建时间"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:348:17",className:"divide-y divide-slate-800",children:d.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:350:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:351:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Deployment数据"})}):d.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:355:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:356:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:357:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:358:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:362:23",className:"px-4 py-3 text-sm text-slate-300",children:t.replicas}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:363:23",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:364:25",className:`text-sm ${(t.available_replicas??t.availableReplicas)===t.replicas?"text-emerald-400":"text-amber-400"}`,children:[t.available_replicas??t.availableReplicas," / ",t.replicas]})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:368:23",className:"px-4 py-3 text-sm text-slate-400 truncate max-w-[200px]",children:t.image}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:369:23",className:"px-4 py-3 text-sm text-slate-400",children:t.created_at||t.createdAt})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:378:11",value:"services",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:379:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:380:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:381:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:382:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:383:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:384:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:385:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"类型"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:386:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"ClusterIP"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:387:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"端口"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:388:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Selector"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:391:17",className:"divide-y divide-slate-800",children:k.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:393:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:394:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Service数据"})}):k.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:398:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:399:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:400:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:401:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:405:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:406:25",variant:"outline",className:t.type==="ClusterIP"?"border-blue-500/30 text-blue-400 bg-blue-500/10":t.type==="NodePort"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:t.type})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:419:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cluster_ip??t.clusterIP}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:420:23",className:"px-4 py-3 text-sm text-slate-300",children:t.ports}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:421:23",className:"px-4 py-3 text-sm text-slate-400",children:t.selector})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:430:11",value:"ingresses",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:431:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:432:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:433:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:434:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:435:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:436:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:437:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Hosts"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:438:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"后端服务"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:439:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"TLS"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:442:17",className:"divide-y divide-slate-800",children:b.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:444:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:445:23",colSpan:5,className:"px-4 py-8 text-center text-slate-500",children:"暂无Ingress数据"})}):b.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:449:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:450:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:451:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:452:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:456:23",className:"px-4 py-3 text-sm text-slate-300",children:t.hosts}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:457:23",className:"px-4 py-3 text-sm text-slate-300",children:t.backend}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:458:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:459:25",variant:"outline",className:t.tls?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-slate-700 text-slate-400",children:t.tls?"已启用":"未启用"})})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:478:11",value:"events",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:479:13",className:"space-y-2",children:[{type:"Normal",reason:"Started",message:"Started container nginx",time:"2分钟前"},{type:"Normal",reason:"Created",message:"Created pod nginx-deployment-xxx",time:"5分钟前"},{type:"Warning",reason:"FailedScheduling",message:"0/3 nodes are available",time:"10分钟前"},{type:"Normal",reason:"Pulling",message:'Pulling image "nginx:latest"',time:"15分钟前"},{type:"Normal",reason:"Pulled",message:"Successfully pulled image",time:"12分钟前"}].map((t,i)=>e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:487:17",className:"flex items-center gap-3 p-3 rounded-lg bg-slate-800/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:491:19",variant:"outline",className:t.type==="Normal"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-amber-500/30 text-amber-400 bg-amber-500/10",children:t.type}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:501:19",className:"text-sm font-medium text-slate-300 min-w-[120px]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:502:19",className:"text-sm text-slate-400 flex-1",children:t.message}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:503:19",className:"text-xs text-slate-500",children:t.time})]},i))})})]})})]})}var J="Radio",[ht,me]=ce(J),[gt,Ct]=ht(J),be=n.forwardRef((a,x)=>{const{__scopeRadio:r,name:g,checked:s=!1,required:u,disabled:d,value:K="on",onCheck:k,form:C,...b}=a,[f,h]=n.useState(null),p=X(x,m=>h(m)),t=n.useRef(!1),i=f?C||!!f.closest("form"):!0;return e.jsxs(gt,{scope:r,checked:s,disabled:d,children:[e.jsx($.button,{type:"button",role:"radio","aria-checked":s,"data-state":ke(s),"data-disabled":d?"":void 0,disabled:d,value:K,...b,ref:p,onClick:H(a.onClick,m=>{s||k?.(),i&&(t.current=m.isPropagationStopped(),t.current||m.stopPropagation())})}),i&&e.jsx(Ce,{control:f,bubbles:!t.current,name:g,value:K,checked:s,required:u,disabled:d,form:C,style:{transform:"translateX(-100%)"}})]})});be.displayName=J;var he="RadioIndicator",ge=n.forwardRef((a,x)=>{const{__scopeRadio:r,forceMount:g,...s}=a,u=Ct(he,r);return e.jsx(Ee,{present:g||u.checked,children:e.jsx($.span,{"data-state":ke(u.checked),"data-disabled":u.disabled?"":void 0,...s,ref:x})})});ge.displayName=he;var kt="RadioBubbleInput",Ce=n.forwardRef(({__scopeRadio:a,control:x,checked:r,bubbles:g=!0,...s},u)=>{const d=n.useRef(null),K=X(d,u),k=xt(r),C=Ae(x);return n.useEffect(()=>{const b=d.current;if(!b)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(k!==r&&p){const t=new Event("click",{bubbles:g});p.call(b,r),b.dispatchEvent(t)}},[k,r,g]),e.jsx($.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:K,style:{...s.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ce.displayName=kt;function ke(a){return a?"checked":"unchecked"}var ft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W="RadioGroup",[jt]=ce(W,[ae,me]),fe=ae(),je=me(),[Kt,vt]=jt(W),Ke=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,name:g,defaultValue:s,value:u,required:d=!1,disabled:K=!1,orientation:k,dir:C,loop:b=!0,onValueChange:f,...h}=a,p=fe(r),t=_e(C),[i,m]=Re({prop:u,defaultProp:s??null,onChange:f,caller:W});return e.jsx(Kt,{scope:r,name:g,required:d,disabled:K,value:i,onValueChange:m,children:e.jsx(Pe,{asChild:!0,...p,orientation:k,dir:t,loop:b,children:e.jsx($.div,{role:"radiogroup","aria-required":d,"aria-orientation":k,"data-disabled":K?"":void 0,dir:t,...h,ref:x})})})});Ke.displayName=W;var ve="RadioGroupItem",Ne=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,disabled:g,...s}=a,u=vt(ve,r),d=u.disabled||g,K=fe(r),k=je(r),C=n.useRef(null),b=X(x,C),f=u.value===s.value,h=n.useRef(!1);return n.useEffect(()=>{const p=i=>{ft.includes(i.key)&&(h.current=!0)},t=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",t)}},[]),e.jsx(Te,{asChild:!0,...K,focusable:!d,active:f,children:e.jsx(be,{disabled:d,required:u.required,checked:f,...k,...s,name:u.name,ref:b,onCheck:()=>u.onValueChange(s.value),onKeyDown:H(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:H(s.onFocus,()=>{h.current&&C.current?.click()})})})});Ne.displayName=ve;var Nt="RadioGroupIndicator",De=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,...g}=a,s=je(r);return e.jsx(ge,{...s,...g,ref:x})});De.displayName=Nt;var Dt=Ke,yt=Ne,wt=De;function St({className:a,...x}){return e.jsx(Dt,{"code-path":"src/components/ui/radio-group.tsx:14:5","data-slot":"radio-group",className:E("grid gap-3",a),...x})}function se({className:a,...x}){return e.jsx(yt,{"code-path":"src/components/ui/radio-group.tsx:27:5","data-slot":"radio-group-item",className:E("border-input text-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 dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...x,children:e.jsx(wt,{"code-path":"src/components/ui/radio-group.tsx:35:7","data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx($e,{"code-path":"src/components/ui/radio-group.tsx:39:9",className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const re=/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/,ne={name:"",version:"",description:"",config_type:1,api_server:"",token:"",kube_config:""};function _t({open:a,onOpenChange:x,editingCluster:r,onSaved:g}){const[s,u]=n.useState({...ne}),[d,K]=n.useState(!1),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");n.useEffect(()=>{a&&(r&&r.id?w.getClusterDetail(r.id).then(o=>{const l=o||{};C(!!l.has_token),f(!!l.has_kube_config),u({name:l.name||"",version:l.version||"",description:l.description||"",config_type:Number(l.config_type??1),api_server:l.api_server||"",token:"",kube_config:""}),p("")}).catch(()=>{u({name:r.name||"",version:r.version||"",description:r.description||"",config_type:Number(r.config_type??1),api_server:r.api_server||"",token:"",kube_config:""}),p("")}):(C(!1),f(!1),u({...ne}),p("")))},[a,r]);const t=o=>{u({...s,name:o}),o.trim()?re.test(o)?p(""):p("只允许英文、数字和连字符(-),首尾不能是连字符"):p("")},i=o=>{const l=o.match(/^\s*server:\s*(\S+)\s*$/m);return l?l[1]:""},m=o=>{const l=i(o);u(N=>({...N,kube_config:o,api_server:l||N.api_server}))},j=async()=>{if(!s.name.trim()||!re.test(s.name.trim())){I.error("请输入有效的集群名称(英文/数字/连字符)");return}try{K(!0);const o={name:s.name.trim(),code:s.name.trim(),version:s.version,description:s.description,config_type:s.config_type,api_server:s.api_server,token:s.config_type===0?s.token:"",kube_config:s.config_type===1?s.kube_config:""};r?await w.updateCluster(r.id,o):await w.createCluster(o),x(!1),g()}catch(o){console.error("保存集群失败:",o)}finally{K(!1)}},D=d||!s.name.trim()||!!h;return e.jsx(oe,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:143:5",open:a,onOpenChange:x,children:e.jsxs(le,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:144:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl",children:[e.jsxs(Me,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:145:9",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:146:11",className:"text-[var(--dg-text-primary)]",children:r?"编辑集群":"添加集群"}),e.jsx(de,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:149:11",className:"text-[var(--dg-text-secondary)]",children:r?"修改集群接入配置":"配置新的 Kubernetes 集群接入信息"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:153:9",className:"space-y-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:154:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:155:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:156:15",className:"text-[var(--dg-text-secondary)]",children:"集群名称"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:157:15",value:s.name,onChange:o=>t(o.target.value),placeholder:"如: prod-cluster",className:`bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] ${h?"border-red-500":""}`}),h&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:163:29",className:"text-xs text-red-400",children:h}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:164:15",className:"text-xs text-[var(--dg-text-muted)]",children:"只允许英文、数字和连字符(-),首尾不能是连字符。名称将作为集群唯一标识。"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:168:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:169:15",className:"text-[var(--dg-text-secondary)]",children:"版本(可选)"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:170:15",value:s.version,onChange:o=>u({...s,version:o.target.value}),placeholder:"如: 1.28.0",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:179:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:180:13",className:"text-[var(--dg-text-secondary)]",children:"描述"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:181:13",value:s.description,onChange:o=>u({...s,description:o.target.value}),placeholder:"集群用途描述",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:189:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:190:13",className:"text-[var(--dg-text-secondary)]",children:"接入方式"}),e.jsxs(St,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:191:13",value:String(s.config_type),onValueChange:o=>u({...s,config_type:Number(o)}),className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:196:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:197:17",value:"0",id:"ct-0"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:198:17",htmlFor:"ct-0",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Token"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:200:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:201:17",value:"1",id:"ct-1"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:202:17",htmlFor:"ct-1",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Kubeconfig"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:207:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:208:13",className:"text-[var(--dg-text-secondary)]",children:"API Server"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:209:13",value:s.api_server,onChange:o=>u({...s,api_server:o.target.value}),placeholder:"https://10.0.0.1:6443",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),s.config_type===0?e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:218:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:219:15",className:"text-[var(--dg-text-secondary)]",children:["Token ",k&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:220:36",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:222:15",value:s.token,onChange:o=>u({...s,token:o.target.value}),placeholder:k?"已配置,输入新值覆盖...":"粘贴 Service Account Token...",rows:4,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:231:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:232:15",className:"text-[var(--dg-text-secondary)]",children:["Kubeconfig ",b&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:233:46",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:235:15",value:s.kube_config,onChange:o=>m(o.target.value),placeholder:b?"已配置,输入新值覆盖...":`apiVersion: v1 +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.tsx:126:13",value:"events",className:"data-[state=active]:bg-slate-700",children:"事件"})]}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:131:11",value:"overview",className:"mt-4 space-y-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:132:13",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:133:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:134:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:135:19",className:"text-sm text-slate-400",children:"资源使用趋势"})}),e.jsxs(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:137:17",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:138:19",className:"h-[200px]",children:e.jsx(ct,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:139:21",width:"100%",height:"100%",children:e.jsxs(ot,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:140:23",data:[{time:"CPU",cpu:Number(h.cpuPct.toFixed(1)),memory:Number(h.memPct.toFixed(1))}],children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:143:25",children:[e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:144:27",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:145:29",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:146:29",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:148:27",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:149:29",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:150:29",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),e.jsx(lt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:153:25",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ut,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:154:25",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(dt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:155:25",stroke:"#475569",fontSize:12,domain:[0,100]}),e.jsx(it,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:156:25",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:164:25",type:"monotone",dataKey:"cpu",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorCpu)",name:"CPU(%)"}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:172:25",type:"monotone",dataKey:"memory",stroke:"#10b981",fillOpacity:1,fill:"url(#colorMemory)",name:"内存(%)"})]})})}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:183:19",className:"flex justify-center gap-6 mt-2 text-xs text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:21",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:32",className:"text-blue-400 font-bold",children:[h.cpuPct.toFixed(1),"%"]})]}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:21",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:31",className:"text-emerald-400 font-bold",children:[h.memPct.toFixed(1),"%"]})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:190:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:191:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:192:19",className:"text-sm text-slate-400",children:"资源分布"})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:194:17",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:195:19",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:196:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:197:23",className:"text-3xl font-bold text-blue-400",children:a.pod_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:198:23",className:"text-sm text-slate-500 mt-1",children:"Pod"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:200:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:201:23",className:"text-3xl font-bold text-emerald-400",children:a.service_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:202:23",className:"text-sm text-slate-500 mt-1",children:"Service"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:204:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:205:23",className:"text-3xl font-bold text-purple-400",children:a.deployment_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:206:23",className:"text-sm text-slate-500 mt-1",children:"Deployment"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:208:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:209:23",className:"text-3xl font-bold text-amber-400",children:a.node_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:210:23",className:"text-sm text-slate-500 mt-1",children:"节点"})]})]})})]})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:218:11",value:"nodes",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:219:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:220:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:221:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:222:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:223:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:224:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"角色"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:225:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:226:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:227:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:228:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Pod"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:229:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"操作系统"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:232:17",className:"divide-y divide-slate-800",children:r.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:234:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:235:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无节点数据"})}):r.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:239:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:240:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:241:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:242:25",variant:"outline",className:t.role==="master"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.role==="master"?"Master":"Worker"})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:253:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:254:25",variant:"outline",className:(t.status||"").toLowerCase()==="ready"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:(t.status||"").toLowerCase()==="ready"?"Ready":"NotReady"})}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:265:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.cpu_usage_m||"0m"," / ",t.cpu,"核"]}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:268:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.mem_usage_mi||"0Mi"," / ",t.memory_mb?(t.memory_mb/1024).toFixed(0)+"GB":"-"]}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:271:23",className:"px-4 py-3 text-sm text-slate-300",children:t.max_pods??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:272:23",className:"px-4 py-3 text-sm text-slate-400",children:t.os})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:281:11",value:"pods",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:282:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:283:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:284:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:285:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:286:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:287:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:288:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:289:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"重启次数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:290:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:291:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:292:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"节点"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:295:17",className:"divide-y divide-slate-800",children:s.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:297:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:298:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无Pod数据"})}):s.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:302:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:303:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:304:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:305:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:309:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:310:25",variant:"outline",className:(t.status||"").toLowerCase()==="running"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":(t.status||"").toLowerCase()==="pending"?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:t.status})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:323:23",className:"px-4 py-3 text-sm text-slate-300",children:t.restart_count??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:324:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cpu_usage_m||"0m"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:325:23",className:"px-4 py-3 text-sm text-slate-300",children:t.mem_usage_mi||"0Mi"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:326:23",className:"px-4 py-3 text-sm text-slate-400",children:t.node_name})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:335:11",value:"deployments",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:336:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:337:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:338:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:339:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:340:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:341:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:342:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"副本数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:343:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"可用副本"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:344:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"镜像"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:345:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"创建时间"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:348:17",className:"divide-y divide-slate-800",children:d.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:350:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:351:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Deployment数据"})}):d.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:355:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:356:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:357:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:358:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:362:23",className:"px-4 py-3 text-sm text-slate-300",children:t.replicas}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:363:23",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:364:25",className:`text-sm ${(t.available_replicas??t.availableReplicas)===t.replicas?"text-emerald-400":"text-amber-400"}`,children:[t.available_replicas??t.availableReplicas," / ",t.replicas]})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:368:23",className:"px-4 py-3 text-sm text-slate-400 truncate max-w-[200px]",children:t.image}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:369:23",className:"px-4 py-3 text-sm text-slate-400",children:t.created_at||t.createdAt})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:378:11",value:"services",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:379:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:380:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:381:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:382:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:383:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:384:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:385:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"类型"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:386:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"ClusterIP"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:387:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"端口"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:388:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Selector"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:391:17",className:"divide-y divide-slate-800",children:k.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:393:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:394:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Service数据"})}):k.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:398:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:399:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:400:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:401:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:405:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:406:25",variant:"outline",className:t.type==="ClusterIP"?"border-blue-500/30 text-blue-400 bg-blue-500/10":t.type==="NodePort"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:t.type})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:419:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cluster_ip??t.clusterIP}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:420:23",className:"px-4 py-3 text-sm text-slate-300",children:t.ports}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:421:23",className:"px-4 py-3 text-sm text-slate-400",children:t.selector})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:430:11",value:"ingresses",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:431:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:432:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:433:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:434:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:435:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:436:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:437:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Hosts"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:438:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"后端服务"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:439:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"TLS"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:442:17",className:"divide-y divide-slate-800",children:b.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:444:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:445:23",colSpan:5,className:"px-4 py-8 text-center text-slate-500",children:"暂无Ingress数据"})}):b.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:449:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:450:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:451:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:452:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:456:23",className:"px-4 py-3 text-sm text-slate-300",children:t.hosts}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:457:23",className:"px-4 py-3 text-sm text-slate-300",children:t.backend}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:458:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:459:25",variant:"outline",className:t.tls?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-slate-700 text-slate-400",children:t.tls?"已启用":"未启用"})})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:478:11",value:"events",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:479:13",className:"space-y-2",children:[{type:"Normal",reason:"Started",message:"Started container nginx",time:"2分钟前"},{type:"Normal",reason:"Created",message:"Created pod nginx-deployment-xxx",time:"5分钟前"},{type:"Warning",reason:"FailedScheduling",message:"0/3 nodes are available",time:"10分钟前"},{type:"Normal",reason:"Pulling",message:'Pulling image "nginx:latest"',time:"15分钟前"},{type:"Normal",reason:"Pulled",message:"Successfully pulled image",time:"12分钟前"}].map((t,i)=>e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:487:17",className:"flex items-center gap-3 p-3 rounded-lg bg-slate-800/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:491:19",variant:"outline",className:t.type==="Normal"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-amber-500/30 text-amber-400 bg-amber-500/10",children:t.type}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:501:19",className:"text-sm font-medium text-slate-300 min-w-[120px]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:502:19",className:"text-sm text-slate-400 flex-1",children:t.message}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:503:19",className:"text-xs text-slate-500",children:t.time})]},i))})})]})})]})}var J="Radio",[ht,me]=ce(J),[gt,Ct]=ht(J),be=n.forwardRef((a,x)=>{const{__scopeRadio:r,name:g,checked:s=!1,required:u,disabled:d,value:K="on",onCheck:k,form:C,...b}=a,[f,h]=n.useState(null),p=X(x,m=>h(m)),t=n.useRef(!1),i=f?C||!!f.closest("form"):!0;return e.jsxs(gt,{scope:r,checked:s,disabled:d,children:[e.jsx($.button,{type:"button",role:"radio","aria-checked":s,"data-state":ke(s),"data-disabled":d?"":void 0,disabled:d,value:K,...b,ref:p,onClick:H(a.onClick,m=>{s||k?.(),i&&(t.current=m.isPropagationStopped(),t.current||m.stopPropagation())})}),i&&e.jsx(Ce,{control:f,bubbles:!t.current,name:g,value:K,checked:s,required:u,disabled:d,form:C,style:{transform:"translateX(-100%)"}})]})});be.displayName=J;var he="RadioIndicator",ge=n.forwardRef((a,x)=>{const{__scopeRadio:r,forceMount:g,...s}=a,u=Ct(he,r);return e.jsx(Ee,{present:g||u.checked,children:e.jsx($.span,{"data-state":ke(u.checked),"data-disabled":u.disabled?"":void 0,...s,ref:x})})});ge.displayName=he;var kt="RadioBubbleInput",Ce=n.forwardRef(({__scopeRadio:a,control:x,checked:r,bubbles:g=!0,...s},u)=>{const d=n.useRef(null),K=X(d,u),k=xt(r),C=Ae(x);return n.useEffect(()=>{const b=d.current;if(!b)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(k!==r&&p){const t=new Event("click",{bubbles:g});p.call(b,r),b.dispatchEvent(t)}},[k,r,g]),e.jsx($.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:K,style:{...s.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ce.displayName=kt;function ke(a){return a?"checked":"unchecked"}var ft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W="RadioGroup",[jt]=ce(W,[ae,me]),fe=ae(),je=me(),[Kt,vt]=jt(W),Ke=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,name:g,defaultValue:s,value:u,required:d=!1,disabled:K=!1,orientation:k,dir:C,loop:b=!0,onValueChange:f,...h}=a,p=fe(r),t=_e(C),[i,m]=Re({prop:u,defaultProp:s??null,onChange:f,caller:W});return e.jsx(Kt,{scope:r,name:g,required:d,disabled:K,value:i,onValueChange:m,children:e.jsx(Pe,{asChild:!0,...p,orientation:k,dir:t,loop:b,children:e.jsx($.div,{role:"radiogroup","aria-required":d,"aria-orientation":k,"data-disabled":K?"":void 0,dir:t,...h,ref:x})})})});Ke.displayName=W;var ve="RadioGroupItem",Ne=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,disabled:g,...s}=a,u=vt(ve,r),d=u.disabled||g,K=fe(r),k=je(r),C=n.useRef(null),b=X(x,C),f=u.value===s.value,h=n.useRef(!1);return n.useEffect(()=>{const p=i=>{ft.includes(i.key)&&(h.current=!0)},t=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",t)}},[]),e.jsx(Te,{asChild:!0,...K,focusable:!d,active:f,children:e.jsx(be,{disabled:d,required:u.required,checked:f,...k,...s,name:u.name,ref:b,onCheck:()=>u.onValueChange(s.value),onKeyDown:H(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:H(s.onFocus,()=>{h.current&&C.current?.click()})})})});Ne.displayName=ve;var Nt="RadioGroupIndicator",De=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,...g}=a,s=je(r);return e.jsx(ge,{...s,...g,ref:x})});De.displayName=Nt;var Dt=Ke,yt=Ne,wt=De;function St({className:a,...x}){return e.jsx(Dt,{"code-path":"src/components/ui/radio-group.tsx:14:5","data-slot":"radio-group",className:E("grid gap-3",a),...x})}function se({className:a,...x}){return e.jsx(yt,{"code-path":"src/components/ui/radio-group.tsx:27:5","data-slot":"radio-group-item",className:E("border-input text-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 dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...x,children:e.jsx(wt,{"code-path":"src/components/ui/radio-group.tsx:35:7","data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx($e,{"code-path":"src/components/ui/radio-group.tsx:39:9",className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const re=/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/,ne={name:"",version:"",description:"",config_type:1,api_server:"",token:"",kube_config:""};function _t({open:a,onOpenChange:x,editingCluster:r,onSaved:g}){const[s,u]=n.useState({...ne}),[d,K]=n.useState(!1),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");n.useEffect(()=>{a&&(r&&r.id?w.getClusterDetail(r.id).then(o=>{const l=o||{};C(!!l.has_token),f(!!l.has_kube_config),u({name:l.name||"",version:l.version||"",description:l.description||"",config_type:Number(l.config_type??1),api_server:l.api_server||"",token:"",kube_config:""}),p("")}).catch(()=>{u({name:r.name||"",version:r.version||"",description:r.description||"",config_type:Number(r.config_type??1),api_server:r.api_server||"",token:"",kube_config:""}),p("")}):(C(!1),f(!1),u({...ne}),p("")))},[a,r]);const t=o=>{u({...s,name:o}),o.trim()?re.test(o)?p(""):p("只允许英文、数字和连字符(-),首尾不能是连字符"):p("")},i=o=>{const l=o.match(/^\s*server:\s*(\S+)\s*$/m);return l?l[1]:""},m=o=>{const l=i(o);u(N=>({...N,kube_config:o,api_server:l||N.api_server}))},j=async()=>{if(!s.name.trim()||!re.test(s.name.trim())){I.error("请输入有效的集群名称(英文/数字/连字符)");return}try{K(!0);const o={name:s.name.trim(),code:s.name.trim(),version:s.version,description:s.description,config_type:s.config_type,api_server:s.api_server,token:s.config_type===0?s.token:"",kube_config:s.config_type===1?s.kube_config:""};r?await w.updateCluster(r.id,o):await w.createCluster(o),x(!1),g()}catch(o){console.error("保存集群失败:",o)}finally{K(!1)}},D=d||!s.name.trim()||!!h;return e.jsx(oe,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:143:5",open:a,onOpenChange:x,children:e.jsxs(le,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:144:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl",children:[e.jsxs(Me,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:145:9",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:146:11",className:"text-[var(--dg-text-primary)]",children:r?"编辑集群":"添加集群"}),e.jsx(de,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:149:11",className:"text-[var(--dg-text-secondary)]",children:r?"修改集群接入配置":"配置新的 Kubernetes 集群接入信息"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:153:9",className:"space-y-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:154:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:155:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:156:15",className:"text-[var(--dg-text-secondary)]",children:"集群名称"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:157:15",value:s.name,onChange:o=>t(o.target.value),placeholder:"如: prod-cluster",className:`bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] ${h?"border-red-500":""}`}),h&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:163:29",className:"text-xs text-red-400",children:h}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:164:15",className:"text-xs text-[var(--dg-text-muted)]",children:"只允许英文、数字和连字符(-),首尾不能是连字符。名称将作为集群唯一标识。"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:168:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:169:15",className:"text-[var(--dg-text-secondary)]",children:"版本(可选)"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:170:15",value:s.version,onChange:o=>u({...s,version:o.target.value}),placeholder:"如: 1.28.0",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:179:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:180:13",className:"text-[var(--dg-text-secondary)]",children:"描述"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:181:13",value:s.description,onChange:o=>u({...s,description:o.target.value}),placeholder:"集群用途描述",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:189:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:190:13",className:"text-[var(--dg-text-secondary)]",children:"接入方式"}),e.jsxs(St,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:191:13",value:String(s.config_type),onValueChange:o=>u({...s,config_type:Number(o)}),className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:196:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:197:17",value:"0",id:"ct-0"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:198:17",htmlFor:"ct-0",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Token"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:200:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:201:17",value:"1",id:"ct-1"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:202:17",htmlFor:"ct-1",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Kubeconfig"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:207:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:208:13",className:"text-[var(--dg-text-secondary)]",children:"API Server"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:209:13",value:s.api_server,onChange:o=>u({...s,api_server:o.target.value}),placeholder:"https://10.0.0.1:6443",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),s.config_type===0?e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:218:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:219:15",className:"text-[var(--dg-text-secondary)]",children:["Token ",k&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:220:36",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:222:15",value:s.token,onChange:o=>u({...s,token:o.target.value}),placeholder:k?"已配置,输入新值覆盖...":"粘贴 Service Account Token...",rows:4,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:231:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:232:15",className:"text-[var(--dg-text-secondary)]",children:["Kubeconfig ",b&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:233:46",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:235:15",value:s.kube_config,onChange:o=>m(o.target.value),placeholder:b?"已配置,输入新值覆盖...":`apiVersion: v1 kind: Config clusters: - cluster: diff --git a/backend/static/assets/KubernetesNodes-B2jEMWTg.js b/backend/static/assets/KubernetesNodes-B0frAPbY.js similarity index 96% rename from backend/static/assets/KubernetesNodes-B2jEMWTg.js rename to backend/static/assets/KubernetesNodes-B0frAPbY.js index 3db6b63..aff32a5 100644 --- a/backend/static/assets/KubernetesNodes-B2jEMWTg.js +++ b/backend/static/assets/KubernetesNodes-B0frAPbY.js @@ -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/kubernetes/KubernetesNodes.tsx:101:7",className:"bg-slate-900 border-slate-800",children:e.jsx(I,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:102:9",className:"p-0",children:e.jsxs(V,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:103:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:104:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:105:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:106:17",className:"text-slate-400",children:"节点名称"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:107:17",className:"text-slate-400",children:"IP"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:108:17",className:"text-slate-400",children:"角色"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:109:17",className:"text-slate-400",children:"状态"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:110:17",className:"text-slate-400",children:"配置"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:111:17",className:"text-slate-400",children:"使用率"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:112:17",className:"text-slate-400",children:"Pods"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:113:17",className:"text-slate-400",children:"Kubelet"})]})}),e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:116:13",children:b?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:95",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):g.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(G,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:95",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c?"暂无节点数据":"请选择集群"]})}):g.map(s=>e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:123:19",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:124:21",className:"font-medium text-slate-200",children:s.name}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:21",children:e.jsx("code",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:32",className:"text-sm text-slate-300 bg-slate-800 px-1.5 py-0.5 rounded",children:s.ip||"-"})}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:126:21",children:_(s.role)}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:127:21",children:E(s.status)}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:128:21",className:"text-sm text-slate-400",children:[s.cpu?`${s.cpu}核`:"-"," / ",s.memory?`${Math.round(s.memory/1024)}GB`:"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:131:21",children:(()=>{const r=s.cpu_usage||0,d=s.memory_usage||0,f=a=>a>=85?"bg-red-500":a>=60?"bg-yellow-500":"bg-emerald-500",v=a=>a>=85?"text-red-400":a>=60?"text-yellow-400":"text-emerald-400";return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:138:27",className:"flex flex-col gap-1 min-w-[120px]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:139:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:140:31",className:"text-xs text-slate-500 w-7",children:"CPU"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:141:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:142:33",className:`h-full rounded-full ${f(r)}`,style:{width:`${Math.min(r,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:144:31",className:`text-xs w-9 text-right ${v(r)}`,children:[r.toFixed(0),"%"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:146:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:147:31",className:"text-xs text-slate-500 w-7",children:"Mem"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:148:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:149:33",className:`h-full rounded-full ${f(d)}`,style:{width:`${Math.min(d,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:151:31",className:`text-xs w-9 text-right ${v(d)}`,children:[d.toFixed(0),"%"]})]})]})})()}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:157:21",className:"text-sm text-slate-400",children:[s.pod_count||0," / ",s.max_pods||"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:158:21",className:"text-xs text-slate-500",children:s.kubelet_version||"-"})]},s.id))})]})})})]})}export{te as KubernetesNodes}; +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/kubernetes/KubernetesNodes.tsx:101:7",className:"bg-slate-900 border-slate-800",children:e.jsx(I,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:102:9",className:"p-0",children:e.jsxs(V,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:103:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:104:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:105:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:106:17",className:"text-slate-400",children:"节点名称"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:107:17",className:"text-slate-400",children:"IP"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:108:17",className:"text-slate-400",children:"角色"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:109:17",className:"text-slate-400",children:"状态"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:110:17",className:"text-slate-400",children:"配置"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:111:17",className:"text-slate-400",children:"使用率"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:112:17",className:"text-slate-400",children:"Pods"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:113:17",className:"text-slate-400",children:"Kubelet"})]})}),e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:116:13",children:b?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:95",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):g.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(G,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:95",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c?"暂无节点数据":"请选择集群"]})}):g.map(s=>e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:123:19",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:124:21",className:"font-medium text-slate-200",children:s.name}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:21",children:e.jsx("code",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:32",className:"text-sm text-slate-300 bg-slate-800 px-1.5 py-0.5 rounded",children:s.ip||"-"})}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:126:21",children:_(s.role)}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:127:21",children:E(s.status)}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:128:21",className:"text-sm text-slate-400",children:[s.cpu?`${s.cpu}核`:"-"," / ",s.memory?`${Math.round(s.memory/1024)}GB`:"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:131:21",children:(()=>{const r=s.cpu_usage||0,d=s.memory_usage||0,f=a=>a>=85?"bg-red-500":a>=60?"bg-yellow-500":"bg-emerald-500",v=a=>a>=85?"text-red-400":a>=60?"text-yellow-400":"text-emerald-400";return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:138:27",className:"flex flex-col gap-1 min-w-[120px]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:139:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:140:31",className:"text-xs text-slate-500 w-7",children:"CPU"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:141:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:142:33",className:`h-full rounded-full ${f(r)}`,style:{width:`${Math.min(r,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:144:31",className:`text-xs w-9 text-right ${v(r)}`,children:[r.toFixed(0),"%"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:146:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:147:31",className:"text-xs text-slate-500 w-7",children:"Mem"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:148:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:149:33",className:`h-full rounded-full ${f(d)}`,style:{width:`${Math.min(d,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:151:31",className:`text-xs w-9 text-right ${v(d)}`,children:[d.toFixed(0),"%"]})]})]})})()}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:157:21",className:"text-sm text-slate-400",children:[s.pod_count||0," / ",s.max_pods||"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:158:21",className:"text-xs text-slate-500",children:s.kubelet_version||"-"})]},s.id))})]})})})]})}export{te as KubernetesNodes}; diff --git a/backend/static/assets/LoginLogsTab-q3NP-L1u.js b/backend/static/assets/LoginLogsTab-BZTjs1T3.js similarity index 95% rename from backend/static/assets/LoginLogsTab-q3NP-L1u.js rename to backend/static/assets/LoginLogsTab-BZTjs1T3.js index 9f9858f..f8c6b6a 100644 --- a/backend/static/assets/LoginLogsTab-q3NP-L1u.js +++ b/backend/static/assets/LoginLogsTab-BZTjs1T3.js @@ -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.tsx:179:21",className:"text-slate-400",children:"归属地"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:180:21",className:"text-slate-400",children:"浏览器/OS"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:181:21",className:"text-slate-400",children:"状态"})]})}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:184:17",children:x.map(e=>s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:186:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:187:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:188:25",className:"text-sm text-slate-400",children:e.login_at?new Date(e.login_at).toLocaleString():"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:192:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:193:25",className:"text-sm text-slate-200 font-medium",children:e.username||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:195:23",children:s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:196:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 text-xs",children:j(e.login_type)})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:200:23",children:s.jsx("code",{"code-path":"src/pages/LoginLogsTab.tsx:201:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:e.ip||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:205:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:206:25",className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:207:27",className:"h-3 w-3"}),e.location||"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:211:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:212:25",className:"text-xs text-slate-500 flex items-center gap-1",title:e.user_agent,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:213:27",className:"h-3 w-3 flex-shrink-0"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):e.user_agent?e.user_agent.length>40?e.user_agent.slice(0,40)+"...":e.user_agent:"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:223:23",children:T(e.status,e.fail_reason)})]},e.id))})]})})})})]})}export{M as LoginLogsTab}; +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.tsx:179:21",className:"text-slate-400",children:"归属地"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:180:21",className:"text-slate-400",children:"浏览器/OS"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:181:21",className:"text-slate-400",children:"状态"})]})}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:184:17",children:x.map(e=>s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:186:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:187:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:188:25",className:"text-sm text-slate-400",children:e.login_at?new Date(e.login_at).toLocaleString():"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:192:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:193:25",className:"text-sm text-slate-200 font-medium",children:e.username||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:195:23",children:s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:196:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 text-xs",children:j(e.login_type)})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:200:23",children:s.jsx("code",{"code-path":"src/pages/LoginLogsTab.tsx:201:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:e.ip||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:205:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:206:25",className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:207:27",className:"h-3 w-3"}),e.location||"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:211:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:212:25",className:"text-xs text-slate-500 flex items-center gap-1",title:e.user_agent,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:213:27",className:"h-3 w-3 flex-shrink-0"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):e.user_agent?e.user_agent.length>40?e.user_agent.slice(0,40)+"...":e.user_agent:"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:223:23",children:T(e.status,e.fail_reason)})]},e.id))})]})})})})]})}export{M as LoginLogsTab}; diff --git a/backend/static/assets/MetricsExplorer-BC0aPabu.js b/backend/static/assets/MetricsExplorer-CBLW7MW5.js similarity index 97% rename from backend/static/assets/MetricsExplorer-BC0aPabu.js rename to backend/static/assets/MetricsExplorer-CBLW7MW5.js index 2809f04..1e071d8 100644 --- a/backend/static/assets/MetricsExplorer-BC0aPabu.js +++ b/backend/static/assets/MetricsExplorer-CBLW7MW5.js @@ -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:Object.entries(R).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:170:19",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:171:21",className:"flex items-center gap-1.5 mb-1.5 text-xs text-[var(--dg-text-muted)]",children:[N[s]?.icon,e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:173:23",children:N[s]?.label||s})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:175:21",className:"space-y-0.5",children:t.map(r=>{const c=o.includes(r);return e.jsxs("label",{"code-path":"src/pages/MetricsExplorer.tsx:179:27",className:`flex items-center gap-2 px-2 py-1 rounded cursor-pointer text-xs transition-colors ${c?"bg-blue-500/10 text-blue-300":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,children:[e.jsx("input",{"code-path":"src/pages/MetricsExplorer.tsx:180:29",type:"checkbox",className:"rounded border-slate-600 bg-slate-800 accent-blue-500",checked:c,onChange:()=>{E(a=>c?a.filter(i=>i!==r):[...a,r])}}),e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:190:29",className:"truncate",children:r})]},r)})})]},s))})]})}),e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:202:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-2",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:203:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:204:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:205:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MetricsExplorer.tsx:206:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:[g?.name||""," — 最近 1 小时"]})]}),o.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:211:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:212:19",className:"text-center",children:[e.jsx(Q,{"code-path":"src/pages/MetricsExplorer.tsx:213:21",className:"h-8 w-8 text-slate-600 mx-auto mb-2"}),"请从左侧勾选指标"]})}):p.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:218:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无数据"}):e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:222:17",className:"h-80 overflow-x-auto",children:e.jsxs("svg",{"code-path":"src/pages/MetricsExplorer.tsx:223:19",viewBox:`0 0 ${Math.max(p.length*4,400)} 300`,className:"w-full h-full min-w-[400px]",children:[[0,25,50,75,100].map(s=>e.jsx("line",{"code-path":"src/pages/MetricsExplorer.tsx:226:23",x1:"0",y1:300-s/100*260,x2:Math.max(p.length*4,400),y2:300-s/100*260,stroke:"#1e293b",strokeDasharray:"3 3"},s)),o.map((s,t)=>{const r=p.map((a,i)=>({x:i*4+2,y:300-(d[a][s]??0)/$*260})).filter(a=>d[p[Math.round((a.x-2)/4)]]?.[s]!=null);if(r.length<2)return null;const c=r.map((a,i)=>`${i===0?"M":"L"}${a.x} ${a.y}`).join(" ");return e.jsx("g",{"code-path":"src/pages/MetricsExplorer.tsx:236:25",children:e.jsx("path",{"code-path":"src/pages/MetricsExplorer.tsx:237:27",d:c,fill:"none",stroke:h[t%h.length],strokeWidth:"1.5"})},s)}),p.filter((s,t)=>t%15===0).map((s,t)=>e.jsx("text",{"code-path":"src/pages/MetricsExplorer.tsx:243:23",x:t*60+2,y:"295",fill:"#475569",fontSize:"9",children:new Date(s*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})},s))]})}),o.length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:252:17",className:"flex flex-wrap gap-3 mt-3",children:o.map((s,t)=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:254:21",className:"flex items-center gap-1.5 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:255:23",className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:h[t%h.length]}}),s]},s))})]})})]}):e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:152:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:153:11",className:"p-12 text-center",children:[e.jsx(K,{"code-path":"src/pages/MetricsExplorer.tsx:154:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:155:13",className:"text-[var(--dg-text-muted)]",children:"请先选择监控目标,然后勾选要查看的指标"})]})}),g&&Object.keys(g.latest_metrics||{}).length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:268:9",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:Object.entries(g.latest_metrics).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:270:13",className:"bg-[var(--dg-bg-secondary)] rounded-lg p-3 border border-[var(--dg-border)] text-center",children:[e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:271:15",className:"text-[10px] text-[var(--dg-text-muted)] truncate",children:s}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:272:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:typeof t=="number"?t.toFixed(1):"--"})]},s))})]})}export{ce as MetricsExplorer,ce as default}; +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:Object.entries(R).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:170:19",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:171:21",className:"flex items-center gap-1.5 mb-1.5 text-xs text-[var(--dg-text-muted)]",children:[N[s]?.icon,e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:173:23",children:N[s]?.label||s})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:175:21",className:"space-y-0.5",children:t.map(r=>{const c=o.includes(r);return e.jsxs("label",{"code-path":"src/pages/MetricsExplorer.tsx:179:27",className:`flex items-center gap-2 px-2 py-1 rounded cursor-pointer text-xs transition-colors ${c?"bg-blue-500/10 text-blue-300":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,children:[e.jsx("input",{"code-path":"src/pages/MetricsExplorer.tsx:180:29",type:"checkbox",className:"rounded border-slate-600 bg-slate-800 accent-blue-500",checked:c,onChange:()=>{E(a=>c?a.filter(i=>i!==r):[...a,r])}}),e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:190:29",className:"truncate",children:r})]},r)})})]},s))})]})}),e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:202:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-2",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:203:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:204:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:205:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MetricsExplorer.tsx:206:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:[g?.name||""," — 最近 1 小时"]})]}),o.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:211:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:212:19",className:"text-center",children:[e.jsx(Q,{"code-path":"src/pages/MetricsExplorer.tsx:213:21",className:"h-8 w-8 text-slate-600 mx-auto mb-2"}),"请从左侧勾选指标"]})}):p.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:218:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无数据"}):e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:222:17",className:"h-80 overflow-x-auto",children:e.jsxs("svg",{"code-path":"src/pages/MetricsExplorer.tsx:223:19",viewBox:`0 0 ${Math.max(p.length*4,400)} 300`,className:"w-full h-full min-w-[400px]",children:[[0,25,50,75,100].map(s=>e.jsx("line",{"code-path":"src/pages/MetricsExplorer.tsx:226:23",x1:"0",y1:300-s/100*260,x2:Math.max(p.length*4,400),y2:300-s/100*260,stroke:"#1e293b",strokeDasharray:"3 3"},s)),o.map((s,t)=>{const r=p.map((a,i)=>({x:i*4+2,y:300-(d[a][s]??0)/$*260})).filter(a=>d[p[Math.round((a.x-2)/4)]]?.[s]!=null);if(r.length<2)return null;const c=r.map((a,i)=>`${i===0?"M":"L"}${a.x} ${a.y}`).join(" ");return e.jsx("g",{"code-path":"src/pages/MetricsExplorer.tsx:236:25",children:e.jsx("path",{"code-path":"src/pages/MetricsExplorer.tsx:237:27",d:c,fill:"none",stroke:h[t%h.length],strokeWidth:"1.5"})},s)}),p.filter((s,t)=>t%15===0).map((s,t)=>e.jsx("text",{"code-path":"src/pages/MetricsExplorer.tsx:243:23",x:t*60+2,y:"295",fill:"#475569",fontSize:"9",children:new Date(s*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})},s))]})}),o.length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:252:17",className:"flex flex-wrap gap-3 mt-3",children:o.map((s,t)=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:254:21",className:"flex items-center gap-1.5 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:255:23",className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:h[t%h.length]}}),s]},s))})]})})]}):e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:152:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:153:11",className:"p-12 text-center",children:[e.jsx(K,{"code-path":"src/pages/MetricsExplorer.tsx:154:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:155:13",className:"text-[var(--dg-text-muted)]",children:"请先选择监控目标,然后勾选要查看的指标"})]})}),g&&Object.keys(g.latest_metrics||{}).length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:268:9",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:Object.entries(g.latest_metrics).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:270:13",className:"bg-[var(--dg-bg-secondary)] rounded-lg p-3 border border-[var(--dg-border)] text-center",children:[e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:271:15",className:"text-[10px] text-[var(--dg-text-muted)] truncate",children:s}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:272:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:typeof t=="number"?t.toFixed(1):"--"})]},s))})]})}export{ce as MetricsExplorer,ce as default}; diff --git a/backend/static/assets/MonitorCenter-btGjdSNo.js b/backend/static/assets/MonitorCenter-DZJmSfOk.js similarity index 98% rename from backend/static/assets/MonitorCenter-btGjdSNo.js rename to backend/static/assets/MonitorCenter-DZJmSfOk.js index 4027660..0f36393 100644 --- a/backend/static/assets/MonitorCenter-btGjdSNo.js +++ b/backend/static/assets/MonitorCenter-DZJmSfOk.js @@ -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,{"code-path":"src/pages/MiddlewareMonitor.tsx:140:15",label:"连接数",value:F(c.redis_connected_clients)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:144:15",label:"内存",value:Fe(c.redis_used_memory)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:148:15",label:"命中率",value:E(c.redis_hit_rate)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:152:15",label:"QPS",value:F(c.redis_qps,0)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:137:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 Redis 连接地址和密码后启用采集。"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:162:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:163:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:164:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(ee,{"code-path":"src/pages/MiddlewareMonitor.tsx:165:13",className:"h-4 w-4 text-blue-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:166:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"MySQL 监控"}),m&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:168:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[m.name," (",m.ip,")"]})]}),m?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:176:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:177:15",label:"连接数",value:F(S.mysql_connections)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:181:15",label:"QPS",value:F(S.mysql_qps,1)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:185:15",label:"慢查询",value:F(S.mysql_slow_queries)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:189:15",label:"缓冲池命中率",value:E(S.mysql_buffer_hit_rate)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:174:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 MySQL 连接地址、用户名和密码后启用采集。"})]})}),t.length>0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:200:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:201:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:202:13",className:"flex items-center gap-2 mb-4",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:203:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:204:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["中间件实例(",t.length,")"]})]}),e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:208:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(r=>e.jsx(He,{"code-path":"src/pages/MiddlewareMonitor.tsx:210:17",target:r},r.id))})]})}),t.filter(r=>!b.includes(r)&&!o.includes(r)).length>0&&e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:219:9",className:"space-y-4",children:t.filter(r=>!b.includes(r)&&!o.includes(r)).map(r=>e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:223:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:224:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:225:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(Se,{"code-path":"src/pages/MiddlewareMonitor.tsx:226:21",className:`h-3 w-3 ${ke(r.status)}`}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:227:21",className:"text-sm font-medium text-[var(--dg-text-primary)] capitalize",children:r.type}),e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:228:21",variant:"outline",className:"text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[r.name," (",r.ip,")"]})]}),Object.keys(r.latest_metrics||{}).length>0?e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:233:21",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(r.latest_metrics).map(([g,D])=>e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:235:25",label:g,value:F(D,1)},g))}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:239:21",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无指标数据"})]})},r.id))})]})}function f({label:t,value:n}){return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:253:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:254:7",className:"text-xs text-[var(--dg-text-muted)]",children:t}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:255:7",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:n})]})}function He({target:t}){const n=t.latest_metrics||{},d=Object.keys(n).length;return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:266:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 border border-[var(--dg-border)] hover:border-[var(--dg-border)]/80 transition-colors",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:267:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:268:9",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:269:11",className:`inline-block w-2 h-2 rounded-full ${Ie(t.status)}`}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:270:11",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:t.name})]}),e.jsx(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:272:9",variant:"outline",className:`text-[10px] capitalize ${t.status==="online"?"border-emerald-400/50 text-emerald-400":"border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,children:t.status})]}),e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:279:7",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:[t.ip," · ",t.type]}),d>0?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:283:9",className:"flex flex-wrap gap-1.5",children:[Object.entries(n).slice(0,4).map(([N,v])=>e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:285:13",className:"inline-flex items-center gap-1 text-[10px] bg-[var(--dg-bg-primary)] rounded px-1.5 py-0.5 text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:286:15",className:"text-[var(--dg-text-muted)]",children:N}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:287:15",className:"font-mono font-medium text-[var(--dg-text-primary)]",children:typeof v=="number"?v.toFixed(1):v})]},N)),d>4&&e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:293:13",className:"text-[10px] text-[var(--dg-text-muted)]",children:["+",d-4," 项"]})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:297:9",className:"text-[10px] text-[var(--dg-text-muted)]",children:"暂无指标"})]})}const G={name:"",ip:"",port:161,snmp_version:"v2c",community:"public",template_id:""};function $e(){const[t,n]=i.useState({total:0,online:0,abnormal:0}),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState({...G}),[c,m]=i.useState(!1),S=i.useCallback(async()=>{try{const a=await H.getStats();n(a)}catch{}},[]),r=i.useCallback(async()=>{try{const a=await H.getDevices();N(a.list??[])}catch{N([])}finally{_(!1)}},[]),g=i.useCallback(()=>{S(),r()},[S,r]);i.useEffect(()=>{g()},[g]);const D=async()=>{if(!(!o.name.trim()||!o.ip.trim())){m(!0);try{await H.createDevice({name:o.name.trim(),ip:o.ip.trim(),port:Number(o.port),snmp_version:o.snmp_version,community:o.community.trim(),template_id:o.template_id?Number(o.template_id):0}),b(!1),x({...G}),g()}catch{}finally{m(!1)}}},q=async a=>{try{await H.deleteDevice(a),g()}catch{}},P=a=>a==="online"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:146:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"在线"}):a==="abnormal"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:149:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"}):e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:151:12",className:"bg-slate-500/15 text-slate-400 border-slate-500/30",children:"离线"});return e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:158:7",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:159:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:160:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:161:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:162:15",className:"h-4 w-4 text-cyan-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:163:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"网络设备"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:165:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"交换机 / 路由器 / 防火墙"}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:166:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:167:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:168:17",className:"text-[var(--dg-text-muted)]",children:"设备总数"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:169:17",className:"text-[var(--dg-text-primary)] font-mono",children:t.total})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:171:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:172:17",className:"text-[var(--dg-text-muted)]",children:"在线"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:173:17",className:"text-emerald-400 font-mono",children:t.online})]})]})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:179:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:180:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:181:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{"code-path":"src/pages/SNMPMonitor.tsx:182:15",className:"h-4 w-4 text-purple-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:183:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"服务器硬件"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:185:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"iLO / iDRAC / IPMI"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:186:13",className:"space-y-2",children:e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:187:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:188:17",className:"text-[var(--dg-text-muted)]",children:"异常"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:189:17",className:"text-red-400 font-mono",children:t.abnormal})]})})]})})]}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:197:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:198:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:199:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(te,{"code-path":"src/pages/SNMPMonitor.tsx:200:13",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:201:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"OID 监控模板"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:203:11",className:"text-sm text-[var(--dg-text-muted)]",children:"支持 Zabbix 兼容的 SNMP OID 模板(XML 格式),内置思科/H3C/华为交换机模板、服务器硬件监控模板。"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:206:11",className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-2 text-xs text-[var(--dg-text-secondary)]",children:["思科交换机","H3C S5000","华为交换机","iLO/Dell"].map(a=>e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:208:15",className:"bg-[var(--dg-bg-tertiary)] rounded px-2 py-1 text-center border border-[var(--dg-border)]",children:a},a))})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:220:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:221:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:222:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:223:13",className:"flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:224:15",className:"h-4 w-4 text-cyan-400"}),e.jsxs("h3",{"code-path":"src/pages/SNMPMonitor.tsx:225:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["SNMP 设备列表",!v&&e.jsxs("span",{"code-path":"src/pages/SNMPMonitor.tsx:228:19",className:"ml-2 text-xs text-[var(--dg-text-muted)] font-normal",children:["(",d.length," 台)"]})]})]}),e.jsxs(X,{"code-path":"src/pages/SNMPMonitor.tsx:236:13",open:T,onOpenChange:b,children:[e.jsx(ue,{"code-path":"src/pages/SNMPMonitor.tsx:237:15",asChild:!0,children:e.jsxs(w,{"code-path":"src/pages/SNMPMonitor.tsx:238:17",size:"sm",className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:[e.jsx(se,{"code-path":"src/pages/SNMPMonitor.tsx:239:19",className:"h-4 w-4"}),"添加设备"]})}),e.jsxs(J,{"code-path":"src/pages/SNMPMonitor.tsx:243:15",className:"bg-slate-900 border-[var(--dg-border)] text-[var(--dg-text-primary)] sm:max-w-md",children:[e.jsxs(K,{"code-path":"src/pages/SNMPMonitor.tsx:244:17",children:[e.jsx(W,{"code-path":"src/pages/SNMPMonitor.tsx:245:19",className:"text-[var(--dg-text-primary)]",children:"添加 SNMP 设备"}),e.jsx(Y,{"code-path":"src/pages/SNMPMonitor.tsx:246:19",className:"text-[var(--dg-text-muted)]",children:"输入设备信息以开始 SNMP 监控采集。"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:251:17",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:253:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:254:21",htmlFor:"snmp-name",className:"text-[var(--dg-text-muted)]",children:"设备名称"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:257:21",id:"snmp-name",placeholder:"例如: 核心交换机",value:o.name,onChange:a=>x({...o,name:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:267:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:268:21",htmlFor:"snmp-ip",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:271:21",id:"snmp-ip",placeholder:"例如: 192.168.1.1",value:o.ip,onChange:a=>x({...o,ip:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:281:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:282:21",htmlFor:"snmp-port",className:"text-[var(--dg-text-muted)]",children:"SNMP 端口"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:285:21",id:"snmp-port",type:"number",placeholder:"161",value:o.port,onChange:a=>x({...o,port:Number(a.target.value)||161}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:296:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:297:21",htmlFor:"snmp-version",className:"text-[var(--dg-text-muted)]",children:"SNMP 版本"}),e.jsxs(re,{"code-path":"src/pages/SNMPMonitor.tsx:300:21",value:o.snmp_version,onValueChange:a=>x({...o,snmp_version:a}),children:[e.jsx(oe,{"code-path":"src/pages/SNMPMonitor.tsx:304:23",id:"snmp-version",className:"w-full bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(ce,{"code-path":"src/pages/SNMPMonitor.tsx:308:25"})}),e.jsxs(de,{"code-path":"src/pages/SNMPMonitor.tsx:310:23",className:"bg-slate-800 border-slate-700 text-slate-200",children:[e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:311:25",value:"v2c",children:"v2c"}),e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:312:25",value:"v3",children:"v3"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:318:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:319:21",htmlFor:"snmp-community",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:322:21",id:"snmp-community",placeholder:"public",value:o.community,onChange:a=>x({...o,community:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:332:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:333:21",htmlFor:"snmp-template",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:336:21",id:"snmp-template",type:"number",placeholder:"模板 ID",value:o.template_id,onChange:a=>x({...o,template_id:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs(Z,{"code-path":"src/pages/SNMPMonitor.tsx:347:17",children:[e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:348:19",variant:"outline",onClick:()=>b(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] hover:bg-slate-800",children:"取消"}),e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:355:19",onClick:D,disabled:c||!o.name.trim()||!o.ip.trim(),className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:c?"添加中...":"确认添加"})]})]})]})]}),v?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:369:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)]",children:"加载中..."}):d.length===0?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:371:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无 SNMP 设备,点击「添加设备」开始监控"}):e.jsxs(ie,{"code-path":"src/pages/SNMPMonitor.tsx:375:13",children:[e.jsx(ne,{"code-path":"src/pages/SNMPMonitor.tsx:376:15",children:e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:377:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:378:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:379:19",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:380:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:381:19",className:"text-[var(--dg-text-muted)]",children:"版本"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:382:19",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:383:19",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:384:19",className:"text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:385:19",className:"text-[var(--dg-text-muted)] w-16",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SNMPMonitor.tsx:388:15",children:d.map(a=>e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:390:19",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:391:21",className:"text-[var(--dg-text-primary)] font-medium",children:a.name}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:394:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.ip}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:397:21",className:"text-[var(--dg-text-muted)]",children:a.port}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:398:21",children:e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:399:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:a.snmp_version})}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:403:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.community}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:406:21",className:"text-[var(--dg-text-muted)]",children:a.template_id||"--"}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:407:21",children:P(a.status)}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:408:21",children:e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:409:23",variant:"ghost",size:"icon-sm",onClick:()=>q(a.id),className:"text-slate-500 hover:text-red-400 hover:bg-red-500/10",title:"删除设备",children:e.jsx(ae,{"code-path":"src/pages/SNMPMonitor.tsx:416:25",className:"h-4 w-4"})})})]},a.id))})]})]})})]})}const qe=[{icon:L,name:"HTTP",color:"text-blue-400",desc:"HTTP URL 状态码 & 响应时间"},{icon:L,name:"HTTPS",color:"text-emerald-400",desc:"HTTPS SSL 证书 & 响应时间"},{icon:ee,name:"TCP",color:"text-orange-400",desc:"TCP 端口连通性检测"},{icon:L,name:"DNS",color:"text-cyan-400",desc:"域名解析延迟 & 结果验证"},{icon:fe,name:"PING",color:"text-purple-400",desc:"ICMP 连通性 & 延迟"}],Oe=["HTTP","HTTPS","TCP","DNS","PING"],Q={name:"",url:"",type:"HTTP",frequency_sec:60,timeout_sec:10,expected_status_code:200};function Re(t){switch(t){case"up":return e.jsx(_e,{"code-path":"src/pages/SiteMonitor.tsx:106:14",className:"h-4 w-4 text-emerald-400"});case"down":return e.jsx(Ce,{"code-path":"src/pages/SiteMonitor.tsx:108:14",className:"h-4 w-4 text-red-400"});default:return e.jsx(Pe,{"code-path":"src/pages/SiteMonitor.tsx:110:14",className:"h-4 w-4 text-gray-400"})}}function Be(t){switch(t){case"up":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:117:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"正常"});case"down":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:119:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"});default:return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:121:14",className:"bg-gray-500/15 text-gray-400 border-gray-500/30",children:"未知"})}}function Ae(t){return t==null||t===0?"--":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Ue(t){if(!t)return"--";const n=new Date(t),d=N=>String(N).padStart(2,"0");return`${d(n.getMonth()+1)}-${d(n.getDate())} ${d(n.getHours())}:${d(n.getMinutes())}`}function ze(){const[t,n]=i.useState(null),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState(!1),[c,m]=i.useState({...Q}),[S,r]=i.useState(!1),[g,D]=i.useState(null),q=Ne(),P=i.useCallback(async()=>{try{const s=await I.getStats();n(s)}catch{}},[]),a=i.useCallback(async()=>{b(!0);try{const s=await I.getTasks();N(s?.list||[])}catch{}finally{b(!1),_(!1)}},[]);i.useEffect(()=>{P(),a()},[P,a]);const U=g?d.filter(s=>s.type?.toUpperCase()===g.toUpperCase()):d,le=()=>{m({...Q}),x(!0)},pe=async()=>{if(!c.name.trim()||!c.url.trim()){C.error("名称和 URL 不能为空");return}r(!0);try{await I.createTask({name:c.name.trim(),url:c.url.trim(),type:c.type.toLowerCase(),frequency_sec:Number(c.frequency_sec)||60,timeout_sec:Number(c.timeout_sec)||10,expected_status_code:Number(c.expected_status_code)||200}),C.success("拨测任务已创建"),x(!1),a(),P()}catch(s){C.error(s.message||"创建失败")}finally{r(!1)}},me=async s=>{if(await q({title:"删除拨测任务",description:`确定删除「${s.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await I.deleteTask(s.id),C.success("任务已删除"),a(),P()}catch(Me){C.error(Me.message||"删除失败")}},ge=async s=>{try{await I.toggleTask(s.id,!s.enabled),C.success(s.enabled?"已停用":"已启用"),a(),P()}catch(k){C.error(k.message||"操作失败")}},he=t?.availability!=null?`${(t.availability*100).toFixed(1)}%`:"--";return v?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:249:7",className:"flex items-center justify-center py-20",children:e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:250:9",className:"h-8 w-8 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:256:5",className:"space-y-6",children:[e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:258:7",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:qe.map(s=>{const k=g===s.name;return e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:262:13",onClick:()=>D(k?null:s.name),className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] transition-colors cursor-pointer ${k?"border-[var(--dg-blue)]/60 ring-1 ring-[var(--dg-blue)]/30":"hover:border-[var(--dg-blue)]/30"}`,children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:269:15",className:"p-3 text-center",children:[e.jsx(s.icon,{"code-path":"src/pages/SiteMonitor.tsx:270:17",className:`h-5 w-5 mx-auto mb-1.5 ${s.color}`}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:271:17",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:272:17",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:s.desc})]})},s.name)})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:280:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:281:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:282:11",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:283:13",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/pages/SiteMonitor.tsx:284:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SiteMonitor.tsx:285:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"拨测任务概览"})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:287:13",size:"sm",variant:"ghost",className:"h-7 text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>{P(),a()},disabled:T,children:[e.jsx(we,{"code-path":"src/pages/SiteMonitor.tsx:294:15",className:`h-3.5 w-3.5 ${T?"animate-spin":""}`}),"刷新"]})]}),e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:298:11",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[{label:"总任务数",value:t?.total_tasks??"--"},{label:"已启用",value:t?.enabled_tasks??"--"},{label:"正常",value:t?.up_count??"--",color:"text-emerald-400"},{label:"异常",value:t?.down_count??"--",color:"text-red-400"},{label:"可用率",value:he,color:"text-blue-400"}].map(s=>e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:306:15",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:307:17",className:"text-xs text-[var(--dg-text-muted)]",children:s.label}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:308:17",className:`text-lg font-bold ${s.color||"text-[var(--dg-text-primary)]"}`,children:s.value})]},s.label))})]})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:318:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:319:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:320:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:321:13",className:"flex items-center gap-2",children:[e.jsx(R,{"code-path":"src/pages/SiteMonitor.tsx:322:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/SiteMonitor.tsx:323:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["拨测任务列表",g&&e.jsxs(u,{"code-path":"src/pages/SiteMonitor.tsx:326:19",variant:"outline",className:"ml-2 text-[10px] cursor-pointer border-[var(--dg-blue)]/40 text-[var(--dg-blue)] h-5",onClick:()=>D(null),children:[g," ×"]})]})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:336:13",size:"sm",className:"h-8 gap-1.5",onClick:le,children:[e.jsx(se,{"code-path":"src/pages/SiteMonitor.tsx:341:15",className:"h-3.5 w-3.5"}),"添加任务"]})]}),U.length===0?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:347:13",className:"text-center py-12 text-sm text-[var(--dg-text-muted)]",children:d.length===0?"暂无拨测任务,点击「添加任务」创建第一个":"当前筛选条件下无任务"}):e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:353:13",className:"overflow-x-auto",children:e.jsxs(ie,{"code-path":"src/pages/SiteMonitor.tsx:354:15",children:[e.jsx(ne,{"code-path":"src/pages/SiteMonitor.tsx:355:17",children:e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:356:19",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:358:21",className:"text-xs text-[var(--dg-text-muted)]",children:"URL"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:359:21",className:"text-xs text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:360:21",className:"text-xs text-[var(--dg-text-muted)]",children:"间隔"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:361:21",className:"text-xs text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:362:21",className:"text-xs text-[var(--dg-text-muted)]",children:"延迟"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:363:21",className:"text-xs text-[var(--dg-text-muted)]",children:"上次检测"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:364:21",className:"text-xs text-[var(--dg-text-muted)]",children:"启用"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:365:21",className:"text-xs text-[var(--dg-text-muted)]",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SiteMonitor.tsx:368:17",children:U.map(s=>e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:370:21",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:371:23",className:"text-sm text-[var(--dg-text-primary)] font-medium",children:s.name}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:374:23",className:"text-sm text-[var(--dg-text-muted)] max-w-[200px] truncate",children:s.url}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:377:23",children:e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:378:25",variant:"outline",className:"text-[11px] border-[var(--dg-border)]",children:s.type?.toUpperCase()})}),e.jsxs(p,{"code-path":"src/pages/SiteMonitor.tsx:382:23",className:"text-sm text-[var(--dg-text-muted)]",children:[s.frequency_sec,"s"]}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:385:23",children:e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:386:25",className:"flex items-center gap-1.5",children:[Re(s.last_status),e.jsx("span",{"code-path":"src/pages/SiteMonitor.tsx:388:27",className:"text-sm text-[var(--dg-text-muted)]",children:Be(s.last_status)})]})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:393:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ae(s.last_response_time_ms)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:396:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ue(s.last_checked_at)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:399:23",children:e.jsx(De,{"code-path":"src/pages/SiteMonitor.tsx:400:25",checked:s.enabled,onCheckedChange:()=>ge(s)})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:405:23",children:e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:406:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>me(s),children:e.jsx(ae,{"code-path":"src/pages/SiteMonitor.tsx:412:27",className:"h-4 w-4"})})})]},s.id))})]})})]})}),e.jsx(X,{"code-path":"src/pages/SiteMonitor.tsx:425:7",open:o,onOpenChange:x,children:e.jsxs(J,{"code-path":"src/pages/SiteMonitor.tsx:426:9",className:"sm:max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(K,{"code-path":"src/pages/SiteMonitor.tsx:427:11",children:[e.jsx(W,{"code-path":"src/pages/SiteMonitor.tsx:428:13",children:"添加拨测任务"}),e.jsx(Y,{"code-path":"src/pages/SiteMonitor.tsx:429:13",className:"text-[var(--dg-text-muted)]",children:"配置站点探活任务,系统将按指定频率自动检测"})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:434:11",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:436:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:437:15",htmlFor:"task-name",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:438:15",id:"task-name",placeholder:"例如:官网首页检测",value:c.name,onChange:s=>m({...c,name:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:447:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:448:15",htmlFor:"task-url",className:"text-[var(--dg-text-primary)]",children:"目标 URL"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:449:15",id:"task-url",placeholder:"例如:https://example.com 或 192.168.1.1",value:c.url,onChange:s=>m({...c,url:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:458:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:459:15",className:"text-[var(--dg-text-primary)]",children:"协议类型"}),e.jsxs(re,{"code-path":"src/pages/SiteMonitor.tsx:460:15",value:c.type,onValueChange:s=>m({...c,type:s}),children:[e.jsx(oe,{"code-path":"src/pages/SiteMonitor.tsx:464:17",children:e.jsx(ce,{"code-path":"src/pages/SiteMonitor.tsx:465:19"})}),e.jsx(de,{"code-path":"src/pages/SiteMonitor.tsx:467:17",children:Oe.map(s=>e.jsx(A,{"code-path":"src/pages/SiteMonitor.tsx:469:21",value:s,children:s},s))})]})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:476:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:477:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:478:17",htmlFor:"freq",className:"text-[var(--dg-text-primary)]",children:"检测间隔 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:481:17",id:"freq",type:"number",min:10,max:86400,value:c.frequency_sec,onChange:s=>m({...c,frequency_sec:Number(s.target.value)||60})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:492:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:493:17",htmlFor:"timeout",className:"text-[var(--dg-text-primary)]",children:"超时 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:496:17",id:"timeout",type:"number",min:1,max:300,value:c.timeout_sec,onChange:s=>m({...c,timeout_sec:Number(s.target.value)||10})})]})]}),(c.type==="HTTP"||c.type==="HTTPS")&&e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:511:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:512:17",htmlFor:"status-code",className:"text-[var(--dg-text-primary)]",children:"期望状态码"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:515:17",id:"status-code",type:"number",min:100,max:599,value:c.expected_status_code,onChange:s=>m({...c,expected_status_code:Number(s.target.value)||200})})]})]}),e.jsxs(Z,{"code-path":"src/pages/SiteMonitor.tsx:529:11",children:[e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:530:13",variant:"outline",onClick:()=>x(!1),disabled:S,children:"取消"}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:533:13",onClick:pe,disabled:S,children:[S&&e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:534:26",className:"h-4 w-4 animate-spin mr-1"}),"创建任务"]})]})]})})]})}const V=[{id:"host",name:"主机监控",icon:Te,description:"CPU / 内存 / 磁盘 / 网络 / 磁盘IO"},{id:"middleware",name:"中间件监控",icon:B,description:"Redis / MySQL 指标采集"},{id:"snmp",name:"SNMP 监控",icon:te,description:"网络设备 / 服务器硬件 (OID 模板)"},{id:"site",name:"站点拨测",icon:L,description:"HTTP / PING / DNS / TCP / WS 拨测"}];function it(){const[t,n]=i.useState("host");return e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:30:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:31:7",children:[e.jsx("h1",{"code-path":"src/pages/MonitorCenter.tsx:32:9",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"监控中心"}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:33:9",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"全面的基础设施与应用监控"})]}),e.jsx("div",{"code-path":"src/pages/MonitorCenter.tsx:37:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)]",children:V.map(d=>e.jsxs("button",{"code-path":"src/pages/MonitorCenter.tsx:39:11",onClick:()=>n(d.id),className:ve("flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium transition-all",t===d.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(d.icon,{"code-path":"src/pages/MonitorCenter.tsx:49:13",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/pages/MonitorCenter.tsx:50:13",className:"hidden sm:inline",children:d.name})]},d.id))}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:56:7",className:"text-sm text-[var(--dg-text-muted)] -mt-4",children:V.find(d=>d.id===t)?.description}),e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:61:7",className:"min-h-[400px]",children:[t==="host"&&e.jsx(je,{"code-path":"src/pages/MonitorCenter.tsx:62:34"}),t==="middleware"&&e.jsx(Le,{"code-path":"src/pages/MonitorCenter.tsx:63:40"}),t==="snmp"&&e.jsx($e,{"code-path":"src/pages/MonitorCenter.tsx:64:34"}),t==="site"&&e.jsx(ze,{"code-path":"src/pages/MonitorCenter.tsx:65:34"})]})]})}export{it as MonitorCenter}; +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,{"code-path":"src/pages/MiddlewareMonitor.tsx:140:15",label:"连接数",value:F(c.redis_connected_clients)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:144:15",label:"内存",value:Fe(c.redis_used_memory)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:148:15",label:"命中率",value:E(c.redis_hit_rate)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:152:15",label:"QPS",value:F(c.redis_qps,0)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:137:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 Redis 连接地址和密码后启用采集。"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:162:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:163:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:164:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(ee,{"code-path":"src/pages/MiddlewareMonitor.tsx:165:13",className:"h-4 w-4 text-blue-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:166:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"MySQL 监控"}),m&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:168:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[m.name," (",m.ip,")"]})]}),m?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:176:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:177:15",label:"连接数",value:F(S.mysql_connections)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:181:15",label:"QPS",value:F(S.mysql_qps,1)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:185:15",label:"慢查询",value:F(S.mysql_slow_queries)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:189:15",label:"缓冲池命中率",value:E(S.mysql_buffer_hit_rate)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:174:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 MySQL 连接地址、用户名和密码后启用采集。"})]})}),t.length>0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:200:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:201:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:202:13",className:"flex items-center gap-2 mb-4",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:203:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:204:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["中间件实例(",t.length,")"]})]}),e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:208:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(r=>e.jsx(He,{"code-path":"src/pages/MiddlewareMonitor.tsx:210:17",target:r},r.id))})]})}),t.filter(r=>!b.includes(r)&&!o.includes(r)).length>0&&e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:219:9",className:"space-y-4",children:t.filter(r=>!b.includes(r)&&!o.includes(r)).map(r=>e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:223:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:224:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:225:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(Se,{"code-path":"src/pages/MiddlewareMonitor.tsx:226:21",className:`h-3 w-3 ${ke(r.status)}`}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:227:21",className:"text-sm font-medium text-[var(--dg-text-primary)] capitalize",children:r.type}),e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:228:21",variant:"outline",className:"text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[r.name," (",r.ip,")"]})]}),Object.keys(r.latest_metrics||{}).length>0?e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:233:21",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(r.latest_metrics).map(([g,D])=>e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:235:25",label:g,value:F(D,1)},g))}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:239:21",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无指标数据"})]})},r.id))})]})}function f({label:t,value:n}){return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:253:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:254:7",className:"text-xs text-[var(--dg-text-muted)]",children:t}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:255:7",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:n})]})}function He({target:t}){const n=t.latest_metrics||{},d=Object.keys(n).length;return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:266:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 border border-[var(--dg-border)] hover:border-[var(--dg-border)]/80 transition-colors",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:267:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:268:9",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:269:11",className:`inline-block w-2 h-2 rounded-full ${Ie(t.status)}`}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:270:11",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:t.name})]}),e.jsx(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:272:9",variant:"outline",className:`text-[10px] capitalize ${t.status==="online"?"border-emerald-400/50 text-emerald-400":"border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,children:t.status})]}),e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:279:7",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:[t.ip," · ",t.type]}),d>0?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:283:9",className:"flex flex-wrap gap-1.5",children:[Object.entries(n).slice(0,4).map(([N,v])=>e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:285:13",className:"inline-flex items-center gap-1 text-[10px] bg-[var(--dg-bg-primary)] rounded px-1.5 py-0.5 text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:286:15",className:"text-[var(--dg-text-muted)]",children:N}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:287:15",className:"font-mono font-medium text-[var(--dg-text-primary)]",children:typeof v=="number"?v.toFixed(1):v})]},N)),d>4&&e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:293:13",className:"text-[10px] text-[var(--dg-text-muted)]",children:["+",d-4," 项"]})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:297:9",className:"text-[10px] text-[var(--dg-text-muted)]",children:"暂无指标"})]})}const G={name:"",ip:"",port:161,snmp_version:"v2c",community:"public",template_id:""};function $e(){const[t,n]=i.useState({total:0,online:0,abnormal:0}),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState({...G}),[c,m]=i.useState(!1),S=i.useCallback(async()=>{try{const a=await H.getStats();n(a)}catch{}},[]),r=i.useCallback(async()=>{try{const a=await H.getDevices();N(a.list??[])}catch{N([])}finally{_(!1)}},[]),g=i.useCallback(()=>{S(),r()},[S,r]);i.useEffect(()=>{g()},[g]);const D=async()=>{if(!(!o.name.trim()||!o.ip.trim())){m(!0);try{await H.createDevice({name:o.name.trim(),ip:o.ip.trim(),port:Number(o.port),snmp_version:o.snmp_version,community:o.community.trim(),template_id:o.template_id?Number(o.template_id):0}),b(!1),x({...G}),g()}catch{}finally{m(!1)}}},q=async a=>{try{await H.deleteDevice(a),g()}catch{}},P=a=>a==="online"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:146:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"在线"}):a==="abnormal"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:149:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"}):e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:151:12",className:"bg-slate-500/15 text-slate-400 border-slate-500/30",children:"离线"});return e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:158:7",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:159:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:160:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:161:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:162:15",className:"h-4 w-4 text-cyan-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:163:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"网络设备"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:165:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"交换机 / 路由器 / 防火墙"}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:166:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:167:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:168:17",className:"text-[var(--dg-text-muted)]",children:"设备总数"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:169:17",className:"text-[var(--dg-text-primary)] font-mono",children:t.total})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:171:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:172:17",className:"text-[var(--dg-text-muted)]",children:"在线"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:173:17",className:"text-emerald-400 font-mono",children:t.online})]})]})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:179:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:180:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:181:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{"code-path":"src/pages/SNMPMonitor.tsx:182:15",className:"h-4 w-4 text-purple-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:183:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"服务器硬件"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:185:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"iLO / iDRAC / IPMI"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:186:13",className:"space-y-2",children:e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:187:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:188:17",className:"text-[var(--dg-text-muted)]",children:"异常"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:189:17",className:"text-red-400 font-mono",children:t.abnormal})]})})]})})]}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:197:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:198:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:199:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(te,{"code-path":"src/pages/SNMPMonitor.tsx:200:13",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:201:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"OID 监控模板"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:203:11",className:"text-sm text-[var(--dg-text-muted)]",children:"支持 Zabbix 兼容的 SNMP OID 模板(XML 格式),内置思科/H3C/华为交换机模板、服务器硬件监控模板。"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:206:11",className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-2 text-xs text-[var(--dg-text-secondary)]",children:["思科交换机","H3C S5000","华为交换机","iLO/Dell"].map(a=>e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:208:15",className:"bg-[var(--dg-bg-tertiary)] rounded px-2 py-1 text-center border border-[var(--dg-border)]",children:a},a))})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:220:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:221:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:222:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:223:13",className:"flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:224:15",className:"h-4 w-4 text-cyan-400"}),e.jsxs("h3",{"code-path":"src/pages/SNMPMonitor.tsx:225:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["SNMP 设备列表",!v&&e.jsxs("span",{"code-path":"src/pages/SNMPMonitor.tsx:228:19",className:"ml-2 text-xs text-[var(--dg-text-muted)] font-normal",children:["(",d.length," 台)"]})]})]}),e.jsxs(X,{"code-path":"src/pages/SNMPMonitor.tsx:236:13",open:T,onOpenChange:b,children:[e.jsx(ue,{"code-path":"src/pages/SNMPMonitor.tsx:237:15",asChild:!0,children:e.jsxs(w,{"code-path":"src/pages/SNMPMonitor.tsx:238:17",size:"sm",className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:[e.jsx(se,{"code-path":"src/pages/SNMPMonitor.tsx:239:19",className:"h-4 w-4"}),"添加设备"]})}),e.jsxs(J,{"code-path":"src/pages/SNMPMonitor.tsx:243:15",className:"bg-slate-900 border-[var(--dg-border)] text-[var(--dg-text-primary)] sm:max-w-md",children:[e.jsxs(K,{"code-path":"src/pages/SNMPMonitor.tsx:244:17",children:[e.jsx(W,{"code-path":"src/pages/SNMPMonitor.tsx:245:19",className:"text-[var(--dg-text-primary)]",children:"添加 SNMP 设备"}),e.jsx(Y,{"code-path":"src/pages/SNMPMonitor.tsx:246:19",className:"text-[var(--dg-text-muted)]",children:"输入设备信息以开始 SNMP 监控采集。"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:251:17",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:253:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:254:21",htmlFor:"snmp-name",className:"text-[var(--dg-text-muted)]",children:"设备名称"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:257:21",id:"snmp-name",placeholder:"例如: 核心交换机",value:o.name,onChange:a=>x({...o,name:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:267:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:268:21",htmlFor:"snmp-ip",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:271:21",id:"snmp-ip",placeholder:"例如: 192.168.1.1",value:o.ip,onChange:a=>x({...o,ip:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:281:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:282:21",htmlFor:"snmp-port",className:"text-[var(--dg-text-muted)]",children:"SNMP 端口"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:285:21",id:"snmp-port",type:"number",placeholder:"161",value:o.port,onChange:a=>x({...o,port:Number(a.target.value)||161}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:296:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:297:21",htmlFor:"snmp-version",className:"text-[var(--dg-text-muted)]",children:"SNMP 版本"}),e.jsxs(re,{"code-path":"src/pages/SNMPMonitor.tsx:300:21",value:o.snmp_version,onValueChange:a=>x({...o,snmp_version:a}),children:[e.jsx(oe,{"code-path":"src/pages/SNMPMonitor.tsx:304:23",id:"snmp-version",className:"w-full bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(ce,{"code-path":"src/pages/SNMPMonitor.tsx:308:25"})}),e.jsxs(de,{"code-path":"src/pages/SNMPMonitor.tsx:310:23",className:"bg-slate-800 border-slate-700 text-slate-200",children:[e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:311:25",value:"v2c",children:"v2c"}),e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:312:25",value:"v3",children:"v3"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:318:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:319:21",htmlFor:"snmp-community",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:322:21",id:"snmp-community",placeholder:"public",value:o.community,onChange:a=>x({...o,community:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:332:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:333:21",htmlFor:"snmp-template",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:336:21",id:"snmp-template",type:"number",placeholder:"模板 ID",value:o.template_id,onChange:a=>x({...o,template_id:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs(Z,{"code-path":"src/pages/SNMPMonitor.tsx:347:17",children:[e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:348:19",variant:"outline",onClick:()=>b(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] hover:bg-slate-800",children:"取消"}),e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:355:19",onClick:D,disabled:c||!o.name.trim()||!o.ip.trim(),className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:c?"添加中...":"确认添加"})]})]})]})]}),v?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:369:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)]",children:"加载中..."}):d.length===0?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:371:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无 SNMP 设备,点击「添加设备」开始监控"}):e.jsxs(ie,{"code-path":"src/pages/SNMPMonitor.tsx:375:13",children:[e.jsx(ne,{"code-path":"src/pages/SNMPMonitor.tsx:376:15",children:e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:377:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:378:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:379:19",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:380:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:381:19",className:"text-[var(--dg-text-muted)]",children:"版本"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:382:19",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:383:19",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:384:19",className:"text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:385:19",className:"text-[var(--dg-text-muted)] w-16",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SNMPMonitor.tsx:388:15",children:d.map(a=>e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:390:19",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:391:21",className:"text-[var(--dg-text-primary)] font-medium",children:a.name}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:394:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.ip}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:397:21",className:"text-[var(--dg-text-muted)]",children:a.port}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:398:21",children:e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:399:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:a.snmp_version})}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:403:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.community}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:406:21",className:"text-[var(--dg-text-muted)]",children:a.template_id||"--"}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:407:21",children:P(a.status)}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:408:21",children:e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:409:23",variant:"ghost",size:"icon-sm",onClick:()=>q(a.id),className:"text-slate-500 hover:text-red-400 hover:bg-red-500/10",title:"删除设备",children:e.jsx(ae,{"code-path":"src/pages/SNMPMonitor.tsx:416:25",className:"h-4 w-4"})})})]},a.id))})]})]})})]})}const qe=[{icon:L,name:"HTTP",color:"text-blue-400",desc:"HTTP URL 状态码 & 响应时间"},{icon:L,name:"HTTPS",color:"text-emerald-400",desc:"HTTPS SSL 证书 & 响应时间"},{icon:ee,name:"TCP",color:"text-orange-400",desc:"TCP 端口连通性检测"},{icon:L,name:"DNS",color:"text-cyan-400",desc:"域名解析延迟 & 结果验证"},{icon:fe,name:"PING",color:"text-purple-400",desc:"ICMP 连通性 & 延迟"}],Oe=["HTTP","HTTPS","TCP","DNS","PING"],Q={name:"",url:"",type:"HTTP",frequency_sec:60,timeout_sec:10,expected_status_code:200};function Re(t){switch(t){case"up":return e.jsx(_e,{"code-path":"src/pages/SiteMonitor.tsx:106:14",className:"h-4 w-4 text-emerald-400"});case"down":return e.jsx(Ce,{"code-path":"src/pages/SiteMonitor.tsx:108:14",className:"h-4 w-4 text-red-400"});default:return e.jsx(Pe,{"code-path":"src/pages/SiteMonitor.tsx:110:14",className:"h-4 w-4 text-gray-400"})}}function Be(t){switch(t){case"up":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:117:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"正常"});case"down":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:119:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"});default:return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:121:14",className:"bg-gray-500/15 text-gray-400 border-gray-500/30",children:"未知"})}}function Ae(t){return t==null||t===0?"--":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Ue(t){if(!t)return"--";const n=new Date(t),d=N=>String(N).padStart(2,"0");return`${d(n.getMonth()+1)}-${d(n.getDate())} ${d(n.getHours())}:${d(n.getMinutes())}`}function ze(){const[t,n]=i.useState(null),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState(!1),[c,m]=i.useState({...Q}),[S,r]=i.useState(!1),[g,D]=i.useState(null),q=Ne(),P=i.useCallback(async()=>{try{const s=await I.getStats();n(s)}catch{}},[]),a=i.useCallback(async()=>{b(!0);try{const s=await I.getTasks();N(s?.list||[])}catch{}finally{b(!1),_(!1)}},[]);i.useEffect(()=>{P(),a()},[P,a]);const U=g?d.filter(s=>s.type?.toUpperCase()===g.toUpperCase()):d,le=()=>{m({...Q}),x(!0)},pe=async()=>{if(!c.name.trim()||!c.url.trim()){C.error("名称和 URL 不能为空");return}r(!0);try{await I.createTask({name:c.name.trim(),url:c.url.trim(),type:c.type.toLowerCase(),frequency_sec:Number(c.frequency_sec)||60,timeout_sec:Number(c.timeout_sec)||10,expected_status_code:Number(c.expected_status_code)||200}),C.success("拨测任务已创建"),x(!1),a(),P()}catch(s){C.error(s.message||"创建失败")}finally{r(!1)}},me=async s=>{if(await q({title:"删除拨测任务",description:`确定删除「${s.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await I.deleteTask(s.id),C.success("任务已删除"),a(),P()}catch(Me){C.error(Me.message||"删除失败")}},ge=async s=>{try{await I.toggleTask(s.id,!s.enabled),C.success(s.enabled?"已停用":"已启用"),a(),P()}catch(k){C.error(k.message||"操作失败")}},he=t?.availability!=null?`${(t.availability*100).toFixed(1)}%`:"--";return v?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:249:7",className:"flex items-center justify-center py-20",children:e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:250:9",className:"h-8 w-8 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:256:5",className:"space-y-6",children:[e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:258:7",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:qe.map(s=>{const k=g===s.name;return e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:262:13",onClick:()=>D(k?null:s.name),className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] transition-colors cursor-pointer ${k?"border-[var(--dg-blue)]/60 ring-1 ring-[var(--dg-blue)]/30":"hover:border-[var(--dg-blue)]/30"}`,children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:269:15",className:"p-3 text-center",children:[e.jsx(s.icon,{"code-path":"src/pages/SiteMonitor.tsx:270:17",className:`h-5 w-5 mx-auto mb-1.5 ${s.color}`}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:271:17",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:272:17",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:s.desc})]})},s.name)})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:280:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:281:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:282:11",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:283:13",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/pages/SiteMonitor.tsx:284:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SiteMonitor.tsx:285:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"拨测任务概览"})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:287:13",size:"sm",variant:"ghost",className:"h-7 text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>{P(),a()},disabled:T,children:[e.jsx(we,{"code-path":"src/pages/SiteMonitor.tsx:294:15",className:`h-3.5 w-3.5 ${T?"animate-spin":""}`}),"刷新"]})]}),e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:298:11",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[{label:"总任务数",value:t?.total_tasks??"--"},{label:"已启用",value:t?.enabled_tasks??"--"},{label:"正常",value:t?.up_count??"--",color:"text-emerald-400"},{label:"异常",value:t?.down_count??"--",color:"text-red-400"},{label:"可用率",value:he,color:"text-blue-400"}].map(s=>e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:306:15",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:307:17",className:"text-xs text-[var(--dg-text-muted)]",children:s.label}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:308:17",className:`text-lg font-bold ${s.color||"text-[var(--dg-text-primary)]"}`,children:s.value})]},s.label))})]})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:318:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:319:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:320:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:321:13",className:"flex items-center gap-2",children:[e.jsx(R,{"code-path":"src/pages/SiteMonitor.tsx:322:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/SiteMonitor.tsx:323:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["拨测任务列表",g&&e.jsxs(u,{"code-path":"src/pages/SiteMonitor.tsx:326:19",variant:"outline",className:"ml-2 text-[10px] cursor-pointer border-[var(--dg-blue)]/40 text-[var(--dg-blue)] h-5",onClick:()=>D(null),children:[g," ×"]})]})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:336:13",size:"sm",className:"h-8 gap-1.5",onClick:le,children:[e.jsx(se,{"code-path":"src/pages/SiteMonitor.tsx:341:15",className:"h-3.5 w-3.5"}),"添加任务"]})]}),U.length===0?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:347:13",className:"text-center py-12 text-sm text-[var(--dg-text-muted)]",children:d.length===0?"暂无拨测任务,点击「添加任务」创建第一个":"当前筛选条件下无任务"}):e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:353:13",className:"overflow-x-auto",children:e.jsxs(ie,{"code-path":"src/pages/SiteMonitor.tsx:354:15",children:[e.jsx(ne,{"code-path":"src/pages/SiteMonitor.tsx:355:17",children:e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:356:19",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:358:21",className:"text-xs text-[var(--dg-text-muted)]",children:"URL"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:359:21",className:"text-xs text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:360:21",className:"text-xs text-[var(--dg-text-muted)]",children:"间隔"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:361:21",className:"text-xs text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:362:21",className:"text-xs text-[var(--dg-text-muted)]",children:"延迟"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:363:21",className:"text-xs text-[var(--dg-text-muted)]",children:"上次检测"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:364:21",className:"text-xs text-[var(--dg-text-muted)]",children:"启用"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:365:21",className:"text-xs text-[var(--dg-text-muted)]",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SiteMonitor.tsx:368:17",children:U.map(s=>e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:370:21",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:371:23",className:"text-sm text-[var(--dg-text-primary)] font-medium",children:s.name}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:374:23",className:"text-sm text-[var(--dg-text-muted)] max-w-[200px] truncate",children:s.url}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:377:23",children:e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:378:25",variant:"outline",className:"text-[11px] border-[var(--dg-border)]",children:s.type?.toUpperCase()})}),e.jsxs(p,{"code-path":"src/pages/SiteMonitor.tsx:382:23",className:"text-sm text-[var(--dg-text-muted)]",children:[s.frequency_sec,"s"]}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:385:23",children:e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:386:25",className:"flex items-center gap-1.5",children:[Re(s.last_status),e.jsx("span",{"code-path":"src/pages/SiteMonitor.tsx:388:27",className:"text-sm text-[var(--dg-text-muted)]",children:Be(s.last_status)})]})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:393:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ae(s.last_response_time_ms)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:396:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ue(s.last_checked_at)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:399:23",children:e.jsx(De,{"code-path":"src/pages/SiteMonitor.tsx:400:25",checked:s.enabled,onCheckedChange:()=>ge(s)})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:405:23",children:e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:406:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>me(s),children:e.jsx(ae,{"code-path":"src/pages/SiteMonitor.tsx:412:27",className:"h-4 w-4"})})})]},s.id))})]})})]})}),e.jsx(X,{"code-path":"src/pages/SiteMonitor.tsx:425:7",open:o,onOpenChange:x,children:e.jsxs(J,{"code-path":"src/pages/SiteMonitor.tsx:426:9",className:"sm:max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(K,{"code-path":"src/pages/SiteMonitor.tsx:427:11",children:[e.jsx(W,{"code-path":"src/pages/SiteMonitor.tsx:428:13",children:"添加拨测任务"}),e.jsx(Y,{"code-path":"src/pages/SiteMonitor.tsx:429:13",className:"text-[var(--dg-text-muted)]",children:"配置站点探活任务,系统将按指定频率自动检测"})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:434:11",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:436:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:437:15",htmlFor:"task-name",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:438:15",id:"task-name",placeholder:"例如:官网首页检测",value:c.name,onChange:s=>m({...c,name:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:447:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:448:15",htmlFor:"task-url",className:"text-[var(--dg-text-primary)]",children:"目标 URL"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:449:15",id:"task-url",placeholder:"例如:https://example.com 或 192.168.1.1",value:c.url,onChange:s=>m({...c,url:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:458:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:459:15",className:"text-[var(--dg-text-primary)]",children:"协议类型"}),e.jsxs(re,{"code-path":"src/pages/SiteMonitor.tsx:460:15",value:c.type,onValueChange:s=>m({...c,type:s}),children:[e.jsx(oe,{"code-path":"src/pages/SiteMonitor.tsx:464:17",children:e.jsx(ce,{"code-path":"src/pages/SiteMonitor.tsx:465:19"})}),e.jsx(de,{"code-path":"src/pages/SiteMonitor.tsx:467:17",children:Oe.map(s=>e.jsx(A,{"code-path":"src/pages/SiteMonitor.tsx:469:21",value:s,children:s},s))})]})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:476:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:477:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:478:17",htmlFor:"freq",className:"text-[var(--dg-text-primary)]",children:"检测间隔 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:481:17",id:"freq",type:"number",min:10,max:86400,value:c.frequency_sec,onChange:s=>m({...c,frequency_sec:Number(s.target.value)||60})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:492:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:493:17",htmlFor:"timeout",className:"text-[var(--dg-text-primary)]",children:"超时 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:496:17",id:"timeout",type:"number",min:1,max:300,value:c.timeout_sec,onChange:s=>m({...c,timeout_sec:Number(s.target.value)||10})})]})]}),(c.type==="HTTP"||c.type==="HTTPS")&&e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:511:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:512:17",htmlFor:"status-code",className:"text-[var(--dg-text-primary)]",children:"期望状态码"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:515:17",id:"status-code",type:"number",min:100,max:599,value:c.expected_status_code,onChange:s=>m({...c,expected_status_code:Number(s.target.value)||200})})]})]}),e.jsxs(Z,{"code-path":"src/pages/SiteMonitor.tsx:529:11",children:[e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:530:13",variant:"outline",onClick:()=>x(!1),disabled:S,children:"取消"}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:533:13",onClick:pe,disabled:S,children:[S&&e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:534:26",className:"h-4 w-4 animate-spin mr-1"}),"创建任务"]})]})]})})]})}const V=[{id:"host",name:"主机监控",icon:Te,description:"CPU / 内存 / 磁盘 / 网络 / 磁盘IO"},{id:"middleware",name:"中间件监控",icon:B,description:"Redis / MySQL 指标采集"},{id:"snmp",name:"SNMP 监控",icon:te,description:"网络设备 / 服务器硬件 (OID 模板)"},{id:"site",name:"站点拨测",icon:L,description:"HTTP / PING / DNS / TCP / WS 拨测"}];function it(){const[t,n]=i.useState("host");return e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:30:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:31:7",children:[e.jsx("h1",{"code-path":"src/pages/MonitorCenter.tsx:32:9",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"监控中心"}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:33:9",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"全面的基础设施与应用监控"})]}),e.jsx("div",{"code-path":"src/pages/MonitorCenter.tsx:37:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)]",children:V.map(d=>e.jsxs("button",{"code-path":"src/pages/MonitorCenter.tsx:39:11",onClick:()=>n(d.id),className:ve("flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium transition-all",t===d.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(d.icon,{"code-path":"src/pages/MonitorCenter.tsx:49:13",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/pages/MonitorCenter.tsx:50:13",className:"hidden sm:inline",children:d.name})]},d.id))}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:56:7",className:"text-sm text-[var(--dg-text-muted)] -mt-4",children:V.find(d=>d.id===t)?.description}),e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:61:7",className:"min-h-[400px]",children:[t==="host"&&e.jsx(je,{"code-path":"src/pages/MonitorCenter.tsx:62:34"}),t==="middleware"&&e.jsx(Le,{"code-path":"src/pages/MonitorCenter.tsx:63:40"}),t==="snmp"&&e.jsx($e,{"code-path":"src/pages/MonitorCenter.tsx:64:34"}),t==="site"&&e.jsx(ze,{"code-path":"src/pages/MonitorCenter.tsx:65:34"})]})]})}export{it as MonitorCenter}; diff --git a/backend/static/assets/NamespaceManagementPage-0VnYV9GN.js b/backend/static/assets/NamespaceManagementPage-BuGcKQSw.js similarity index 98% rename from backend/static/assets/NamespaceManagementPage-0VnYV9GN.js rename to backend/static/assets/NamespaceManagementPage-BuGcKQSw.js index a2dce7c..7ae2a87 100644 --- a/backend/static/assets/NamespaceManagementPage-0VnYV9GN.js +++ b/backend/static/assets/NamespaceManagementPage-BuGcKQSw.js @@ -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":"src/components/kubernetes/NamespaceManagementPage.tsx:145:19",children:"命名空间名称"}),e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:146:19",value:d,onChange:s=>y(s.target.value),placeholder:"例如: my-app",onKeyDown:s=>s.key==="Enter"&&D()}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:152:19",className:"text-xs text-slate-500",children:"名称需符合 DNS-1123 标准(小写字母/数字/连字符)"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:157:15",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:158:17",variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:159:17",onClick:D,disabled:v||!d.trim(),children:[v?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:160:31",className:"h-4 w-4 animate-spin mr-1"}):null,"创建"]})]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:170:7",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:171:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:172:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:18",className:"text-xs text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:64",className:"text-xl font-bold text-emerald-400",children:o.length})]}),e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:174:13",className:"h-6 w-6 opacity-30 text-emerald-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:177:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:178:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:18",className:"text-xs text-slate-500",children:"Deployments"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:71",className:"text-xl font-bold text-blue-400",children:G})]}),e.jsx(oe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:180:13",className:"h-6 w-6 opacity-30 text-blue-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:183:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:184:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:18",className:"text-xs text-slate-500",children:"Pods"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:64",className:"text-xl font-bold text-purple-400",children:U})]}),e.jsx(pe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:186:13",className:"h-6 w-6 opacity-30 text-purple-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:189:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:190:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:18",className:"text-xs text-slate-500",children:"Services"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:68",className:"text-xl font-bold text-cyan-400",children:V})]}),e.jsx(le,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:192:13",className:"h-6 w-6 opacity-30 text-cyan-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:195:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:196:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:18",className:"text-xs text-slate-500",children:"配额限制"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:64",className:"text-xl font-bold text-amber-400",children:W})]}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:198:13",className:"h-6 w-6 opacity-30 text-amber-400"})]})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:204:7",className:"flex items-center gap-3",children:e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:205:9",value:b,onChange:s=>J(s.target.value),placeholder:"搜索命名空间...",className:"max-w-xs bg-slate-900 border-slate-700"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:214:7",className:"bg-slate-900 border-slate-800",children:e.jsx(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:215:9",className:"p-0",children:e.jsxs(te,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:216:11",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:217:13",children:e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:218:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:219:17",className:"text-slate-400",children:"名称"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:220:17",className:"text-slate-400",children:"状态"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:221:17",className:"text-slate-400",children:"年龄"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:222:17",className:"text-slate-400 text-center",children:"Deploy"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:223:17",className:"text-slate-400 text-center",children:"Pods"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:224:17",className:"text-slate-400 text-center",children:"Svc"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:225:17",className:"text-slate-400 text-center",children:"配额"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:226:17",className:"text-slate-400",children:"标签"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:227:17",className:"text-slate-400 text-center",children:"操作"})]})}),e.jsx(ce,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:230:13",children:u?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:233:19",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):T.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:237:19",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无命名空间"]})}):T.map(s=>{const r=ge.has(s.name);return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:243:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:244:23",className:"font-medium",children:e.jsx("button",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:245:25",className:"text-blue-400 hover:text-blue-300 hover:underline text-left",onClick:()=>F(`/kubernetes/${t}/namespace/${s.name}`),children:s.name})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:252:23",children:e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:253:25",className:s.status==="Active"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:[s.status==="Active"?e.jsx(xe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:53",className:"h-3 w-3 mr-1"}):e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:97",className:"h-3 w-3 mr-1"}),s.status]})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:258:23",className:"text-sm text-slate-400",children:s.age}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:259:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.deployments??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:260:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.pods??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:261:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.services??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:262:23",className:"text-center",children:s.has_resource_quota?e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:264:27",className:"bg-amber-500/20 text-amber-400",title:JSON.stringify(s.resource_quotas?.[0]?.status),children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:265:29",className:"h-3 w-3 mr-1"}),"有"]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:268:27",className:"text-xs text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:271:23",className:"text-xs",children:s.labels&&Object.keys(s.labels).length>0?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:273:27",className:"flex flex-wrap gap-1 max-w-[200px]",children:[Object.entries(s.labels).slice(0,3).map(([_,X])=>e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:275:31",className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:[_,"=",X]},_)),Object.keys(s.labels).length>3&&e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:278:31",className:"text-slate-600",children:["+",Object.keys(s.labels).length-3]})]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:282:27",className:"text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:285:23",className:"text-center",children:r?e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:287:27",className:"text-xs text-slate-600",children:"系统"}):e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:289:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>h(s.name),title:"删除命名空间",children:e.jsx(de,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:295:29",className:"h-3.5 w-3.5"})})})]},s.name)})})]})})}),e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:309:7",open:!!g,onOpenChange:s=>!s&&h(null),children:e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:310:9",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:311:11",children:e.jsxs(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:312:13",className:"text-red-400 flex items-center gap-2",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:313:15",className:"h-5 w-5"}),"删除命名空间"]})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:316:11",className:"space-y-3 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:317:13",className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:318:15",className:"text-sm text-red-300",children:["⚠️ 即将删除命名空间 ",e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:319:29",className:"font-bold",children:g})," 及其中所有资源。"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:321:15",className:"text-xs text-red-400/70 mt-1",children:"此操作不可逆,所有 Deployment/Pod/Service/ConfigMap 等资源将被永久删除。"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:326:11",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:327:13",variant:"outline",onClick:()=>h(null),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:328:13",variant:"destructive",onClick:Y,disabled:C,children:[C?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:329:27",className:"h-4 w-4 animate-spin mr-1"}):null,"确认删除"]})]})]})})]})}export{fe as default}; +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":"src/components/kubernetes/NamespaceManagementPage.tsx:145:19",children:"命名空间名称"}),e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:146:19",value:d,onChange:s=>y(s.target.value),placeholder:"例如: my-app",onKeyDown:s=>s.key==="Enter"&&D()}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:152:19",className:"text-xs text-slate-500",children:"名称需符合 DNS-1123 标准(小写字母/数字/连字符)"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:157:15",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:158:17",variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:159:17",onClick:D,disabled:v||!d.trim(),children:[v?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:160:31",className:"h-4 w-4 animate-spin mr-1"}):null,"创建"]})]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:170:7",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:171:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:172:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:18",className:"text-xs text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:64",className:"text-xl font-bold text-emerald-400",children:o.length})]}),e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:174:13",className:"h-6 w-6 opacity-30 text-emerald-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:177:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:178:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:18",className:"text-xs text-slate-500",children:"Deployments"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:71",className:"text-xl font-bold text-blue-400",children:G})]}),e.jsx(oe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:180:13",className:"h-6 w-6 opacity-30 text-blue-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:183:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:184:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:18",className:"text-xs text-slate-500",children:"Pods"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:64",className:"text-xl font-bold text-purple-400",children:U})]}),e.jsx(pe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:186:13",className:"h-6 w-6 opacity-30 text-purple-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:189:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:190:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:18",className:"text-xs text-slate-500",children:"Services"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:68",className:"text-xl font-bold text-cyan-400",children:V})]}),e.jsx(le,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:192:13",className:"h-6 w-6 opacity-30 text-cyan-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:195:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:196:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:18",className:"text-xs text-slate-500",children:"配额限制"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:64",className:"text-xl font-bold text-amber-400",children:W})]}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:198:13",className:"h-6 w-6 opacity-30 text-amber-400"})]})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:204:7",className:"flex items-center gap-3",children:e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:205:9",value:b,onChange:s=>J(s.target.value),placeholder:"搜索命名空间...",className:"max-w-xs bg-slate-900 border-slate-700"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:214:7",className:"bg-slate-900 border-slate-800",children:e.jsx(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:215:9",className:"p-0",children:e.jsxs(te,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:216:11",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:217:13",children:e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:218:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:219:17",className:"text-slate-400",children:"名称"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:220:17",className:"text-slate-400",children:"状态"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:221:17",className:"text-slate-400",children:"年龄"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:222:17",className:"text-slate-400 text-center",children:"Deploy"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:223:17",className:"text-slate-400 text-center",children:"Pods"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:224:17",className:"text-slate-400 text-center",children:"Svc"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:225:17",className:"text-slate-400 text-center",children:"配额"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:226:17",className:"text-slate-400",children:"标签"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:227:17",className:"text-slate-400 text-center",children:"操作"})]})}),e.jsx(ce,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:230:13",children:u?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:233:19",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):T.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:237:19",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无命名空间"]})}):T.map(s=>{const r=ge.has(s.name);return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:243:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:244:23",className:"font-medium",children:e.jsx("button",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:245:25",className:"text-blue-400 hover:text-blue-300 hover:underline text-left",onClick:()=>F(`/kubernetes/${t}/namespace/${s.name}`),children:s.name})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:252:23",children:e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:253:25",className:s.status==="Active"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:[s.status==="Active"?e.jsx(xe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:53",className:"h-3 w-3 mr-1"}):e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:97",className:"h-3 w-3 mr-1"}),s.status]})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:258:23",className:"text-sm text-slate-400",children:s.age}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:259:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.deployments??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:260:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.pods??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:261:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.services??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:262:23",className:"text-center",children:s.has_resource_quota?e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:264:27",className:"bg-amber-500/20 text-amber-400",title:JSON.stringify(s.resource_quotas?.[0]?.status),children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:265:29",className:"h-3 w-3 mr-1"}),"有"]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:268:27",className:"text-xs text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:271:23",className:"text-xs",children:s.labels&&Object.keys(s.labels).length>0?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:273:27",className:"flex flex-wrap gap-1 max-w-[200px]",children:[Object.entries(s.labels).slice(0,3).map(([_,X])=>e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:275:31",className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:[_,"=",X]},_)),Object.keys(s.labels).length>3&&e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:278:31",className:"text-slate-600",children:["+",Object.keys(s.labels).length-3]})]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:282:27",className:"text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:285:23",className:"text-center",children:r?e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:287:27",className:"text-xs text-slate-600",children:"系统"}):e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:289:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>h(s.name),title:"删除命名空间",children:e.jsx(de,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:295:29",className:"h-3.5 w-3.5"})})})]},s.name)})})]})})}),e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:309:7",open:!!g,onOpenChange:s=>!s&&h(null),children:e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:310:9",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:311:11",children:e.jsxs(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:312:13",className:"text-red-400 flex items-center gap-2",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:313:15",className:"h-5 w-5"}),"删除命名空间"]})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:316:11",className:"space-y-3 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:317:13",className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:318:15",className:"text-sm text-red-300",children:["⚠️ 即将删除命名空间 ",e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:319:29",className:"font-bold",children:g})," 及其中所有资源。"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:321:15",className:"text-xs text-red-400/70 mt-1",children:"此操作不可逆,所有 Deployment/Pod/Service/ConfigMap 等资源将被永久删除。"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:326:11",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:327:13",variant:"outline",onClick:()=>h(null),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:328:13",variant:"destructive",onClick:Y,disabled:C,children:[C?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:329:27",className:"h-4 w-4 animate-spin mr-1"}):null,"确认删除"]})]})]})})]})}export{fe as default}; diff --git a/backend/static/assets/NamespaceOverviewPage-4pfBO49u.js b/backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js similarity index 97% rename from backend/static/assets/NamespaceOverviewPage-4pfBO49u.js rename to backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js index fcae151..9f7a5f5 100644 --- a/backend/static/assets/NamespaceOverviewPage-4pfBO49u.js +++ b/backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js @@ -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}; diff --git a/backend/static/assets/NamespaceResourcePage-C3E7L6GV.js b/backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js similarity index 98% rename from backend/static/assets/NamespaceResourcePage-C3E7L6GV.js rename to backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js index 2241c44..3189e80 100644 --- a/backend/static/assets/NamespaceResourcePage-C3E7L6GV.js +++ b/backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js @@ -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 工作负载运行状态",icon:C,columns:["名称","命名空间","副本","镜像","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:55:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:56:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:58:9",children:(()=>{const o=s.ready_replicas||0,r=s.replicas||0,n=r>0?o/r*100:0,x=o===r;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:63:15",className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:64:17",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:65:19",className:`h-full rounded-full ${x?"bg-emerald-500":"bg-yellow-500"}`,style:{width:`${n}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:67:17",className:`text-xs ${x?"text-emerald-400":"text-yellow-400"}`,children:[o,"/",r]})]})})()}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:72:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:73:9",onClick:o=>o.stopPropagation(),children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:74:11",className:"flex items-center gap-0.5",children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:75:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:76:53",className:"h-3.5 w-3.5"})})})})]},s.name)},pods:{title:"Pods",subtitle:"Pod 实例运行状态",icon:$e,columns:["名称","命名空间","状态","节点","CPU","内存","重启","镜像","操作"],renderRow:(s,a)=>{const o={Running:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",Pending:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",Failed:"bg-red-500/20 text-red-400 border-red-500/30"};return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:88:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:89:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:22",className:o[s.status]||"bg-slate-500/20 text-slate-400",children:s.status||"Unknown"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:92:11",className:"text-sm text-slate-400",children:s.node_name||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:93:11",className:"text-sm text-cyan-400",children:s.cpu_usage_m||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:94:11",className:"text-sm text-amber-400",children:s.mem_usage_mi||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:95:11",className:s.restart_count>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:96:11",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:97:11",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:98:13",className:"flex items-center gap-1",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:99:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",title:"终端",onClick:()=>a.onTerminal?.(s),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:100:79",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:101:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",title:"文件浏览器",onClick:()=>a.onFileBrowser?.(s),children:[e.jsx(Le,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:102:82",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:103:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:104:55",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})})]},s.name)}},services:{title:"Services",subtitle:"Service 网络服务",icon:K,columns:["名称","命名空间","类型","Cluster IP","端口","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:115:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:116:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:20",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:s.type||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:119:9",className:"text-sm text-slate-400",children:s.cluster_ip||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:120:9",className:"text-sm text-slate-400",children:s.ports||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:57",name:s.name,opts:a})})]},s.name)},ingresses:{title:"Ingresses",subtitle:"Ingress 路由规则",icon:K,columns:["名称","命名空间","Hosts","TLS","操作"],renderRow:(s,a)=>{const o=s.hosts||[];return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:131:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:132:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:134:11",className:"text-sm text-slate-400 max-w-[250px] truncate",children:o.length>0?o.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:22",className:s.tls?"bg-emerald-500/20 text-emerald-400":"bg-slate-500/20 text-slate-400",children:s.tls?"HTTPS":"HTTP"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:11",onClick:r=>r.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:59",name:s.name,opts:a})})]},s.name)}},configmaps:{title:"ConfigMaps",subtitle:"配置字典",icon:Ye,columns:["名称","命名空间","键数量","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:145:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:146:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:148:9",className:"text-sm text-slate-400",children:s.key_count||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:57",name:s.name,opts:a})})]},s.name)},secrets:{title:"Secrets",subtitle:"密钥管理(仅名称与类型)",icon:w,columns:["名称","命名空间","类型","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:157:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:158:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:160:9",className:"text-sm text-slate-400",children:s.type||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:57",name:s.name,opts:a})})]},s.name)},hpas:{title:"HPAs",subtitle:"水平自动伸缩",icon:ye,columns:["名称","命名空间","目标","最小/最大","CPU%","Mem%"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:169:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:170:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:172:9",className:"text-sm text-slate-400",children:[s.target_kind,"/",s.target_name]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:173:9",className:"text-sm text-slate-400",children:[s.min_replicas,"/",s.max_replicas]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:174:9",className:"text-sm text-slate-400",children:[s.cpu_percent??"-","%"]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:175:9",className:"text-sm text-slate-400",children:[s.mem_percent??"-","%"]})]},s.name)},cronjobs:{title:"CronJobs",subtitle:"定时任务",icon:Se,columns:["名称","命名空间","调度","状态","上次执行"],renderRow:s=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:183:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:184:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:186:9",className:"text-sm font-mono text-slate-400",children:s.schedule||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:20",className:s.suspend?"bg-yellow-500/20 text-yellow-400":"bg-emerald-500/20 text-emerald-400",children:s.suspend?"已暂停":"运行中"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:188:9",className:"text-sm text-slate-400",children:s.last_schedule||"-"})]},s.name)},pvcs:{title:"存储卷声明",subtitle:"PersistentVolumeClaim",icon:C,columns:["名称","命名空间","状态","大小","StorageClass","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:196:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:197:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:20",className:s.phase==="Bound"?"bg-emerald-500/20 text-emerald-400":"bg-yellow-500/20 text-yellow-400",children:s.phase||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:200:9",className:"text-sm text-slate-400",children:s.size||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:201:9",className:"text-sm text-slate-400",children:s.storage_class||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:57",name:s.name,opts:a})})]},s.name)},statefulsets:{title:"StatefulSets",subtitle:"有状态应用",icon:C,columns:["名称","命名空间","副本","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:210:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:211:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:213:9",className:"text-sm text-slate-400",children:s.replicas||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:214:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:215:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},daemonsets:{title:"DaemonSets",subtitle:"守护进程集",icon:C,columns:["名称","命名空间","期望","当前","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:223:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:224:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:226:9",className:"text-sm text-slate-400",children:s.desired||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:227:9",className:"text-sm text-slate-400",children:s.current||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:228:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:229:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},serviceaccounts:{title:"ServiceAccounts",subtitle:"服务账号(RBAC 身份标识)",icon:w,columns:["名称","命名空间","Secret数","镜像拉取凭证","创建时间","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:237:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:238:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:240:9",className:"text-sm text-slate-400",children:s.secret_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:241:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image_pull_secrets&&s.image_pull_secrets.length>0?s.image_pull_secrets.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:244:9",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:245:9",onClick:o=>o.stopPropagation(),children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:246:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:247:52",className:"h-3.5 w-3.5"})})})]},s.name)},roles:{title:"Roles",subtitle:"命名空间级角色权限(RBAC)",icon:w,columns:["名称","命名空间","规则数","权限范围","创建时间","操作"],renderRow:(s,a)=>{const o=s.verbs||[],r=s.resources||[],n=o.length>4?o.slice(0,4).join(", ")+` +${o.length-4}`:o.join(", "),x=r.length>4?r.slice(0,4).join(", ")+` +${r.length-4}`:r.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:261:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:262:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:264:11",className:"text-sm text-slate-400",children:s.rule_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:265:11",className:"text-xs text-slate-500 max-w-[280px]",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:266:13",className:"flex flex-col gap-0.5",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:267:15",className:"text-cyan-400 truncate",title:o.join(", "),children:["verbs: ",n||"-"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:268:15",className:"text-amber-400 truncate",title:r.join(", "),children:["resources: ",x||"-"]})]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:271:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:272:11",onClick:h=>h.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:273:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:274:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:275:55",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:276:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:277:55",className:"h-3.5 w-3.5"})})]})})]},s.name)}},rolebindings:{title:"RoleBindings",subtitle:"角色绑定关系(RBAC 授权)",icon:w,columns:["名称","命名空间","角色引用","绑定主体","创建时间","操作"],renderRow:(s,a)=>{const o=s.subjects||[],r=o.length>3?o.slice(0,3).join(", ")+` +${o.length-3}`:o.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:291:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:292:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:294:11",children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:295:13",className:"bg-purple-500/20 text-purple-400 border-purple-500/30",children:[s.role_ref_kind||"-","/",s.role_ref_name||"-"]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:299:11",className:"text-xs text-slate-500 max-w-[200px] truncate",title:o.join(", "),children:r||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:302:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:303:11",onClick:n=>n.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:304:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:305:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:306:56",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:307:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:308:56",className:"h-3.5 w-3.5"})})]})})]},s.name)}}};function Ze(){const{clusterCode:s,namespace:a}=de(),o=he(),r=be();Z();const n=u.useMemo(()=>{const c=o.pathname.split("/"),d=c[c.length-1];if(d&&L[d])return d;if(c.length>=2){const j=c[c.length-2];if(j&&L[j])return j}return"deployments"},[o.pathname]),x=L[n],[h,k]=u.useState([]),[S,b]=u.useState([]),[ee,T]=u.useState([]),[y,z]=u.useState(!1),[V,se]=u.useState(""),[P,Y]=u.useState(null),[v,$]=u.useState(null),[te,F]=u.useState(!1),[D,H]=u.useState(null),[A,O]=u.useState(null);u.useEffect(()=>{l.getClusters().then(c=>{const d=c?.list||[];if(k(d),!s&&d.length>0){const j=d[0].code||String(d[0].id);r(`/kubernetes/${j}/namespace/${a||"default"}/${n}`,{replace:!0})}}).catch(()=>k([]))},[]),u.useEffect(()=>{s&&l.getNamespaces(s).then(c=>{const d=Array.isArray(c)?c:c?.list||c?.data||[];b(d),!a&&d.length>0&&r(`/kubernetes/${s}/namespace/${d[0]}/${n}`,{replace:!0})}).catch(()=>b([]))},[s]);const g=u.useCallback(async()=>{if(!(!s||!a)){z(!0);try{let c=[];switch(n){case"deployments":c=await l.getNamespaceDeployments(s,a).catch(()=>[]);break;case"pods":c=await l.getNamespacePods(s,a).catch(()=>[]);break;case"services":c=await l.getNamespaceServices(s,a).catch(()=>[]);break;case"ingresses":c=await l.getNamespaceIngresses(s,a).catch(()=>[]);break;case"configmaps":c=await l.getNamespaceConfigMaps(s,a).catch(()=>[]);break;case"secrets":c=await l.getNamespaceSecrets(s,a).catch(()=>[]);break;case"hpas":c=await l.getHPAs(s,a).catch(()=>[]);break;case"cronjobs":c=await l.getCronJobs(s,a).catch(()=>[]);break;case"pvcs":c=await l.getPVCs(s,a).catch(()=>[]);break;case"statefulsets":c=await l.getStatefulSets(s,a).catch(()=>[]);break;case"daemonsets":c=await l.getDaemonSets(s,a).catch(()=>[]);break;case"serviceaccounts":c=await l.getServiceAccounts(s,a).catch(()=>[]);break;case"roles":c=await l.getRoles(s,a).catch(()=>[]);break;case"rolebindings":c=await l.getRoleBindings(s,a).catch(()=>[]);break}T(Array.isArray(c)?c:c?.list||c?.data||[])}catch{T([])}finally{z(!1)}}},[s,a,n]);u.useEffect(()=>{g()},[g]);const f=ee.filter(c=>(c.name||"").toLowerCase().includes(V.toLowerCase())),ae=c=>{n==="deployments"?r(`/kubernetes/${s}/namespace/${a}/workload/view/Deployment/${c.name}`):n==="statefulsets"?r(`/kubernetes/${s}/namespace/${a}/workload/view/StatefulSet/${c.name}`):n==="daemonsets"&&r(`/kubernetes/${s}/namespace/${a}/workload/view/DaemonSet/${c.name}`)},ce=c=>Y({resource:n,name:c}),oe=c=>{W.includes(n)?$({resource:n,name:c}):Y({resource:n,name:c,editMode:!0})},ne=()=>$({resource:n,name:"",isCreate:!0}),re=()=>l.exportAsCSV(`${n}-${s}-${a}.csv`,f),me=()=>l.exportAsJSON(`${n}-${s}-${a}.json`,f);return x?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:424:5",className:"space-y-4",children:[P&&e.jsx(Pe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:426:9",clusterCode:s||"",namespace:a||"",resource:P.resource,name:P.name,onClose:()=>Y(null),onSaved:g,cleanBeforeEdit:!0,autoEdit:P.editMode===!0}),te&&e.jsx(Be,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:438:9",clusterCode:s||"",onClose:()=>F(!1),onApplied:g}),v&&e.jsx(we,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:445:9",clusterCode:s||"",namespace:a||"",resource:v.resource,name:v.name,isCreate:v.isCreate,onClose:()=>$(null),onSaved:g}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:456:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:457:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:27",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:63",to:`/kubernetes/${s}`,className:"hover:text-slate-300 transition-colors",children:s})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:25",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:61",to:`/kubernetes/${s}/namespace/${a}`,className:"hover:text-slate-300 transition-colors",children:a})]}),e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:45",className:"text-slate-300",children:x.title})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:462:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:463:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:464:11",className:"text-2xl font-bold text-slate-100",children:x.title}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:465:11",className:"text-sm text-slate-500 mt-1",children:x.subtitle})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:467:9",className:"flex items-center gap-2",children:[e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:468:11",value:s||"",onValueChange:c=>r(`/kubernetes/${c}/namespace/${a||"default"}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:97",placeholder:"选择集群"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:13",className:"bg-slate-800 border-slate-700",children:h.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:91",value:c.code||String(c.id),children:c.name},c.id))})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:472:11",value:a||"",onValueChange:c=>r(`/kubernetes/${s}/namespace/${c}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:13",className:"w-40 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:97",placeholder:"命名空间"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:13",className:"bg-slate-800 border-slate-700 max-h-[300px]",children:S.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:108",value:c,children:c},c))})]}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:476:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:g,disabled:y,children:y?e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:24",className:"h-4 w-4 animate-spin"}):e.jsx(De,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:71",className:"h-4 w-4"})}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:479:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:re,title:"导出CSV",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:480:13",className:"h-3 w-3 mr-1"}),"CSV"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:482:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:me,title:"导出JSON",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:483:13",className:"h-3 w-3 mr-1"}),"JSON"]}),W.includes(n)&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:487:15",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:()=>F(!0),children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:488:17",className:"h-3 w-3 mr-1"}),"导入"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:490:15",size:"sm",className:"h-9 text-xs bg-blue-600 hover:bg-blue-700",onClick:ne,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:491:17",className:"h-3 w-3 mr-1"}),"新建"]})]})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:497:7",className:"flex items-center gap-3 flex-wrap",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:498:7",className:"relative w-56 flex-1 min-w-[200px] max-w-xs",children:[e.jsx(Ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:499:9",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(ge,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:500:9",placeholder:"搜索...",value:V,onChange:c=>se(c.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]})}),e.jsx(ue,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:503:7",className:"bg-slate-900 border-slate-800",children:e.jsx(ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:504:9",className:"p-0",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:505:11",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:13",children:e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:26",className:"border-slate-800 hover:bg-transparent",children:x.columns.map(c=>e.jsx(je,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:115",className:"text-slate-400",children:c},c))})}),e.jsx(Re,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:507:13",children:y?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:115",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):f.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(x.icon,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:115",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无 ",x.title]})}):f.map(c=>x.renderRow(c,{clusterCode:s||"",namespace:a||"",onDetail:ae,onYaml:ce,onEdit:oe,onTerminal:d=>H(d),onFileBrowser:d=>O(d)}))})]})})}),e.jsx(ve,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:521:7",open:!!D,onOpenChange:c=>{c||H(null)},clusterId:h[0]?.id||h[0]?.code||s||"",namespace:a||"",podName:D?.name||"",containers:(D?.containers||[]).map(c=>c.name).filter(Boolean)}),e.jsx(fe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:530:7",open:!!A,onOpenChange:c=>{c||O(null)},clusterCode:s||"",namespace:a||"",podName:A?.name||"",containers:(A?.containers||[]).map(c=>c.name).filter(Boolean)})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:421:23",className:"text-slate-400 p-8 text-center",children:["未知资源类型: ",n]})}export{Ze as default}; +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 工作负载运行状态",icon:C,columns:["名称","命名空间","副本","镜像","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:55:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:56:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:58:9",children:(()=>{const o=s.ready_replicas||0,r=s.replicas||0,n=r>0?o/r*100:0,x=o===r;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:63:15",className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:64:17",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:65:19",className:`h-full rounded-full ${x?"bg-emerald-500":"bg-yellow-500"}`,style:{width:`${n}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:67:17",className:`text-xs ${x?"text-emerald-400":"text-yellow-400"}`,children:[o,"/",r]})]})})()}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:72:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:73:9",onClick:o=>o.stopPropagation(),children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:74:11",className:"flex items-center gap-0.5",children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:75:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:76:53",className:"h-3.5 w-3.5"})})})})]},s.name)},pods:{title:"Pods",subtitle:"Pod 实例运行状态",icon:$e,columns:["名称","命名空间","状态","节点","CPU","内存","重启","镜像","操作"],renderRow:(s,a)=>{const o={Running:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",Pending:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",Failed:"bg-red-500/20 text-red-400 border-red-500/30"};return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:88:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:89:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:22",className:o[s.status]||"bg-slate-500/20 text-slate-400",children:s.status||"Unknown"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:92:11",className:"text-sm text-slate-400",children:s.node_name||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:93:11",className:"text-sm text-cyan-400",children:s.cpu_usage_m||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:94:11",className:"text-sm text-amber-400",children:s.mem_usage_mi||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:95:11",className:s.restart_count>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:96:11",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:97:11",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:98:13",className:"flex items-center gap-1",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:99:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",title:"终端",onClick:()=>a.onTerminal?.(s),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:100:79",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:101:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",title:"文件浏览器",onClick:()=>a.onFileBrowser?.(s),children:[e.jsx(Le,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:102:82",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:103:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:104:55",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})})]},s.name)}},services:{title:"Services",subtitle:"Service 网络服务",icon:K,columns:["名称","命名空间","类型","Cluster IP","端口","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:115:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:116:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:20",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:s.type||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:119:9",className:"text-sm text-slate-400",children:s.cluster_ip||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:120:9",className:"text-sm text-slate-400",children:s.ports||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:57",name:s.name,opts:a})})]},s.name)},ingresses:{title:"Ingresses",subtitle:"Ingress 路由规则",icon:K,columns:["名称","命名空间","Hosts","TLS","操作"],renderRow:(s,a)=>{const o=s.hosts||[];return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:131:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:132:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:134:11",className:"text-sm text-slate-400 max-w-[250px] truncate",children:o.length>0?o.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:22",className:s.tls?"bg-emerald-500/20 text-emerald-400":"bg-slate-500/20 text-slate-400",children:s.tls?"HTTPS":"HTTP"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:11",onClick:r=>r.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:59",name:s.name,opts:a})})]},s.name)}},configmaps:{title:"ConfigMaps",subtitle:"配置字典",icon:Ye,columns:["名称","命名空间","键数量","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:145:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:146:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:148:9",className:"text-sm text-slate-400",children:s.key_count||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:57",name:s.name,opts:a})})]},s.name)},secrets:{title:"Secrets",subtitle:"密钥管理(仅名称与类型)",icon:w,columns:["名称","命名空间","类型","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:157:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:158:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:160:9",className:"text-sm text-slate-400",children:s.type||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:57",name:s.name,opts:a})})]},s.name)},hpas:{title:"HPAs",subtitle:"水平自动伸缩",icon:ye,columns:["名称","命名空间","目标","最小/最大","CPU%","Mem%"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:169:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:170:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:172:9",className:"text-sm text-slate-400",children:[s.target_kind,"/",s.target_name]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:173:9",className:"text-sm text-slate-400",children:[s.min_replicas,"/",s.max_replicas]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:174:9",className:"text-sm text-slate-400",children:[s.cpu_percent??"-","%"]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:175:9",className:"text-sm text-slate-400",children:[s.mem_percent??"-","%"]})]},s.name)},cronjobs:{title:"CronJobs",subtitle:"定时任务",icon:Se,columns:["名称","命名空间","调度","状态","上次执行"],renderRow:s=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:183:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:184:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:186:9",className:"text-sm font-mono text-slate-400",children:s.schedule||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:20",className:s.suspend?"bg-yellow-500/20 text-yellow-400":"bg-emerald-500/20 text-emerald-400",children:s.suspend?"已暂停":"运行中"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:188:9",className:"text-sm text-slate-400",children:s.last_schedule||"-"})]},s.name)},pvcs:{title:"存储卷声明",subtitle:"PersistentVolumeClaim",icon:C,columns:["名称","命名空间","状态","大小","StorageClass","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:196:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:197:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:20",className:s.phase==="Bound"?"bg-emerald-500/20 text-emerald-400":"bg-yellow-500/20 text-yellow-400",children:s.phase||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:200:9",className:"text-sm text-slate-400",children:s.size||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:201:9",className:"text-sm text-slate-400",children:s.storage_class||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:57",name:s.name,opts:a})})]},s.name)},statefulsets:{title:"StatefulSets",subtitle:"有状态应用",icon:C,columns:["名称","命名空间","副本","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:210:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:211:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:213:9",className:"text-sm text-slate-400",children:s.replicas||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:214:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:215:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},daemonsets:{title:"DaemonSets",subtitle:"守护进程集",icon:C,columns:["名称","命名空间","期望","当前","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:223:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:224:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:226:9",className:"text-sm text-slate-400",children:s.desired||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:227:9",className:"text-sm text-slate-400",children:s.current||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:228:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:229:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},serviceaccounts:{title:"ServiceAccounts",subtitle:"服务账号(RBAC 身份标识)",icon:w,columns:["名称","命名空间","Secret数","镜像拉取凭证","创建时间","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:237:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:238:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:240:9",className:"text-sm text-slate-400",children:s.secret_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:241:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image_pull_secrets&&s.image_pull_secrets.length>0?s.image_pull_secrets.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:244:9",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:245:9",onClick:o=>o.stopPropagation(),children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:246:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:247:52",className:"h-3.5 w-3.5"})})})]},s.name)},roles:{title:"Roles",subtitle:"命名空间级角色权限(RBAC)",icon:w,columns:["名称","命名空间","规则数","权限范围","创建时间","操作"],renderRow:(s,a)=>{const o=s.verbs||[],r=s.resources||[],n=o.length>4?o.slice(0,4).join(", ")+` +${o.length-4}`:o.join(", "),x=r.length>4?r.slice(0,4).join(", ")+` +${r.length-4}`:r.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:261:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:262:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:264:11",className:"text-sm text-slate-400",children:s.rule_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:265:11",className:"text-xs text-slate-500 max-w-[280px]",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:266:13",className:"flex flex-col gap-0.5",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:267:15",className:"text-cyan-400 truncate",title:o.join(", "),children:["verbs: ",n||"-"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:268:15",className:"text-amber-400 truncate",title:r.join(", "),children:["resources: ",x||"-"]})]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:271:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:272:11",onClick:h=>h.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:273:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:274:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:275:55",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:276:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:277:55",className:"h-3.5 w-3.5"})})]})})]},s.name)}},rolebindings:{title:"RoleBindings",subtitle:"角色绑定关系(RBAC 授权)",icon:w,columns:["名称","命名空间","角色引用","绑定主体","创建时间","操作"],renderRow:(s,a)=>{const o=s.subjects||[],r=o.length>3?o.slice(0,3).join(", ")+` +${o.length-3}`:o.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:291:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:292:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:294:11",children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:295:13",className:"bg-purple-500/20 text-purple-400 border-purple-500/30",children:[s.role_ref_kind||"-","/",s.role_ref_name||"-"]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:299:11",className:"text-xs text-slate-500 max-w-[200px] truncate",title:o.join(", "),children:r||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:302:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:303:11",onClick:n=>n.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:304:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:305:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:306:56",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:307:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:308:56",className:"h-3.5 w-3.5"})})]})})]},s.name)}}};function Ze(){const{clusterCode:s,namespace:a}=de(),o=he(),r=be();Z();const n=u.useMemo(()=>{const c=o.pathname.split("/"),d=c[c.length-1];if(d&&L[d])return d;if(c.length>=2){const j=c[c.length-2];if(j&&L[j])return j}return"deployments"},[o.pathname]),x=L[n],[h,k]=u.useState([]),[S,b]=u.useState([]),[ee,T]=u.useState([]),[y,z]=u.useState(!1),[V,se]=u.useState(""),[P,Y]=u.useState(null),[v,$]=u.useState(null),[te,F]=u.useState(!1),[D,H]=u.useState(null),[A,O]=u.useState(null);u.useEffect(()=>{l.getClusters().then(c=>{const d=c?.list||[];if(k(d),!s&&d.length>0){const j=d[0].code||String(d[0].id);r(`/kubernetes/${j}/namespace/${a||"default"}/${n}`,{replace:!0})}}).catch(()=>k([]))},[]),u.useEffect(()=>{s&&l.getNamespaces(s).then(c=>{const d=Array.isArray(c)?c:c?.list||c?.data||[];b(d),!a&&d.length>0&&r(`/kubernetes/${s}/namespace/${d[0]}/${n}`,{replace:!0})}).catch(()=>b([]))},[s]);const g=u.useCallback(async()=>{if(!(!s||!a)){z(!0);try{let c=[];switch(n){case"deployments":c=await l.getNamespaceDeployments(s,a).catch(()=>[]);break;case"pods":c=await l.getNamespacePods(s,a).catch(()=>[]);break;case"services":c=await l.getNamespaceServices(s,a).catch(()=>[]);break;case"ingresses":c=await l.getNamespaceIngresses(s,a).catch(()=>[]);break;case"configmaps":c=await l.getNamespaceConfigMaps(s,a).catch(()=>[]);break;case"secrets":c=await l.getNamespaceSecrets(s,a).catch(()=>[]);break;case"hpas":c=await l.getHPAs(s,a).catch(()=>[]);break;case"cronjobs":c=await l.getCronJobs(s,a).catch(()=>[]);break;case"pvcs":c=await l.getPVCs(s,a).catch(()=>[]);break;case"statefulsets":c=await l.getStatefulSets(s,a).catch(()=>[]);break;case"daemonsets":c=await l.getDaemonSets(s,a).catch(()=>[]);break;case"serviceaccounts":c=await l.getServiceAccounts(s,a).catch(()=>[]);break;case"roles":c=await l.getRoles(s,a).catch(()=>[]);break;case"rolebindings":c=await l.getRoleBindings(s,a).catch(()=>[]);break}T(Array.isArray(c)?c:c?.list||c?.data||[])}catch{T([])}finally{z(!1)}}},[s,a,n]);u.useEffect(()=>{g()},[g]);const f=ee.filter(c=>(c.name||"").toLowerCase().includes(V.toLowerCase())),ae=c=>{n==="deployments"?r(`/kubernetes/${s}/namespace/${a}/workload/view/Deployment/${c.name}`):n==="statefulsets"?r(`/kubernetes/${s}/namespace/${a}/workload/view/StatefulSet/${c.name}`):n==="daemonsets"&&r(`/kubernetes/${s}/namespace/${a}/workload/view/DaemonSet/${c.name}`)},ce=c=>Y({resource:n,name:c}),oe=c=>{W.includes(n)?$({resource:n,name:c}):Y({resource:n,name:c,editMode:!0})},ne=()=>$({resource:n,name:"",isCreate:!0}),re=()=>l.exportAsCSV(`${n}-${s}-${a}.csv`,f),me=()=>l.exportAsJSON(`${n}-${s}-${a}.json`,f);return x?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:424:5",className:"space-y-4",children:[P&&e.jsx(Pe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:426:9",clusterCode:s||"",namespace:a||"",resource:P.resource,name:P.name,onClose:()=>Y(null),onSaved:g,cleanBeforeEdit:!0,autoEdit:P.editMode===!0}),te&&e.jsx(Be,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:438:9",clusterCode:s||"",onClose:()=>F(!1),onApplied:g}),v&&e.jsx(we,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:445:9",clusterCode:s||"",namespace:a||"",resource:v.resource,name:v.name,isCreate:v.isCreate,onClose:()=>$(null),onSaved:g}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:456:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:457:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:27",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:63",to:`/kubernetes/${s}`,className:"hover:text-slate-300 transition-colors",children:s})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:25",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:61",to:`/kubernetes/${s}/namespace/${a}`,className:"hover:text-slate-300 transition-colors",children:a})]}),e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:45",className:"text-slate-300",children:x.title})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:462:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:463:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:464:11",className:"text-2xl font-bold text-slate-100",children:x.title}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:465:11",className:"text-sm text-slate-500 mt-1",children:x.subtitle})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:467:9",className:"flex items-center gap-2",children:[e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:468:11",value:s||"",onValueChange:c=>r(`/kubernetes/${c}/namespace/${a||"default"}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:97",placeholder:"选择集群"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:13",className:"bg-slate-800 border-slate-700",children:h.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:91",value:c.code||String(c.id),children:c.name},c.id))})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:472:11",value:a||"",onValueChange:c=>r(`/kubernetes/${s}/namespace/${c}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:13",className:"w-40 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:97",placeholder:"命名空间"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:13",className:"bg-slate-800 border-slate-700 max-h-[300px]",children:S.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:108",value:c,children:c},c))})]}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:476:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:g,disabled:y,children:y?e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:24",className:"h-4 w-4 animate-spin"}):e.jsx(De,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:71",className:"h-4 w-4"})}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:479:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:re,title:"导出CSV",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:480:13",className:"h-3 w-3 mr-1"}),"CSV"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:482:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:me,title:"导出JSON",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:483:13",className:"h-3 w-3 mr-1"}),"JSON"]}),W.includes(n)&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:487:15",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:()=>F(!0),children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:488:17",className:"h-3 w-3 mr-1"}),"导入"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:490:15",size:"sm",className:"h-9 text-xs bg-blue-600 hover:bg-blue-700",onClick:ne,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:491:17",className:"h-3 w-3 mr-1"}),"新建"]})]})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:497:7",className:"flex items-center gap-3 flex-wrap",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:498:7",className:"relative w-56 flex-1 min-w-[200px] max-w-xs",children:[e.jsx(Ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:499:9",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(ge,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:500:9",placeholder:"搜索...",value:V,onChange:c=>se(c.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]})}),e.jsx(ue,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:503:7",className:"bg-slate-900 border-slate-800",children:e.jsx(ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:504:9",className:"p-0",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:505:11",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:13",children:e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:26",className:"border-slate-800 hover:bg-transparent",children:x.columns.map(c=>e.jsx(je,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:115",className:"text-slate-400",children:c},c))})}),e.jsx(Re,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:507:13",children:y?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:115",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):f.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(x.icon,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:115",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无 ",x.title]})}):f.map(c=>x.renderRow(c,{clusterCode:s||"",namespace:a||"",onDetail:ae,onYaml:ce,onEdit:oe,onTerminal:d=>H(d),onFileBrowser:d=>O(d)}))})]})})}),e.jsx(ve,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:521:7",open:!!D,onOpenChange:c=>{c||H(null)},clusterId:h[0]?.id||h[0]?.code||s||"",namespace:a||"",podName:D?.name||"",containers:(D?.containers||[]).map(c=>c.name).filter(Boolean)}),e.jsx(fe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:530:7",open:!!A,onOpenChange:c=>{c||O(null)},clusterCode:s||"",namespace:a||"",podName:A?.name||"",containers:(A?.containers||[]).map(c=>c.name).filter(Boolean)})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:421:23",className:"text-slate-400 p-8 text-center",children:["未知资源类型: ",n]})}export{Ze as default}; diff --git a/backend/static/assets/NodeDetailPage-C5UOgqcz.js b/backend/static/assets/NodeDetailPage-CSCwjDLO.js similarity index 98% rename from backend/static/assets/NodeDetailPage-C5UOgqcz.js rename to backend/static/assets/NodeDetailPage-CSCwjDLO.js index 8e7ed38..6a3f702 100644 --- a/backend/static/assets/NodeDetailPage-C5UOgqcz.js +++ b/backend/static/assets/NodeDetailPage-CSCwjDLO.js @@ -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-slate-400",onClick:b,disabled:h,children:h?e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:22",className:"h-4 w-4 animate-spin"}):e.jsx(A,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:69",className:"h-4 w-4"})})]}),h&&!s?e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:129:11",className:"py-16 flex items-center justify-center",children:e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:130:13",className:"h-6 w-6 animate-spin text-slate-500"})})}):s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:143:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:145:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:146:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:147:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:148:19",className:"h-4 w-4 text-cyan-400"}),"系统信息"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:150:17",className:"space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:151:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:152:21",className:"text-slate-500",children:"容器运行时"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:153:21",className:"text-slate-300 font-mono",children:s.container_runtime||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:155:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:156:21",className:"text-slate-500",children:"Kubelet"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:157:21",className:"text-slate-300 font-mono",children:s.kubelet_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:159:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:160:21",className:"text-slate-500",children:"操作系统"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:161:21",className:"text-slate-300",children:s.os_image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:163:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:164:21",className:"text-slate-500",children:"内核版本"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:165:21",className:"text-slate-300 font-mono",children:s.kernel_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:167:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:168:21",className:"text-slate-500",children:"架构"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:169:21",className:"text-slate-300 font-mono",children:s.architecture||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:171:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:172:21",className:"text-slate-500",children:"创建时间"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:173:21",className:"text-slate-300",children:s.creation_time?new Date(s.creation_time).toLocaleString("zh-CN"):"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:175:19",className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:176:21",className:"text-slate-500",children:"Pod CIDR"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:177:21",className:"text-slate-300 font-mono",children:s.pod_cidr||"-"})]})]})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:184:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:185:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:186:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:187:19",className:"h-4 w-4 text-emerald-400"}),"资源分配率"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:189:17",className:"space-y-4 mt-4",children:[e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:191:19",label:"CPU 已分配",used:`${(s.cpu_request_m/1e3).toFixed(2)} 核`,total:`${s.cpu_allocatable} 核`,unit:"",pct:s.cpu_alloc_pct,color:"text-emerald-400"}),s.cpu_usage_m&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:201:21",label:"CPU 实时使用",used:s.cpu_usage_m,total:`${s.cpu_capacity} 核`,unit:"",pct:parseFloat(s.cpu_usage_m.replace("m",""))/(s.cpu_capacity*1e3)*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:211:19",label:"内存已分配",used:`${s.mem_request_mi} Mi`,total:`${s.mem_allocatable_mb} Mi`,unit:"",pct:s.mem_alloc_pct,color:"text-emerald-400"}),s.mem_usage_mi&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:221:21",label:"内存实时使用",used:s.mem_usage_mi,total:`${s.mem_capacity_mb} Mi`,unit:"",pct:parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi",""))/s.mem_capacity_mb*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:231:19",label:"Pod 数量",used:`${s.pod_count}`,total:`${s.pod_allocatable}`,unit:"",pct:s.pod_alloc_pct,color:"text-emerald-400"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:241:17",className:"mt-4 pt-3 border-t border-slate-800/50 space-y-1 text-[11px] text-slate-500",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:242:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:243:21",children:"CPU 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:244:21",className:"font-mono",children:[s.cpu_capacity," / ",s.cpu_allocatable," 核"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:246:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:247:21",children:"内存容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:248:21",className:"font-mono",children:[s.mem_capacity_mb," / ",s.mem_allocatable_mb," Mi"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:250:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:251:21",children:"Pod 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:252:21",className:"font-mono",children:[s.pod_capacity," / ",s.pod_allocatable]})]})]})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:260:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:262:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:263:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:264:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:265:19",className:"h-4 w-4 text-blue-400"}),"节点条件"]}),!s.conditions||s.conditions.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:268:19",className:"text-xs text-slate-500 py-4 text-center",children:"无条件数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:270:19",className:"space-y-2",children:s.conditions.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:272:23",className:"flex items-start gap-2 text-xs py-1.5 border-b border-slate-800/30 last:border-0",children:[e.jsxs(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:273:25",className:_(t.type,t.status),children:[t.status==="True"?e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:274:53",className:"h-3 w-3 mr-1"}):null,t.type]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:277:25",className:"flex-1 min-w-0",children:[t.reason&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:278:43",className:"text-slate-400 block",children:t.reason}),t.message&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:279:44",className:"text-slate-600 text-[11px] block truncate",children:t.message})]})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:289:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:290:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:291:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:292:19",className:"h-4 w-4 text-amber-400"}),"污点 (Taints)"]}),!s.taints||s.taints.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:295:19",className:"text-xs text-slate-500 py-4 text-center",children:"无污点"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:297:19",className:"space-y-2",children:s.taints.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:299:23",className:"flex items-center gap-2 text-xs",children:[e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:300:25",className:y(t.effect),children:t.effect}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:301:25",className:"text-slate-300 font-mono",children:t.key}),t.value&&e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:302:37",className:"text-slate-500",children:["= ",t.value]})]},a))})]})})]}),s.labels&&s.labels.length>0&&e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:313:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:314:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:315:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:316:19",className:"h-4 w-4 text-slate-400"}),"标签 (",s.labels.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:318:17",className:"flex flex-wrap gap-1.5",children:s.labels.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:320:21",className:"flex items-center gap-1 bg-slate-800/50 border border-slate-700/50 rounded px-2 py-0.5 text-[11px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:321:23",className:"text-slate-400",children:t.key}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:322:23",className:"text-slate-600",children:":"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:323:23",className:"text-slate-300",children:t.value})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:332:11",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:333:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:334:15",className:"px-4 py-3 border-b border-slate-800",children:e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:335:17",className:"text-sm font-semibold text-slate-200 flex items-center gap-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:336:19",className:"h-4 w-4 text-cyan-400"}),"节点上的 Pod",e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:338:19",className:"bg-slate-700/50 text-slate-300",children:s.pods?.length||0})]})}),!s.pods||s.pods.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:342:17",className:"text-xs text-slate-500 py-8 text-center",children:"该节点上暂无 Pod"}):e.jsxs(B,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:344:17",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:345:19",children:e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:346:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:347:23",className:"text-slate-400",children:"命名空间"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:348:23",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:349:23",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:350:23",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:351:23",className:"text-slate-400",children:"CPU 请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:352:23",className:"text-slate-400",children:"内存请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:353:23",className:"text-slate-400",children:"重启次数"})]})}),e.jsx(S,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:356:19",children:s.pods.map((t,a)=>e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:358:23",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:359:25",className:"text-sm text-slate-400",children:t.namespace}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:360:25",className:"text-sm font-medium text-slate-200",children:t.name}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:361:25",children:e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:362:27",className:t.status==="Running"?"bg-emerald-500/20 text-emerald-400":t.status==="Pending"?"bg-amber-500/20 text-amber-400":"bg-red-500/20 text-red-400",children:t.status})}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:368:25",className:"text-xs text-slate-400 font-mono",children:t.ip||"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:369:25",className:"text-xs text-slate-400",children:t.cpu_request_m>0?`${t.cpu_request_m}m`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:372:25",className:"text-xs text-slate-400",children:t.mem_request_mi>0?`${t.mem_request_mi}Mi`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:375:25",className:"text-xs",children:t.restart_count>0?e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:377:29",className:"text-amber-400",children:t.restart_count}):e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:379:29",className:"text-slate-600",children:"0"})})]},a))})]})]})})]}):e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:134:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:135:11",className:"py-16 text-center text-slate-500",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:136:13",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"无法加载节点详情"]})})]})}export{X as default}; +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-slate-400",onClick:b,disabled:h,children:h?e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:22",className:"h-4 w-4 animate-spin"}):e.jsx(A,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:69",className:"h-4 w-4"})})]}),h&&!s?e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:129:11",className:"py-16 flex items-center justify-center",children:e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:130:13",className:"h-6 w-6 animate-spin text-slate-500"})})}):s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:143:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:145:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:146:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:147:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:148:19",className:"h-4 w-4 text-cyan-400"}),"系统信息"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:150:17",className:"space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:151:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:152:21",className:"text-slate-500",children:"容器运行时"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:153:21",className:"text-slate-300 font-mono",children:s.container_runtime||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:155:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:156:21",className:"text-slate-500",children:"Kubelet"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:157:21",className:"text-slate-300 font-mono",children:s.kubelet_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:159:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:160:21",className:"text-slate-500",children:"操作系统"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:161:21",className:"text-slate-300",children:s.os_image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:163:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:164:21",className:"text-slate-500",children:"内核版本"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:165:21",className:"text-slate-300 font-mono",children:s.kernel_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:167:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:168:21",className:"text-slate-500",children:"架构"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:169:21",className:"text-slate-300 font-mono",children:s.architecture||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:171:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:172:21",className:"text-slate-500",children:"创建时间"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:173:21",className:"text-slate-300",children:s.creation_time?new Date(s.creation_time).toLocaleString("zh-CN"):"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:175:19",className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:176:21",className:"text-slate-500",children:"Pod CIDR"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:177:21",className:"text-slate-300 font-mono",children:s.pod_cidr||"-"})]})]})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:184:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:185:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:186:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:187:19",className:"h-4 w-4 text-emerald-400"}),"资源分配率"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:189:17",className:"space-y-4 mt-4",children:[e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:191:19",label:"CPU 已分配",used:`${(s.cpu_request_m/1e3).toFixed(2)} 核`,total:`${s.cpu_allocatable} 核`,unit:"",pct:s.cpu_alloc_pct,color:"text-emerald-400"}),s.cpu_usage_m&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:201:21",label:"CPU 实时使用",used:s.cpu_usage_m,total:`${s.cpu_capacity} 核`,unit:"",pct:parseFloat(s.cpu_usage_m.replace("m",""))/(s.cpu_capacity*1e3)*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:211:19",label:"内存已分配",used:`${s.mem_request_mi} Mi`,total:`${s.mem_allocatable_mb} Mi`,unit:"",pct:s.mem_alloc_pct,color:"text-emerald-400"}),s.mem_usage_mi&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:221:21",label:"内存实时使用",used:s.mem_usage_mi,total:`${s.mem_capacity_mb} Mi`,unit:"",pct:parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi",""))/s.mem_capacity_mb*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:231:19",label:"Pod 数量",used:`${s.pod_count}`,total:`${s.pod_allocatable}`,unit:"",pct:s.pod_alloc_pct,color:"text-emerald-400"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:241:17",className:"mt-4 pt-3 border-t border-slate-800/50 space-y-1 text-[11px] text-slate-500",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:242:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:243:21",children:"CPU 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:244:21",className:"font-mono",children:[s.cpu_capacity," / ",s.cpu_allocatable," 核"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:246:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:247:21",children:"内存容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:248:21",className:"font-mono",children:[s.mem_capacity_mb," / ",s.mem_allocatable_mb," Mi"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:250:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:251:21",children:"Pod 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:252:21",className:"font-mono",children:[s.pod_capacity," / ",s.pod_allocatable]})]})]})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:260:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:262:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:263:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:264:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:265:19",className:"h-4 w-4 text-blue-400"}),"节点条件"]}),!s.conditions||s.conditions.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:268:19",className:"text-xs text-slate-500 py-4 text-center",children:"无条件数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:270:19",className:"space-y-2",children:s.conditions.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:272:23",className:"flex items-start gap-2 text-xs py-1.5 border-b border-slate-800/30 last:border-0",children:[e.jsxs(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:273:25",className:_(t.type,t.status),children:[t.status==="True"?e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:274:53",className:"h-3 w-3 mr-1"}):null,t.type]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:277:25",className:"flex-1 min-w-0",children:[t.reason&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:278:43",className:"text-slate-400 block",children:t.reason}),t.message&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:279:44",className:"text-slate-600 text-[11px] block truncate",children:t.message})]})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:289:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:290:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:291:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:292:19",className:"h-4 w-4 text-amber-400"}),"污点 (Taints)"]}),!s.taints||s.taints.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:295:19",className:"text-xs text-slate-500 py-4 text-center",children:"无污点"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:297:19",className:"space-y-2",children:s.taints.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:299:23",className:"flex items-center gap-2 text-xs",children:[e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:300:25",className:y(t.effect),children:t.effect}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:301:25",className:"text-slate-300 font-mono",children:t.key}),t.value&&e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:302:37",className:"text-slate-500",children:["= ",t.value]})]},a))})]})})]}),s.labels&&s.labels.length>0&&e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:313:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:314:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:315:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:316:19",className:"h-4 w-4 text-slate-400"}),"标签 (",s.labels.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:318:17",className:"flex flex-wrap gap-1.5",children:s.labels.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:320:21",className:"flex items-center gap-1 bg-slate-800/50 border border-slate-700/50 rounded px-2 py-0.5 text-[11px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:321:23",className:"text-slate-400",children:t.key}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:322:23",className:"text-slate-600",children:":"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:323:23",className:"text-slate-300",children:t.value})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:332:11",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:333:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:334:15",className:"px-4 py-3 border-b border-slate-800",children:e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:335:17",className:"text-sm font-semibold text-slate-200 flex items-center gap-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:336:19",className:"h-4 w-4 text-cyan-400"}),"节点上的 Pod",e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:338:19",className:"bg-slate-700/50 text-slate-300",children:s.pods?.length||0})]})}),!s.pods||s.pods.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:342:17",className:"text-xs text-slate-500 py-8 text-center",children:"该节点上暂无 Pod"}):e.jsxs(B,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:344:17",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:345:19",children:e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:346:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:347:23",className:"text-slate-400",children:"命名空间"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:348:23",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:349:23",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:350:23",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:351:23",className:"text-slate-400",children:"CPU 请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:352:23",className:"text-slate-400",children:"内存请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:353:23",className:"text-slate-400",children:"重启次数"})]})}),e.jsx(S,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:356:19",children:s.pods.map((t,a)=>e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:358:23",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:359:25",className:"text-sm text-slate-400",children:t.namespace}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:360:25",className:"text-sm font-medium text-slate-200",children:t.name}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:361:25",children:e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:362:27",className:t.status==="Running"?"bg-emerald-500/20 text-emerald-400":t.status==="Pending"?"bg-amber-500/20 text-amber-400":"bg-red-500/20 text-red-400",children:t.status})}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:368:25",className:"text-xs text-slate-400 font-mono",children:t.ip||"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:369:25",className:"text-xs text-slate-400",children:t.cpu_request_m>0?`${t.cpu_request_m}m`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:372:25",className:"text-xs text-slate-400",children:t.mem_request_mi>0?`${t.mem_request_mi}Mi`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:375:25",className:"text-xs",children:t.restart_count>0?e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:377:29",className:"text-amber-400",children:t.restart_count}):e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:379:29",className:"text-slate-600",children:"0"})})]},a))})]})]})})]}):e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:134:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:135:11",className:"py-16 text-center text-slate-500",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:136:13",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"无法加载节点详情"]})})]})}export{X as default}; diff --git a/backend/static/assets/PipelineEditor-Cvagngmv.js b/backend/static/assets/PipelineEditor-BEQjb4Gp.js similarity index 98% rename from backend/static/assets/PipelineEditor-Cvagngmv.js rename to backend/static/assets/PipelineEditor-BEQjb4Gp.js index 5b5c4d8..c5c1ae8 100644 --- a/backend/static/assets/PipelineEditor-Cvagngmv.js +++ b/backend/static/assets/PipelineEditor-BEQjb4Gp.js @@ -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/PipelineEditor.tsx:108:13",children:Object.entries(we).map(([c])=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:69",value:c,children:c},c))})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:111:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:111:34",className:"text-xs",children:"脚本类型"}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:112:9",className:"flex gap-2",children:["shell","python"].map(c=>e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:112:68",variant:r.script_type===c?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>d({...r,script_type:c}),children:c},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:114:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:114:34",className:"text-xs",children:"脚本内容"}),e.jsx(os,{"code-path":"src/components/deploy/PipelineEditor.tsx:115:9",value:r.script,onChange:c=>d({...r,script:c.target.value}),className:"font-mono text-xs min-h-[200px] bg-slate-950 text-green-400",placeholder:"#!/bin/bash\\nset -e\\necho 'hello'"})]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:97:21",className:"p-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"选择一个任务开始编辑"})}function fs({open:r,onClose:d,run:c,logs:v}){return e.jsx(Ye,{"code-path":"src/components/deploy/PipelineEditor.tsx:124:5",open:r,onOpenChange:d,children:e.jsxs(Ze,{"code-path":"src/components/deploy/PipelineEditor.tsx:125:7",className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qe,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:9",children:e.jsxs(es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:23",className:"flex items-center gap-2",children:[e.jsx(Es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:72",className:"w-5 h-5"}),"执行日志 #",c?.build_number||c?.id]})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:127:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:128:11",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:129:13",children:["触发方式: ",c?.triggered_by||"manual"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:130:13",children:["分支: ",c?.branch||"-"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:131:13",children:["耗时: ",Ce(c?.duration)]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:132:13",children:c?.created_at?new Date(c.created_at).toLocaleString("zh-CN"):"-"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:134:11",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:v.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:136:15",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):v.map((a,x)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:139:17",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:140:19",className:"text-slate-500 shrink-0",children:["[",a.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:141:19",className:a.level==="error"?"text-red-400":a.level==="warn"?"text-yellow-400":a.level==="success"?"text-green-400":"text-slate-300",children:[a.level==="success"?"✓":a.level==="error"?"✗":a.level==="warn"?"!":">"," ",a.message]})]},x))})]})]})})}function Vs(){const{code:r}=Qe(),d=r||"",[c,v]=i.useState(null),[a,x]=i.useState([]),[_,T]=i.useState(null),[ke,I]=i.useState({}),[Se,_e]=i.useState("flow"),[Te,W]=i.useState(!0),[K,Q]=i.useState(!1),[F,X]=i.useState([]),[Y,Me]=i.useState([]),[J,Z]=i.useState([]),[Le,q]=i.useState(!1),[N,M]=i.useState("manual"),[ee,se]=i.useState(""),[te,oe]=i.useState(""),[ne,ce]=i.useState(""),[b,f]=i.useState([]),[L,de]=i.useState(""),[U,ie]=i.useState(""),[re,ze]=i.useState("editor"),[Ae,ae]=i.useState(!1),[De,Re]=i.useState(null),[$e,pe]=i.useState([]),le=Xe(),xe=i.useCallback(async()=>{try{const s=await ns.getEnvironments();Me(Array.isArray(s)?s:s?.list||[])}catch{}},[]),z=i.useCallback(async()=>{q(!0);try{const s=await g.getMembers(d);Z(Array.isArray(s)?s:s?.data||[])}catch{Z([])}finally{q(!1)}},[d]),A=i.useCallback(async()=>{try{const s=await g.getRuns(d);X(Array.isArray(s)?s:s?.list||[])}catch{X([])}},[d]);i.useEffect(()=>{(async()=>{W(!0);try{const s=await g.getPipelineDetail(d);if(!s||!s.id){v(null),W(!1);return}v(s),M(s.trigger_mode||"manual"),se(s.watch_branches||""),oe(s.cron_expr||""),ce(s.webhook_token||""),de(s.environment_id||"");try{const n=s.variables?JSON.parse(s.variables):{};f(Object.entries(n).map(([o,t])=>[o,String(t)]))}catch{f([])}try{const n=s.stages?JSON.parse(s.stages):[],o=Array.isArray(n)?n:[];x(o);const t={};o.forEach(l=>{t[l.id]=!0}),I(t)}catch{x([])}}catch{m.error("加载失败")}finally{W(!1)}})(),xe(),z(),A()},[d,xe,z,A]);const me=a.flatMap(s=>s.tasks).find(s=>s.id===_)||null,Oe=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.map(t=>t.id===s.id?s:t)})))},Ve=s=>{const n={id:vs(),name:"新任务",type:"build",icon:"Wrench",config:{},script:"",script_type:"shell"};x(o=>o.map((t,l)=>l===s?{...t,tasks:[...t.tasks,n]}:t))},Be=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.filter(t=>t.id!==s)}))),_===s&&T(null)},Ie=()=>{const s={id:`stg-${Date.now()}`,name:"新阶段",type:"custom",tasks:[]};x(n=>[...n,s])},We=s=>{x(n=>n.filter((o,t)=>t!==s))},he=(s,n)=>{const o=s+n;if(o<0||o>=a.length)return;const t=[...a];[t[s],t[o]]=[t[o],t[s]],x(t)},Fe=async()=>{Q(!0);try{await g.updatePipeline(d,{stages:JSON.stringify(a),trigger_mode:N,watch_branches:ee,cron_expr:te,webhook_token:ne,environment_id:L?Number(L):null,variables:JSON.stringify(Object.fromEntries(b.filter(([s])=>s.trim())))}),m.success("已保存")}catch{m.error("保存失败")}finally{Q(!1)}},Je=async()=>{try{await g.triggerPipeline(d),m.success("已触发"),A()}catch{m.error("触发失败")}},Ue=async s=>{if(await le({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await g.stopRun(d,s),m.success("已停止"),A()}catch{m.error("停止失败")}},Ge=async s=>{Re(s),ae(!0);try{const n=await g.getRunLog(d,s.id);pe(n?.logs||[])}catch{pe([])}},He=async()=>{if(!U.trim()){m.error("请输入用户名");return}try{await g.addMember(d,{username:U.trim(),role:re}),m.success("已添加成员"),ie(""),z()}catch(s){m.error(s?.message||"添加失败")}},ye=async s=>{if(await le({title:"移除成员",description:"确定要移除此成员吗?",variant:"destructive"}))try{await g.removeMember(d,s),m.success("已移除"),z()}catch{m.error("移除失败")}},w=Y.find(s=>String(s.id)===String(L));return Te?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:325:23",className:"flex items-center justify-center py-20",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:325:79",className:"w-6 h-6 animate-spin"})}):c?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:329:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:331:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:332:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/PipelineEditor.tsx:333:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:334:13",className:"w-5 h-5 text-blue-500"}),c.name,w&&e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:336:26",style:{backgroundColor:w.color+"20",color:w.color,borderColor:w.color+"40"},className:"text-xs ml-2",children:w.display_name})]}),e.jsxs("p",{"code-path":"src/components/deploy/PipelineEditor.tsx:338:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:["code: ",c.code," · ",c.description]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:340:9",className:"flex items-center gap-2",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:11",variant:"outline",onClick:Fe,disabled:K,children:[e.jsx(cs,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:76",className:"w-4 h-4 mr-1"}),K?"保存中...":"保存"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:11",variant:"default",onClick:Je,children:[e.jsx(ds,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:61",className:"w-4 h-4 mr-1"}),"运行"]})]})]}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:347:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:348:9",className:"p-3 flex items-center gap-3",children:[e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:349:11",className:"w-4 h-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:350:11",className:"text-sm text-[var(--dg-text-secondary)]",children:"部署环境:"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:351:11",value:String(L),onValueChange:s=>de(s==="__none"?"":s),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:13",className:"w-40 h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:57",placeholder:"选择环境"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:353:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:354:15",value:"__none",children:"未指定"}),Y.map(s=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:356:17",value:String(s.id),children:e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:357:19",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:358:21",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:s.color}}),s.display_name]})},s.id))]})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:365:11",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"选择后流水线执行记录会关联到对应环境"})]})}),e.jsxs(ss,{"code-path":"src/components/deploy/PipelineEditor.tsx:369:7",value:Se,onValueChange:_e,children:[e.jsxs(ts,{"code-path":"src/components/deploy/PipelineEditor.tsx:370:9",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:371:11",value:"flow",children:"流程配置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:372:11",value:"triggers",children:"触发设置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:373:11",value:"variables",children:"变量"}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:374:11",value:"runs",children:["发布记录 (",F.length,")"]}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:375:11",value:"members",children:["成员管理 (",J.length,")"]})]}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:379:9",value:"flow",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:380:11",className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:381:13",className:"flex-1 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:382:15",className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:383:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["流水线阶段 (",a.length,")"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:17",size:"sm",onClick:Ie,children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:60",className:"w-3.5 h-3.5 mr-1"}),"添加阶段"]})]}),a.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:387:17",className:"text-center py-12 border-2 border-dashed rounded-lg text-[var(--dg-text-secondary)]",children:"点击「添加阶段」开始"}):a.map((s,n)=>{const o=ke[s.id]!==!1;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:392:19",className:"space-y-1",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:393:21",className:"flex items-center gap-2 px-3 py-2 bg-[var(--dg-bg-tertiary)] rounded-t-md border border-b-0 border-[var(--dg-border)] cursor-pointer",onClick:()=>I(t=>({...t,[s.id]:!o})),children:[e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:397:23",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:t=>{t.stopPropagation(),I(l=>({...l,[s.id]:!o}))},children:o?e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:39",className:"w-3.5 h-3.5"}):e.jsx(Ee,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:81",className:"w-3.5 h-3.5"})}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:400:23",value:s.name,onChange:t=>x(l=>l.map((ge,Ke)=>Ke===n?{...ge,name:t.target.value}:ge)),className:"h-7 text-sm font-medium border-none bg-transparent shadow-none flex-1 px-1",onClick:t=>t.stopPropagation()}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:406:23",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.tasks.length," 任务"]}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:407:23",variant:"secondary",className:"text-xs",children:us[s.type]||s.type}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,-1)},disabled:n===0,children:e.jsx(is,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:168",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,1)},disabled:n===a.length-1,children:e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:183",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:23",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-500",onClick:t=>{t.stopPropagation(),We(n)},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:158",className:"w-3.5 h-3.5"})})]}),o&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:413:21",className:"border border-[var(--dg-border)] rounded-b-md p-3 space-y-2",children:[s.tasks.map(t=>e.jsx(Ns,{"code-path":"src/components/deploy/PipelineEditor.tsx:414:46",task:t,selected:_===t.id,onSelect:()=>T(_===t.id?null:t.id),onDelete:()=>Be(t.id)},t.id)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:23",variant:"outline",size:"sm",className:"w-full h-8 text-xs",onClick:()=>Ve(n),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:125",className:"w-3 h-3 mr-1"}),"添加任务"]})]}),nT(null),children:"关闭"})]}),e.jsx(bs,{"code-path":"src/components/deploy/PipelineEditor.tsx:426:15",task:me,onUpdate:Oe,onClose:()=>T(null)})]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:432:9",value:"triggers",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:433:11",className:"space-y-4 max-w-lg",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:184",className:"font-medium",children:"Git Push 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:238",checked:N==="git_push",onCheckedChange:s=>M(s?"git_push":"manual")})]}),N==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:436:46",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:73",children:"监听分支"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:92",value:ee,onChange:s=>se(s.target.value),placeholder:"master, release/*",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:180",className:"font-medium",children:"定时触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:227",checked:N==="cron",onCheckedChange:s=>M(s?"cron":"manual")})]}),N==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:440:42",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:69",children:"Cron 表达式"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:92",value:te,onChange:s=>oe(s.target.value),placeholder:"0 2 * * *",className:"h-9 font-mono"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:182",className:"font-medium",children:"Webhook 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:235",checked:N==="webhook",onCheckedChange:s=>M(s?"webhook":"manual")})]}),N==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:444:45",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:72",children:"Secret Token"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:99",value:ne,onChange:s=>ce(s.target.value),type:"password",placeholder:"输入签名密钥",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:85",className:"pt-6",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:115",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:186",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:228",className:"font-medium",children:"手动触发"}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:269",variant:"secondary",className:"text-xs",children:"默认启用"})]})})})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:451:9",value:"variables",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:452:11",className:"max-w-lg space-y-3",children:[b.map(([s,n],o)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:454:15",className:"flex gap-2 items-center",children:[e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:455:17",value:s,onChange:t=>{const l=[...b];l[o][0]=t.target.value,f(l)},placeholder:"KEY",className:"h-9 w-40 font-mono text-sm"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:456:17",className:"text-[var(--dg-text-secondary)]",children:"="}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:457:17",value:n,onChange:t=>{const l=[...b];l[o][1]=t.target.value,f(l)},placeholder:"VALUE",className:"h-9 flex-1"}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:17",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>f(b.filter((t,l)=>l!==o)),children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:152",className:"w-3.5 h-3.5"})})]},o)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:13",variant:"outline",size:"sm",onClick:()=>f([...b,["",""]]),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:104",className:"w-3.5 h-3.5 mr-1"}),"添加变量"]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:466:9",value:"runs",className:"mt-3",children:F.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:468:13",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无执行记录"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:470:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/PipelineEditor.tsx:471:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineEditor.tsx:472:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:473:19",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:474:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:475:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:476:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:477:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:478:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"分支"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:479:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:480:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:481:21",className:"px-3 py-2 text-right text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineEditor.tsx:484:17",children:F.map(s=>e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:486:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:487:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",s.build_number||s.id]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:488:23",className:"px-3 py-2",children:s.status==="success"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:51",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(rs,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:127",className:"w-3 h-3 mr-0.5"}),"成功"]}):s.status==="failed"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:50",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(as,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:114",className:"w-3 h-3 mr-0.5"}),"失败"]}):s.status==="running"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:51",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:[e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:118",className:"w-3 h-3 animate-spin mr-0.5"}),"执行中"]}):s.status==="cancelled"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:53",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:126",className:"w-3 h-3 mr-0.5"}),"已停止"]}):e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:493:26",variant:"secondary",className:"text-[var(--dg-text-secondary)]",children:s.status})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:495:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:[s.trigger_mode==="manual"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:496:57",className:"flex items-center gap-1",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:496:99",className:"w-3 h-3"}),"手动"]}),s.trigger_mode==="cron"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:497:55",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:497:97",className:"w-3 h-3"}),"定时"]}),s.trigger_mode==="webhook"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:498:58",className:"flex items-center gap-1",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:498:100",className:"w-3 h-3"}),"Webhook"]}),s.trigger_mode==="git_push"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:499:59",className:"flex items-center gap-1",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:499:101",className:"w-3 h-3"}),"Git Push"]}),!s.trigger_mode&&(s.triggered_by||"手动")]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:502:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.triggered_by||"admin"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:503:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] font-mono text-xs",children:s.branch||"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:504:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:Ce(s.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:505:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.created_at?new Date(s.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:506:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:507:25",className:"flex items-center justify-end gap-1",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>Ge(s),children:[e.jsx(ps,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:152",className:"w-3.5 h-3.5 mr-1"}),"日志"]}),(s.status==="running"||s.status==="pending")&&e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:29",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>Ue(s.id),children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:152",className:"w-3.5 h-3.5 mr-1"}),"停止"]})]})})]},s.id))})]})})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:523:9",value:"members",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:524:11",className:"max-w-xl space-y-4",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:526:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:527:15",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:528:17",className:"flex items-center gap-3",children:[e.jsx(ls,{"code-path":"src/components/deploy/PipelineEditor.tsx:529:19",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:530:19",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"添加用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:532:17",className:"flex items-end gap-3 mt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:533:19",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:534:21",className:"text-xs",children:"用户名"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:535:21",value:U,onChange:s=>ie(s.target.value),placeholder:"输入用户名",className:"h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:537:19",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:538:21",className:"text-xs",children:"角色"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:539:21",value:re,onValueChange:ze,children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:23",className:"h-9 w-28",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:59"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:541:23",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:542:25",value:"owner",children:"拥有者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:543:25",value:"editor",children:"编辑者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:544:25",value:"viewer",children:"查看者"})]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:19",onClick:He,className:"h-9",children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:69",className:"w-4 h-4 mr-1"}),"添加"]})]})]})}),(()=>{const s=J.filter(o=>o.username),n=J.filter(o=>o.group_id);return e.jsxs(e.Fragment,{children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:560:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:561:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:562:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👤 直接用户授权 (",s.length,")"]}),Le?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:566:25",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:566:80",className:"w-5 h-5 animate-spin text-[var(--dg-text-secondary)]"})}):s.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:568:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:"暂无直接用户"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:570:25",className:"divide-y divide-[var(--dg-border)]",children:s.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:572:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:573:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:574:33",className:"w-8 h-8 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(xs,{"code-path":"src/components/deploy/PipelineEditor.tsx:574:119",className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:575:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:576:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.username}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:35",className:"text-xs text-[var(--dg-text-secondary)]",children:o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:227",className:"text-slate-400",children:"查看者"})})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:162",className:"w-3.5 h-3.5 mr-1"}),"移除"]})]},o.id))})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:589:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:590:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:591:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👥 用户组授权 (",n.length,")"]}),n.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:595:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:["暂无组授权 — 在「",e.jsx("a",{"code-path":"src/components/deploy/PipelineEditor.tsx:596:37",href:"/deploy/groups",className:"text-blue-400 underline",children:"用户组管理"}),"」页面创建组后,可在此授权"]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:599:25",className:"divide-y divide-[var(--dg-border)]",children:n.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:601:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:602:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:603:33",className:"w-8 h-8 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:603:121",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:604:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:605:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.group?.name||`组 #${o.group_id}`}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:35",className:"text-xs text-[var(--dg-text-secondary)]",children:[o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:227",className:"text-slate-400",children:"查看者"})," · 组内全体成员"]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:162",className:"w-3.5 h-3.5 mr-1"}),"撤销授权"]})]},o.id))})]})})]})})()]})})]}),e.jsx(fs,{"code-path":"src/components/deploy/PipelineEditor.tsx:624:7",open:Ae,onClose:()=>ae(!1),run:De,logs:$e})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:326:25",className:"text-center py-20 text-[var(--dg-text-secondary)]",children:"流水线不存在"})}export{Vs as default}; +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/PipelineEditor.tsx:108:13",children:Object.entries(we).map(([c])=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:69",value:c,children:c},c))})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:111:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:111:34",className:"text-xs",children:"脚本类型"}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:112:9",className:"flex gap-2",children:["shell","python"].map(c=>e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:112:68",variant:r.script_type===c?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>d({...r,script_type:c}),children:c},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:114:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:114:34",className:"text-xs",children:"脚本内容"}),e.jsx(os,{"code-path":"src/components/deploy/PipelineEditor.tsx:115:9",value:r.script,onChange:c=>d({...r,script:c.target.value}),className:"font-mono text-xs min-h-[200px] bg-slate-950 text-green-400",placeholder:"#!/bin/bash\\nset -e\\necho 'hello'"})]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:97:21",className:"p-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"选择一个任务开始编辑"})}function fs({open:r,onClose:d,run:c,logs:v}){return e.jsx(Ye,{"code-path":"src/components/deploy/PipelineEditor.tsx:124:5",open:r,onOpenChange:d,children:e.jsxs(Ze,{"code-path":"src/components/deploy/PipelineEditor.tsx:125:7",className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qe,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:9",children:e.jsxs(es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:23",className:"flex items-center gap-2",children:[e.jsx(Es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:72",className:"w-5 h-5"}),"执行日志 #",c?.build_number||c?.id]})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:127:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:128:11",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:129:13",children:["触发方式: ",c?.triggered_by||"manual"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:130:13",children:["分支: ",c?.branch||"-"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:131:13",children:["耗时: ",Ce(c?.duration)]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:132:13",children:c?.created_at?new Date(c.created_at).toLocaleString("zh-CN"):"-"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:134:11",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:v.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:136:15",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):v.map((a,x)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:139:17",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:140:19",className:"text-slate-500 shrink-0",children:["[",a.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:141:19",className:a.level==="error"?"text-red-400":a.level==="warn"?"text-yellow-400":a.level==="success"?"text-green-400":"text-slate-300",children:[a.level==="success"?"✓":a.level==="error"?"✗":a.level==="warn"?"!":">"," ",a.message]})]},x))})]})]})})}function Vs(){const{code:r}=Qe(),d=r||"",[c,v]=i.useState(null),[a,x]=i.useState([]),[_,T]=i.useState(null),[ke,I]=i.useState({}),[Se,_e]=i.useState("flow"),[Te,W]=i.useState(!0),[K,Q]=i.useState(!1),[F,X]=i.useState([]),[Y,Me]=i.useState([]),[J,Z]=i.useState([]),[Le,q]=i.useState(!1),[N,M]=i.useState("manual"),[ee,se]=i.useState(""),[te,oe]=i.useState(""),[ne,ce]=i.useState(""),[b,f]=i.useState([]),[L,de]=i.useState(""),[U,ie]=i.useState(""),[re,ze]=i.useState("editor"),[Ae,ae]=i.useState(!1),[De,Re]=i.useState(null),[$e,pe]=i.useState([]),le=Xe(),xe=i.useCallback(async()=>{try{const s=await ns.getEnvironments();Me(Array.isArray(s)?s:s?.list||[])}catch{}},[]),z=i.useCallback(async()=>{q(!0);try{const s=await g.getMembers(d);Z(Array.isArray(s)?s:s?.data||[])}catch{Z([])}finally{q(!1)}},[d]),A=i.useCallback(async()=>{try{const s=await g.getRuns(d);X(Array.isArray(s)?s:s?.list||[])}catch{X([])}},[d]);i.useEffect(()=>{(async()=>{W(!0);try{const s=await g.getPipelineDetail(d);if(!s||!s.id){v(null),W(!1);return}v(s),M(s.trigger_mode||"manual"),se(s.watch_branches||""),oe(s.cron_expr||""),ce(s.webhook_token||""),de(s.environment_id||"");try{const n=s.variables?JSON.parse(s.variables):{};f(Object.entries(n).map(([o,t])=>[o,String(t)]))}catch{f([])}try{const n=s.stages?JSON.parse(s.stages):[],o=Array.isArray(n)?n:[];x(o);const t={};o.forEach(l=>{t[l.id]=!0}),I(t)}catch{x([])}}catch{m.error("加载失败")}finally{W(!1)}})(),xe(),z(),A()},[d,xe,z,A]);const me=a.flatMap(s=>s.tasks).find(s=>s.id===_)||null,Oe=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.map(t=>t.id===s.id?s:t)})))},Ve=s=>{const n={id:vs(),name:"新任务",type:"build",icon:"Wrench",config:{},script:"",script_type:"shell"};x(o=>o.map((t,l)=>l===s?{...t,tasks:[...t.tasks,n]}:t))},Be=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.filter(t=>t.id!==s)}))),_===s&&T(null)},Ie=()=>{const s={id:`stg-${Date.now()}`,name:"新阶段",type:"custom",tasks:[]};x(n=>[...n,s])},We=s=>{x(n=>n.filter((o,t)=>t!==s))},he=(s,n)=>{const o=s+n;if(o<0||o>=a.length)return;const t=[...a];[t[s],t[o]]=[t[o],t[s]],x(t)},Fe=async()=>{Q(!0);try{await g.updatePipeline(d,{stages:JSON.stringify(a),trigger_mode:N,watch_branches:ee,cron_expr:te,webhook_token:ne,environment_id:L?Number(L):null,variables:JSON.stringify(Object.fromEntries(b.filter(([s])=>s.trim())))}),m.success("已保存")}catch{m.error("保存失败")}finally{Q(!1)}},Je=async()=>{try{await g.triggerPipeline(d),m.success("已触发"),A()}catch{m.error("触发失败")}},Ue=async s=>{if(await le({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await g.stopRun(d,s),m.success("已停止"),A()}catch{m.error("停止失败")}},Ge=async s=>{Re(s),ae(!0);try{const n=await g.getRunLog(d,s.id);pe(n?.logs||[])}catch{pe([])}},He=async()=>{if(!U.trim()){m.error("请输入用户名");return}try{await g.addMember(d,{username:U.trim(),role:re}),m.success("已添加成员"),ie(""),z()}catch(s){m.error(s?.message||"添加失败")}},ye=async s=>{if(await le({title:"移除成员",description:"确定要移除此成员吗?",variant:"destructive"}))try{await g.removeMember(d,s),m.success("已移除"),z()}catch{m.error("移除失败")}},w=Y.find(s=>String(s.id)===String(L));return Te?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:325:23",className:"flex items-center justify-center py-20",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:325:79",className:"w-6 h-6 animate-spin"})}):c?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:329:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:331:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:332:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/PipelineEditor.tsx:333:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:334:13",className:"w-5 h-5 text-blue-500"}),c.name,w&&e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:336:26",style:{backgroundColor:w.color+"20",color:w.color,borderColor:w.color+"40"},className:"text-xs ml-2",children:w.display_name})]}),e.jsxs("p",{"code-path":"src/components/deploy/PipelineEditor.tsx:338:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:["code: ",c.code," · ",c.description]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:340:9",className:"flex items-center gap-2",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:11",variant:"outline",onClick:Fe,disabled:K,children:[e.jsx(cs,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:76",className:"w-4 h-4 mr-1"}),K?"保存中...":"保存"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:11",variant:"default",onClick:Je,children:[e.jsx(ds,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:61",className:"w-4 h-4 mr-1"}),"运行"]})]})]}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:347:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:348:9",className:"p-3 flex items-center gap-3",children:[e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:349:11",className:"w-4 h-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:350:11",className:"text-sm text-[var(--dg-text-secondary)]",children:"部署环境:"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:351:11",value:String(L),onValueChange:s=>de(s==="__none"?"":s),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:13",className:"w-40 h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:57",placeholder:"选择环境"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:353:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:354:15",value:"__none",children:"未指定"}),Y.map(s=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:356:17",value:String(s.id),children:e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:357:19",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:358:21",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:s.color}}),s.display_name]})},s.id))]})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:365:11",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"选择后流水线执行记录会关联到对应环境"})]})}),e.jsxs(ss,{"code-path":"src/components/deploy/PipelineEditor.tsx:369:7",value:Se,onValueChange:_e,children:[e.jsxs(ts,{"code-path":"src/components/deploy/PipelineEditor.tsx:370:9",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:371:11",value:"flow",children:"流程配置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:372:11",value:"triggers",children:"触发设置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:373:11",value:"variables",children:"变量"}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:374:11",value:"runs",children:["发布记录 (",F.length,")"]}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:375:11",value:"members",children:["成员管理 (",J.length,")"]})]}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:379:9",value:"flow",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:380:11",className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:381:13",className:"flex-1 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:382:15",className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:383:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["流水线阶段 (",a.length,")"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:17",size:"sm",onClick:Ie,children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:60",className:"w-3.5 h-3.5 mr-1"}),"添加阶段"]})]}),a.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:387:17",className:"text-center py-12 border-2 border-dashed rounded-lg text-[var(--dg-text-secondary)]",children:"点击「添加阶段」开始"}):a.map((s,n)=>{const o=ke[s.id]!==!1;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:392:19",className:"space-y-1",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:393:21",className:"flex items-center gap-2 px-3 py-2 bg-[var(--dg-bg-tertiary)] rounded-t-md border border-b-0 border-[var(--dg-border)] cursor-pointer",onClick:()=>I(t=>({...t,[s.id]:!o})),children:[e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:397:23",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:t=>{t.stopPropagation(),I(l=>({...l,[s.id]:!o}))},children:o?e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:39",className:"w-3.5 h-3.5"}):e.jsx(Ee,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:81",className:"w-3.5 h-3.5"})}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:400:23",value:s.name,onChange:t=>x(l=>l.map((ge,Ke)=>Ke===n?{...ge,name:t.target.value}:ge)),className:"h-7 text-sm font-medium border-none bg-transparent shadow-none flex-1 px-1",onClick:t=>t.stopPropagation()}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:406:23",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.tasks.length," 任务"]}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:407:23",variant:"secondary",className:"text-xs",children:us[s.type]||s.type}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,-1)},disabled:n===0,children:e.jsx(is,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:168",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,1)},disabled:n===a.length-1,children:e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:183",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:23",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-500",onClick:t=>{t.stopPropagation(),We(n)},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:158",className:"w-3.5 h-3.5"})})]}),o&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:413:21",className:"border border-[var(--dg-border)] rounded-b-md p-3 space-y-2",children:[s.tasks.map(t=>e.jsx(Ns,{"code-path":"src/components/deploy/PipelineEditor.tsx:414:46",task:t,selected:_===t.id,onSelect:()=>T(_===t.id?null:t.id),onDelete:()=>Be(t.id)},t.id)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:23",variant:"outline",size:"sm",className:"w-full h-8 text-xs",onClick:()=>Ve(n),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:125",className:"w-3 h-3 mr-1"}),"添加任务"]})]}),nT(null),children:"关闭"})]}),e.jsx(bs,{"code-path":"src/components/deploy/PipelineEditor.tsx:426:15",task:me,onUpdate:Oe,onClose:()=>T(null)})]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:432:9",value:"triggers",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:433:11",className:"space-y-4 max-w-lg",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:184",className:"font-medium",children:"Git Push 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:238",checked:N==="git_push",onCheckedChange:s=>M(s?"git_push":"manual")})]}),N==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:436:46",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:73",children:"监听分支"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:92",value:ee,onChange:s=>se(s.target.value),placeholder:"master, release/*",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:180",className:"font-medium",children:"定时触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:227",checked:N==="cron",onCheckedChange:s=>M(s?"cron":"manual")})]}),N==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:440:42",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:69",children:"Cron 表达式"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:92",value:te,onChange:s=>oe(s.target.value),placeholder:"0 2 * * *",className:"h-9 font-mono"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:182",className:"font-medium",children:"Webhook 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:235",checked:N==="webhook",onCheckedChange:s=>M(s?"webhook":"manual")})]}),N==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:444:45",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:72",children:"Secret Token"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:99",value:ne,onChange:s=>ce(s.target.value),type:"password",placeholder:"输入签名密钥",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:85",className:"pt-6",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:115",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:186",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:228",className:"font-medium",children:"手动触发"}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:269",variant:"secondary",className:"text-xs",children:"默认启用"})]})})})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:451:9",value:"variables",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:452:11",className:"max-w-lg space-y-3",children:[b.map(([s,n],o)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:454:15",className:"flex gap-2 items-center",children:[e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:455:17",value:s,onChange:t=>{const l=[...b];l[o][0]=t.target.value,f(l)},placeholder:"KEY",className:"h-9 w-40 font-mono text-sm"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:456:17",className:"text-[var(--dg-text-secondary)]",children:"="}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:457:17",value:n,onChange:t=>{const l=[...b];l[o][1]=t.target.value,f(l)},placeholder:"VALUE",className:"h-9 flex-1"}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:17",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>f(b.filter((t,l)=>l!==o)),children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:152",className:"w-3.5 h-3.5"})})]},o)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:13",variant:"outline",size:"sm",onClick:()=>f([...b,["",""]]),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:104",className:"w-3.5 h-3.5 mr-1"}),"添加变量"]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:466:9",value:"runs",className:"mt-3",children:F.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:468:13",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无执行记录"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:470:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/PipelineEditor.tsx:471:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineEditor.tsx:472:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:473:19",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:474:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:475:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:476:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:477:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:478:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"分支"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:479:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:480:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:481:21",className:"px-3 py-2 text-right text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineEditor.tsx:484:17",children:F.map(s=>e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:486:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:487:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",s.build_number||s.id]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:488:23",className:"px-3 py-2",children:s.status==="success"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:51",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(rs,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:127",className:"w-3 h-3 mr-0.5"}),"成功"]}):s.status==="failed"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:50",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(as,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:114",className:"w-3 h-3 mr-0.5"}),"失败"]}):s.status==="running"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:51",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:[e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:118",className:"w-3 h-3 animate-spin mr-0.5"}),"执行中"]}):s.status==="cancelled"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:53",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:126",className:"w-3 h-3 mr-0.5"}),"已停止"]}):e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:493:26",variant:"secondary",className:"text-[var(--dg-text-secondary)]",children:s.status})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:495:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:[s.trigger_mode==="manual"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:496:57",className:"flex items-center gap-1",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:496:99",className:"w-3 h-3"}),"手动"]}),s.trigger_mode==="cron"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:497:55",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:497:97",className:"w-3 h-3"}),"定时"]}),s.trigger_mode==="webhook"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:498:58",className:"flex items-center gap-1",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:498:100",className:"w-3 h-3"}),"Webhook"]}),s.trigger_mode==="git_push"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:499:59",className:"flex items-center gap-1",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:499:101",className:"w-3 h-3"}),"Git Push"]}),!s.trigger_mode&&(s.triggered_by||"手动")]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:502:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.triggered_by||"admin"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:503:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] font-mono text-xs",children:s.branch||"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:504:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:Ce(s.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:505:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.created_at?new Date(s.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:506:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:507:25",className:"flex items-center justify-end gap-1",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>Ge(s),children:[e.jsx(ps,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:152",className:"w-3.5 h-3.5 mr-1"}),"日志"]}),(s.status==="running"||s.status==="pending")&&e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:29",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>Ue(s.id),children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:152",className:"w-3.5 h-3.5 mr-1"}),"停止"]})]})})]},s.id))})]})})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:523:9",value:"members",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:524:11",className:"max-w-xl space-y-4",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:526:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:527:15",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:528:17",className:"flex items-center gap-3",children:[e.jsx(ls,{"code-path":"src/components/deploy/PipelineEditor.tsx:529:19",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:530:19",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"添加用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:532:17",className:"flex items-end gap-3 mt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:533:19",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:534:21",className:"text-xs",children:"用户名"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:535:21",value:U,onChange:s=>ie(s.target.value),placeholder:"输入用户名",className:"h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:537:19",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:538:21",className:"text-xs",children:"角色"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:539:21",value:re,onValueChange:ze,children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:23",className:"h-9 w-28",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:59"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:541:23",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:542:25",value:"owner",children:"拥有者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:543:25",value:"editor",children:"编辑者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:544:25",value:"viewer",children:"查看者"})]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:19",onClick:He,className:"h-9",children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:69",className:"w-4 h-4 mr-1"}),"添加"]})]})]})}),(()=>{const s=J.filter(o=>o.username),n=J.filter(o=>o.group_id);return e.jsxs(e.Fragment,{children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:560:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:561:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:562:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👤 直接用户授权 (",s.length,")"]}),Le?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:566:25",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:566:80",className:"w-5 h-5 animate-spin text-[var(--dg-text-secondary)]"})}):s.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:568:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:"暂无直接用户"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:570:25",className:"divide-y divide-[var(--dg-border)]",children:s.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:572:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:573:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:574:33",className:"w-8 h-8 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(xs,{"code-path":"src/components/deploy/PipelineEditor.tsx:574:119",className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:575:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:576:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.username}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:35",className:"text-xs text-[var(--dg-text-secondary)]",children:o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:227",className:"text-slate-400",children:"查看者"})})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:162",className:"w-3.5 h-3.5 mr-1"}),"移除"]})]},o.id))})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:589:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:590:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:591:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👥 用户组授权 (",n.length,")"]}),n.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:595:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:["暂无组授权 — 在「",e.jsx("a",{"code-path":"src/components/deploy/PipelineEditor.tsx:596:37",href:"/deploy/groups",className:"text-blue-400 underline",children:"用户组管理"}),"」页面创建组后,可在此授权"]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:599:25",className:"divide-y divide-[var(--dg-border)]",children:n.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:601:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:602:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:603:33",className:"w-8 h-8 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:603:121",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:604:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:605:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.group?.name||`组 #${o.group_id}`}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:35",className:"text-xs text-[var(--dg-text-secondary)]",children:[o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:227",className:"text-slate-400",children:"查看者"})," · 组内全体成员"]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:162",className:"w-3.5 h-3.5 mr-1"}),"撤销授权"]})]},o.id))})]})})]})})()]})})]}),e.jsx(fs,{"code-path":"src/components/deploy/PipelineEditor.tsx:624:7",open:Ae,onClose:()=>ae(!1),run:De,logs:$e})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:326:25",className:"text-center py-20 text-[var(--dg-text-secondary)]",children:"流水线不存在"})}export{Vs as default}; diff --git a/backend/static/assets/PipelineManager-DCrhFfx4.js b/backend/static/assets/PipelineManager-C_oAjTIU.js similarity index 99% rename from backend/static/assets/PipelineManager-DCrhFfx4.js rename to backend/static/assets/PipelineManager-C_oAjTIU.js index 2e81c4e..8241e82 100644 --- a/backend/static/assets/PipelineManager-DCrhFfx4.js +++ b/backend/static/assets/PipelineManager-C_oAjTIU.js @@ -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/PipelineRunPanel.tsx:75:18",className:"font-bold text-amber-400",children:["(",u,")"]})]})]}),u>0&&t.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:81:9",className:"space-y-1",children:t.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:83:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:84:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:85:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:86:17",className:"text-[var(--dg-text-secondary)] font-mono",children:["#",String(i.build_number??i.id??"")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:87:17",className:"text-[var(--dg-text-secondary)]",children:String(i.branch||"-")}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:88:17",className:"text-[var(--dg-text-secondary)] opacity-50",children:String(i.triggered_by||"-")})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:90:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i.id),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:91:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i.id))}),u>0&&t.length===0&&C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:99:9",className:"space-y-1",children:C.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:101:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:102:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:103:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:104:17",className:"text-[var(--dg-text-muted)] font-mono",children:["Run #",i]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:106:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:107:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i))})]})}function ga({pipeline:n,pipelineRuns:p,isLoadingRuns:P,onStopRun:b}){const[j,d]=o.useState(!1),[y,M]=o.useState(null),[w,u]=o.useState([]),C=n.code||n.id,R=async t=>{M(t),d(!0);try{const i=await L.getRunLog(C,t.id);u(i?.logs||[])}catch{u([])}};return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:136:5",className:"border-t border-[var(--dg-border)]",children:[e.jsx(xa,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:137:7",pipeline:n}),P?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:140:9",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:141:11",className:"h-5 w-5 animate-spin text-[var(--dg-text-secondary)]"})}):p.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:144:9",className:"py-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"暂无执行记录"}):e.jsxs("table",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:146:9",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:147:11",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:148:13",className:"bg-[var(--dg-bg-tertiary)]",children:[e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:149:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:150:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:151:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:152:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:153:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:154:15",className:"px-4 py-2 text-right text-xs font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:157:11",children:p.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:159:15",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:160:17",className:"px-4 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",String(t.build_number??t.id??"")]}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:161:17",className:"px-4 py-2",children:t.status==="success"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:163:21",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-[11px]",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:164:23",className:"h-3 w-3 mr-0.5"}),"成功"]}):t.status==="failed"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:167:21",className:"bg-red-500/20 text-red-400 border-red-500/30 text-[11px]",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:168:23",className:"h-3 w-3 mr-0.5"}),"失败"]}):t.status==="running"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:171:21",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-[11px]",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:172:23",className:"h-3 w-3 animate-spin mr-0.5"}),"执行中"]}):t.status==="cancelled"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:175:21",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-[11px]",children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:176:23",className:"h-3 w-3 mr-0.5"}),"已停止"]}):e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:179:21",variant:"secondary",className:"text-[11px]",children:String(t.status)})}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:182:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:String(t.triggered_by||"admin")}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:183:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:ge(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:184:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:t.created_at?new Date(t.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:187:17",className:"px-4 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:188:19",className:"flex items-center justify-end gap-1",children:[e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:189:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>R(t),children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:190:23",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),(t.status==="running"||t.status==="pending")&&e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:193:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>b(t.id),children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:194:25",className:"h-3.5 w-3.5 mr-1"}),"停止"]})]})})]},t.id))})]}),e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:205:7",open:j,onOpenChange:d,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:206:9",className:"max-w-3xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:207:11",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:208:13",className:"flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:209:15",className:"h-5 w-5"}),"执行日志 #",String(y?.build_number??y?.id??"")]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:212:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:213:13",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:214:15",children:["触发方式: ",String(y?.triggered_by||"manual")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:215:15",children:["分支: ",String(y?.branch||"-")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:216:15",children:["耗时: ",ge(y?.duration)]})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:218:13",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:w.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:220:17",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):w.map((t,i)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:223:19",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:224:21",className:"text-slate-500 shrink-0",children:["[",t.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:225:21",className:t.level==="error"?"text-red-400":t.level==="warn"?"text-yellow-400":t.level==="success"?"text-green-400":"text-slate-300",children:[t.level==="success"?"✓":t.level==="error"?"✗":t.level==="warn"?"!":">"," ",t.message]})]},i))})]})]})})]})}function ha({pipeline:n,isExpanded:p,isLoadingRuns:P,pipelineRuns:b,onToggleExpand:j,onTrigger:d,onStopRunning:y,onDelete:M,onStopRun:w}){const u=Oe(),C=ma(n.stages),R=n.repo,t=n.registry,i=n.environment,A=n.code||n.id;return e.jsx(Ke,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:61:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] overflow-hidden",children:e.jsxs(Ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:62:7",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:63:9",className:"px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:64:11",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:65:13",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:66:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:67:17",className:"font-semibold text-[var(--dg-text-primary)]",children:String(n.name)}),n.run_count>0&&e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:69:19",variant:"outline",className:"text-[11px] text-[var(--dg-text-secondary)] border-[var(--dg-border)]",children:["#",String(n.run_count)]}),da(n.last_status),i&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:75:19",style:{backgroundColor:`${i.color}20`,color:i.color},className:"text-xs",children:String(i.display_name)}),n.job_name&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:83:19",variant:"secondary",className:"text-xs font-mono opacity-60",children:String(n.job_name)})]}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:86:15",className:"text-xs text-[var(--dg-text-secondary)] mt-1 line-clamp-1",children:String(n.description||"暂无描述")}),(n.last_run_branch||n.last_commit_id||n.last_image_tag)&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:91:17",className:"flex items-center gap-1 mt-1.5 text-xs font-mono",children:[n.last_run_branch&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:93:21",className:"flex items-center gap-0.5 text-indigo-400",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:94:23",className:"h-3 w-3"}),String(n.last_run_branch)]}),n.last_run_branch&&n.last_commit_id&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:98:21",className:"text-[var(--dg-text-secondary)] opacity-50 text-[10px] mx-0.5",children:"+"}),n.last_commit_id&&e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:101:21",className:"text-amber-400 bg-amber-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_commit_id).slice(0,8)}),(n.last_run_branch||n.last_commit_id)&&n.last_image_tag&&e.jsx(I,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:106:21",className:"h-3 w-3 text-[var(--dg-text-secondary)] opacity-40 mx-0.5"}),n.last_image_tag&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:109:21",className:"flex items-center gap-0.5 text-cyan-400",children:[e.jsx(Ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:110:23",className:"h-3 w-3"}),e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:111:23",className:"bg-cyan-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_image_tag)})]}),n.last_duration>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:115:21",className:"flex items-center gap-0.5 ml-auto text-[var(--dg-text-secondary)] opacity-50",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:116:23",className:"h-3 w-3"}),ge(n.last_duration)]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:121:15",className:"flex items-center gap-3 mt-1.5 text-xs text-[var(--dg-text-secondary)] opacity-60",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:122:17",className:"flex items-center gap-1",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:123:19",className:"h-3 w-3"}),n.deploy_mode==="tag"?"Tag发版":String(n.branch||"main")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:126:17",className:"flex items-center gap-1",children:(n.deploy_target||"ssh")==="k8s"?e.jsxs(e.Fragment,{children:[e.jsx(he,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:128:23",className:"h-3 w-3"}),"Kubernetes"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:130:23",className:"h-3 w-3"}),"SSH 主机"]})}),R&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:26",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:68",className:"h-3 w-3"}),String(R.name)]}),t&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:30",className:"flex items-center gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:72",className:"h-3 w-3"}),String(t.name)]}),n.last_run_at&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:19",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:25",className:"h-3 w-3 inline mr-0.5"}),new Date(n.last_run_at).toLocaleString("zh-CN")]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:140:13",className:"flex items-center gap-1 ml-4 shrink-0",children:[n.last_status==="running"?e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:142:17",variant:"destructive",size:"sm",className:"h-8",onClick:y,children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:143:19",className:"h-3.5 w-3.5 mr-1"}),"停止"]}):e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:146:17",variant:"default",size:"sm",className:"h-8",onClick:d,children:[e.jsx(Xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:147:19",className:"h-3.5 w-3.5 mr-1"}),"执行"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:150:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}`),children:"编辑"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:151:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}/runs`),children:[e.jsx(Ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:152:17",className:"h-3.5 w-3.5 mr-1"}),"记录"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:154:15",variant:"ghost",size:"sm",className:"h-8",onClick:j,children:p?e.jsx(Ze,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:31",className:"h-4 w-4"}):e.jsx(me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:69",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:157:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:M,children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:158:17",className:"h-4 w-4"})})]})]}),C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:164:13",className:"flex items-center mt-2.5",children:C.map((g,E)=>{const Q=le.find(z=>z.label===g.name);let _="";if(n.last_run_stages)try{const z=typeof n.last_run_stages=="string"?JSON.parse(n.last_run_stages):n.last_run_stages,X=Array.isArray(z)?z.find(J=>J.name===g.name||J.type===Q?.key):null;_=String(X?.status||"")}catch{}const F=_==="success"||_==="completed",q=_==="running"||_==="in_progress",G=_==="failed"||_==="error",$=G?"#EF4444":q?"#3B82F6":F?"#10B981":"#6B7280",V=G?"#EF444428":q?"#3B82F628":F?"#10B98128":"#6B728018",W=G?e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:186:19",className:"h-3 w-3"}):q?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:188:19",className:"h-3 w-3 animate-spin"}):F?e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:190:19",className:"h-3 w-3"}):e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:192:19",className:"text-[10px] opacity-40",children:"○"});return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:195:19",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:196:21",className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] font-semibold border shadow-sm",style:{backgroundColor:V,borderColor:`${$}70`,color:$,borderRadius:E===0?"8px 0 0 8px":E===C.length-1?"0 8px 8px 0":"0"},children:[W,String(g.name)]}),E{try{const[a,c]=await Promise.all([ra.getEnvironments().catch(()=>({list:[]})),la.list({page_size:100}).catch(()=>({list:[]}))]);ze(Array.isArray(a?.list)?a.list:[]);const x=c?.list||[];X(x.filter(m=>m.secret_type==="api")),ne(x.filter(m=>m.secret_type==="docker"))}catch{}},[]);o.useEffect(()=>{n&&Re()},[n,Re]);const Ae=()=>{j(""),y(""),w(""),C(""),t("main"),A(""),E(["checkout","build","image","deploy"]),_("branch"),q("ssh"),$(""),r(""),B(""),S("manual"),ve(""),be(""),pe(""),fe(""),K([]),we(""),Se(2)},qe=async()=>{if(!b.trim()){N.error("请输入流水线名称");return}if(g.includes("checkout")&&!u.trim()){N.error("代码检出阶段需要填写 Git URL");return}if(g.includes("image")&&!l){N.error("镜像打包阶段需要关联 Docker 凭证");return}W(!0);try{const a=g.map(x=>le.find(m=>m.key===x)?.label||x),c=JSON.stringify(a.map((x,m)=>({id:`stage-${m+1}`,name:x,type:g[m]||"custom",tasks:[]})));await L.createPipeline({name:b,code:ca(b),job_name:d||void 0,description:M,source:u,branch:R,dockerfile:i,type:"deploy",stages:c,deploy_mode:Q,deploy_target:F,environment_id:G?Number(G):null,repo_id:null,registry_id:null,git_credential_id:s?Number(s):null,registry_credential_id:l?Number(l):null,trigger_mode:k,watch_branches:Pe||void 0,exclude_branch:je||void 0,cron_expr:Ne||void 0,webhook_token:Ce||void 0,variables:O.length>0?JSON.stringify(O):void 0,cache_paths:De||void 0,max_executors:ke}),N.success("流水线已创建"),p(!1),Ae(),P()}catch{N.error("创建失败")}finally{W(!1)}};return e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:153:5",open:n,onOpenChange:p,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:154:7",className:"max-w-2xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:155:9",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:11",className:"flex items-center gap-2",children:[e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:60",className:"h-5 w-5"}),"新建流水线"]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:158:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:159:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:160:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:15",children:["名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:25",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:162:15",value:b,onChange:a=>j(a.target.value),placeholder:"例如: demo-jar 后端部署",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:164:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:15",children:["Job 名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:29",className:"text-xs text-[var(--dg-text-secondary)]",children:"(Webhook URL)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:166:15",value:d,onChange:a=>y(a.target.value),placeholder:"cex-admin-server",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-sm"}),d&&e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:30",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook: POST .../webhook/job/",e.jsx("b",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:130",children:d})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:170:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:171:13",children:"描述"}),e.jsx(oa,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:172:13",value:M,onChange:a=>w(a.target.value),placeholder:"流水线描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:175:11",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:176:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:177:15",children:"部署模式"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:178:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"branch",label:"分支",icon:U},{key:"tag",label:"Tag 发版",icon:ea}].map(a=>{const c=Q===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:185:21",onClick:()=>_(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:192:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:198:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:199:15",children:"部署目标"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:200:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"ssh",label:"SSH 主机",icon:ye},{key:"k8s",label:"Kubernetes 集群",icon:he}].map(a=>{const c=F===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:207:21",onClick:()=>q(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-green-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:214:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:220:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:221:15",children:"环境分组"}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:222:15",value:String(G),onValueChange:a=>$(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:102",placeholder:"选择环境"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:224:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:225:19",value:"__none",children:"不指定"}),$e.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:227:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:228:23",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:229:25",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:a.color}}),String(a.display_name)]})},a.id))]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:239:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:240:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:15",children:["Git URL ",g.includes("checkout")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:70",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:242:15",value:u,onChange:a=>C(a.target.value),placeholder:"https://gitee.com/user/repo.git",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:244:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:245:15",children:"分支 / Tag"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:246:15",value:R,onChange:a=>t(a.target.value),placeholder:Q==="tag"?"v1.0.0":"main",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:248:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:15",children:["Git 凭证 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:29",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(API Token)"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:250:15",value:String(s),onValueChange:a=>r(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:102",placeholder:"选择凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:252:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:253:19",value:"__none",children:"不关联"}),z.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:255:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:256:23",className:"flex items-center gap-1.5",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:96",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!s&&g.includes("checkout")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:263:78",className:"text-xs text-amber-400",children:"建议关联凭证"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:265:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:15",children:["镜像仓库凭证 ",g.includes("image")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:66",className:"text-red-400",children:"*"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:267:15",value:String(l),onValueChange:a=>B(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:102",placeholder:"选择 Docker 凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:269:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:270:19",value:"__none",children:"不关联"}),J.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:272:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:273:23",className:"flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:100",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!l&&g.includes("image")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:280:80",className:"text-xs text-amber-400",children:"需要关联 Docker 凭证"})]})]}),l&&d&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:285:13",className:"p-2.5 rounded-md bg-blue-500/5 border border-blue-500/20 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:286:15",className:"text-blue-400",children:"镜像命名:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:287:15",className:"text-[var(--dg-text-primary)]",children:["{registry}","/","{namespace}","/","{","{JOB_BASE_NAME}","}",":","{","{tag}","}"]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:288:15",className:"ml-2 opacity-60",children:"例:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:289:15",className:"opacity-60",children:["harbor.ast1001.com/test/",d,":latest"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:292:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:293:13",children:"Dockerfile 路径"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:294:13",value:i,onChange:a=>A(a.target.value),placeholder:"jar/Dockerfile",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:297:11",className:"space-y-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:13",children:["发布流程 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70 ml-1",children:"按顺序选择阶段"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:299:13",className:"flex flex-wrap gap-2",children:le.map(a=>{const c=g.includes(a.key);return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:303:19",className:`cursor-pointer transition-all text-xs px-3 py-1.5 ${c?"border-current":"border-[var(--dg-border)] opacity-50 hover:opacity-80"}`,style:c?{backgroundColor:`${a.color}20`,color:a.color,borderColor:a.color}:{},onClick:()=>E(c?g.filter(x=>x!==a.key):[...g,a.key]),title:a.desc,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:310:21",className:"h-3 w-3 mr-1"}),a.label," ",a.needs.includes("repo")?"🔗":"",a.needs.includes("registry")?"📦":""]},a.key)})}),g.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:316:15",className:"flex items-center mt-2",children:g.map((a,c)=>{const x=le.find(m=>m.key===a);return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:320:21",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:321:23",className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium border",style:{backgroundColor:`${x.color}20`,borderColor:`${x.color}40`,color:x.color,borderRadius:c===0?"6px 0 0 6px":c===g.length-1?"0 6px 6px 0":"0"},children:[e.jsx(x.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:330:25",className:"h-3 w-3"}),x.label]}),c{const c=k===a.key;return e.jsx("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:355:19",onClick:()=>S(a.key),className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,title:a.desc,children:a.label},a.key)})}),k==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:370:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:371:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:19",className:"text-xs",children:["监听分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(逗号分隔,支持 * 通配)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:373:19",value:Pe,onChange:a=>ve(a.target.value),placeholder:"release/*, main",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:19",className:"text-xs",children:["排除分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(不触发构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:377:19",value:je,onChange:a=>be(a.target.value),placeholder:"wip/*, draft/*",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]})]}),k==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:383:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:384:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:19",className:"text-xs",children:["Cron 表达式 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:55",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(标准 5 位)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:386:19",value:Ne,onChange:a=>pe(a.target.value),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:388:17",className:"flex flex-wrap gap-1.5",children:[{expr:"*/5 * * * *",label:"每5分钟"},{expr:"0 * * * *",label:"每小时"},{expr:"0 2 * * *",label:"每天2点"},{expr:"0 0 * * 0",label:"每周日"}].map(a=>e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:395:21",variant:"outline",className:"cursor-pointer text-[10px] hover:bg-blue-500/10",onClick:()=>pe(a.expr),children:a.label},a.expr))})]}),k==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:404:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:405:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:19",className:"text-xs",children:["Webhook Token ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:60",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(签名验证,可选)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:407:19",value:Ce,onChange:a=>fe(a.target.value),placeholder:"随机字符串",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:409:17",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook URL: ",e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:410:32",className:"text-[var(--dg-blue)]",children:["POST /api/v1/webhook/pipeline/","{code}"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:416:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:417:13",className:"flex items-center justify-between mb-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:15",children:["环境变量 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:27",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:["($","{VAR_NAME}"," 引用)"]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:419:15",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>K([...O,{key:"",value:"",desc:""}]),children:[e.jsx(xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:420:17",className:"h-3 w-3 mr-1"}),"添加变量"]})]}),O.length===0?e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:424:15",className:"text-xs text-[var(--dg-text-muted)] py-2",children:'暂无变量,点击"添加变量"新增'}):e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:426:15",className:"space-y-2",children:O.map((a,c)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:428:19",className:"grid grid-cols-12 gap-2 items-start p-2 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:429:21",value:a.key,onChange:x=>{const m=[...O];m[c]={...m[c],key:x.target.value},K(m)},placeholder:"变量名",className:"col-span-3 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:439:21",value:a.value,onChange:x=>{const m=[...O];m[c]={...m[c],value:x.target.value},K(m)},placeholder:"变量值",className:"col-span-4 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:449:21",value:a.desc,onChange:x=>{const m=[...O];m[c]={...m[c],desc:x.target.value},K(m)},placeholder:"说明",className:"col-span-4 h-8 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:459:21",variant:"ghost",size:"icon",className:"col-span-1 h-8 w-8 text-red-400",onClick:()=>K(O.filter((x,m)=>m!==c)),children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:460:23",className:"h-3.5 w-3.5"})})]},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:468:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:13",className:"mb-2 block",children:["构建缓存 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:48",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(加速后续构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:470:13",value:De,onChange:a=>we(a.target.value),placeholder:"node_modules, .m2, target",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-8 text-xs font-mono"}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:471:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"多个路径用逗号分隔,相同的 Key 会命中已有缓存"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:474:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:13",className:"mb-2 block",children:["并发执行数 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:49",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(Number of executors)"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:476:13",className:"flex items-center gap-2",children:e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:477:15",value:String(ke),onValueChange:a=>Se(Number(a)),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:478:17",className:"w-32 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:479:19"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:481:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:482:19",value:"1",children:"1 — 串行"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:483:19",value:"2",children:"2"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:484:19",value:"3",children:"3"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:485:19",value:"4",children:"4"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:486:19",value:"5",children:"5"})]})]})}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:490:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"设为 1 则按顺序串行执行,默认 2 可并发构建"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:493:9",className:"flex justify-end gap-2 mt-4 pt-4 border-t border-[var(--dg-border)]",children:[e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:494:11",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:495:11",onClick:qe,disabled:V,children:[V?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:75",className:"h-4 w-4 mr-1"}),V?"创建中...":"创建流水线"]})]})]})})}function Ea(){const[n,p]=o.useState(""),{data:P=[],isLoading:b,refetch:j}=ia(),{triggerMutation:d,deleteMutation:y,stopRunMutation:M}=pa(),[w,u]=o.useState({}),[C,R]=o.useState({}),[t,i]=o.useState({}),[A,g]=o.useState("all"),[E,Q]=o.useState({}),[_,F]=o.useState(!1),q=Qe(),G=[{key:"all",label:"全部",icon:na,color:"#6B7280"},{key:"production",label:"生产",icon:Le,color:"#EF4444"},{key:"testing",label:"测试",icon:ae,color:"#F59E0B"},{key:"staging",label:"预发布",icon:ue,color:"#8B5CF6"},{key:"development",label:"开发",icon:sa,color:"#3B82F6"}];o.useEffect(()=>{P.forEach(s=>{const r=s.id;s.last_status==="running"&&!E[r]&&L.getRuns(s.code).then(l=>{const k=(l?.list||[]).find(S=>S.status==="running"||S.status==="pending");k&&Q(S=>({...S,[r]:k}))}).catch(()=>{})})},[P,E]);const $=async(s,r)=>{i(l=>({...l,[s]:!0}));try{const l=await L.getRuns(r);R(B=>({...B,[s]:l?.list||[]}))}catch{R(l=>({...l,[s]:[]}))}finally{i(l=>({...l,[s]:!1}))}},V=(s,r)=>{w[s]?u(l=>({...l,[s]:!1})):($(s,r),u(l=>({...l,[s]:!0})))},W=async(s,r)=>{try{await d.mutateAsync(r),N.success("已触发"),$(s,r),j()}catch{N.error("触发失败")}},z=async(s,r,l)=>{if(await q({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await M.mutateAsync({code:r,runId:l}),N.success("已停止"),$(s,r),Q(k=>{const S={...k};return delete S[s],S})}catch{N.error("停止失败")}},X=async(s,r)=>{const l=E[s];if(!l){try{const k=((await L.getRuns(r))?.list||[]).find(S=>S.status==="running"||S.status==="pending");k?await z(s,r,k.id):N.error("未找到运行中的任务")}catch{N.error("停止失败")}return}await z(s,r,l.id)},J=async s=>{if(await q({title:"删除流水线",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await y.mutateAsync(s.id),N.success("已删除"),j()}catch{N.error("删除失败")}},ne=P.filter(s=>{const r=String(s.name||"").toLowerCase().includes(n.toLowerCase())||String(s.description||"").toLowerCase().includes(n.toLowerCase()),l=s.environment,B=A==="all"||(l?.type||"")===A;return r&&B});return e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:157:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/deploy/PipelineManager.tsx:160:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"流水线"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:161:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"CI/CD 构建 · 部署 · 发布一体化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:164:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>j(),children:[e.jsx(ee,{"code-path":"src/components/deploy/PipelineManager.tsx:165:13",className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:167:11",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:167:52",className:"h-4 w-4 mr-2"}),"新建流水线"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:172:7",className:"flex items-stretch gap-3 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:173:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:174:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:175:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:176:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:177:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:178:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:179:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:180:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:181:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-blue-400/10 border border-blue-400/20",children:[e.jsx(ye,{"code-path":"src/components/deploy/PipelineManager.tsx:182:15",className:"h-3 w-3 text-blue-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:183:15",className:"text-[10px] font-medium text-blue-400",children:"SSH 主机"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:186:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"传统主机 SCP 部署 · 无需镜像仓库"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:188:9",className:"w-px bg-[var(--dg-border)]"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:189:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:190:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:191:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:192:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:193:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(ie,{"code-path":"src/components/deploy/PipelineManager.tsx:194:13",className:"h-3 w-3 text-cyan-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:195:13",className:"text-[10px] font-semibold text-cyan-400",children:"镜像仓库"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:196:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:197:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:198:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:199:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:200:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-400/10 border border-emerald-400/20",children:[e.jsx(he,{"code-path":"src/components/deploy/PipelineManager.tsx:201:15",className:"h-3 w-3 text-emerald-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:202:15",className:"text-[10px] font-medium text-emerald-400",children:"Kubernetes"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:205:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"容器化部署 · 需镜像仓库推送"})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:207:9",className:"self-center ml-2 text-[10px] text-[var(--dg-text-secondary)] opacity-30 tracking-wide whitespace-nowrap",children:"全流程可视化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:210:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:211:9",className:"relative max-w-md flex-1",children:[e.jsx(aa,{"code-path":"src/components/deploy/PipelineManager.tsx:212:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx(f,{"code-path":"src/components/deploy/PipelineManager.tsx:213:11",placeholder:"搜索流水线...",value:n,onChange:s=>p(s.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:220:9",className:"flex items-center gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:G.map(s=>{const r=A===s.key,l=s.icon;return e.jsxs("button",{"code-path":"src/components/deploy/PipelineManager.tsx:225:15",onClick:()=>g(s.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r?"text-white shadow-sm":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,style:r?{backgroundColor:s.color}:{},children:[e.jsx(l,{"code-path":"src/components/deploy/PipelineManager.tsx:233:17",className:"h-3.5 w-3.5"}),s.label]},s.key)})})]}),b?e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:241:9",className:"flex items-center justify-center py-12",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineManager.tsx:242:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):ne.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:245:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(ta,{"code-path":"src/components/deploy/PipelineManager.tsx:246:11",className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:247:11",className:"text-sm",children:"暂无流水线"}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:248:11",variant:"outline",className:"mt-4",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:249:13",className:"h-4 w-4 mr-1"}),"创建第一个流水线"]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:253:9",className:"space-y-3",children:ne.map(s=>{const r=s.id,l=s.code||s.id;return e.jsx(ha,{"code-path":"src/components/deploy/PipelineManager.tsx:258:15",pipeline:s,isExpanded:!!w[r],isLoadingRuns:!!t[r],pipelineRuns:C[r]||[],onToggleExpand:()=>V(r,l),onTrigger:()=>W(r,l),onStopRunning:()=>X(r,l),onDelete:()=>J(s),onStopRun:B=>z(r,l,B)},r)})}),e.jsx(ya,{"code-path":"src/components/deploy/PipelineManager.tsx:275:7",open:_,onOpenChange:F,onCreated:j})]})}export{Ea as PipelineManager}; +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/PipelineRunPanel.tsx:75:18",className:"font-bold text-amber-400",children:["(",u,")"]})]})]}),u>0&&t.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:81:9",className:"space-y-1",children:t.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:83:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:84:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:85:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:86:17",className:"text-[var(--dg-text-secondary)] font-mono",children:["#",String(i.build_number??i.id??"")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:87:17",className:"text-[var(--dg-text-secondary)]",children:String(i.branch||"-")}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:88:17",className:"text-[var(--dg-text-secondary)] opacity-50",children:String(i.triggered_by||"-")})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:90:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i.id),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:91:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i.id))}),u>0&&t.length===0&&C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:99:9",className:"space-y-1",children:C.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:101:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:102:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:103:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:104:17",className:"text-[var(--dg-text-muted)] font-mono",children:["Run #",i]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:106:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:107:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i))})]})}function ga({pipeline:n,pipelineRuns:p,isLoadingRuns:P,onStopRun:b}){const[j,d]=o.useState(!1),[y,M]=o.useState(null),[w,u]=o.useState([]),C=n.code||n.id,R=async t=>{M(t),d(!0);try{const i=await L.getRunLog(C,t.id);u(i?.logs||[])}catch{u([])}};return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:136:5",className:"border-t border-[var(--dg-border)]",children:[e.jsx(xa,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:137:7",pipeline:n}),P?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:140:9",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:141:11",className:"h-5 w-5 animate-spin text-[var(--dg-text-secondary)]"})}):p.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:144:9",className:"py-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"暂无执行记录"}):e.jsxs("table",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:146:9",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:147:11",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:148:13",className:"bg-[var(--dg-bg-tertiary)]",children:[e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:149:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:150:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:151:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:152:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:153:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:154:15",className:"px-4 py-2 text-right text-xs font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:157:11",children:p.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:159:15",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:160:17",className:"px-4 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",String(t.build_number??t.id??"")]}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:161:17",className:"px-4 py-2",children:t.status==="success"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:163:21",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-[11px]",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:164:23",className:"h-3 w-3 mr-0.5"}),"成功"]}):t.status==="failed"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:167:21",className:"bg-red-500/20 text-red-400 border-red-500/30 text-[11px]",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:168:23",className:"h-3 w-3 mr-0.5"}),"失败"]}):t.status==="running"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:171:21",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-[11px]",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:172:23",className:"h-3 w-3 animate-spin mr-0.5"}),"执行中"]}):t.status==="cancelled"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:175:21",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-[11px]",children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:176:23",className:"h-3 w-3 mr-0.5"}),"已停止"]}):e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:179:21",variant:"secondary",className:"text-[11px]",children:String(t.status)})}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:182:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:String(t.triggered_by||"admin")}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:183:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:ge(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:184:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:t.created_at?new Date(t.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:187:17",className:"px-4 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:188:19",className:"flex items-center justify-end gap-1",children:[e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:189:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>R(t),children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:190:23",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),(t.status==="running"||t.status==="pending")&&e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:193:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>b(t.id),children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:194:25",className:"h-3.5 w-3.5 mr-1"}),"停止"]})]})})]},t.id))})]}),e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:205:7",open:j,onOpenChange:d,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:206:9",className:"max-w-3xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:207:11",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:208:13",className:"flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:209:15",className:"h-5 w-5"}),"执行日志 #",String(y?.build_number??y?.id??"")]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:212:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:213:13",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:214:15",children:["触发方式: ",String(y?.triggered_by||"manual")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:215:15",children:["分支: ",String(y?.branch||"-")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:216:15",children:["耗时: ",ge(y?.duration)]})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:218:13",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:w.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:220:17",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):w.map((t,i)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:223:19",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:224:21",className:"text-slate-500 shrink-0",children:["[",t.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:225:21",className:t.level==="error"?"text-red-400":t.level==="warn"?"text-yellow-400":t.level==="success"?"text-green-400":"text-slate-300",children:[t.level==="success"?"✓":t.level==="error"?"✗":t.level==="warn"?"!":">"," ",t.message]})]},i))})]})]})})]})}function ha({pipeline:n,isExpanded:p,isLoadingRuns:P,pipelineRuns:b,onToggleExpand:j,onTrigger:d,onStopRunning:y,onDelete:M,onStopRun:w}){const u=Oe(),C=ma(n.stages),R=n.repo,t=n.registry,i=n.environment,A=n.code||n.id;return e.jsx(Ke,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:61:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] overflow-hidden",children:e.jsxs(Ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:62:7",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:63:9",className:"px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:64:11",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:65:13",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:66:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:67:17",className:"font-semibold text-[var(--dg-text-primary)]",children:String(n.name)}),n.run_count>0&&e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:69:19",variant:"outline",className:"text-[11px] text-[var(--dg-text-secondary)] border-[var(--dg-border)]",children:["#",String(n.run_count)]}),da(n.last_status),i&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:75:19",style:{backgroundColor:`${i.color}20`,color:i.color},className:"text-xs",children:String(i.display_name)}),n.job_name&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:83:19",variant:"secondary",className:"text-xs font-mono opacity-60",children:String(n.job_name)})]}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:86:15",className:"text-xs text-[var(--dg-text-secondary)] mt-1 line-clamp-1",children:String(n.description||"暂无描述")}),(n.last_run_branch||n.last_commit_id||n.last_image_tag)&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:91:17",className:"flex items-center gap-1 mt-1.5 text-xs font-mono",children:[n.last_run_branch&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:93:21",className:"flex items-center gap-0.5 text-indigo-400",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:94:23",className:"h-3 w-3"}),String(n.last_run_branch)]}),n.last_run_branch&&n.last_commit_id&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:98:21",className:"text-[var(--dg-text-secondary)] opacity-50 text-[10px] mx-0.5",children:"+"}),n.last_commit_id&&e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:101:21",className:"text-amber-400 bg-amber-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_commit_id).slice(0,8)}),(n.last_run_branch||n.last_commit_id)&&n.last_image_tag&&e.jsx(I,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:106:21",className:"h-3 w-3 text-[var(--dg-text-secondary)] opacity-40 mx-0.5"}),n.last_image_tag&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:109:21",className:"flex items-center gap-0.5 text-cyan-400",children:[e.jsx(Ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:110:23",className:"h-3 w-3"}),e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:111:23",className:"bg-cyan-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_image_tag)})]}),n.last_duration>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:115:21",className:"flex items-center gap-0.5 ml-auto text-[var(--dg-text-secondary)] opacity-50",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:116:23",className:"h-3 w-3"}),ge(n.last_duration)]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:121:15",className:"flex items-center gap-3 mt-1.5 text-xs text-[var(--dg-text-secondary)] opacity-60",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:122:17",className:"flex items-center gap-1",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:123:19",className:"h-3 w-3"}),n.deploy_mode==="tag"?"Tag发版":String(n.branch||"main")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:126:17",className:"flex items-center gap-1",children:(n.deploy_target||"ssh")==="k8s"?e.jsxs(e.Fragment,{children:[e.jsx(he,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:128:23",className:"h-3 w-3"}),"Kubernetes"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:130:23",className:"h-3 w-3"}),"SSH 主机"]})}),R&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:26",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:68",className:"h-3 w-3"}),String(R.name)]}),t&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:30",className:"flex items-center gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:72",className:"h-3 w-3"}),String(t.name)]}),n.last_run_at&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:19",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:25",className:"h-3 w-3 inline mr-0.5"}),new Date(n.last_run_at).toLocaleString("zh-CN")]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:140:13",className:"flex items-center gap-1 ml-4 shrink-0",children:[n.last_status==="running"?e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:142:17",variant:"destructive",size:"sm",className:"h-8",onClick:y,children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:143:19",className:"h-3.5 w-3.5 mr-1"}),"停止"]}):e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:146:17",variant:"default",size:"sm",className:"h-8",onClick:d,children:[e.jsx(Xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:147:19",className:"h-3.5 w-3.5 mr-1"}),"执行"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:150:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}`),children:"编辑"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:151:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}/runs`),children:[e.jsx(Ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:152:17",className:"h-3.5 w-3.5 mr-1"}),"记录"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:154:15",variant:"ghost",size:"sm",className:"h-8",onClick:j,children:p?e.jsx(Ze,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:31",className:"h-4 w-4"}):e.jsx(me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:69",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:157:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:M,children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:158:17",className:"h-4 w-4"})})]})]}),C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:164:13",className:"flex items-center mt-2.5",children:C.map((g,E)=>{const Q=le.find(z=>z.label===g.name);let _="";if(n.last_run_stages)try{const z=typeof n.last_run_stages=="string"?JSON.parse(n.last_run_stages):n.last_run_stages,X=Array.isArray(z)?z.find(J=>J.name===g.name||J.type===Q?.key):null;_=String(X?.status||"")}catch{}const F=_==="success"||_==="completed",q=_==="running"||_==="in_progress",G=_==="failed"||_==="error",$=G?"#EF4444":q?"#3B82F6":F?"#10B981":"#6B7280",V=G?"#EF444428":q?"#3B82F628":F?"#10B98128":"#6B728018",W=G?e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:186:19",className:"h-3 w-3"}):q?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:188:19",className:"h-3 w-3 animate-spin"}):F?e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:190:19",className:"h-3 w-3"}):e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:192:19",className:"text-[10px] opacity-40",children:"○"});return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:195:19",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:196:21",className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] font-semibold border shadow-sm",style:{backgroundColor:V,borderColor:`${$}70`,color:$,borderRadius:E===0?"8px 0 0 8px":E===C.length-1?"0 8px 8px 0":"0"},children:[W,String(g.name)]}),E{try{const[a,c]=await Promise.all([ra.getEnvironments().catch(()=>({list:[]})),la.list({page_size:100}).catch(()=>({list:[]}))]);ze(Array.isArray(a?.list)?a.list:[]);const x=c?.list||[];X(x.filter(m=>m.secret_type==="api")),ne(x.filter(m=>m.secret_type==="docker"))}catch{}},[]);o.useEffect(()=>{n&&Re()},[n,Re]);const Ae=()=>{j(""),y(""),w(""),C(""),t("main"),A(""),E(["checkout","build","image","deploy"]),_("branch"),q("ssh"),$(""),r(""),B(""),S("manual"),ve(""),be(""),pe(""),fe(""),K([]),we(""),Se(2)},qe=async()=>{if(!b.trim()){N.error("请输入流水线名称");return}if(g.includes("checkout")&&!u.trim()){N.error("代码检出阶段需要填写 Git URL");return}if(g.includes("image")&&!l){N.error("镜像打包阶段需要关联 Docker 凭证");return}W(!0);try{const a=g.map(x=>le.find(m=>m.key===x)?.label||x),c=JSON.stringify(a.map((x,m)=>({id:`stage-${m+1}`,name:x,type:g[m]||"custom",tasks:[]})));await L.createPipeline({name:b,code:ca(b),job_name:d||void 0,description:M,source:u,branch:R,dockerfile:i,type:"deploy",stages:c,deploy_mode:Q,deploy_target:F,environment_id:G?Number(G):null,repo_id:null,registry_id:null,git_credential_id:s?Number(s):null,registry_credential_id:l?Number(l):null,trigger_mode:k,watch_branches:Pe||void 0,exclude_branch:je||void 0,cron_expr:Ne||void 0,webhook_token:Ce||void 0,variables:O.length>0?JSON.stringify(O):void 0,cache_paths:De||void 0,max_executors:ke}),N.success("流水线已创建"),p(!1),Ae(),P()}catch{N.error("创建失败")}finally{W(!1)}};return e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:153:5",open:n,onOpenChange:p,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:154:7",className:"max-w-2xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:155:9",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:11",className:"flex items-center gap-2",children:[e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:60",className:"h-5 w-5"}),"新建流水线"]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:158:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:159:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:160:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:15",children:["名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:25",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:162:15",value:b,onChange:a=>j(a.target.value),placeholder:"例如: demo-jar 后端部署",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:164:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:15",children:["Job 名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:29",className:"text-xs text-[var(--dg-text-secondary)]",children:"(Webhook URL)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:166:15",value:d,onChange:a=>y(a.target.value),placeholder:"cex-admin-server",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-sm"}),d&&e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:30",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook: POST .../webhook/job/",e.jsx("b",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:130",children:d})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:170:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:171:13",children:"描述"}),e.jsx(oa,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:172:13",value:M,onChange:a=>w(a.target.value),placeholder:"流水线描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:175:11",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:176:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:177:15",children:"部署模式"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:178:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"branch",label:"分支",icon:U},{key:"tag",label:"Tag 发版",icon:ea}].map(a=>{const c=Q===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:185:21",onClick:()=>_(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:192:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:198:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:199:15",children:"部署目标"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:200:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"ssh",label:"SSH 主机",icon:ye},{key:"k8s",label:"Kubernetes 集群",icon:he}].map(a=>{const c=F===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:207:21",onClick:()=>q(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-green-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:214:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:220:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:221:15",children:"环境分组"}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:222:15",value:String(G),onValueChange:a=>$(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:102",placeholder:"选择环境"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:224:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:225:19",value:"__none",children:"不指定"}),$e.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:227:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:228:23",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:229:25",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:a.color}}),String(a.display_name)]})},a.id))]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:239:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:240:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:15",children:["Git URL ",g.includes("checkout")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:70",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:242:15",value:u,onChange:a=>C(a.target.value),placeholder:"https://gitee.com/user/repo.git",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:244:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:245:15",children:"分支 / Tag"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:246:15",value:R,onChange:a=>t(a.target.value),placeholder:Q==="tag"?"v1.0.0":"main",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:248:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:15",children:["Git 凭证 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:29",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(API Token)"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:250:15",value:String(s),onValueChange:a=>r(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:102",placeholder:"选择凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:252:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:253:19",value:"__none",children:"不关联"}),z.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:255:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:256:23",className:"flex items-center gap-1.5",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:96",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!s&&g.includes("checkout")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:263:78",className:"text-xs text-amber-400",children:"建议关联凭证"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:265:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:15",children:["镜像仓库凭证 ",g.includes("image")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:66",className:"text-red-400",children:"*"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:267:15",value:String(l),onValueChange:a=>B(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:102",placeholder:"选择 Docker 凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:269:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:270:19",value:"__none",children:"不关联"}),J.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:272:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:273:23",className:"flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:100",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!l&&g.includes("image")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:280:80",className:"text-xs text-amber-400",children:"需要关联 Docker 凭证"})]})]}),l&&d&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:285:13",className:"p-2.5 rounded-md bg-blue-500/5 border border-blue-500/20 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:286:15",className:"text-blue-400",children:"镜像命名:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:287:15",className:"text-[var(--dg-text-primary)]",children:["{registry}","/","{namespace}","/","{","{JOB_BASE_NAME}","}",":","{","{tag}","}"]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:288:15",className:"ml-2 opacity-60",children:"例:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:289:15",className:"opacity-60",children:["harbor.ast1001.com/test/",d,":latest"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:292:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:293:13",children:"Dockerfile 路径"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:294:13",value:i,onChange:a=>A(a.target.value),placeholder:"jar/Dockerfile",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:297:11",className:"space-y-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:13",children:["发布流程 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70 ml-1",children:"按顺序选择阶段"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:299:13",className:"flex flex-wrap gap-2",children:le.map(a=>{const c=g.includes(a.key);return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:303:19",className:`cursor-pointer transition-all text-xs px-3 py-1.5 ${c?"border-current":"border-[var(--dg-border)] opacity-50 hover:opacity-80"}`,style:c?{backgroundColor:`${a.color}20`,color:a.color,borderColor:a.color}:{},onClick:()=>E(c?g.filter(x=>x!==a.key):[...g,a.key]),title:a.desc,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:310:21",className:"h-3 w-3 mr-1"}),a.label," ",a.needs.includes("repo")?"🔗":"",a.needs.includes("registry")?"📦":""]},a.key)})}),g.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:316:15",className:"flex items-center mt-2",children:g.map((a,c)=>{const x=le.find(m=>m.key===a);return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:320:21",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:321:23",className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium border",style:{backgroundColor:`${x.color}20`,borderColor:`${x.color}40`,color:x.color,borderRadius:c===0?"6px 0 0 6px":c===g.length-1?"0 6px 6px 0":"0"},children:[e.jsx(x.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:330:25",className:"h-3 w-3"}),x.label]}),c{const c=k===a.key;return e.jsx("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:355:19",onClick:()=>S(a.key),className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,title:a.desc,children:a.label},a.key)})}),k==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:370:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:371:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:19",className:"text-xs",children:["监听分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(逗号分隔,支持 * 通配)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:373:19",value:Pe,onChange:a=>ve(a.target.value),placeholder:"release/*, main",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:19",className:"text-xs",children:["排除分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(不触发构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:377:19",value:je,onChange:a=>be(a.target.value),placeholder:"wip/*, draft/*",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]})]}),k==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:383:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:384:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:19",className:"text-xs",children:["Cron 表达式 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:55",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(标准 5 位)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:386:19",value:Ne,onChange:a=>pe(a.target.value),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:388:17",className:"flex flex-wrap gap-1.5",children:[{expr:"*/5 * * * *",label:"每5分钟"},{expr:"0 * * * *",label:"每小时"},{expr:"0 2 * * *",label:"每天2点"},{expr:"0 0 * * 0",label:"每周日"}].map(a=>e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:395:21",variant:"outline",className:"cursor-pointer text-[10px] hover:bg-blue-500/10",onClick:()=>pe(a.expr),children:a.label},a.expr))})]}),k==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:404:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:405:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:19",className:"text-xs",children:["Webhook Token ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:60",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(签名验证,可选)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:407:19",value:Ce,onChange:a=>fe(a.target.value),placeholder:"随机字符串",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:409:17",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook URL: ",e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:410:32",className:"text-[var(--dg-blue)]",children:["POST /api/v1/webhook/pipeline/","{code}"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:416:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:417:13",className:"flex items-center justify-between mb-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:15",children:["环境变量 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:27",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:["($","{VAR_NAME}"," 引用)"]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:419:15",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>K([...O,{key:"",value:"",desc:""}]),children:[e.jsx(xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:420:17",className:"h-3 w-3 mr-1"}),"添加变量"]})]}),O.length===0?e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:424:15",className:"text-xs text-[var(--dg-text-muted)] py-2",children:'暂无变量,点击"添加变量"新增'}):e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:426:15",className:"space-y-2",children:O.map((a,c)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:428:19",className:"grid grid-cols-12 gap-2 items-start p-2 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:429:21",value:a.key,onChange:x=>{const m=[...O];m[c]={...m[c],key:x.target.value},K(m)},placeholder:"变量名",className:"col-span-3 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:439:21",value:a.value,onChange:x=>{const m=[...O];m[c]={...m[c],value:x.target.value},K(m)},placeholder:"变量值",className:"col-span-4 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:449:21",value:a.desc,onChange:x=>{const m=[...O];m[c]={...m[c],desc:x.target.value},K(m)},placeholder:"说明",className:"col-span-4 h-8 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:459:21",variant:"ghost",size:"icon",className:"col-span-1 h-8 w-8 text-red-400",onClick:()=>K(O.filter((x,m)=>m!==c)),children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:460:23",className:"h-3.5 w-3.5"})})]},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:468:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:13",className:"mb-2 block",children:["构建缓存 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:48",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(加速后续构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:470:13",value:De,onChange:a=>we(a.target.value),placeholder:"node_modules, .m2, target",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-8 text-xs font-mono"}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:471:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"多个路径用逗号分隔,相同的 Key 会命中已有缓存"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:474:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:13",className:"mb-2 block",children:["并发执行数 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:49",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(Number of executors)"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:476:13",className:"flex items-center gap-2",children:e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:477:15",value:String(ke),onValueChange:a=>Se(Number(a)),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:478:17",className:"w-32 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:479:19"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:481:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:482:19",value:"1",children:"1 — 串行"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:483:19",value:"2",children:"2"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:484:19",value:"3",children:"3"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:485:19",value:"4",children:"4"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:486:19",value:"5",children:"5"})]})]})}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:490:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"设为 1 则按顺序串行执行,默认 2 可并发构建"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:493:9",className:"flex justify-end gap-2 mt-4 pt-4 border-t border-[var(--dg-border)]",children:[e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:494:11",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:495:11",onClick:qe,disabled:V,children:[V?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:75",className:"h-4 w-4 mr-1"}),V?"创建中...":"创建流水线"]})]})]})})}function Ea(){const[n,p]=o.useState(""),{data:P=[],isLoading:b,refetch:j}=ia(),{triggerMutation:d,deleteMutation:y,stopRunMutation:M}=pa(),[w,u]=o.useState({}),[C,R]=o.useState({}),[t,i]=o.useState({}),[A,g]=o.useState("all"),[E,Q]=o.useState({}),[_,F]=o.useState(!1),q=Qe(),G=[{key:"all",label:"全部",icon:na,color:"#6B7280"},{key:"production",label:"生产",icon:Le,color:"#EF4444"},{key:"testing",label:"测试",icon:ae,color:"#F59E0B"},{key:"staging",label:"预发布",icon:ue,color:"#8B5CF6"},{key:"development",label:"开发",icon:sa,color:"#3B82F6"}];o.useEffect(()=>{P.forEach(s=>{const r=s.id;s.last_status==="running"&&!E[r]&&L.getRuns(s.code).then(l=>{const k=(l?.list||[]).find(S=>S.status==="running"||S.status==="pending");k&&Q(S=>({...S,[r]:k}))}).catch(()=>{})})},[P,E]);const $=async(s,r)=>{i(l=>({...l,[s]:!0}));try{const l=await L.getRuns(r);R(B=>({...B,[s]:l?.list||[]}))}catch{R(l=>({...l,[s]:[]}))}finally{i(l=>({...l,[s]:!1}))}},V=(s,r)=>{w[s]?u(l=>({...l,[s]:!1})):($(s,r),u(l=>({...l,[s]:!0})))},W=async(s,r)=>{try{await d.mutateAsync(r),N.success("已触发"),$(s,r),j()}catch{N.error("触发失败")}},z=async(s,r,l)=>{if(await q({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await M.mutateAsync({code:r,runId:l}),N.success("已停止"),$(s,r),Q(k=>{const S={...k};return delete S[s],S})}catch{N.error("停止失败")}},X=async(s,r)=>{const l=E[s];if(!l){try{const k=((await L.getRuns(r))?.list||[]).find(S=>S.status==="running"||S.status==="pending");k?await z(s,r,k.id):N.error("未找到运行中的任务")}catch{N.error("停止失败")}return}await z(s,r,l.id)},J=async s=>{if(await q({title:"删除流水线",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await y.mutateAsync(s.id),N.success("已删除"),j()}catch{N.error("删除失败")}},ne=P.filter(s=>{const r=String(s.name||"").toLowerCase().includes(n.toLowerCase())||String(s.description||"").toLowerCase().includes(n.toLowerCase()),l=s.environment,B=A==="all"||(l?.type||"")===A;return r&&B});return e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:157:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/deploy/PipelineManager.tsx:160:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"流水线"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:161:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"CI/CD 构建 · 部署 · 发布一体化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:164:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>j(),children:[e.jsx(ee,{"code-path":"src/components/deploy/PipelineManager.tsx:165:13",className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:167:11",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:167:52",className:"h-4 w-4 mr-2"}),"新建流水线"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:172:7",className:"flex items-stretch gap-3 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:173:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:174:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:175:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:176:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:177:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:178:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:179:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:180:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:181:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-blue-400/10 border border-blue-400/20",children:[e.jsx(ye,{"code-path":"src/components/deploy/PipelineManager.tsx:182:15",className:"h-3 w-3 text-blue-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:183:15",className:"text-[10px] font-medium text-blue-400",children:"SSH 主机"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:186:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"传统主机 SCP 部署 · 无需镜像仓库"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:188:9",className:"w-px bg-[var(--dg-border)]"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:189:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:190:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:191:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:192:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:193:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(ie,{"code-path":"src/components/deploy/PipelineManager.tsx:194:13",className:"h-3 w-3 text-cyan-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:195:13",className:"text-[10px] font-semibold text-cyan-400",children:"镜像仓库"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:196:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:197:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:198:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:199:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:200:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-400/10 border border-emerald-400/20",children:[e.jsx(he,{"code-path":"src/components/deploy/PipelineManager.tsx:201:15",className:"h-3 w-3 text-emerald-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:202:15",className:"text-[10px] font-medium text-emerald-400",children:"Kubernetes"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:205:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"容器化部署 · 需镜像仓库推送"})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:207:9",className:"self-center ml-2 text-[10px] text-[var(--dg-text-secondary)] opacity-30 tracking-wide whitespace-nowrap",children:"全流程可视化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:210:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:211:9",className:"relative max-w-md flex-1",children:[e.jsx(aa,{"code-path":"src/components/deploy/PipelineManager.tsx:212:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx(f,{"code-path":"src/components/deploy/PipelineManager.tsx:213:11",placeholder:"搜索流水线...",value:n,onChange:s=>p(s.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:220:9",className:"flex items-center gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:G.map(s=>{const r=A===s.key,l=s.icon;return e.jsxs("button",{"code-path":"src/components/deploy/PipelineManager.tsx:225:15",onClick:()=>g(s.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r?"text-white shadow-sm":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,style:r?{backgroundColor:s.color}:{},children:[e.jsx(l,{"code-path":"src/components/deploy/PipelineManager.tsx:233:17",className:"h-3.5 w-3.5"}),s.label]},s.key)})})]}),b?e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:241:9",className:"flex items-center justify-center py-12",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineManager.tsx:242:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):ne.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:245:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(ta,{"code-path":"src/components/deploy/PipelineManager.tsx:246:11",className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:247:11",className:"text-sm",children:"暂无流水线"}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:248:11",variant:"outline",className:"mt-4",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:249:13",className:"h-4 w-4 mr-1"}),"创建第一个流水线"]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:253:9",className:"space-y-3",children:ne.map(s=>{const r=s.id,l=s.code||s.id;return e.jsx(ha,{"code-path":"src/components/deploy/PipelineManager.tsx:258:15",pipeline:s,isExpanded:!!w[r],isLoadingRuns:!!t[r],pipelineRuns:C[r]||[],onToggleExpand:()=>V(r,l),onTrigger:()=>W(r,l),onStopRunning:()=>X(r,l),onDelete:()=>J(s),onStopRun:B=>z(r,l,B)},r)})}),e.jsx(ya,{"code-path":"src/components/deploy/PipelineManager.tsx:275:7",open:_,onOpenChange:F,onCreated:j})]})}export{Ea as PipelineManager}; diff --git a/backend/static/assets/PipelineRunDetail-OPxhDG-Y.js b/backend/static/assets/PipelineRunDetail-C9e6xlUh.js similarity index 99% rename from backend/static/assets/PipelineRunDetail-OPxhDG-Y.js rename to backend/static/assets/PipelineRunDetail-C9e6xlUh.js index 405b04e..13d15f6 100644 --- a/backend/static/assets/PipelineRunDetail-OPxhDG-Y.js +++ b/backend/static/assets/PipelineRunDetail-C9e6xlUh.js @@ -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:"加载中..."}),N&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:178:13",className:"flex items-center justify-center h-full text-red-400 text-sm",children:N}),x&&!P&&e.jsxs("table",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:184:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:185:15",className:"sticky top-0 bg-[var(--dg-bg-primary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:186:17",className:"text-left text-[var(--dg-text-muted)] text-xs",children:[e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:187:19",className:"py-2 pl-4 pr-2 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:188:19",className:"py-2 px-2 font-medium w-24 text-right",children:"大小"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:189:19",className:"py-2 pr-4 pl-2 font-medium w-40 hidden sm:table-cell",children:"修改时间"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:190:19",className:"py-2 pr-4 pl-2 font-medium w-16"})]})}),e.jsxs("tbody",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:193:15",children:[v&&e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:196:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>{const r=v.split("/").slice(0,-1).join("/");F(r)},children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:203:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:204:23",className:"h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:205:23",className:"text-[var(--dg-text-secondary)]",children:".."})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:207:21",className:"py-2 px-2 text-right"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:208:21",className:"py-2 pr-4 pl-2 hidden sm:table-cell"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:209:21",className:"py-2 pr-4 pl-2"})]}),x.dirs?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:215:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>F(r.path),children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:220:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:221:23",className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:222:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:224:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:"-"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:225:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:226:21",className:"py-2 pr-4 pl-2"})]},r.path)),x.files?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:232:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:236:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:237:23",className:"h-4 w-4 text-sky-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:238:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:240:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:We(r.size)}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:241:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:242:21",className:"py-2 pr-4 pl-2",children:e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:243:23",onClick:m=>{m.stopPropagation(),y(r)},className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] hover:text-white",title:"下载",children:e.jsx(Ce,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:248:25",className:"h-3.5 w-3.5"})})})]},r.path)),x.dirs?.length===0&&x.files?.length===0&&!v&&e.jsx("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:256:19",children:e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:257:21",colSpan:4,className:"py-8 text-center text-[var(--dg-text-muted)]",children:P?"加载中...":"目录为空"})})]})]})]})]})})}const j=[{key:"checkout",label:"代码检出",icon:Ee,color:"#6366F1",order:1},{key:"build",label:"构建",icon:Ae,color:"#F59E0B",order:2},{key:"test",label:"测试",icon:T,color:"#10B981",order:3},{key:"image",label:"镜像打包",icon:Le,color:"#06B6D4",order:4},{key:"deploy",label:"部署",icon:Te,color:"#EF4444",order:5},{key:"verify",label:"验证",icon:Ie,color:"#3B82F6",order:6}].sort((s,o)=>s.order-o.order),Ge={success:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",running:"bg-blue-500/20 text-blue-400 border-blue-500/30",pending:"bg-slate-500/20 text-slate-400 border-slate-500/30",cancelled:"bg-amber-500/20 text-amber-400 border-amber-500/30"},He={success:T,failed:G,running:$,pending:te,cancelled:Oe};function qe(s){if(!s)return"-";if(s<60)return`${s}秒`;const o=Math.floor(s/60),u=s%60;return`${o}分${u}秒`}function Xe(s){return s?new Date(s).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}function Ke(s){if(!s)return[];try{const o=typeof s=="string"?JSON.parse(s):s;return Array.isArray(o)?o:[]}catch{return[]}}function Ve(s){const o=new Map;return s&&(Ke(s.stages).forEach(c=>{if(c.name||c.type){const x=c.type||j.find(a=>a.label===c.name)?.key;x&&o.set(x,c.status)}}),o.size===0&&s.status==="success"?j.forEach(c=>o.set(c.key,"success")):o.size===0&&s.status==="failed"?j.forEach((c,x)=>o.set(c.key,x===0?"success":"pending")):o.size===0&&s.status==="running"&&o.set("checkout","running")),o}function Qe(s,o){const u=s.find(x=>x.stage===o);if(u)return u.message;const c=j.find(x=>x.key===o);return c?`${c.label}...`:""}function nt(){const{code:s}=De(),[o,u]=n.useState(null),[c,x]=n.useState([]),[a,P]=n.useState(null),[B,N]=n.useState([]),[L,v]=n.useState(!1),[i,w]=n.useState(null),[z,F]=n.useState(10),[y,R]=n.useState(new Set),[I,r]=n.useState(!1),m=n.useRef(null),b=n.useRef(null),[se,H]=n.useState(!1),[q,oe]=n.useState(null),ne=n.useCallback(async()=>{try{const t=await C.getByCode(s);u(t?.data||t)}catch{}},[s]),f=n.useCallback(async()=>{v(!0);try{const d=(await C.getRunsByCode(s,z))?.list||[];x(d),!a&&d.length>0&&P(d[0])}catch{S.error("获取执行记录失败")}finally{v(!1)}},[s,z]);n.useEffect(()=>{ne(),f()},[]),n.useEffect(()=>{f()},[z]),n.useEffect(()=>{if(!c.some(l=>l.status==="running"))return;const d=setInterval(f,5e3);return()=>clearInterval(d)},[c,f]);const X=n.useCallback(async t=>{try{const d=await C.getRunLogStream(t.id);if(d?.logs){const l=typeof d.logs=="string"?JSON.parse(d.logs):d.logs;N(Array.isArray(l)?l:[])}else N([]);t.status==="running"&&ae(t.id)}catch{N([])}},[]),ae=t=>{b.current&&b.current.close();const d=window.location.protocol==="https:"?"wss:":"ws:",l=localStorage.getItem("token"),p=new WebSocket(`${d}//${window.location.host}/ws/pipeline/${t}/log?token=${l}`);p.onmessage=k=>{try{const h=JSON.parse(k.data);if(h.type==="init"&&h.logs){const g=typeof h.logs=="string"?JSON.parse(h.logs):h.logs;N(Array.isArray(g)?g:[])}else h.type==="done"?(p.close(),f()):h.time&&h.level&&N(g=>[...g,h])}catch{}},p.onclose=()=>{b.current=null},p.onerror=()=>{b.current=null},b.current=p};n.useEffect(()=>(a&&(X(a),w(null)),()=>{b.current&&b.current.close()}),[a,X]),n.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[B]);const le=async()=>{try{await C.triggerByCode(s),S.success("已触发"),f()}catch{S.error("触发失败")}},ce=async t=>{try{await C.stopRunByCode(s,t),S.success("已停止"),f()}catch{S.error("停止失败")}},re=async()=>{if(y.size!==0){r(!0);try{await C.batchDeleteRuns(s,Array.from(y)),S.success(`已删除 ${y.size} 条记录`),R(new Set),f()}catch{S.error("批量删除失败")}finally{r(!1)}}},ie=t=>{R(d=>{const l=new Set(d);return l.has(t)?l.delete(t):l.add(t),l})},de=()=>{y.size===c.length?R(new Set):R(new Set(c.map(t=>t.id)))},K=t=>t.triggered_by==="system"?"Cron":t.triggered_by==="git"?"Git Push":t.triggered_by||"Manual",O=Ve(a),V=i?B.filter(t=>t.stage===i):B,Q=i?Qe(B,i):"";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:293:5",className:"space-y-4 h-full flex flex-col",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:295:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:296:9",children:[e.jsxs("h2",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:297:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:298:13",className:"w-5 h-5 inline mr-2"}),"流水线详情"]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:301:11",className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[o?.name&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:303:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),o?.environment&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:308:15",className:"text-xs",style:{backgroundColor:o.environment.color+"20",color:o.environment.color},children:o.environment.display_name}),a&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:316:15",className:"text-sm text-[var(--dg-text-secondary)]",children:["发布 #",a.build_number]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:322:9",className:"flex gap-2 items-center",children:[y.size>0&&e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:324:13",variant:"destructive",size:"sm",onClick:re,disabled:I,children:[e.jsx($e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:325:15",className:"w-4 h-4 mr-1"}),"删除 (",y.size,")"]}),e.jsxs("select",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:328:11",value:z,onChange:t=>F(Number(t.target.value)),className:"h-8 px-2 text-xs rounded border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-primary)]",children:[e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:333:13",value:10,children:"10条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:334:13",value:20,children:"20条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:335:13",value:30,children:"30条/页"})]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:337:11",variant:"outline",size:"sm",onClick:f,children:[e.jsx(ze,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:338:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:340:11",size:"sm",onClick:le,children:[e.jsx(_e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:341:13",className:"w-4 h-4 mr-1"}),"立即执行"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:347:7",className:"flex items-center gap-0 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] overflow-x-auto",children:[j.map((t,d)=>{const l=O.get(t.key)||"",p=l==="success"||l==="completed",k=l==="running"||l==="in_progress",h=l==="failed"||l==="error",g=i===t.key;t.key;const _=O.size>0,D=h?"#EF4444":k?"#3B82F6":p?"#207060":"#6B7280",U=h?"#EF444420":k?"#3B82F620":p?"#20706020":"#6B728010",M=g?D:D+"50",W=t.icon,pe=h?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:369:35",className:"h-3.5 w-3.5"}):k?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:370:27",className:"h-3.5 w-3.5 animate-spin"}):p?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:371:27",className:"h-3.5 w-3.5"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:372:25",className:"text-[10px] opacity-40",children:"○"}):e.jsx(W,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:373:15",className:"h-3.5 w-3.5 opacity-40"}),Y=d===j.length-1,xe=d===0?"8px 0 0 8px":Y?"0 8px 8px 0":"0";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:379:13",className:"flex items-center",children:[e.jsxs("button",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:380:15",onClick:()=>w(i===t.key?null:t.key),title:`${t.label}${l?` (${l})`:""} — 点击查看日志`,className:`flex items-center gap-1.5 px-3 py-2 text-[12px] font-semibold border shadow-sm transition-all cursor-pointer +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:"加载中..."}),N&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:178:13",className:"flex items-center justify-center h-full text-red-400 text-sm",children:N}),x&&!P&&e.jsxs("table",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:184:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:185:15",className:"sticky top-0 bg-[var(--dg-bg-primary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:186:17",className:"text-left text-[var(--dg-text-muted)] text-xs",children:[e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:187:19",className:"py-2 pl-4 pr-2 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:188:19",className:"py-2 px-2 font-medium w-24 text-right",children:"大小"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:189:19",className:"py-2 pr-4 pl-2 font-medium w-40 hidden sm:table-cell",children:"修改时间"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:190:19",className:"py-2 pr-4 pl-2 font-medium w-16"})]})}),e.jsxs("tbody",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:193:15",children:[v&&e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:196:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>{const r=v.split("/").slice(0,-1).join("/");F(r)},children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:203:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:204:23",className:"h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:205:23",className:"text-[var(--dg-text-secondary)]",children:".."})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:207:21",className:"py-2 px-2 text-right"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:208:21",className:"py-2 pr-4 pl-2 hidden sm:table-cell"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:209:21",className:"py-2 pr-4 pl-2"})]}),x.dirs?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:215:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>F(r.path),children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:220:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:221:23",className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:222:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:224:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:"-"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:225:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:226:21",className:"py-2 pr-4 pl-2"})]},r.path)),x.files?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:232:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:236:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:237:23",className:"h-4 w-4 text-sky-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:238:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:240:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:We(r.size)}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:241:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:242:21",className:"py-2 pr-4 pl-2",children:e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:243:23",onClick:m=>{m.stopPropagation(),y(r)},className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] hover:text-white",title:"下载",children:e.jsx(Ce,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:248:25",className:"h-3.5 w-3.5"})})})]},r.path)),x.dirs?.length===0&&x.files?.length===0&&!v&&e.jsx("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:256:19",children:e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:257:21",colSpan:4,className:"py-8 text-center text-[var(--dg-text-muted)]",children:P?"加载中...":"目录为空"})})]})]})]})]})})}const j=[{key:"checkout",label:"代码检出",icon:Ee,color:"#6366F1",order:1},{key:"build",label:"构建",icon:Ae,color:"#F59E0B",order:2},{key:"test",label:"测试",icon:T,color:"#10B981",order:3},{key:"image",label:"镜像打包",icon:Le,color:"#06B6D4",order:4},{key:"deploy",label:"部署",icon:Te,color:"#EF4444",order:5},{key:"verify",label:"验证",icon:Ie,color:"#3B82F6",order:6}].sort((s,o)=>s.order-o.order),Ge={success:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",running:"bg-blue-500/20 text-blue-400 border-blue-500/30",pending:"bg-slate-500/20 text-slate-400 border-slate-500/30",cancelled:"bg-amber-500/20 text-amber-400 border-amber-500/30"},He={success:T,failed:G,running:$,pending:te,cancelled:Oe};function qe(s){if(!s)return"-";if(s<60)return`${s}秒`;const o=Math.floor(s/60),u=s%60;return`${o}分${u}秒`}function Xe(s){return s?new Date(s).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}function Ke(s){if(!s)return[];try{const o=typeof s=="string"?JSON.parse(s):s;return Array.isArray(o)?o:[]}catch{return[]}}function Ve(s){const o=new Map;return s&&(Ke(s.stages).forEach(c=>{if(c.name||c.type){const x=c.type||j.find(a=>a.label===c.name)?.key;x&&o.set(x,c.status)}}),o.size===0&&s.status==="success"?j.forEach(c=>o.set(c.key,"success")):o.size===0&&s.status==="failed"?j.forEach((c,x)=>o.set(c.key,x===0?"success":"pending")):o.size===0&&s.status==="running"&&o.set("checkout","running")),o}function Qe(s,o){const u=s.find(x=>x.stage===o);if(u)return u.message;const c=j.find(x=>x.key===o);return c?`${c.label}...`:""}function nt(){const{code:s}=De(),[o,u]=n.useState(null),[c,x]=n.useState([]),[a,P]=n.useState(null),[B,N]=n.useState([]),[L,v]=n.useState(!1),[i,w]=n.useState(null),[z,F]=n.useState(10),[y,R]=n.useState(new Set),[I,r]=n.useState(!1),m=n.useRef(null),b=n.useRef(null),[se,H]=n.useState(!1),[q,oe]=n.useState(null),ne=n.useCallback(async()=>{try{const t=await C.getByCode(s);u(t?.data||t)}catch{}},[s]),f=n.useCallback(async()=>{v(!0);try{const d=(await C.getRunsByCode(s,z))?.list||[];x(d),!a&&d.length>0&&P(d[0])}catch{S.error("获取执行记录失败")}finally{v(!1)}},[s,z]);n.useEffect(()=>{ne(),f()},[]),n.useEffect(()=>{f()},[z]),n.useEffect(()=>{if(!c.some(l=>l.status==="running"))return;const d=setInterval(f,5e3);return()=>clearInterval(d)},[c,f]);const X=n.useCallback(async t=>{try{const d=await C.getRunLogStream(t.id);if(d?.logs){const l=typeof d.logs=="string"?JSON.parse(d.logs):d.logs;N(Array.isArray(l)?l:[])}else N([]);t.status==="running"&&ae(t.id)}catch{N([])}},[]),ae=t=>{b.current&&b.current.close();const d=window.location.protocol==="https:"?"wss:":"ws:",l=localStorage.getItem("token"),p=new WebSocket(`${d}//${window.location.host}/ws/pipeline/${t}/log?token=${l}`);p.onmessage=k=>{try{const h=JSON.parse(k.data);if(h.type==="init"&&h.logs){const g=typeof h.logs=="string"?JSON.parse(h.logs):h.logs;N(Array.isArray(g)?g:[])}else h.type==="done"?(p.close(),f()):h.time&&h.level&&N(g=>[...g,h])}catch{}},p.onclose=()=>{b.current=null},p.onerror=()=>{b.current=null},b.current=p};n.useEffect(()=>(a&&(X(a),w(null)),()=>{b.current&&b.current.close()}),[a,X]),n.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[B]);const le=async()=>{try{await C.triggerByCode(s),S.success("已触发"),f()}catch{S.error("触发失败")}},ce=async t=>{try{await C.stopRunByCode(s,t),S.success("已停止"),f()}catch{S.error("停止失败")}},re=async()=>{if(y.size!==0){r(!0);try{await C.batchDeleteRuns(s,Array.from(y)),S.success(`已删除 ${y.size} 条记录`),R(new Set),f()}catch{S.error("批量删除失败")}finally{r(!1)}}},ie=t=>{R(d=>{const l=new Set(d);return l.has(t)?l.delete(t):l.add(t),l})},de=()=>{y.size===c.length?R(new Set):R(new Set(c.map(t=>t.id)))},K=t=>t.triggered_by==="system"?"Cron":t.triggered_by==="git"?"Git Push":t.triggered_by||"Manual",O=Ve(a),V=i?B.filter(t=>t.stage===i):B,Q=i?Qe(B,i):"";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:293:5",className:"space-y-4 h-full flex flex-col",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:295:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:296:9",children:[e.jsxs("h2",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:297:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:298:13",className:"w-5 h-5 inline mr-2"}),"流水线详情"]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:301:11",className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[o?.name&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:303:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),o?.environment&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:308:15",className:"text-xs",style:{backgroundColor:o.environment.color+"20",color:o.environment.color},children:o.environment.display_name}),a&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:316:15",className:"text-sm text-[var(--dg-text-secondary)]",children:["发布 #",a.build_number]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:322:9",className:"flex gap-2 items-center",children:[y.size>0&&e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:324:13",variant:"destructive",size:"sm",onClick:re,disabled:I,children:[e.jsx($e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:325:15",className:"w-4 h-4 mr-1"}),"删除 (",y.size,")"]}),e.jsxs("select",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:328:11",value:z,onChange:t=>F(Number(t.target.value)),className:"h-8 px-2 text-xs rounded border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-primary)]",children:[e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:333:13",value:10,children:"10条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:334:13",value:20,children:"20条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:335:13",value:30,children:"30条/页"})]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:337:11",variant:"outline",size:"sm",onClick:f,children:[e.jsx(ze,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:338:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:340:11",size:"sm",onClick:le,children:[e.jsx(_e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:341:13",className:"w-4 h-4 mr-1"}),"立即执行"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:347:7",className:"flex items-center gap-0 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] overflow-x-auto",children:[j.map((t,d)=>{const l=O.get(t.key)||"",p=l==="success"||l==="completed",k=l==="running"||l==="in_progress",h=l==="failed"||l==="error",g=i===t.key;t.key;const _=O.size>0,D=h?"#EF4444":k?"#3B82F6":p?"#207060":"#6B7280",U=h?"#EF444420":k?"#3B82F620":p?"#20706020":"#6B728010",M=g?D:D+"50",W=t.icon,pe=h?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:369:35",className:"h-3.5 w-3.5"}):k?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:370:27",className:"h-3.5 w-3.5 animate-spin"}):p?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:371:27",className:"h-3.5 w-3.5"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:372:25",className:"text-[10px] opacity-40",children:"○"}):e.jsx(W,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:373:15",className:"h-3.5 w-3.5 opacity-40"}),Y=d===j.length-1,xe=d===0?"8px 0 0 8px":Y?"0 8px 8px 0":"0";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:379:13",className:"flex items-center",children:[e.jsxs("button",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:380:15",onClick:()=>w(i===t.key?null:t.key),title:`${t.label}${l?` (${l})`:""} — 点击查看日志`,className:`flex items-center gap-1.5 px-3 py-2 text-[12px] font-semibold border shadow-sm transition-all cursor-pointer ${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":"src/components/deploy/PipelineRunDetail.tsx:531:17",children:["分支: ",a.branch||"-"]}),a.commit_id&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:534:21",className:"opacity-40",children:"|"}),e.jsx("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:535:21",className:"bg-amber-400/10 text-amber-400 px-1 py-0.5 rounded text-[10px]",children:a.commit_id.slice(0,8)})]}),a.image_tag&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:542:21",className:"opacity-40",children:"|"}),e.jsxs("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:543:21",className:"bg-cyan-400/10 text-cyan-400 px-1 py-0.5 rounded text-[10px]",children:["📦 ",a.image_tag]})]})]})]}),e.jsxs(we,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:550:13",className:"flex-1 p-0 overflow-hidden min-h-0",children:[i&&Q&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:553:17",className:"px-4 py-2 border-b border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)]/30",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:554:19",className:"flex items-center gap-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:555:21",className:"text-[11px] font-semibold text-[var(--dg-text-secondary)]",children:["[",j.find(t=>t.key===i)?.label||i,"]"]}),(()=>{const t=O.get(i);return t==="success"||t==="completed"?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:560:74",className:"h-3.5 w-3.5 text-emerald-400"}):t==="failed"||t==="error"?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:561:69",className:"h-3.5 w-3.5 text-red-400"}):t==="running"||t==="in_progress"?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:562:76",className:"h-3.5 w-3.5 text-blue-400 animate-spin"}):null})(),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:565:21",className:"text-xs text-[var(--dg-text-muted)] truncate font-mono",children:Q})]})}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:571:15",className:"h-full overflow-y-auto bg-[#0d1117] font-mono text-xs leading-5 p-4",style:{minHeight:280},children:V.length===0&&a.status!=="running"?e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:573:19",className:"text-center py-12 text-slate-500",children:i?"该阶段暂无日志输出":"暂无日志输出"}):e.jsxs(e.Fragment,{children:[(()=>{let t="";const d={checkout:"border-indigo-500 bg-indigo-500/10",build:"border-amber-500 bg-amber-500/10",test:"border-emerald-500 bg-emerald-500/10",image:"border-cyan-500 bg-cyan-500/10",deploy:"border-red-500 bg-red-500/10",verify:"border-blue-500 bg-blue-500/10"},l={checkout:"⬇",build:"⚙",test:"✓",image:"📦",deploy:"🚀",verify:"🛡"};return V.map((p,k)=>{const h=!i&&p.stage&&p.stage!==t;h&&(t=p.stage||"");const g=p.level==="error",_=p.level==="warn",D=p.level==="success",U=g?"border-l-2 border-red-500 bg-red-500/10":_?"border-l-2 border-amber-500 bg-amber-500/10":D?"border-l-2 border-emerald-500 bg-emerald-500/5":"",M=g?"text-red-200":_?"text-amber-200":D?"text-emerald-200":"text-slate-300",W=g?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:605:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-red-600/40 text-red-200",children:"ERR"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:607:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-amber-600/40 text-amber-200",children:"WARN"}):D?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:609:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-emerald-600/30 text-emerald-200",children:" OK "}):e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:610:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] bg-slate-600/30 text-slate-400",children:"INFO"});return e.jsxs(me.Fragment,{children:[h&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:614:31",className:`flex items-center gap-2 my-2 py-1 px-2 border-l-4 rounded-r ${d[p.stage||""]||"border-slate-500 bg-slate-500/10"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:615:33",className:"text-xs",children:l[p.stage||""]||"▸"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:616:33",className:"text-[11px] font-semibold tracking-wider text-slate-200",children:p.stage}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:617:33",className:"flex-1 border-t border-slate-700/50"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:620:29",className:`flex items-start gap-2 px-2 py-0.5 -mx-1 rounded-sm ${U} ${!g&&!_&&!D?"hover:bg-white/[0.03]":""}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:621:31",className:"text-slate-600 shrink-0 w-14 text-right text-[10px] pt-px",children:p.time}),W,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:623:31",className:`break-all ${M}`,children:p.message})]})]},k)})})(),a.status==="running"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:630:23",className:"flex items-center gap-2 mt-2 py-1.5 px-3 bg-blue-500/10 border-l-4 border-blue-500 rounded-r",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:631:25",className:"w-3 h-3 animate-spin text-blue-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:632:25",className:"text-[11px] text-blue-300 font-medium",children:"流水线执行中,实时输出..."}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:633:25",className:"flex gap-1 ml-1",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:634:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:635:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:636:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"300ms"}})]})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:640:21",ref:m})]})})]})]})]}),e.jsx(Je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:650:7",open:se,onOpenChange:H,runId:q?.id??null,buildNumber:q?.buildNumber??0})]})}export{nt as default}; diff --git a/backend/static/assets/PlatformManager-sKNMDVik.js b/backend/static/assets/PlatformManager-CsXWkkgm.js similarity index 98% rename from backend/static/assets/PlatformManager-sKNMDVik.js rename to backend/static/assets/PlatformManager-CsXWkkgm.js index 628fcd0..d55a2cc 100644 --- a/backend/static/assets/PlatformManager-sKNMDVik.js +++ b/backend/static/assets/PlatformManager-CsXWkkgm.js @@ -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,{"code-path":"src/components/cloud/PlatformManager.tsx:175:21",className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:177:19",children:[e.jsx("h3",{"code-path":"src/components/cloud/PlatformManager.tsx:178:21",className:"font-medium text-slate-100",children:a.name}),e.jsx("span",{"code-path":"src/components/cloud/PlatformManager.tsx:179:21",className:"text-xs text-slate-500 font-mono",children:a.code})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:182:17",className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.website&&e.jsx("a",{"code-path":"src/components/cloud/PlatformManager.tsx:184:21",href:a.website,target:"_blank",rel:"noreferrer",className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(W,{"code-path":"src/components/cloud/PlatformManager.tsx:185:23",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:188:19",onClick:()=>_(a),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(Y,{"code-path":"src/components/cloud/PlatformManager.tsx:189:21",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:191:19",onClick:()=>z(a.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(Z,{"code-path":"src/components/cloud/PlatformManager.tsx:192:21",className:"h-3.5 w-3.5"})})]})]}),a.description&&e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:198:17",className:"text-sm text-slate-400 mb-3 line-clamp-2",children:a.description}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:201:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(j,{"code-path":"src/components/cloud/PlatformManager.tsx:202:17",variant:"outline",className:se[a.type]||"text-slate-400",children:ae[a.type]||a.type}),a.status==="active"?e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:206:19",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx($,{"code-path":"src/components/cloud/PlatformManager.tsx:207:21",className:"h-3 w-3"})," 启用"]}):e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:210:19",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(ee,{"code-path":"src/components/cloud/PlatformManager.tsx:211:21",className:"h-3 w-3"})," 禁用"]})]})]},a.id))}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:221:7",open:R,onOpenChange:l,children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:222:9",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:223:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:224:13",children:n?"编辑云平台":"添加云平台"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:225:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:227:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:228:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:229:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:230:17",children:"平台名称 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:231:17",value:s.name,onChange:a=>c({...s,name:a.target.value}),placeholder:"如:阿里云",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:238:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:239:17",children:"编码 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:240:17",value:s.code,onChange:a=>c({...s,code:a.target.value}),placeholder:"如:aliyun",className:"bg-slate-800/50 border-slate-700",disabled:!!n})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:249:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:250:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:251:17",children:"类型"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:252:17",value:s.type,onValueChange:a=>c({...s,type:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:253:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:254:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:256:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:257:21",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:258:21",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:259:21",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:263:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:264:17",children:"状态"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:265:17",value:s.status,onValueChange:a=>c({...s,status:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:266:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:267:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:269:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:270:21",value:"active",children:"启用"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:271:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:276:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:277:15",children:"官网地址"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:278:15",value:s.website,onChange:a=>c({...s,website:a.target.value}),placeholder:"https://...",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:285:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:286:15",children:"描述"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:287:15",value:s.description,onChange:a=>c({...s,description:a.target.value}),placeholder:"平台描述...",className:"bg-slate-800/50 border-slate-700"})]})]}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:295:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:296:13",variant:"ghost",onClick:()=>l(!1),children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:297:13",onClick:q,disabled:C||!s.name.trim()||!s.code.trim(),children:[C&&e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:298:30",className:"h-4 w-4 mr-1 animate-spin"}),n?"保存":"创建"]})]})]})}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:306:7",open:g!==null,onOpenChange:a=>!a&&i(null),children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:307:9",className:"max-w-sm",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:308:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:309:13",children:"确认删除"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:310:13",className:"sr-only",children:"描述"})]}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:312:11",className:"text-sm text-slate-400",children:"确定删除此云平台?此操作不可撤销。"}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:313:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:314:13",variant:"ghost",onClick:()=>i(null),children:"取消"}),e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:315:13",variant:"destructive",onClick:G,children:"删除"})]})]})})]})}export{ie as PlatformManager}; +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,{"code-path":"src/components/cloud/PlatformManager.tsx:175:21",className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:177:19",children:[e.jsx("h3",{"code-path":"src/components/cloud/PlatformManager.tsx:178:21",className:"font-medium text-slate-100",children:a.name}),e.jsx("span",{"code-path":"src/components/cloud/PlatformManager.tsx:179:21",className:"text-xs text-slate-500 font-mono",children:a.code})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:182:17",className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.website&&e.jsx("a",{"code-path":"src/components/cloud/PlatformManager.tsx:184:21",href:a.website,target:"_blank",rel:"noreferrer",className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(W,{"code-path":"src/components/cloud/PlatformManager.tsx:185:23",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:188:19",onClick:()=>_(a),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(Y,{"code-path":"src/components/cloud/PlatformManager.tsx:189:21",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:191:19",onClick:()=>z(a.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(Z,{"code-path":"src/components/cloud/PlatformManager.tsx:192:21",className:"h-3.5 w-3.5"})})]})]}),a.description&&e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:198:17",className:"text-sm text-slate-400 mb-3 line-clamp-2",children:a.description}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:201:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(j,{"code-path":"src/components/cloud/PlatformManager.tsx:202:17",variant:"outline",className:se[a.type]||"text-slate-400",children:ae[a.type]||a.type}),a.status==="active"?e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:206:19",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx($,{"code-path":"src/components/cloud/PlatformManager.tsx:207:21",className:"h-3 w-3"})," 启用"]}):e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:210:19",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(ee,{"code-path":"src/components/cloud/PlatformManager.tsx:211:21",className:"h-3 w-3"})," 禁用"]})]})]},a.id))}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:221:7",open:R,onOpenChange:l,children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:222:9",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:223:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:224:13",children:n?"编辑云平台":"添加云平台"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:225:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:227:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:228:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:229:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:230:17",children:"平台名称 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:231:17",value:s.name,onChange:a=>c({...s,name:a.target.value}),placeholder:"如:阿里云",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:238:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:239:17",children:"编码 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:240:17",value:s.code,onChange:a=>c({...s,code:a.target.value}),placeholder:"如:aliyun",className:"bg-slate-800/50 border-slate-700",disabled:!!n})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:249:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:250:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:251:17",children:"类型"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:252:17",value:s.type,onValueChange:a=>c({...s,type:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:253:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:254:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:256:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:257:21",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:258:21",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:259:21",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:263:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:264:17",children:"状态"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:265:17",value:s.status,onValueChange:a=>c({...s,status:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:266:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:267:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:269:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:270:21",value:"active",children:"启用"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:271:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:276:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:277:15",children:"官网地址"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:278:15",value:s.website,onChange:a=>c({...s,website:a.target.value}),placeholder:"https://...",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:285:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:286:15",children:"描述"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:287:15",value:s.description,onChange:a=>c({...s,description:a.target.value}),placeholder:"平台描述...",className:"bg-slate-800/50 border-slate-700"})]})]}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:295:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:296:13",variant:"ghost",onClick:()=>l(!1),children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:297:13",onClick:q,disabled:C||!s.name.trim()||!s.code.trim(),children:[C&&e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:298:30",className:"h-4 w-4 mr-1 animate-spin"}),n?"保存":"创建"]})]})]})}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:306:7",open:g!==null,onOpenChange:a=>!a&&i(null),children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:307:9",className:"max-w-sm",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:308:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:309:13",children:"确认删除"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:310:13",className:"sr-only",children:"描述"})]}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:312:11",className:"text-sm text-slate-400",children:"确定删除此云平台?此操作不可撤销。"}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:313:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:314:13",variant:"ghost",onClick:()=>i(null),children:"取消"}),e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:315:13",variant:"destructive",onClick:G,children:"删除"})]})]})})]})}export{ie as PlatformManager}; diff --git a/backend/static/assets/PodFileBrowser-BPio7wxi.js b/backend/static/assets/PodFileBrowser-Bs6KRfHw.js similarity index 99% rename from backend/static/assets/PodFileBrowser-BPio7wxi.js rename to backend/static/assets/PodFileBrowser-Bs6KRfHw.js index 2e1714d..c91e4a2 100644 --- a/backend/static/assets/PodFileBrowser-BPio7wxi.js +++ b/backend/static/assets/PodFileBrowser-Bs6KRfHw.js @@ -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++;na.startsWith(i)):!1}for(;n=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++;n2||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=4&&a.startsWith("- name:")&&k(a)){const p=i;for(n++;n0&&o[o.length-1].trim()===""){n++;continue}o.push(x),n++}return o.join(` `).replace(/\n{3,}/g,` diff --git a/backend/static/assets/PodMetricsPage-On_xK19V.js b/backend/static/assets/PodMetricsPage-NkW2J2Qd.js similarity index 95% rename from backend/static/assets/PodMetricsPage-On_xK19V.js rename to backend/static/assets/PodMetricsPage-NkW2J2Qd.js index 1ad1ef8..8691f0e 100644 --- a/backend/static/assets/PodMetricsPage-On_xK19V.js +++ b/backend/static/assets/PodMetricsPage-NkW2J2Qd.js @@ -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/PodMetricsPage.tsx:112:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:11",className:"text-xs text-slate-500",children:"Pod 数"}),e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:58",className:"text-xl font-bold text-slate-200",children:p.length})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:11",className:"text-xs text-slate-500",children:"总 CPU"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:58",className:"text-xl font-bold text-blue-400",children:[I,"m"]})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:11",className:"text-xs text-slate-500",children:"总内存"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:56",className:"text-xl font-bold text-emerald-400",children:[R.toFixed(0),"Mi"]})]})})]}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsx(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:124:9",className:"p-0",children:e.jsxs(W,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:125:11",children:[e.jsx(F,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:127:15",className:"text-slate-400",children:"Pod"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:128:15",className:"text-slate-400",children:"命名空间"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:129:15",className:"text-slate-400",children:"容器"}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:15",className:"text-slate-400",children:[e.jsx(K,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:53",className:"h-3 w-3 inline mr-1"}),"CPU"]}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:15",className:"text-slate-400",children:[e.jsx(q,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:53",className:"h-3 w-3 inline mr-1"}),"Memory"]})]})}),e.jsx(z,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:133:13",children:o.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:27",colSpan:5,className:"text-center text-slate-500 py-8",children:["暂无数据",m?e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):o.map((s,t)=>e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:137:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:138:19",className:"font-medium text-slate-200 text-sm",children:s.pod}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:19",children:e.jsx(V,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:140:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:141:19",className:"text-sm text-blue-400",children:s.cpu}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:142:19",className:"text-sm text-emerald-400",children:s.memory})]},`${s.pod}-${s.container}-${t}`))})]})})})]})}export{te as default}; +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/PodMetricsPage.tsx:112:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:11",className:"text-xs text-slate-500",children:"Pod 数"}),e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:58",className:"text-xl font-bold text-slate-200",children:p.length})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:11",className:"text-xs text-slate-500",children:"总 CPU"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:58",className:"text-xl font-bold text-blue-400",children:[I,"m"]})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:11",className:"text-xs text-slate-500",children:"总内存"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:56",className:"text-xl font-bold text-emerald-400",children:[R.toFixed(0),"Mi"]})]})})]}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsx(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:124:9",className:"p-0",children:e.jsxs(W,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:125:11",children:[e.jsx(F,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:127:15",className:"text-slate-400",children:"Pod"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:128:15",className:"text-slate-400",children:"命名空间"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:129:15",className:"text-slate-400",children:"容器"}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:15",className:"text-slate-400",children:[e.jsx(K,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:53",className:"h-3 w-3 inline mr-1"}),"CPU"]}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:15",className:"text-slate-400",children:[e.jsx(q,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:53",className:"h-3 w-3 inline mr-1"}),"Memory"]})]})}),e.jsx(z,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:133:13",children:o.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:27",colSpan:5,className:"text-center text-slate-500 py-8",children:["暂无数据",m?e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):o.map((s,t)=>e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:137:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:138:19",className:"font-medium text-slate-200 text-sm",children:s.pod}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:19",children:e.jsx(V,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:140:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:141:19",className:"text-sm text-blue-400",children:s.cpu}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:142:19",className:"text-sm text-emerald-400",children:s.memory})]},`${s.pod}-${s.container}-${t}`))})]})})})]})}export{te as default}; diff --git a/backend/static/assets/RegionManager-DAgeWbRr.js b/backend/static/assets/RegionManager-BFFP324K.js similarity index 97% rename from backend/static/assets/RegionManager-DAgeWbRr.js rename to backend/static/assets/RegionManager-BFFP324K.js index afb223b..e38072a 100644 --- a/backend/static/assets/RegionManager-DAgeWbRr.js +++ b/backend/static/assets/RegionManager-BFFP324K.js @@ -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",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:223:13",variant:"ghost",size:"sm",onClick:()=>d([]),className:"text-slate-400 hover:text-slate-200",children:"取消选择"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:226:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:Z,children:[e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:232:15",className:"h-4 w-4 mr-1.5"}),"批量删除"]})]})]}),F?e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:241:9",className:"flex justify-center py-20",children:e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:242:11",className:"h-6 w-6 animate-spin text-slate-500"})}):h.length===0?e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:245:9",className:"text-center py-20 text-slate-500",children:[e.jsx(ge,{"code-path":"src/components/cloud/RegionManager.tsx:246:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/RegionManager.tsx:247:11",children:"暂无区域数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:250:9",className:"rounded-lg overflow-hidden",children:e.jsxs(re,{"code-path":"src/components/cloud/RegionManager.tsx:251:11",children:[e.jsx(le,{"code-path":"src/components/cloud/RegionManager.tsx:252:13",children:e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:253:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:254:17",className:"w-10",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:255:19",checked:E,onCheckedChange:q,className:"border-slate-600"})}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:261:17",className:"text-slate-400",children:"区域名称"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:262:17",className:"text-slate-400",children:"编码"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:263:17",className:"text-slate-400",children:"云商"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:264:17",className:"text-slate-400",children:"位置"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:265:17",className:"text-slate-400",children:"接入端点"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:266:17",className:"text-slate-400",children:"状态"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:267:17",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(de,{"code-path":"src/components/cloud/RegionManager.tsx:270:13",children:h.map(s=>e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:272:17",className:"border-slate-800/50 group",children:[e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:273:19",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:274:21",checked:c.includes(s.id),onCheckedChange:()=>G(s.id),className:"border-slate-600"})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:280:19",className:"font-medium text-slate-200",children:s.name}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:281:19",className:"font-mono text-sm text-slate-400",children:s.code}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:282:19",children:e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:283:21",className:ue[s.provider]||"text-slate-400",children:k[s.provider]||s.provider})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:287:19",className:"text-slate-400",children:s.location||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:288:19",className:"max-w-[200px] truncate font-mono text-xs text-slate-400",title:s.endpoint,children:s.endpoint||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:289:19",children:s.status==="active"?e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:291:23",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx(xe,{"code-path":"src/components/cloud/RegionManager.tsx:292:25",className:"h-3 w-3"})," 启用"]}):e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:295:23",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(he,{"code-path":"src/components/cloud/RegionManager.tsx:296:25",className:"h-3 w-3"})," 禁用"]})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:300:19",children:e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:301:21",className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:302:23",onClick:()=>K(s),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(me,{"code-path":"src/components/cloud/RegionManager.tsx:303:25",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:305:23",onClick:()=>Y(s.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:306:25",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})}),e.jsx(se,{"code-path":"src/components/cloud/RegionManager.tsx:318:7",open:X,onOpenChange:p,children:e.jsxs(ae,{"code-path":"src/components/cloud/RegionManager.tsx:319:9",children:[e.jsxs(oe,{"code-path":"src/components/cloud/RegionManager.tsx:320:11",children:[e.jsx(te,{"code-path":"src/components/cloud/RegionManager.tsx:321:13",children:g?"编辑区域":"添加区域"}),e.jsx(ce,{"code-path":"src/components/cloud/RegionManager.tsx:322:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:324:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:325:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:326:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:327:17",children:"区域名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:328:17",value:a.name,onChange:s=>n({...a,name:s.target.value}),placeholder:"如:华北-北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:335:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:336:17",children:"编码 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:337:17",value:a.code,onChange:s=>n({...a,code:s.target.value}),placeholder:"如:cn-north-1",className:"bg-slate-800/50 border-slate-700 font-mono",disabled:!!g})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:346:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:347:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:348:17",children:"云商"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:349:17",value:a.provider,onValueChange:s=>n({...a,provider:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:350:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:351:21"})}),e.jsx(S,{"code-path":"src/components/cloud/RegionManager.tsx:353:19",children:Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:355:23",value:s,children:o},s))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:360:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:361:17",children:"状态"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:362:17",value:a.status,onValueChange:s=>n({...a,status:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:363:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:364:21"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:366:19",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:367:21",value:"active",children:"启用"}),e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:368:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:373:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:374:15",children:"地理位置"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:375:15",value:a.location,onChange:s=>n({...a,location:s.target.value}),placeholder:"如:中国北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:382:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:383:15",children:"接入端点"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:384:15",value:a.endpoint,onChange:s=>n({...a,endpoint:s.target.value}),placeholder:"如:ecs.cn-north-1.aliyuncs.com",className:"bg-slate-800/50 border-slate-700 font-mono text-sm"})]})]}),e.jsxs(ne,{"code-path":"src/components/cloud/RegionManager.tsx:392:11",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:393:13",variant:"ghost",onClick:()=>p(!1),children:"取消"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:394:13",onClick:U,disabled:B||!a.name.trim()||!a.code.trim(),children:[B&&e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:395:30",className:"h-4 w-4 mr-1 animate-spin"}),g?"保存":"创建"]})]})]})})]})}export{ke as RegionManager}; +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",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:223:13",variant:"ghost",size:"sm",onClick:()=>d([]),className:"text-slate-400 hover:text-slate-200",children:"取消选择"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:226:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:Z,children:[e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:232:15",className:"h-4 w-4 mr-1.5"}),"批量删除"]})]})]}),F?e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:241:9",className:"flex justify-center py-20",children:e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:242:11",className:"h-6 w-6 animate-spin text-slate-500"})}):h.length===0?e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:245:9",className:"text-center py-20 text-slate-500",children:[e.jsx(ge,{"code-path":"src/components/cloud/RegionManager.tsx:246:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/RegionManager.tsx:247:11",children:"暂无区域数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:250:9",className:"rounded-lg overflow-hidden",children:e.jsxs(re,{"code-path":"src/components/cloud/RegionManager.tsx:251:11",children:[e.jsx(le,{"code-path":"src/components/cloud/RegionManager.tsx:252:13",children:e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:253:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:254:17",className:"w-10",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:255:19",checked:E,onCheckedChange:q,className:"border-slate-600"})}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:261:17",className:"text-slate-400",children:"区域名称"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:262:17",className:"text-slate-400",children:"编码"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:263:17",className:"text-slate-400",children:"云商"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:264:17",className:"text-slate-400",children:"位置"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:265:17",className:"text-slate-400",children:"接入端点"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:266:17",className:"text-slate-400",children:"状态"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:267:17",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(de,{"code-path":"src/components/cloud/RegionManager.tsx:270:13",children:h.map(s=>e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:272:17",className:"border-slate-800/50 group",children:[e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:273:19",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:274:21",checked:c.includes(s.id),onCheckedChange:()=>G(s.id),className:"border-slate-600"})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:280:19",className:"font-medium text-slate-200",children:s.name}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:281:19",className:"font-mono text-sm text-slate-400",children:s.code}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:282:19",children:e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:283:21",className:ue[s.provider]||"text-slate-400",children:k[s.provider]||s.provider})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:287:19",className:"text-slate-400",children:s.location||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:288:19",className:"max-w-[200px] truncate font-mono text-xs text-slate-400",title:s.endpoint,children:s.endpoint||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:289:19",children:s.status==="active"?e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:291:23",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx(xe,{"code-path":"src/components/cloud/RegionManager.tsx:292:25",className:"h-3 w-3"})," 启用"]}):e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:295:23",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(he,{"code-path":"src/components/cloud/RegionManager.tsx:296:25",className:"h-3 w-3"})," 禁用"]})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:300:19",children:e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:301:21",className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:302:23",onClick:()=>K(s),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(me,{"code-path":"src/components/cloud/RegionManager.tsx:303:25",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:305:23",onClick:()=>Y(s.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:306:25",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})}),e.jsx(se,{"code-path":"src/components/cloud/RegionManager.tsx:318:7",open:X,onOpenChange:p,children:e.jsxs(ae,{"code-path":"src/components/cloud/RegionManager.tsx:319:9",children:[e.jsxs(oe,{"code-path":"src/components/cloud/RegionManager.tsx:320:11",children:[e.jsx(te,{"code-path":"src/components/cloud/RegionManager.tsx:321:13",children:g?"编辑区域":"添加区域"}),e.jsx(ce,{"code-path":"src/components/cloud/RegionManager.tsx:322:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:324:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:325:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:326:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:327:17",children:"区域名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:328:17",value:a.name,onChange:s=>n({...a,name:s.target.value}),placeholder:"如:华北-北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:335:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:336:17",children:"编码 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:337:17",value:a.code,onChange:s=>n({...a,code:s.target.value}),placeholder:"如:cn-north-1",className:"bg-slate-800/50 border-slate-700 font-mono",disabled:!!g})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:346:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:347:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:348:17",children:"云商"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:349:17",value:a.provider,onValueChange:s=>n({...a,provider:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:350:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:351:21"})}),e.jsx(S,{"code-path":"src/components/cloud/RegionManager.tsx:353:19",children:Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:355:23",value:s,children:o},s))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:360:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:361:17",children:"状态"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:362:17",value:a.status,onValueChange:s=>n({...a,status:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:363:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:364:21"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:366:19",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:367:21",value:"active",children:"启用"}),e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:368:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:373:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:374:15",children:"地理位置"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:375:15",value:a.location,onChange:s=>n({...a,location:s.target.value}),placeholder:"如:中国北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:382:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:383:15",children:"接入端点"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:384:15",value:a.endpoint,onChange:s=>n({...a,endpoint:s.target.value}),placeholder:"如:ecs.cn-north-1.aliyuncs.com",className:"bg-slate-800/50 border-slate-700 font-mono text-sm"})]})]}),e.jsxs(ne,{"code-path":"src/components/cloud/RegionManager.tsx:392:11",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:393:13",variant:"ghost",onClick:()=>p(!1),children:"取消"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:394:13",onClick:U,disabled:B||!a.name.trim()||!a.code.trim(),children:[B&&e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:395:30",className:"h-4 w-4 mr-1 animate-spin"}),g?"保存":"创建"]})]})]})})]})}export{ke as RegionManager}; diff --git a/backend/static/assets/ResourceVisualEditor-BXksS6e2.js b/backend/static/assets/ResourceVisualEditor-CXyg-7xn.js similarity index 98% rename from backend/static/assets/ResourceVisualEditor-BXksS6e2.js rename to backend/static/assets/ResourceVisualEditor-CXyg-7xn.js index f45d8ba..5d9007e 100644 --- a/backend/static/assets/ResourceVisualEditor-BXksS6e2.js +++ b/backend/static/assets/ResourceVisualEditor-CXyg-7xn.js @@ -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 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:148:13",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:149:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="visual"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="yaml"?n():P("visual")},disabled:!t&&j!=="yaml",children:"可视化编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:154:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="yaml"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="visual"?C():P("yaml")},children:"YAML 编辑"})]}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)]",onClick:g,children:e.jsx(de,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:119",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:164:9",className:"flex-1 overflow-auto p-4",children:f?e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:13",className:"flex items-center justify-center h-full py-20",children:e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:76",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):j==="yaml"?e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:168:13",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:169:15",className:"text-xs text-amber-400/80",children:"⚠️ YAML 编辑模式 — 修改后点击保存。已自动清理只读字段(status/managedFields/uid)"}),e.jsx(H,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:170:15",value:l,height:"550px",theme:X,extensions:[J()],onChange:E=>o(E),basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,autocompletion:!0},style:{fontSize:"12px"}}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:179:15",className:"flex justify-end gap-2",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:180:17",variant:"outline",size:"sm",onClick:()=>{o($(S))},children:"重置"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:181:17",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:a,disabled:m,children:[m?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:29",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:85",className:"h-3.5 w-3.5 mr-1"}),"保存"]})]})]}):t?e.jsxs(e.Fragment,{children:[c==="configmaps"&&e.jsx(le,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:189:45",manifest:t,onSave:s,saving:m,isCreate:b}),c==="secrets"&&e.jsx(ue,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:190:42",manifest:t,onSave:s,saving:m,isCreate:b}),c==="services"&&e.jsx(xe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:191:43",manifest:t,onSave:s,saving:m,isCreate:b}),c==="ingresses"&&e.jsx(pe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:192:44",manifest:t,onSave:s,saving:m,isCreate:b}),c==="pvcs"&&e.jsx(me,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:193:39",manifest:t,onSave:s,saving:m,isCreate:b}),!["configmaps","secrets","services","ingresses","pvcs"].includes(c)&&e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:195:17",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:196:19",children:"该资源类型暂不支持可视化编辑"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:197:19",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:202:13",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:203:15",children:"无法解析资源结构"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:204:15",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})})]})})}function le({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>({key:r,value:String(t)}))),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:""}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:241:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:242:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:243:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:244:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:246:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:247:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:248:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"配置数据 (键值对)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:251:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:253:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:254:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 LOG_LEVEL)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(K,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:260:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"值",className:"flex-[2] font-mono text-xs min-h-[36px] max-h-[120px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:266:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:267:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:272:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无配置数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:276:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:277:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:77",className:"h-3.5 w-3.5 mr-1"}),"保存配置"]})})]})}function ue({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>{const u=String(t);try{const j=atob(u);return{key:r,value:j,encoded:!0}}catch{return{key:r,value:u,encoded:!1}}})),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:"",encoded:!0}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.encoded?btoa(t.value):t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:327:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:328:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:329:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:330:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:332:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:333:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"类型"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:334:9",value:d?.type||"Opaque",readOnly:!0,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:336:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:337:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:338:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"密钥数据 (已自动解码 Base64)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:341:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:343:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:344:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 password)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:350:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"明文值",className:"flex-[2] font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:356:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:357:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:362:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无密钥数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:366:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:367:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:77",className:"h-3.5 w-3.5 mr-1"}),"保存密钥"]})})]})}function xe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.type||"ClusterIP"),[x,m]=v.useState((g.ports||[]).map(s=>({name:s.name||"",port:String(s.port||""),targetPort:String(s.targetPort||""),protocol:s.protocol||"TCP",nodePort:s.nodePort?String(s.nodePort):""}))),[y,S]=v.useState(Object.entries(g.selector||{}).map(([s,a])=>({key:s,value:String(a)}))),r=(s,a,n)=>{const C=[...x];C[s]={...C[s],[a]:n},m(C)},t=()=>m([...x,{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]),u=s=>m(x.filter((a,n)=>n!==s)),j=(s,a,n)=>{const C=[...y];C[s]={...C[s],[a]:n},S(C)},P=()=>S([...y,{key:"",value:""}]),l=s=>S(y.filter((a,n)=>n!==s)),o=()=>{const s={...g};s.type=i,s.ports=x.map(n=>{const C={port:parseInt(n.port)||80,targetPort:parseInt(n.targetPort)||parseInt(n.port)||80,protocol:n.protocol};return n.name&&(C.name=n.name),n.nodePort&&i==="NodePort"&&(C.nodePort=parseInt(n.nodePort)),C});const a={};y.forEach(n=>{n.key.trim()&&(a[n.key.trim()]=n.value)}),s.selector=a,h({...d,metadata:{...d.metadata,name:N.trim()},spec:s})},p=[{value:"ClusterIP",label:"ClusterIP"},{value:"NodePort",label:"NodePort"},{value:"LoadBalancer",label:"LoadBalancer"}];return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:438:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:439:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:440:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"服务名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:441:9",value:N,onChange:s=>b(s.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:443:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:444:9",className:"text-[var(--dg-text-secondary)] text-xs mb-2 block",children:"服务类型"}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:445:9",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden w-fit",children:p.map(s=>e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:447:13",type:"button",className:`px-3 py-1.5 text-xs transition-colors ${i===s.value?"bg-blue-600 text-white":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>f(s.value),children:s.label},s.value))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:460:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:461:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:462:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"端口映射"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:t,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:89",className:"h-3 w-3 mr-1"}),"添加端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:465:9",className:"space-y-2",children:[x.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:467:13",className:"grid grid-cols-[1fr_80px_80px_80px_80px_32px] gap-2 items-center",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:468:15",value:s.name,onChange:n=>r(a,"name",n.target.value),placeholder:"名称",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:469:15",value:s.port,onChange:n=>r(a,"port",n.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:470:15",value:s.targetPort,onChange:n=>r(a,"targetPort",n.target.value),placeholder:"目标",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:471:15",value:s.protocol,onValueChange:n=>r(a,"protocol",n),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:17",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:139"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:32",value:"TCP",children:"TCP"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:72",value:"UDP",children:"UDP"})]})]}),i==="NodePort"?e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:476:17",value:s.nodePort,onChange:n=>r(a,"nodePort",n.target.value),placeholder:"NodePort",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}):e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:477:19"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>u(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:133",className:"h-3 w-3"})})]},a)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:481:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无端口,点击「添加端口」"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:486:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:487:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:488:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"选择器 (Selector)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:P,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:93",className:"h-3 w-3 mr-1"}),"添加标签"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:491:9",className:"space-y-2",children:[y.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:493:13",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:494:15",value:s.key,onChange:n=>j(a,"key",n.target.value),placeholder:"键 (如 app)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:495:15",className:"text-[var(--dg-text-muted)] text-xs",children:"="}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:496:15",value:s.value,onChange:n=>j(a,"value",n.target.value),placeholder:"值 (如 nginx)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>l(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:137",className:"h-3 w-3"})})]},a)),y.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:500:37",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无选择器"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:504:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:505:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:o,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Service"]})})]})}function pe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.ingressClassName||"nginx"),[x,m]=v.useState((g.rules||[]).map(l=>({host:l.host||"",paths:l.http?.backend?.servicePort!=null?[{path:"/",pathType:"Prefix",serviceName:l.http?.backend?.serviceName||"",servicePort:String(l.http?.backend?.servicePort||"80")}]:(l.http?.paths||[]).map(o=>({path:o.path||"/",pathType:o.pathType||"Prefix",serviceName:o.backend?.service?.name||o.backend?.serviceName||"",servicePort:String(o.backend?.service?.port?.number??o.backend?.servicePort??"80")}))}))),y=(l,o)=>{const p=[...x];p[l]={...p[l],host:o},m(p)},S=()=>m([...x,{host:"",paths:[{path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}]}]),r=l=>m(x.filter((o,p)=>p!==l)),t=(l,o,p,s)=>{const a=[...x];a[l].paths[o]={...a[l].paths[o],[p]:s},m(a)},u=l=>{const o=[...x];o[l].paths.push({path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}),m(o)},j=(l,o)=>{const p=[...x];p[l].paths=p[l].paths.filter((s,a)=>a!==o),m(p)},P=()=>{const l=x.map(p=>({host:p.host,http:{paths:p.paths.map(s=>({path:s.path,pathType:s.pathType,backend:{service:{name:s.serviceName,port:{number:parseInt(s.servicePort)||80}}}}))}})),o={...g,rules:l};i.trim()?o.ingressClassName=i.trim():delete o.ingressClassName,h({...d,metadata:{...d.metadata,name:N.trim()},spec:o})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:579:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:580:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:581:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:582:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:583:11",value:N,onChange:l=>b(l.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:585:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:586:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"Ingress Class"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:587:11",value:i,onChange:l=>f(l.target.value),placeholder:"nginx / alb",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:590:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:591:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:592:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"路由规则"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:S,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:89",className:"h-3 w-3 mr-1"}),"添加 Host"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:595:9",className:"space-y-3 max-h-[50vh] overflow-y-auto pr-1",children:[x.map((l,o)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:597:13",className:"p-3 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:598:15",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:599:17",value:l.host,onChange:p=>y(o,p.target.value),placeholder:"域名 (如 api.example.com)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:17",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>r(o),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:136",className:"h-3 w-3"})})]}),l.paths.map((p,s)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:608:17",className:"grid grid-cols-[1fr_100px_1fr_60px_28px] gap-1.5 items-center pl-4",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:609:19",value:p.path,onChange:a=>t(o,s,"path",a.target.value),placeholder:"路径 /",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:610:19",value:p.pathType,onValueChange:a=>t(o,s,"pathType",a),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:21",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:143"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:21",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:36",value:"Prefix",children:"Prefix"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:82",value:"Exact",children:"Exact"})]})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:614:19",value:p.serviceName,onChange:a=>t(o,s,"serviceName",a.target.value),placeholder:"Service",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:615:19",value:p.servicePort,onChange:a=>t(o,s,"servicePort",a.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>j(o,s),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:142",className:"h-3 w-3"})})]},s)),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-[var(--dg-text-muted)]",onClick:()=>u(o),children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:129",className:"h-3 w-3 mr-1"}),"添加路径"]})]},o)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:622:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无路由规则,点击「添加 Host」"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:625:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:626:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:P,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Ingress"]})})]})}function me({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},N=g.resources?.requests||{},[b,i]=v.useState(d?.metadata?.name||""),[f,x]=v.useState(N.storage||"1Gi"),[m,y]=v.useState(g.accessModes?.[0]||"ReadWriteOnce"),[S,r]=v.useState(g.storageClassName||""),t=()=>{h({...d,metadata:{...d.metadata,name:b.trim()},spec:{...g,accessModes:[m],storageClassName:S||void 0,resources:{requests:{storage:f}}}})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:660:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:661:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:662:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:663:9",value:b,onChange:u=>i(u.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:665:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:666:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:667:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"存储大小"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:11",value:f,onChange:u=>x(u.target.value),placeholder:"如 10Gi",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:674:11",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"单位:Gi (GiB), Mi (MiB), Ti (TiB)"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:676:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:677:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"访问模式"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:678:11",value:m,onValueChange:y,children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:679:13",className:"mt-1 h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] text-xs",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:680:15"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:682:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:683:15",value:"ReadWriteOnce",children:"ReadWriteOnce (单节点读写)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:684:15",value:"ReadOnlyMany",children:"ReadOnlyMany (多节点只读)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:685:15",value:"ReadWriteMany",children:"ReadWriteMany (多节点读写)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:690:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:691:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"StorageClass"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:692:9",value:S,onChange:u=>r(u.target.value),placeholder:"留空使用默认 StorageClass",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:699:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:700:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:t,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:77",className:"h-3.5 w-3.5 mr-1"}),"保存 PVC"]})})]})}export{Ne as R}; +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 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:148:13",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:149:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="visual"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="yaml"?n():P("visual")},disabled:!t&&j!=="yaml",children:"可视化编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:154:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="yaml"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="visual"?C():P("yaml")},children:"YAML 编辑"})]}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)]",onClick:g,children:e.jsx(de,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:119",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:164:9",className:"flex-1 overflow-auto p-4",children:f?e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:13",className:"flex items-center justify-center h-full py-20",children:e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:76",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):j==="yaml"?e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:168:13",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:169:15",className:"text-xs text-amber-400/80",children:"⚠️ YAML 编辑模式 — 修改后点击保存。已自动清理只读字段(status/managedFields/uid)"}),e.jsx(H,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:170:15",value:l,height:"550px",theme:X,extensions:[J()],onChange:E=>o(E),basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,autocompletion:!0},style:{fontSize:"12px"}}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:179:15",className:"flex justify-end gap-2",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:180:17",variant:"outline",size:"sm",onClick:()=>{o($(S))},children:"重置"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:181:17",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:a,disabled:m,children:[m?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:29",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:85",className:"h-3.5 w-3.5 mr-1"}),"保存"]})]})]}):t?e.jsxs(e.Fragment,{children:[c==="configmaps"&&e.jsx(le,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:189:45",manifest:t,onSave:s,saving:m,isCreate:b}),c==="secrets"&&e.jsx(ue,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:190:42",manifest:t,onSave:s,saving:m,isCreate:b}),c==="services"&&e.jsx(xe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:191:43",manifest:t,onSave:s,saving:m,isCreate:b}),c==="ingresses"&&e.jsx(pe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:192:44",manifest:t,onSave:s,saving:m,isCreate:b}),c==="pvcs"&&e.jsx(me,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:193:39",manifest:t,onSave:s,saving:m,isCreate:b}),!["configmaps","secrets","services","ingresses","pvcs"].includes(c)&&e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:195:17",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:196:19",children:"该资源类型暂不支持可视化编辑"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:197:19",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:202:13",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:203:15",children:"无法解析资源结构"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:204:15",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})})]})})}function le({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>({key:r,value:String(t)}))),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:""}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:241:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:242:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:243:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:244:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:246:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:247:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:248:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"配置数据 (键值对)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:251:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:253:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:254:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 LOG_LEVEL)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(K,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:260:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"值",className:"flex-[2] font-mono text-xs min-h-[36px] max-h-[120px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:266:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:267:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:272:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无配置数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:276:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:277:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:77",className:"h-3.5 w-3.5 mr-1"}),"保存配置"]})})]})}function ue({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>{const u=String(t);try{const j=atob(u);return{key:r,value:j,encoded:!0}}catch{return{key:r,value:u,encoded:!1}}})),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:"",encoded:!0}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.encoded?btoa(t.value):t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:327:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:328:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:329:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:330:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:332:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:333:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"类型"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:334:9",value:d?.type||"Opaque",readOnly:!0,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:336:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:337:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:338:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"密钥数据 (已自动解码 Base64)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:341:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:343:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:344:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 password)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:350:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"明文值",className:"flex-[2] font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:356:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:357:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:362:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无密钥数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:366:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:367:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:77",className:"h-3.5 w-3.5 mr-1"}),"保存密钥"]})})]})}function xe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.type||"ClusterIP"),[x,m]=v.useState((g.ports||[]).map(s=>({name:s.name||"",port:String(s.port||""),targetPort:String(s.targetPort||""),protocol:s.protocol||"TCP",nodePort:s.nodePort?String(s.nodePort):""}))),[y,S]=v.useState(Object.entries(g.selector||{}).map(([s,a])=>({key:s,value:String(a)}))),r=(s,a,n)=>{const C=[...x];C[s]={...C[s],[a]:n},m(C)},t=()=>m([...x,{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]),u=s=>m(x.filter((a,n)=>n!==s)),j=(s,a,n)=>{const C=[...y];C[s]={...C[s],[a]:n},S(C)},P=()=>S([...y,{key:"",value:""}]),l=s=>S(y.filter((a,n)=>n!==s)),o=()=>{const s={...g};s.type=i,s.ports=x.map(n=>{const C={port:parseInt(n.port)||80,targetPort:parseInt(n.targetPort)||parseInt(n.port)||80,protocol:n.protocol};return n.name&&(C.name=n.name),n.nodePort&&i==="NodePort"&&(C.nodePort=parseInt(n.nodePort)),C});const a={};y.forEach(n=>{n.key.trim()&&(a[n.key.trim()]=n.value)}),s.selector=a,h({...d,metadata:{...d.metadata,name:N.trim()},spec:s})},p=[{value:"ClusterIP",label:"ClusterIP"},{value:"NodePort",label:"NodePort"},{value:"LoadBalancer",label:"LoadBalancer"}];return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:438:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:439:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:440:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"服务名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:441:9",value:N,onChange:s=>b(s.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:443:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:444:9",className:"text-[var(--dg-text-secondary)] text-xs mb-2 block",children:"服务类型"}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:445:9",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden w-fit",children:p.map(s=>e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:447:13",type:"button",className:`px-3 py-1.5 text-xs transition-colors ${i===s.value?"bg-blue-600 text-white":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>f(s.value),children:s.label},s.value))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:460:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:461:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:462:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"端口映射"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:t,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:89",className:"h-3 w-3 mr-1"}),"添加端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:465:9",className:"space-y-2",children:[x.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:467:13",className:"grid grid-cols-[1fr_80px_80px_80px_80px_32px] gap-2 items-center",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:468:15",value:s.name,onChange:n=>r(a,"name",n.target.value),placeholder:"名称",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:469:15",value:s.port,onChange:n=>r(a,"port",n.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:470:15",value:s.targetPort,onChange:n=>r(a,"targetPort",n.target.value),placeholder:"目标",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:471:15",value:s.protocol,onValueChange:n=>r(a,"protocol",n),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:17",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:139"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:32",value:"TCP",children:"TCP"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:72",value:"UDP",children:"UDP"})]})]}),i==="NodePort"?e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:476:17",value:s.nodePort,onChange:n=>r(a,"nodePort",n.target.value),placeholder:"NodePort",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}):e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:477:19"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>u(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:133",className:"h-3 w-3"})})]},a)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:481:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无端口,点击「添加端口」"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:486:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:487:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:488:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"选择器 (Selector)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:P,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:93",className:"h-3 w-3 mr-1"}),"添加标签"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:491:9",className:"space-y-2",children:[y.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:493:13",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:494:15",value:s.key,onChange:n=>j(a,"key",n.target.value),placeholder:"键 (如 app)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:495:15",className:"text-[var(--dg-text-muted)] text-xs",children:"="}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:496:15",value:s.value,onChange:n=>j(a,"value",n.target.value),placeholder:"值 (如 nginx)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>l(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:137",className:"h-3 w-3"})})]},a)),y.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:500:37",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无选择器"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:504:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:505:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:o,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Service"]})})]})}function pe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.ingressClassName||"nginx"),[x,m]=v.useState((g.rules||[]).map(l=>({host:l.host||"",paths:l.http?.backend?.servicePort!=null?[{path:"/",pathType:"Prefix",serviceName:l.http?.backend?.serviceName||"",servicePort:String(l.http?.backend?.servicePort||"80")}]:(l.http?.paths||[]).map(o=>({path:o.path||"/",pathType:o.pathType||"Prefix",serviceName:o.backend?.service?.name||o.backend?.serviceName||"",servicePort:String(o.backend?.service?.port?.number??o.backend?.servicePort??"80")}))}))),y=(l,o)=>{const p=[...x];p[l]={...p[l],host:o},m(p)},S=()=>m([...x,{host:"",paths:[{path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}]}]),r=l=>m(x.filter((o,p)=>p!==l)),t=(l,o,p,s)=>{const a=[...x];a[l].paths[o]={...a[l].paths[o],[p]:s},m(a)},u=l=>{const o=[...x];o[l].paths.push({path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}),m(o)},j=(l,o)=>{const p=[...x];p[l].paths=p[l].paths.filter((s,a)=>a!==o),m(p)},P=()=>{const l=x.map(p=>({host:p.host,http:{paths:p.paths.map(s=>({path:s.path,pathType:s.pathType,backend:{service:{name:s.serviceName,port:{number:parseInt(s.servicePort)||80}}}}))}})),o={...g,rules:l};i.trim()?o.ingressClassName=i.trim():delete o.ingressClassName,h({...d,metadata:{...d.metadata,name:N.trim()},spec:o})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:579:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:580:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:581:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:582:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:583:11",value:N,onChange:l=>b(l.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:585:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:586:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"Ingress Class"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:587:11",value:i,onChange:l=>f(l.target.value),placeholder:"nginx / alb",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:590:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:591:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:592:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"路由规则"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:S,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:89",className:"h-3 w-3 mr-1"}),"添加 Host"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:595:9",className:"space-y-3 max-h-[50vh] overflow-y-auto pr-1",children:[x.map((l,o)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:597:13",className:"p-3 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:598:15",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:599:17",value:l.host,onChange:p=>y(o,p.target.value),placeholder:"域名 (如 api.example.com)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:17",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>r(o),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:136",className:"h-3 w-3"})})]}),l.paths.map((p,s)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:608:17",className:"grid grid-cols-[1fr_100px_1fr_60px_28px] gap-1.5 items-center pl-4",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:609:19",value:p.path,onChange:a=>t(o,s,"path",a.target.value),placeholder:"路径 /",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:610:19",value:p.pathType,onValueChange:a=>t(o,s,"pathType",a),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:21",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:143"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:21",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:36",value:"Prefix",children:"Prefix"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:82",value:"Exact",children:"Exact"})]})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:614:19",value:p.serviceName,onChange:a=>t(o,s,"serviceName",a.target.value),placeholder:"Service",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:615:19",value:p.servicePort,onChange:a=>t(o,s,"servicePort",a.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>j(o,s),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:142",className:"h-3 w-3"})})]},s)),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-[var(--dg-text-muted)]",onClick:()=>u(o),children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:129",className:"h-3 w-3 mr-1"}),"添加路径"]})]},o)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:622:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无路由规则,点击「添加 Host」"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:625:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:626:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:P,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Ingress"]})})]})}function me({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},N=g.resources?.requests||{},[b,i]=v.useState(d?.metadata?.name||""),[f,x]=v.useState(N.storage||"1Gi"),[m,y]=v.useState(g.accessModes?.[0]||"ReadWriteOnce"),[S,r]=v.useState(g.storageClassName||""),t=()=>{h({...d,metadata:{...d.metadata,name:b.trim()},spec:{...g,accessModes:[m],storageClassName:S||void 0,resources:{requests:{storage:f}}}})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:660:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:661:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:662:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:663:9",value:b,onChange:u=>i(u.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:665:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:666:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:667:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"存储大小"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:11",value:f,onChange:u=>x(u.target.value),placeholder:"如 10Gi",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:674:11",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"单位:Gi (GiB), Mi (MiB), Ti (TiB)"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:676:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:677:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"访问模式"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:678:11",value:m,onValueChange:y,children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:679:13",className:"mt-1 h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] text-xs",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:680:15"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:682:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:683:15",value:"ReadWriteOnce",children:"ReadWriteOnce (单节点读写)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:684:15",value:"ReadOnlyMany",children:"ReadOnlyMany (多节点只读)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:685:15",value:"ReadWriteMany",children:"ReadWriteMany (多节点读写)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:690:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:691:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"StorageClass"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:692:9",value:S,onChange:u=>r(u.target.value),placeholder:"留空使用默认 StorageClass",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:699:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:700:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:t,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:77",className:"h-3.5 w-3.5 mr-1"}),"保存 PVC"]})})]})}export{Ne as R}; diff --git a/backend/static/assets/ScriptManager-9IW87qYN.js b/backend/static/assets/ScriptManager-Dz9eHvUK.js similarity index 97% rename from backend/static/assets/ScriptManager-9IW87qYN.js rename to backend/static/assets/ScriptManager-Dz9eHvUK.js index 2f0aed4..165107b 100644 --- a/backend/static/assets/ScriptManager-9IW87qYN.js +++ b/backend/static/assets/ScriptManager-Dz9eHvUK.js @@ -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 diff --git a/backend/static/assets/ServerManager-BOk1s-nd.js b/backend/static/assets/ServerManager-D6Uxl03e.js similarity index 98% rename from backend/static/assets/ServerManager-BOk1s-nd.js rename to backend/static/assets/ServerManager-D6Uxl03e.js index 5d255f0..e4b0043 100644 --- a/backend/static/assets/ServerManager-BOk1s-nd.js +++ b/backend/static/assets/ServerManager-D6Uxl03e.js @@ -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("")},oe=S.filter(s=>!f||s.name?.toLowerCase().includes(f.toLowerCase())||s.code?.toLowerCase().includes(f.toLowerCase())),ve=[{id:1,title:"公有云",icon:Nr},{id:2,title:"访问凭据",icon:Le},{id:3,title:"选择区域",icon:We},{id:4,title:"导入确认",icon:cr}];return e.jsx(Te,{"code-path":"src/components/server/CloudServerImport.tsx:232:5",open:r,onOpenChange:je,children:e.jsxs(_e,{"code-path":"src/components/server/CloudServerImport.tsx:233:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Ke,{"code-path":"src/components/server/CloudServerImport.tsx:234:9",children:[e.jsx(Re,{"code-path":"src/components/server/CloudServerImport.tsx:235:11",className:"text-xl",children:"导入云主机"}),e.jsx(Me,{"code-path":"src/components/server/CloudServerImport.tsx:236:11",className:"sr-only",children:"从云平台批量导入主机资产"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:240:9",className:"flex items-center justify-center mb-6 flex-wrap gap-1",children:ve.map((s,T)=>e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:242:13",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:243:15",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${a===s.id?"bg-blue-600 text-white":a>s.id?"bg-emerald-600/20 text-emerald-400":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:[e.jsx(s.icon,{"code-path":"src/components/server/CloudServerImport.tsx:250:17",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:251:17",className:"font-medium hidden sm:inline",children:s.title}),a>s.id&&e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:252:33",className:"h-3 w-3 ml-1"})]}),Te.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:267:17",className:`cursor-pointer transition-all ${u===s.id?"border-blue-500 ring-2 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>g(s.id),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:276:19",className:"p-4 flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:277:21",className:`w-10 h-10 rounded-lg ${s.color} flex items-center justify-center text-white font-bold text-sm`,children:s.icon}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:280:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name})]})},s.id))})]}),a===2&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:290:11",className:"space-y-4",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:291:13",className:"text-[var(--dg-text-secondary)] text-sm",children:"请选择访问凭据(AccessKey)"}),B.length>0?e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:293:15",className:"space-y-2 max-h-[300px] overflow-y-auto",children:B.map(s=>e.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:295:19",className:`cursor-pointer transition-all ${x?.id===s.id?"border-blue-500 ring-1 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>_(s),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:304:21",className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:305:23",className:"flex items-center gap-3",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:306:25",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:307:25",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:308:27",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:309:27",className:"text-xs text-[var(--dg-text-muted)]",children:[(s.access_key||s.accessKey||"******").slice(0,20),"..."]})]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:314:23",className:"text-right",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:315:25",className:"bg-emerald-500/20 text-emerald-400 border-0",children:[s.region_count??s.regionCount??0," 区域"]}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:318:25",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:[s.server_count??s.serverCount??0," 服务器"]})]})]})},s.id))}):e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:325:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:326:17",className:"h-12 w-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:327:17",children:"该云平台暂无有效的访问凭据"})]})]}),a===3&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:335:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:336:13",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:337:15",className:"text-[var(--dg-text-secondary)] text-sm",children:["请选择要同步的区域",S.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:340:19",className:"ml-2 text-[var(--dg-text-muted)]",children:["(共 ",S.length," 个区域,已选 ",n.length," 个)"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:343:15",variant:"outline",size:"sm",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>x&&K(x.id),disabled:w,children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:350:17",className:`h-3 w-3 mr-1 ${w?"animate-spin":""}`}),w?"同步中...":"刷新区域"]})]}),w?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:356:15",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:357:17",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:358:17",className:"text-[var(--dg-text-secondary)]",children:"正在从云平台同步区域列表..."})]}):S.length===0?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:361:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:362:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:363:17",children:"暂无区域数据"}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:364:17",variant:"outline",size:"sm",className:"mt-3 border-[var(--dg-border)] text-blue-400",onClick:()=>x&&K(x.id),children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:370:19",className:"h-3 w-3 mr-1"}),"立即同步"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:377:17",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:378:19",className:"relative flex-1",children:[e.jsx(yr,{"code-path":"src/components/server/CloudServerImport.tsx:379:21",className:"h-4 w-4 absolute left-3 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:380:21",placeholder:"搜索区域名称或编码...",value:f,onChange:s=>R(s.target.value),className:"pl-9 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:387:19",variant:"outline",size:"sm",onClick:Be,className:"border-[var(--dg-border)]",children:n.length===S.length&&S.length>0?"取消全选":"全选"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:393:17",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:394:19",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:395:21",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:396:23",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:397:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:398:27",checked:n.length===S.length&&S.length>0,onCheckedChange:Be})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:403:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域编码"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:404:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域名称"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:405:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"Endpoint"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:408:21",className:"divide-y divide-[var(--dg-border)]",children:oe.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:410:25",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${n.includes(s.code)?"bg-blue-500/10":""}`,onClick:()=>{y(T=>T.includes(s.code)?T.filter(ae=>ae!==s.code):[...T,s.code])},children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:421:27",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:422:29",checked:n.includes(s.code)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:424:27",className:"px-3 py-2 text-sm text-blue-400 font-mono",children:s.code}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:425:27",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.name}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:426:27",className:"px-3 py-2 text-xs text-[var(--dg-text-muted)] font-mono truncate max-w-[200px]",children:s.endpoint||"-"})]},s.id||s.code))})]})})]})]}),a===4&&e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:439:11",className:"space-y-4",children:F?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:442:15",className:"text-center py-12",children:[e.jsx(cr,{"code-path":"src/components/server/CloudServerImport.tsx:443:17",className:"h-12 w-12 mx-auto mb-3 text-emerald-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:444:17",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:"导入完成"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:445:17",className:"flex items-center justify-center gap-6 mt-4",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:446:19",className:"bg-emerald-500/20 text-emerald-400 border-0 text-base px-4 py-1",children:["成功导入 ",F.imported," 台"]}),F.skipped>0&&e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:450:21",className:"bg-amber-500/20 text-amber-400 border-0 text-base px-4 py-1",children:["跳过 ",F.skipped," 台(已存在)"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:458:17",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:459:19",className:"text-[var(--dg-text-secondary)] text-sm",children:["已选 ",n.length," 个区域",h.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:462:23",className:"ml-2",children:["· 发现 ",h.length," 台主机"]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:465:19",className:"flex items-center gap-2",children:[h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:468:25",variant:"outline",size:"sm",onClick:Pe,className:"border-[var(--dg-border)]",children:I.length===h.length&&h.length>0?"取消全选":"全选"}),e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:471:25",className:"bg-blue-500/20 text-blue-400 border-0",children:["已选 ",I.length," 台"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:476:21",variant:"outline",size:"sm",onClick:me,disabled:L||n.length===0,className:"border-[var(--dg-border)] text-blue-400",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:483:23",className:`h-3 w-3 mr-1 ${L?"animate-spin":""}`}),L?"发现中...":h.length>0?"重新发现":"发现主机"]})]})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:490:17",className:"flex flex-wrap gap-1",children:n.map(s=>{const T=S.find(ae=>ae.code===s);return e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:494:23",className:"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)] border border-[var(--dg-border)] text-xs",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:495:25",className:"h-3 w-3 mr-1"}),T?.name||s]},s)})}),z.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:504:19",className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-sm",children:[e.jsx(ze,{"code-path":"src/components/server/CloudServerImport.tsx:505:21",className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:506:21",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:507:23",className:"font-medium",children:"部分区域发现失败:"}),z.map((s,T)=>e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:509:25",className:"text-xs mt-1 opacity-80",children:s},T))]})]}),L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:517:19",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:518:21",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:519:21",className:"text-[var(--dg-text-secondary)]",children:"正在发现云主机,请稍候..."}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:520:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"正在逐区域查询,可能需要数秒"})]}):h.length===0&&!L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:523:19",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(He,{"code-path":"src/components/server/CloudServerImport.tsx:524:21",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:525:21",children:'点击"发现主机"按钮,开始扫描所选区域'})]}):e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:528:19",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:529:21",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:530:23",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:531:25",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:532:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:533:29",checked:I.length===h.length&&h.length>0,onCheckedChange:Pe})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:538:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"主机名"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:539:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"IP地址"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:542:23",className:"divide-y divide-[var(--dg-border)]",children:h.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:544:27",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${I.includes(s.instance_id)?"bg-blue-500/10":""}`,onClick:()=>Ve(s.instance_id),children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:549:29",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:550:31",checked:I.includes(s.instance_id)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:552:29",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.instance_name||s.hostname||"-"}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:553:29",className:"px-3 py-2 text-sm text-[var(--dg-text-secondary)]",children:s.private_ip||s.public_ip||"-"})]},s.instance_id))})]})}),h.length>0&&I.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:565:19",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:566:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:567:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["SSH 端口",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:569:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(导入时统一设置)"})]}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:571:23",type:"number",placeholder:"22",value:Y,onChange:s=>q(s.target.value),className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:579:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:580:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["关联凭证",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:582:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(可选,用于SSH远程管理)"})]}),e.jsxs("select",{"code-path":"src/components/server/CloudServerImport.tsx:584:23",value:$,onChange:s=>Q(s.target.value),className:"w-full px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-xs",children:[e.jsx("option",{"code-path":"src/components/server/CloudServerImport.tsx:589:25",value:"",children:"不使用凭据"}),re.map(s=>e.jsxs("option",{"code-path":"src/components/server/CloudServerImport.tsx:591:27",value:String(s.id),children:[s.type==="ssh_key"?"🔑":"🔒"," ",s.name]},s.id))]})]})]})]})}),e.jsxs(Qe,{"code-path":"src/components/server/CloudServerImport.tsx:605:9",className:"flex justify-between items-center",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:606:11",children:a>1&&!F&&e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:608:15",variant:"outline",onClick:Se,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:[e.jsx(Xe,{"code-path":"src/components/server/CloudServerImport.tsx:609:17",className:"h-4 w-4 mr-1"}),"上一步"]})}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:614:11",className:"flex gap-2",children:F?e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:616:15",onClick:je,className:"bg-blue-600 hover:bg-blue-700",children:"完成"}):e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:621:17",variant:"outline",onClick:je,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),a<4?e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:625:19",onClick:H,disabled:a===1&&!u||a===2&&!x||a===3&&n.length===0,className:"bg-blue-600 hover:bg-blue-700",children:["下一步",e.jsx(Ee,{"code-path":"src/components/server/CloudServerImport.tsx:635:21",className:"h-4 w-4 ml-1"})]}):e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:638:19",onClick:se,disabled:I.length===0||b,className:"bg-emerald-600 hover:bg-emerald-700",children:b?e.jsxs(e.Fragment,{children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:645:25",className:"h-4 w-4 mr-1 animate-spin"}),"导入中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:650:25",className:"h-4 w-4 mr-1"}),"确认导入 (",I.length,")"]})})]})})]})]})})}function ys({open:r,onOpenChange:p,serverId:c,serverName:t,serverIp:a,hasAuth:v=!0}){const u=o.useRef(null),g=o.useRef(null),x=o.useRef(null),_=o.useRef(null),[S,E]=o.useState(!1),[n,y]=o.useState(!1),[f,R]=o.useState([]),[w,i]=o.useState(""),[h,C]=o.useState(!1),[I,D]=o.useState(v);o.useEffect(()=>{!r||v||rr.list().then(N=>R(N?.list||[])).catch(()=>{})},[r,v]);const L=async()=>{if(!(!w||!c))try{C(!0),await hs.assign(c,Number(w)),G.success("凭据已关联"),D(!0)}catch(N){G.error(N?.message||"关联失败")}finally{C(!1)}};return o.useEffect(()=>{r||(D(v),i(""))},[r,v]),o.useEffect(()=>{if(!r||!c||!I)return;const N=new ps.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),z=new ms.FitAddon;N.loadAddon(z),g.current=N,_.current=z;const m=location.protocol==="https:"?"wss":"ws",b=vr.getState().token||"",M=`${m}://${location.host}/ws/terminal?id=${c}&cols=80&rows=24&token=${encodeURIComponent(b)}`,F=new WebSocket(M);return x.current=F,N.onData(A=>{F.readyState===WebSocket.OPEN&&F.send(JSON.stringify({status:0,data:A}))}),F.onmessage=A=>{try{const Y=JSON.parse(A.data);Y.status===0&&typeof Y.data=="string"&&N.write(Y.data)}catch{N.write(typeof A.data=="string"?A.data:"")}},F.onopen=()=>{E(!0),xs(N,z,()=>u.current,F)},F.onclose=()=>{E(!1),N.write(`\r +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("")},oe=S.filter(s=>!f||s.name?.toLowerCase().includes(f.toLowerCase())||s.code?.toLowerCase().includes(f.toLowerCase())),ve=[{id:1,title:"公有云",icon:Nr},{id:2,title:"访问凭据",icon:Le},{id:3,title:"选择区域",icon:We},{id:4,title:"导入确认",icon:cr}];return e.jsx(Te,{"code-path":"src/components/server/CloudServerImport.tsx:232:5",open:r,onOpenChange:je,children:e.jsxs(_e,{"code-path":"src/components/server/CloudServerImport.tsx:233:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Ke,{"code-path":"src/components/server/CloudServerImport.tsx:234:9",children:[e.jsx(Re,{"code-path":"src/components/server/CloudServerImport.tsx:235:11",className:"text-xl",children:"导入云主机"}),e.jsx(Me,{"code-path":"src/components/server/CloudServerImport.tsx:236:11",className:"sr-only",children:"从云平台批量导入主机资产"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:240:9",className:"flex items-center justify-center mb-6 flex-wrap gap-1",children:ve.map((s,T)=>e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:242:13",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:243:15",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${a===s.id?"bg-blue-600 text-white":a>s.id?"bg-emerald-600/20 text-emerald-400":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:[e.jsx(s.icon,{"code-path":"src/components/server/CloudServerImport.tsx:250:17",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:251:17",className:"font-medium hidden sm:inline",children:s.title}),a>s.id&&e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:252:33",className:"h-3 w-3 ml-1"})]}),Te.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:267:17",className:`cursor-pointer transition-all ${u===s.id?"border-blue-500 ring-2 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>g(s.id),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:276:19",className:"p-4 flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:277:21",className:`w-10 h-10 rounded-lg ${s.color} flex items-center justify-center text-white font-bold text-sm`,children:s.icon}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:280:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name})]})},s.id))})]}),a===2&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:290:11",className:"space-y-4",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:291:13",className:"text-[var(--dg-text-secondary)] text-sm",children:"请选择访问凭据(AccessKey)"}),B.length>0?e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:293:15",className:"space-y-2 max-h-[300px] overflow-y-auto",children:B.map(s=>e.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:295:19",className:`cursor-pointer transition-all ${x?.id===s.id?"border-blue-500 ring-1 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>_(s),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:304:21",className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:305:23",className:"flex items-center gap-3",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:306:25",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:307:25",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:308:27",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:309:27",className:"text-xs text-[var(--dg-text-muted)]",children:[(s.access_key||s.accessKey||"******").slice(0,20),"..."]})]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:314:23",className:"text-right",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:315:25",className:"bg-emerald-500/20 text-emerald-400 border-0",children:[s.region_count??s.regionCount??0," 区域"]}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:318:25",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:[s.server_count??s.serverCount??0," 服务器"]})]})]})},s.id))}):e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:325:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:326:17",className:"h-12 w-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:327:17",children:"该云平台暂无有效的访问凭据"})]})]}),a===3&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:335:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:336:13",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:337:15",className:"text-[var(--dg-text-secondary)] text-sm",children:["请选择要同步的区域",S.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:340:19",className:"ml-2 text-[var(--dg-text-muted)]",children:["(共 ",S.length," 个区域,已选 ",n.length," 个)"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:343:15",variant:"outline",size:"sm",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>x&&K(x.id),disabled:w,children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:350:17",className:`h-3 w-3 mr-1 ${w?"animate-spin":""}`}),w?"同步中...":"刷新区域"]})]}),w?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:356:15",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:357:17",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:358:17",className:"text-[var(--dg-text-secondary)]",children:"正在从云平台同步区域列表..."})]}):S.length===0?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:361:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:362:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:363:17",children:"暂无区域数据"}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:364:17",variant:"outline",size:"sm",className:"mt-3 border-[var(--dg-border)] text-blue-400",onClick:()=>x&&K(x.id),children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:370:19",className:"h-3 w-3 mr-1"}),"立即同步"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:377:17",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:378:19",className:"relative flex-1",children:[e.jsx(yr,{"code-path":"src/components/server/CloudServerImport.tsx:379:21",className:"h-4 w-4 absolute left-3 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:380:21",placeholder:"搜索区域名称或编码...",value:f,onChange:s=>R(s.target.value),className:"pl-9 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:387:19",variant:"outline",size:"sm",onClick:Be,className:"border-[var(--dg-border)]",children:n.length===S.length&&S.length>0?"取消全选":"全选"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:393:17",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:394:19",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:395:21",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:396:23",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:397:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:398:27",checked:n.length===S.length&&S.length>0,onCheckedChange:Be})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:403:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域编码"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:404:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域名称"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:405:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"Endpoint"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:408:21",className:"divide-y divide-[var(--dg-border)]",children:oe.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:410:25",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${n.includes(s.code)?"bg-blue-500/10":""}`,onClick:()=>{y(T=>T.includes(s.code)?T.filter(ae=>ae!==s.code):[...T,s.code])},children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:421:27",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:422:29",checked:n.includes(s.code)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:424:27",className:"px-3 py-2 text-sm text-blue-400 font-mono",children:s.code}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:425:27",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.name}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:426:27",className:"px-3 py-2 text-xs text-[var(--dg-text-muted)] font-mono truncate max-w-[200px]",children:s.endpoint||"-"})]},s.id||s.code))})]})})]})]}),a===4&&e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:439:11",className:"space-y-4",children:F?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:442:15",className:"text-center py-12",children:[e.jsx(cr,{"code-path":"src/components/server/CloudServerImport.tsx:443:17",className:"h-12 w-12 mx-auto mb-3 text-emerald-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:444:17",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:"导入完成"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:445:17",className:"flex items-center justify-center gap-6 mt-4",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:446:19",className:"bg-emerald-500/20 text-emerald-400 border-0 text-base px-4 py-1",children:["成功导入 ",F.imported," 台"]}),F.skipped>0&&e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:450:21",className:"bg-amber-500/20 text-amber-400 border-0 text-base px-4 py-1",children:["跳过 ",F.skipped," 台(已存在)"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:458:17",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:459:19",className:"text-[var(--dg-text-secondary)] text-sm",children:["已选 ",n.length," 个区域",h.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:462:23",className:"ml-2",children:["· 发现 ",h.length," 台主机"]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:465:19",className:"flex items-center gap-2",children:[h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:468:25",variant:"outline",size:"sm",onClick:Pe,className:"border-[var(--dg-border)]",children:I.length===h.length&&h.length>0?"取消全选":"全选"}),e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:471:25",className:"bg-blue-500/20 text-blue-400 border-0",children:["已选 ",I.length," 台"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:476:21",variant:"outline",size:"sm",onClick:me,disabled:L||n.length===0,className:"border-[var(--dg-border)] text-blue-400",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:483:23",className:`h-3 w-3 mr-1 ${L?"animate-spin":""}`}),L?"发现中...":h.length>0?"重新发现":"发现主机"]})]})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:490:17",className:"flex flex-wrap gap-1",children:n.map(s=>{const T=S.find(ae=>ae.code===s);return e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:494:23",className:"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)] border border-[var(--dg-border)] text-xs",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:495:25",className:"h-3 w-3 mr-1"}),T?.name||s]},s)})}),z.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:504:19",className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-sm",children:[e.jsx(ze,{"code-path":"src/components/server/CloudServerImport.tsx:505:21",className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:506:21",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:507:23",className:"font-medium",children:"部分区域发现失败:"}),z.map((s,T)=>e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:509:25",className:"text-xs mt-1 opacity-80",children:s},T))]})]}),L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:517:19",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:518:21",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:519:21",className:"text-[var(--dg-text-secondary)]",children:"正在发现云主机,请稍候..."}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:520:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"正在逐区域查询,可能需要数秒"})]}):h.length===0&&!L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:523:19",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(He,{"code-path":"src/components/server/CloudServerImport.tsx:524:21",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:525:21",children:'点击"发现主机"按钮,开始扫描所选区域'})]}):e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:528:19",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:529:21",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:530:23",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:531:25",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:532:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:533:29",checked:I.length===h.length&&h.length>0,onCheckedChange:Pe})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:538:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"主机名"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:539:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"IP地址"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:542:23",className:"divide-y divide-[var(--dg-border)]",children:h.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:544:27",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${I.includes(s.instance_id)?"bg-blue-500/10":""}`,onClick:()=>Ve(s.instance_id),children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:549:29",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:550:31",checked:I.includes(s.instance_id)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:552:29",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.instance_name||s.hostname||"-"}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:553:29",className:"px-3 py-2 text-sm text-[var(--dg-text-secondary)]",children:s.private_ip||s.public_ip||"-"})]},s.instance_id))})]})}),h.length>0&&I.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:565:19",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:566:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:567:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["SSH 端口",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:569:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(导入时统一设置)"})]}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:571:23",type:"number",placeholder:"22",value:Y,onChange:s=>q(s.target.value),className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:579:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:580:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["关联凭证",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:582:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(可选,用于SSH远程管理)"})]}),e.jsxs("select",{"code-path":"src/components/server/CloudServerImport.tsx:584:23",value:$,onChange:s=>Q(s.target.value),className:"w-full px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-xs",children:[e.jsx("option",{"code-path":"src/components/server/CloudServerImport.tsx:589:25",value:"",children:"不使用凭据"}),re.map(s=>e.jsxs("option",{"code-path":"src/components/server/CloudServerImport.tsx:591:27",value:String(s.id),children:[s.type==="ssh_key"?"🔑":"🔒"," ",s.name]},s.id))]})]})]})]})}),e.jsxs(Qe,{"code-path":"src/components/server/CloudServerImport.tsx:605:9",className:"flex justify-between items-center",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:606:11",children:a>1&&!F&&e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:608:15",variant:"outline",onClick:Se,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:[e.jsx(Xe,{"code-path":"src/components/server/CloudServerImport.tsx:609:17",className:"h-4 w-4 mr-1"}),"上一步"]})}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:614:11",className:"flex gap-2",children:F?e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:616:15",onClick:je,className:"bg-blue-600 hover:bg-blue-700",children:"完成"}):e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:621:17",variant:"outline",onClick:je,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),a<4?e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:625:19",onClick:H,disabled:a===1&&!u||a===2&&!x||a===3&&n.length===0,className:"bg-blue-600 hover:bg-blue-700",children:["下一步",e.jsx(Ee,{"code-path":"src/components/server/CloudServerImport.tsx:635:21",className:"h-4 w-4 ml-1"})]}):e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:638:19",onClick:se,disabled:I.length===0||b,className:"bg-emerald-600 hover:bg-emerald-700",children:b?e.jsxs(e.Fragment,{children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:645:25",className:"h-4 w-4 mr-1 animate-spin"}),"导入中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:650:25",className:"h-4 w-4 mr-1"}),"确认导入 (",I.length,")"]})})]})})]})]})})}function ys({open:r,onOpenChange:p,serverId:c,serverName:t,serverIp:a,hasAuth:v=!0}){const u=o.useRef(null),g=o.useRef(null),x=o.useRef(null),_=o.useRef(null),[S,E]=o.useState(!1),[n,y]=o.useState(!1),[f,R]=o.useState([]),[w,i]=o.useState(""),[h,C]=o.useState(!1),[I,D]=o.useState(v);o.useEffect(()=>{!r||v||rr.list().then(N=>R(N?.list||[])).catch(()=>{})},[r,v]);const L=async()=>{if(!(!w||!c))try{C(!0),await hs.assign(c,Number(w)),G.success("凭据已关联"),D(!0)}catch(N){G.error(N?.message||"关联失败")}finally{C(!1)}};return o.useEffect(()=>{r||(D(v),i(""))},[r,v]),o.useEffect(()=>{if(!r||!c||!I)return;const N=new ps.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),z=new ms.FitAddon;N.loadAddon(z),g.current=N,_.current=z;const m=location.protocol==="https:"?"wss":"ws",b=vr.getState().token||"",M=`${m}://${location.host}/ws/terminal?id=${c}&cols=80&rows=24&token=${encodeURIComponent(b)}`,F=new WebSocket(M);return x.current=F,N.onData(A=>{F.readyState===WebSocket.OPEN&&F.send(JSON.stringify({status:0,data:A}))}),F.onmessage=A=>{try{const Y=JSON.parse(A.data);Y.status===0&&typeof Y.data=="string"&&N.write(Y.data)}catch{N.write(typeof A.data=="string"?A.data:"")}},F.onopen=()=>{E(!0),xs(N,z,()=>u.current,F)},F.onclose=()=>{E(!1),N.write(`\r \x1B[31m[连接已关闭]\x1B[0m\r `)},F.onerror=()=>{N.write(`\r \x1B[31m[连接发生错误]\x1B[0m\r diff --git a/backend/static/assets/SystemManager-BD0ukLSx.js b/backend/static/assets/SystemManager-B9Kzdis0.js similarity index 99% rename from backend/static/assets/SystemManager-BD0ukLSx.js rename to backend/static/assets/SystemManager-B9Kzdis0.js index 53490f4..9de09a5 100644 --- a/backend/static/assets/SystemManager-BD0ukLSx.js +++ b/backend/static/assets/SystemManager-B9Kzdis0.js @@ -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-800 border-slate-700",children:T.map(n=>s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:n.name,children:n.name},n.id))})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:144:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:145:15",className:"text-xs text-slate-500",children:"状态"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:n=>m({...a,status:Number(n)}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:155:19",value:"0",children:"禁用"})]})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:160:11",className:"space-y-2",children:[s.jsxs("label",{"code-path":"src/components/system/UserFormDialog.tsx:161:13",className:"text-xs text-slate-500",children:["密码",t?"(留空则不修改)":""]}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:n=>m({...a,password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserFormDialog.tsx:174:9",children:[s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:175:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:178:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}function Oe({selectedUser:e,setSelectedUser:d,getUserStatusBadge:t,openEdit:a}){return s.jsx(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:29:5",open:!!e,onOpenChange:()=>d(null),children:s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:30:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserDetailDialog.tsx:31:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserDetailDialog.tsx:32:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserDetailDialog.tsx:33:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(as,{"code-path":"src/components/system/UserDetailDialog.tsx:36:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:41:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:42:11",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-slate-800/50",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:44:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:45:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:47:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:48:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:49:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:51:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:52:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:53:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:55:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:56:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:57:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:59:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:60:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:61:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:63:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:64:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:65:15",className:"text-sm text-slate-200",children:e&&e.createdAt?new Date(e.createdAt).toLocaleDateString():"--"})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:71:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:72:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:73:13",className:"flex flex-wrap gap-2",children:e?.roles.map(m=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:75:17",variant:"outline",className:"border-slate-700 text-slate-400",children:m},m))})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserDetailDialog.tsx:83:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:84:11",variant:"outline",className:"border-slate-700 text-slate-300",children:[s.jsx(Qs,{"code-path":"src/components/system/UserDetailDialog.tsx:85:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:88:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(d(null),a(e))},children:[s.jsx(vs,{"code-path":"src/components/system/UserDetailDialog.tsx:97:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:d,importPreview:t,setImportPreview:a,importing:m,importResult:i,setImportResult:u,handleCsvUpload:T,handleBatchImport:N}){return s.jsx(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:n=>!n&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(ts,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(as,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),i?s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:120:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:121:13",className:`flex items-center gap-3 p-4 rounded-lg ${i.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[i.code===200?s.jsx(Ws,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:125:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/CsvImportDialog.tsx:127:15",className:"text-sm text-slate-200",children:i.message})]}),i.errors?.length>0&&s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:130:15",className:"max-h-32 overflow-auto rounded-lg bg-slate-800/50 p-3 space-y-1",children:i.errors.map((n,U)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:n},U))}),s.jsx(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:136:13",children:s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:137:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),u(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:61:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:62:15",className:"flex items-center gap-2",children:[s.jsxs(x,{"code-path":"src/components/system/CsvImportDialog.tsx:63:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q.downloadTemplate(),children:[s.jsx(de,{"code-path":"src/components/system/CsvImportDialog.tsx:64:19",className:"h-4 w-4 mr-1.5"}),"下载模板"]}),s.jsxs("label",{"code-path":"src/components/system/CsvImportDialog.tsx:67:17",className:"inline-flex items-center px-3 py-1.5 rounded-md text-sm bg-slate-800 border border-slate-700 text-slate-200 cursor-pointer hover:bg-slate-700 transition-colors",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:68:19",className:"h-4 w-4 mr-1.5"}),"选择 CSV 文件",s.jsx("input",{"code-path":"src/components/system/CsvImportDialog.tsx:70:19",type:"file",accept:".csv",className:"hidden",onChange:T})]})]}),t.length>0&&s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:75:17",className:"rounded-lg border border-slate-800 overflow-hidden",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:76:19",className:"px-3 py-2 bg-slate-800/50 text-xs text-slate-400",children:["预览:",t.length," 条数据"]}),s.jsxs(As,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(Ps,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((n,U)=>s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:90:25",className:"border-slate-800",children:[s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:91:27",className:"text-slate-200 text-xs",children:n.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:n.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:n.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:n.phone})]},U)),t.length>5&&s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:98:25",className:"border-slate-800",children:s.jsxs(w,{"code-path":"src/components/system/CsvImportDialog.tsx:99:27",colSpan:4,className:"text-slate-500 text-xs text-center",children:["还有 ",t.length-5," 条..."]})})]})]})]})]}),s.jsxs(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:110:13",children:[s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:111:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:114:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:N,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Pe({importDialogOpen:e,setImportDialogOpen:d,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:T,ldapImportOUDN:N,setLdapImportOUDN:n,loadLdapUsers:U,handleLdapImport:h,importing:D,importResult:b,setImportResult:S}){return s.jsx(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:y=>!y&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(as,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),b?s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:163:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:164:13",className:`flex items-center gap-3 p-4 rounded-lg ${b.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[b.code===200?s.jsx(Ws,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:168:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:170:15",className:"text-sm text-slate-200",children:b.message})]}),s.jsx(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:172:13",children:s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:173:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),S(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:72:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:73:15",className:"flex items-center gap-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:74:17",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:75:19",className:"text-xs text-slate-500 whitespace-nowrap",children:"选择 OU"}),s.jsxs("select",{"code-path":"src/components/system/LdapImportDialog.tsx:76:19",className:"bg-slate-800 border border-slate-700 text-slate-200 text-xs rounded-md px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",value:N,onChange:y=>{n(y.target.value),U(y.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),T.map(y=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:y.dn,children:y.name},y.dn))]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapImportDialog.tsx:90:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300 ml-auto",onClick:()=>U(N),disabled:u,children:[u?s.jsx(Ns,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:91:88",className:"h-4 w-4 mr-1.5"}),"刷新"]})]}),s.jsx("p",{"code-path":"src/components/system/LdapImportDialog.tsx:96:15",className:"text-xs text-slate-500",children:t.length>0?`找到 ${t.length} 个用户`:"选择 OU 或点击刷新获取用户列表"}),t.length>0&&s.jsx("div",{"code-path":"src/components/system/LdapImportDialog.tsx:101:17",className:"max-h-80 overflow-auto rounded-lg border border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:105:25",className:"w-10 text-slate-400 text-xs",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:106:27",type:"checkbox",className:"accent-blue-600",checked:m.size===t.length&&t.length>0,onChange:y=>{y.target.checked?i(new Set(t.map(R=>R.dn))):i(new Set)}})}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(y=>s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:127:25",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:128:27",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:129:29",type:"checkbox",className:"accent-blue-600",checked:m.has(y.dn),onChange:R=>{const C=new Set(m);R.target.checked?C.add(y.dn):C.delete(y.dn),i(C)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:y.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:y.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:y.mail}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:144:27",className:"text-slate-500 text-xs font-mono truncate max-w-[200px]",children:y.dn})]},y.dn))})]})})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:153:13",children:[s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:154:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:157:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:h,disabled:D||m.size===0,children:D?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function Ee({searchQuery:e,setSearchQuery:d,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,dialogOpen:T,setDialogOpen:N,editingUser:n,form:U,setForm:h,saving:D,handleSubmit:b,openCreate:S,openEdit:y,handleDelete:R,importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j,ldapUsers:_,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,setLdapUsers:K}){const{hasPermission:Q}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:116:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:117:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:118:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(f,{"code-path":"src/components/system/SystemUserTab.tsx:119:11",placeholder:"搜索用户...",value:e,onChange:v=>d(v.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:126:9",className:"flex items-center gap-2",children:[Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:128:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("csv"),children:[s.jsx(Gs,{"code-path":"src/components/system/SystemUserTab.tsx:129:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("ldap"),children:[s.jsx(Js,{"code-path":"src/components/system/SystemUserTab.tsx:135:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:140:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:S,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemUserTab.tsx:141:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(xs,{"code-path":"src/components/system/SystemUserTab.tsx:149:7",className:"bg-slate-900 border-slate-800",children:s.jsx(hs,{"code-path":"src/components/system/SystemUserTab.tsx:150:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:151:11",className:"border-t border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/SystemUserTab.tsx:152:13",children:[s.jsx(Ps,{"code-path":"src/components/system/SystemUserTab.tsx:153:15",children:s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:154:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:155:19",className:"text-slate-400",children:"用户信息"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:156:19",className:"text-slate-400",children:"联系方式"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"角色"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"来源"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"状态"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"最后登录"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/SystemUserTab.tsx:164:15",children:a?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:166:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:167:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:168:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:169:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:174:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:175:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(v=>s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:181:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:182:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:183:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:184:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(v.nickname||v.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:187:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:188:29",className:"text-sm font-medium text-slate-200",children:v.nickname||v.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:189:29",className:"text-xs text-slate-500",children:["@",v.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:193:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:194:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:195:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:196:29",className:"h-3.5 w-3.5"}),v.email||"--"]}),v.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:200:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:201:31",className:"h-3.5 w-3.5"}),v.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:207:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:208:25",className:"flex flex-wrap gap-1",children:(v.roles||[]).map(Y=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:210:29",variant:"outline",className:"border-slate-700 text-slate-400",children:Y},Y))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:216:23",children:v.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:218:27",variant:"outline",className:"border-cyan-500/30 text-cyan-400 bg-cyan-500/10",children:"LDAP"}):s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:222:27",variant:"outline",className:"border-slate-600/30 text-slate-400 bg-slate-600/10",children:"本地"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:227:23",children:u(v.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:228:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:229:25",className:"text-sm text-slate-400",children:v.lastLoginAt?new Date(v.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:233:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:234:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:235:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>i(v),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:241:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:244:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>y(v),children:s.jsx(vs,{"code-path":"src/components/system/SystemUserTab.tsx:250:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:254:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>R(v),children:s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:260:29",className:"h-4 w-4"})})]})})]},v.id))})]})})})}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:275:7",selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,openEdit:y}),s.jsx(Fe,{"code-path":"src/components/system/SystemUserTab.tsx:282:7",open:T,onOpenChange:N,editingUser:n,form:U,setForm:h,saving:D,onSubmit:b}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:292:7",importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:304:7",importDialogOpen:C,setImportDialogOpen:P,ldapUsers:_,setLdapUsers:K,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,importing:k,importResult:A,setImportResult:p})]})}const ze=[{key:"dashboard",label:"📊 仪表盘",prefixes:["dashboard:"]},{key:"server",label:"🖥️ 资产管理",prefixes:["server:"]},{key:"cloud",label:"☁️ 云资源",prefixes:["cloud:"]},{key:"k8s",label:"☸️ Kubernetes",prefixes:["k8s:"]},{key:"deploy",label:"🚀 应用发布",prefixes:["deploy:"]},{key:"monitor",label:"📡 监控告警",prefixes:["monitor:","agent:"]},{key:"auto",label:"⚙️ 自动化运维",prefixes:["auto:"]},{key:"aiops",label:"🤖 AIOps智能",prefixes:["aiops:"]},{key:"approval",label:"✅ 资源申请",prefixes:["approval:"]},{key:"audit",label:"🔍 安全审计",prefixes:["audit:"]},{key:"system",label:"🔧 系统管理",prefixes:["system:"]}];function $e(e){const d=ze.map(m=>({key:m.key,label:m.label,items:e.filter(i=>m.prefixes.some(u=>i.code.startsWith(u)))})).filter(m=>m.items.length>0),t=new Set(d.flatMap(m=>m.items.map(i=>i.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&d.push({key:"other",label:"📌 其他",items:a}),d}function Be({open:e,onOpenChange:d,editingRole:t,form:a,setForm:m,saving:i,onSubmit:u,permissions:T}){const N=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return D?S.add(h):S.delete(h),{...b,permission_ids:Array.from(S)}})},n=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return h.forEach(y=>D?S.add(y.id):S.delete(y.id)),{...b,permission_ids:Array.from(S)}})},U=$e(T);return s.jsx(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/RoleFormDialog.tsx:92:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(es,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(ts,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(se,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(as,{"code-path":"src/components/system/RoleFormDialog.tsx:98:11",className:"text-[var(--dg-text-secondary)]",children:t?"修改角色信息与权限":"创建新的系统角色并分配权限"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:103:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:104:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:105:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:107:15",value:a.name,onChange:h=>m({...a,name:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]",placeholder:"如:运维工程师"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:114:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:116:15",value:a.code,onChange:h=>m({...a,code:h.target.value}),disabled:!!t,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] disabled:opacity-60",placeholder:"如:ops_engineer"})]})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:125:11",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Re,{"code-path":"src/components/system/RoleFormDialog.tsx:127:13",value:a.description,onChange:h=>m({...a,description:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] resize-none",placeholder:"角色职责描述(可选)",rows:2})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:137:11",className:"space-y-2",children:[s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:138:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["权限分配",a.permission_ids.length>0&&s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:141:17",className:"ml-2 text-purple-400",children:["已选 ",a.permission_ids.length," 项"]})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:144:13",className:"max-h-[40vh] overflow-y-auto rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)] p-3 space-y-3",children:U.length===0?s.jsx("p",{"code-path":"src/components/system/RoleFormDialog.tsx:146:17",className:"text-xs text-[var(--dg-text-muted)] text-center py-4",children:"暂无可分配权限"}):U.map(h=>{const D=h.items.filter(S=>a.permission_ids.includes(S.id)).length,b=D===h.items.length&&h.items.length>0;return s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:152:21",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:153:23",className:"flex items-center justify-between mb-1.5",children:[s.jsxs("button",{"code-path":"src/components/system/RoleFormDialog.tsx:154:25",onClick:()=>n(h.items,!b),className:"text-xs font-medium text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1",children:[h.label,s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:159:27",className:"text-[var(--dg-text-muted)] text-[10px]",children:["(",D,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>n(h.items,!b),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:b?"取消全选":"全选"})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:170:23",className:"grid grid-cols-2 gap-x-3 gap-y-1 pl-1",children:h.items.map(S=>s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:172:27",className:"flex items-center gap-2 text-xs text-[var(--dg-text-secondary)] font-normal cursor-pointer hover:text-[var(--dg-text-primary)] py-0.5",children:[s.jsx(_e,{"code-path":"src/components/system/RoleFormDialog.tsx:176:29",checked:a.permission_ids.includes(S.id),onCheckedChange:y=>N(S.id,y===!0),className:"border-[var(--dg-border)] data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 h-3.5 w-3.5"}),s.jsx("span",{"code-path":"src/components/system/RoleFormDialog.tsx:181:29",className:"truncate",children:S.name})]},S.id))})]},h.key)})})]})]}),s.jsxs(ls,{"code-path":"src/components/system/RoleFormDialog.tsx:193:9",children:[s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:194:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:197:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}const Ve={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},He=[{label:"仪表盘",prefixes:["dashboard:"]},{label:"资产管理",prefixes:["server:"]},{label:"云资源",prefixes:["cloud:"]},{label:"K8s",prefixes:["k8s:"]},{label:"发布",prefixes:["deploy:"]},{label:"监控",prefixes:["monitor:","agent:"]},{label:"自动化",prefixes:["auto:"]},{label:"AI",prefixes:["aiops:"]},{label:"审批",prefixes:["approval:"]},{label:"审计",prefixes:["audit:"]},{label:"系统",prefixes:["system:"]}];function Ge(e,d){return He.map(a=>{const m=e.filter((i,u)=>a.prefixes.some(T=>(d[u]||"").startsWith(T)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Ke(e){const d=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:d.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:d.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:d.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function Qe({selectedRole:e,setSelectedRole:d}){const t=Ks(),[a,m]=o.useState([]),[i,u]=o.useState(!0),[T,N]=o.useState([]),[n,U]=o.useState(!1),[h,D]=o.useState(null),[b,S]=o.useState({...me}),[y,R]=o.useState(!1),C=o.useCallback(async()=>{u(!0);try{const O=(await q.getRoles())?.list??[];m(O.map(Ke))}catch{m([])}finally{u(!1)}},[]),P=o.useCallback(async()=>{try{const O=(await q.getPermissions())?.list??[];N(O.map(j=>({id:Number(j.id),name:j.name??j.code??"",code:j.code??"",type:j.type})))}catch{N([])}},[]);o.useEffect(()=>{C(),P()},[C,P]);const F=()=>{D(null),S({...me}),U(!0)},B=p=>{D(p._raw||p),S({name:p.name??"",code:p.code??"",description:p.description??"",permission_ids:Array.isArray(p._permissionIds)?[...p._permissionIds]:[]}),U(!0)},k=async()=>{if(!b.name.trim()){V.error("请输入角色名称");return}if(!b.code.trim()){V.error("请输入角色编码");return}R(!0);try{const p={name:b.name.trim(),code:b.code.trim(),description:b.description.trim(),permission_ids:b.permission_ids};h?(await q.updateRole(h.id,p),V.success("角色更新成功")):(await q.createRole(p),V.success("角色创建成功")),U(!1),await C()}catch(p){V.error(p?.message||"保存失败")}finally{R(!1)}},A=async p=>{if(p.isSystem){V.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${p.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await q.deleteRole(p.id),V.success("角色已删除"),await C()}catch(j){const _=j?.response?.data?.message||j?.message||"删除失败";V.error(_)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:187:7",className:"flex items-center justify-end gap-2",children:[s.jsxs("span",{"code-path":"src/components/system/SystemRolesTab.tsx:188:9",className:"text-xs text-[var(--dg-text-muted)]",children:[a.length," 个角色"]}),s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:189:9",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:F,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),i?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:195:9",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:196:11",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:199:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:200:11",className:"h-10 w-10 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:201:11",className:"text-sm",children:"暂无角色数据"})]}):s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:204:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:a.map(p=>{const O=p.permissions,j=p.permissionCodes,_=Ge(O,j),G=Ve[p.code]||"🛡️";return s.jsxs(xs,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${p.isSystem?"border-purple-500/20":""}`,children:[s.jsx(Ss,{"code-path":"src/components/system/SystemRolesTab.tsx:212:17",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:213:19",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:214:21",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:215:23",className:`w-10 h-10 rounded-lg flex items-center justify-center text-lg ${p.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:G}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(js,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[p.name,p.isSystem&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:224:29",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px] px-1 py-0",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(us,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:p.code})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:232:21",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:233:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>d(p),children:s.jsx(pe,{"code-path":"src/components/system/SystemRolesTab.tsx:238:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:240:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-blue-400",onClick:()=>B(p),children:s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:245:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:247:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-red-400",onClick:()=>A(p),disabled:p.isSystem,title:p.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${p.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(hs,{"code-path":"src/components/system/SystemRolesTab.tsx:259:17",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:260:19",className:"text-sm text-[var(--dg-text-secondary)] mb-3",children:p.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(E=>s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:264:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] text-[10px]",children:[E.label,"·",E.count]},E.label))}),O.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},p.id)})}),s.jsx(We,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>d(null),onEdit:p=>{d(null),B(p)}}),s.jsx(Be,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:n,onOpenChange:U,editingRole:h,form:b,setForm:S,saving:y,onSubmit:k,permissions:T})]})}function We({role:e,onClose:d,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(Z,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:i=>!i&&d(),children:s.jsxs(ss,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(es,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(ts,{"code-path":"src/components/system/SystemRolesTab.tsx:302:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Ce,{"code-path":"src/components/system/SystemRolesTab.tsx:303:13",className:"h-5 w-5 text-purple-400"}),e?.name,m&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:306:15",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px]",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(as,{"code-path":"src/components/system/SystemRolesTab.tsx:311:11",className:"text-[var(--dg-text-muted)]",children:["编码:",e?.code]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:313:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:314:11",className:"rounded-lg bg-[var(--dg-bg-tertiary)] p-4",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:315:13",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:"描述"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:316:13",className:"text-sm text-[var(--dg-text-primary)]",children:e?.description||"暂无描述"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:318:11",children:[s.jsxs("h4",{"code-path":"src/components/system/SystemRolesTab.tsx:319:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:["权限列表 (",e?.permissions?.length||0," 项)"]}),e&&e.permissions.length>0?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:323:15",className:"flex flex-wrap gap-2 max-h-60 overflow-y-auto",children:e.permissions.map((i,u)=>s.jsx(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:325:19",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:i},u))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(ls,{"code-path":"src/components/system/SystemRolesTab.tsx:335:9",children:s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:336:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>e&&t(e),children:[s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function qe(e){const{ldapConfig:d,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:i,setSelectedOUDN:u,ldapUsers:T,selectedLDAPUsers:N,setSelectedLDAPUsers:n,loadLdapOUs:U,loadLdapOUUsers:h,handleLdapImport:D,importing:b,importFeedback:S,importResultOpen:y,setImportResultOpen:R,createOUOpen:C,setCreateOUOpen:P,ouForm:F,setOuForm:B,handleCreateOU:k,ldapSaving:A,createUserOpen:p,setCreateUserOpen:O,newUser:j,setNewUser:_,handleCreateLDAPUser:G,ldapUserTestOpen:E,setLdapUserTestOpen:X,ldapTestUser:L,setLdapTestUser:rs,ldapTestPass:ns,setLdapTestPass:ds,ldapUserTesting:ps,ldapUserTestResult:K,handleLdapUserTest:Q,editLdapUser:v,setEditLdapUser:Y,editLdapForm:r,setEditLdapForm:z,handleUpdateLdapUser:os,handleDeleteLDAPEntry:fs,openEditLdapUser:ks}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const c=!t;a(c),c&&m.length===0&&U()},className:"w-full flex items-center gap-2 px-4 py-2.5 bg-slate-900/50 hover:bg-slate-800/50 text-slate-400 text-sm transition-colors",children:[s.jsx(Me,{"code-path":"src/components/system/LdapManagementSection.tsx:148:9",className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),s.jsx(ie,{"code-path":"src/components/system/LdapManagementSection.tsx:149:9",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:150:9",className:"text-slate-300",children:"LDAP 账号管理"})]}),t&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:154:9",className:"bg-slate-900/30 border-t border-slate-800/50 px-4 py-4 space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:155:11",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:E,onOpenChange:X,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:158:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:159:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Qs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:167:19",className:"text-slate-500",children:"输入 LDAP 用户凭据进行认证测试"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:169:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:170:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:171:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:L,onChange:c=>rs(c.target.value),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:179:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:180:21",className:"text-xs text-slate-500 mb-1 block",children:"密码"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:ns,onChange:c=>ds(c.target.value),onKeyDown:c=>c.key==="Enter"&&Q(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),K&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${K.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[K.message,K.user_info&&s.jsx("pre",{"code-path":"src/components/system/LdapManagementSection.tsx:194:25",className:"mt-2 text-xs whitespace-pre-wrap",children:JSON.stringify(K.user_info,null,2)})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:198:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:Q,disabled:ps||!L,children:[ps?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:203:40",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"验证"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:210:13",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",onClick:U,children:[s.jsx(Xs,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Us,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:i,onValueChange:c=>{u(c),h(c)},children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:217:15",className:"w-60 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs",children:s.jsx(Cs,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Ms,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(H,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:d.base_dn,children:["根 (",d.base_dn,")"]}),m.map(c=>s.jsx(H,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:c.dn,children:c.description?`${c.name} (${c.description})`:c.name},c.dn))]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:C,onOpenChange:P,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:232:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:233:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:241:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的组织单元 (OU)"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:243:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:244:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:245:21",className:"text-xs text-slate-500 mb-1 block",children:"OU 名称 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:F.ou_name,onChange:c=>B({...F,ou_name:c.target.value}),placeholder:"dev",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:248:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:249:21",className:"text-xs text-slate-500 mb-1 block",children:"父级 DN"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:F.parent_dn,onChange:c=>B({...F,parent_dn:c.target.value}),placeholder:d.base_dn,className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:252:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:253:21",className:"text-xs text-slate-500 mb-1 block",children:"描述"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:F.description,onChange:c=>B({...F,description:c.target.value}),placeholder:"开发团队",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:256:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:k,disabled:!F.ou_name||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:p,onOpenChange:O,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:266:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:267:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(ke,{"code-path":"src/components/system/LdapManagementSection.tsx:268:19",className:"h-3.5 w-3.5 mr-1"}),"添加用户"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:275:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的用户账号"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:277:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:278:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:279:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:j.username,onChange:c=>_({...j,username:c.target.value}),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:282:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:283:21",className:"text-xs text-slate-500 mb-1 block",children:"密码 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:j.password,onChange:c=>_({...j,password:c.target.value}),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:286:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:287:21",className:"text-xs text-slate-500 mb-1 block",children:"显示名称"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:j.display_name,onChange:c=>_({...j,display_name:c.target.value}),placeholder:"张三",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:290:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:291:21",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:j.email,onChange:c=>_({...j,email:c.target.value}),placeholder:"zs@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:294:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:295:21",className:"text-xs text-slate-500 mb-1 block",children:"目标 OU"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:j.ou_dn||i||d.base_dn,onChange:c=>_({...j,ou_dn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:298:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:G,disabled:!j.username||!j.password||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:299:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:307:13",variant:"outline",size:"sm",className:"border-blue-600/50 text-blue-400 hover:bg-blue-600/10 ml-auto",onClick:D,disabled:T.length===0||b,children:[b?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:314:28",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(de,{"code-path":"src/components/system/LdapManagementSection.tsx:314:84",className:"h-3.5 w-3.5 mr-1"}),N.length>0?`导入 (${N.length})`:`导入全部 (${T.length})`]})]}),S&&s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:y,onOpenChange:R,children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:324:19",className:"text-slate-500",children:"LDAP 用户导入到本地用户库的执行结果"})]}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:326:17",className:"py-3 text-sm text-slate-300",children:S}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:329:17",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>R(!1),children:"确定"})]})}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:337:11",className:"border border-slate-800 rounded-lg overflow-hidden",children:s.jsxs(As,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:341:19",className:"text-slate-400 w-8",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:342:21",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.length>0&&N.length===T.length,onChange:c=>n(c.target.checked?T.map(W=>W.dn):[])})}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:T.length===0?s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:358:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:359:21",colSpan:6,className:"text-center text-slate-500 py-8",children:"点击「刷新」加载 LDAP 用户"})}):T.map(c=>s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:365:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:366:23",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:367:25",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.includes(c.dn),onChange:W=>{W.target.checked?n([...N,c.dn]):n(N.filter(is=>is!==c.dn))}})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:377:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:378:25",className:"text-sm text-slate-200 font-medium",children:c.uid})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:380:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:381:25",className:"text-sm text-slate-300",children:c.cn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:383:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:384:25",className:"text-sm text-slate-400",children:c.mail||"-"})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:386:23",children:s.jsx("code",{"code-path":"src/components/system/LdapManagementSection.tsx:387:25",className:"text-xs text-slate-500",children:c.dn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:389:23",children:s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:390:25",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:391:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400 hover:text-blue-400 hover:bg-blue-500/10",onClick:()=>ks(c),children:s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:397:29",className:"h-3 w-3"})}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:399:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>fs(c.dn),children:s.jsx(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},c.dn))})]})})]}),s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!v,onOpenChange:c=>!c&&Y(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(as,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",v?.uid," 的属性"]})]}),v&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:431:13",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:432:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:433:17",className:"text-xs text-slate-500 mb-1 block",children:"用户名(只读)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:v.uid||"",disabled:!0,className:"bg-slate-800/50 border-slate-700 text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:436:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:437:17",className:"text-xs text-slate-500 mb-1 block",children:"显示名称 (cn)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:r.cn,onChange:c=>z({...r,cn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:440:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:441:17",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:r.mail,onChange:c=>z({...r,mail:c.target.value}),placeholder:"user@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:444:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:445:17",className:"text-xs text-slate-500 mb-1 block",children:"电话"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:r.phone,onChange:c=>z({...r,phone:c.target.value}),placeholder:"13800138000",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:448:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:449:17",className:"text-xs text-slate-500 mb-1 block",children:"职位/头衔"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:r.title,onChange:c=>z({...r,title:c.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapManagementSection.tsx:454:11",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:455:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Y(null),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:456:13",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:os,children:"保存"})]})]})})]})}function Je(e){const{ldapConfig:d,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:i,ldapTestResult:u,handleLdapSave:T,handleLdapTest:N}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:93:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:102:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:103:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:104:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:105:17",className:"text-sm font-medium text-slate-200",children:"强制密码复杂度"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:106:17",className:"text-xs text-slate-500",children:"要求密码包含大小写字母、数字和特殊字符"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:108:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:110:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:111:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:112:17",className:"text-sm font-medium text-slate-200",children:"登录失败锁定"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:113:17",className:"text-xs text-slate-500",children:"连续5次登录失败锁定账户30分钟"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:115:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:117:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:118:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:119:17",className:"text-sm font-medium text-slate-200",children:"双因素认证"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:120:17",className:"text-xs text-slate-500",children:"启用后需要手机验证码登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ie,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:135:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:136:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:137:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:138:17",className:"text-sm font-medium text-slate-200",children:"记录所有操作"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:139:17",className:"text-xs text-slate-500",children:"记录用户的所有操作行为"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:141:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:143:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:144:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:145:17",className:"text-sm font-medium text-slate-200",children:"日志保留时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:146:17",className:"text-xs text-slate-500",children:"操作日志保留180天"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:149:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:171:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:172:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:173:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:174:17",className:"text-sm font-medium text-slate-200",children:"会话超时时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:175:17",className:"text-xs text-slate-500",children:"用户无操作30分钟后自动登出"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:178:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:185:19",value:"120",children:"2小时"})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:189:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:190:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:191:17",className:"text-sm font-medium text-slate-200",children:"单点登录"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:192:17",className:"text-xs text-slate-500",children:"同一账号只能在一个设备登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:201:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(xe,{"code-path":"src/components/system/SystemSettingsTab.tsx:202:15",className:"h-5 w-5 text-purple-400"}),"系统信息"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:207:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:208:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:209:15",className:"text-sm text-slate-400",children:"系统版本"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:210:15",className:"text-sm text-slate-200",children:"v2.5.1"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:212:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:213:15",className:"text-sm text-slate-400",children:"运行时间"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:214:15",className:"text-sm text-slate-200",children:"30天 12小时"})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:222:9",children:s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:223:11",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:224:13",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:233:9",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:234:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:235:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:236:15",className:"text-xs text-slate-500",children:"LDAP 服务器地址"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:n=>a({...t,ldap_host:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ldap.example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:244:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:245:15",className:"text-xs text-slate-500",children:"端口"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:n=>a({...t,ldap_port:Number(n.target.value)}),className:"bg-slate-800/50 border-slate-700 text-slate-200",placeholder:"389"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:254:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:255:15",className:"text-xs text-slate-500",children:"Base DN(用户搜索基础)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:n=>a({...t,base_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ou=users,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:263:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:264:15",className:"text-xs text-slate-500",children:"管理员 Bind DN"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:n=>a({...t,admin_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"cn=admin,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:272:13",className:"space-y-1.5",children:[s.jsxs("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:273:15",className:"text-xs text-slate-500",children:["管理员密码 ",d&&"(留空不修改)"]}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:n=>a({...t,admin_password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"******"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:282:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:283:15",className:"text-xs text-slate-500",children:"搜索过滤器(可选,用 %s 代表用户名)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:n=>a({...t,search_filter:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"(uid=%s)"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:291:13",className:"flex items-center gap-2 col-span-2",children:[s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:n=>a({...t,use_ldaps:n}),className:"data-[state=checked]:bg-blue-600"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:297:15",className:"text-sm text-slate-300",children:"启用 LDAPS(SSL 加密)"})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:302:11",className:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-800",children:[u&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${u.includes("成功")?"text-emerald-400":"text-red-400"}`,children:u}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:308:13",className:"flex items-center gap-2 ml-auto",children:[s.jsxs(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:309:15",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,disabled:i,children:[i?s.jsx(Ns,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:88",className:"h-3.5 w-3.5 mr-1"}),"测试连接"]}),s.jsx(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:319:15",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:T,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),d&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(qe,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Xe(e){const d=Ks(),[t,a]=o.useState([]),[m,i]=o.useState(new Set),[u,T]=o.useState(!1),[N,n]=o.useState([]),[U,h]=o.useState(""),[D,b]=o.useState(null),[S,y]=o.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[R,C]=o.useState(!1),[P,F]=o.useState(!1),[B,k]=o.useState(null),[A,p]=o.useState(!1),[O,j]=o.useState(null),[_,G]=o.useState(!1),[E,X]=o.useState([]),[L,rs]=o.useState(""),[ns,ds]=o.useState([]),[ps,K]=o.useState(!1),[Q,v]=o.useState(!1),[Y,r]=o.useState({ou_name:"",parent_dn:"",description:""}),[z,os]=o.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[fs,ks]=o.useState(!1),[c,W]=o.useState(""),[is,Is]=o.useState(""),[Rs,Ds]=o.useState(!1),[_s,ys]=o.useState(null),[gs,g]=o.useState(null),[ms,Fs]=o.useState({cn:"",mail:"",phone:"",title:""}),[te,zs]=o.useState(!1),ae=async()=>{try{const l=await $.getConfig();l&&l.ldap_host&&(b(l),y({ldap_host:l.ldap_host||"",ldap_port:l.ldap_port||389,use_ldaps:l.use_ldaps||!1,admin_dn:l.admin_dn||"",admin_password:"",base_dn:l.base_dn||"",search_filter:l.search_filter||""}))}catch{}},he=async()=>{C(!0);try{await $.updateConfig(S),await ae()}catch(l){console.error("Failed to save LDAP config:",l)}finally{C(!1)}},ye=async()=>{F(!0),k(null);try{await $.updateConfig(S);const l=await $.testConnection();k(l?.message||(l?.success?"连接成功":"连接失败"))}catch(l){k(l?.message||"连接失败")}finally{F(!1)}},Ls=async l=>{try{const I=await $.listUsers(l);a(I||[])}catch(I){console.error("loadOUUsers",I)}},ce=async()=>{try{const l=await $.listOUs();X(l||[]),!L&&D?.base_dn&&(rs(D.base_dn),await Ls(D.base_dn))}catch(l){console.error("loadOUs",l)}},ge=async()=>{C(!0);try{await $.createOU(Y),K(!1),r({ou_name:"",parent_dn:"",description:""}),await ce()}catch(l){const I=l?.message||"";I.includes("Already Exists")||I.includes("68")?V.error(`OU "${Y.ou_name}" 已存在,请使用其他名称`):V.error("创建失败: "+I)}finally{C(!1)}},be=async()=>{C(!0);try{await $.createUser({...z,ou_dn:z.ou_dn||L||D?.base_dn}),v(!1),os({username:"",password:"",display_name:"",email:"",ou_dn:""}),await Ls(L)}catch(l){V.error(l?.message||"创建失败")}finally{C(!1)}},Se=async(l,I=!1)=>{if(!(!I&&!await d({title:"删除 LDAP 条目",description:`确定删除 ${l}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(l),I||await Ls(L)}catch(Os){I||V.error(Os?.message||"删除失败")}},je=l=>{g(l),Fs({cn:l.cn||"",mail:l.mail||"",phone:l.phone||"",title:l.title||""})},ue=async()=>{if(gs)try{await $.updateUser({dn:gs.dn,...ms}),g(null),await Ls(L)}catch(l){V.error(l?.message||"修改失败")}},Ne=async()=>{Ds(!0),ys(null);try{const l=await $.testConnection({test_user:c,test_password:is});ys(l)}catch(l){ys({success:!1,message:l?.message||"验证失败"})}finally{Ds(!1)}},ne=async l=>{T(!0);try{const I=await $.listUsers(l);a(Array.isArray(I)?I:[]),i(new Set)}catch{a([])}finally{T(!1)}},oe=async()=>{let l=[];if(ns.length>0?l=t.filter(I=>ns.includes(I.dn)):l=t,l.length!==0){zs(!0);try{const I=l.map($s=>({username:$s.uid||"",nickname:$s.cn||"",email:$s.mail||""})),Os=await $.batchImport(I);j(Os?.message||`成功导入 ${l.length} 个用户`),G(!0),ds([]),await e()}catch(I){j("导入失败: "+(I?.message||"未知错误")),G(!0)}finally{zs(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:N,ldapImportOUDN:U,setLdapImportOUDN:h,loadLdapUsers:ne,handleLdapImport:oe,loadImportDialogData:()=>{$.listOUs().then(l=>n(Array.isArray(l)?l:[])).catch(()=>{}),ne("")},importing:te,setImporting:zs,importFeedback:O,importResultOpen:_,setImportResultOpen:G,loadLdapConfig:ae,settingsTabProps:{ldapConfig:D,ldapForm:S,setLdapForm:y,ldapSaving:R,ldapTesting:P,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:A,setLdapMgmtOpen:p,ldapOUs:E,selectedOUDN:L,setSelectedOUDN:rs,ldapUsers:t,selectedLDAPUsers:ns,setSelectedLDAPUsers:ds,loadLdapOUs:ce,loadLdapOUUsers:Ls,handleLdapImport:oe,importing:te,importFeedback:O,importResultOpen:_,setImportResultOpen:G,createOUOpen:ps,setCreateOUOpen:K,ouForm:Y,setOuForm:r,handleCreateOU:ge,createUserOpen:Q,setCreateUserOpen:v,newUser:z,setNewUser:os,handleCreateLDAPUser:be,ldapUserTestOpen:fs,setLdapUserTestOpen:ks,ldapTestUser:c,setLdapTestUser:W,ldapTestPass:is,setLdapTestPass:Is,ldapUserTesting:Rs,ldapUserTestResult:_s,handleLdapUserTest:Ne,editLdapUser:gs,setEditLdapUser:g,editLdapForm:ms,setEditLdapForm:Fs,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function Ye(e){return{...e,status:e.status===1||e.status==="active"?"active":"inactive",roles:Array.isArray(e.roles)?e.roles:e.role?[e.role]:[],lastLoginAt:e.last_login??e.lastLoginAt,createdAt:e.created_at??e.createdAt,authSource:e.auth_source??e.authSource??"local"}}const le={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function yt(){const e=Ks(),d=fe(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=o.useState(t[d.pathname]||"users");o.useEffect(()=>{const r=t[d.pathname];r&&r!==a&&m(r)},[d.pathname]);const[i,u]=o.useState(""),[T,N]=o.useState([]),[n,U]=o.useState(!0),[h,D]=o.useState(null),[b,S]=o.useState(null),[y,R]=o.useState(!1),[C,P]=o.useState(null),[F,B]=o.useState(!1),[k,A]=o.useState({...le}),[p,O]=o.useState(null),[j,_]=o.useState([]),[G,E]=o.useState(null),X=async()=>{U(!0);try{const z=(await q.getUsers({page:1,page_size:100}))?.list??[];N(z.map(Ye))}catch(r){console.error("Failed to fetch users:",r),N([])}finally{U(!1)}},L=Xe(X);o.useEffect(()=>{X(),L.loadLdapConfig()},[]),o.useEffect(()=>{p==="ldap"&&L.loadImportDialogData()},[p]);const rs=T.filter(r=>(r.username||"").toLowerCase().includes(i.toLowerCase())||(r.nickname||"").toLowerCase().includes(i.toLowerCase())||(r.email||"").toLowerCase().includes(i.toLowerCase())),ns=r=>r==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:110:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Ws,{"code-path":"src/components/system/SystemManager.tsx:111:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:115:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:116:9",className:"h-3 w-3 mr-1"}),"禁用"]}),ds=()=>{P(null),A({...le}),R(!0)},ps=r=>{P(r),A({username:r.username||"",nickname:r.nickname||"",email:r.email||"",phone:r.phone||"",role:Array.isArray(r.roles)?r.roles[0]||"":r.role||"",password:"",status:r.status==="active"?1:0}),R(!0)},K=async()=>{B(!0);try{const r={username:k.username,nickname:k.nickname,email:k.email,phone:k.phone,role:k.role,status:k.status};k.password&&(r.password=k.password),C?await q.updateUser(C.id,r):await q.createUser(r),R(!1),await X()}catch(r){console.error("Failed to save user:",r)}finally{B(!1)}},Q=async r=>{if(await e({title:"删除用户",description:`确认删除用户「${r.nickname||r.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await q.deleteUser(r.id),await X()}catch(os){console.error("Failed to delete user:",os)}},v=r=>{const z=r.target.files?.[0];if(!z)return;const os=new FileReader;os.onload=fs=>{const c=(fs.target?.result).split(` +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-800 border-slate-700",children:T.map(n=>s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:n.name,children:n.name},n.id))})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:144:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:145:15",className:"text-xs text-slate-500",children:"状态"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:n=>m({...a,status:Number(n)}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:155:19",value:"0",children:"禁用"})]})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:160:11",className:"space-y-2",children:[s.jsxs("label",{"code-path":"src/components/system/UserFormDialog.tsx:161:13",className:"text-xs text-slate-500",children:["密码",t?"(留空则不修改)":""]}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:n=>m({...a,password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserFormDialog.tsx:174:9",children:[s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:175:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:178:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}function Oe({selectedUser:e,setSelectedUser:d,getUserStatusBadge:t,openEdit:a}){return s.jsx(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:29:5",open:!!e,onOpenChange:()=>d(null),children:s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:30:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserDetailDialog.tsx:31:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserDetailDialog.tsx:32:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserDetailDialog.tsx:33:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(as,{"code-path":"src/components/system/UserDetailDialog.tsx:36:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:41:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:42:11",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-slate-800/50",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:44:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:45:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:47:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:48:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:49:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:51:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:52:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:53:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:55:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:56:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:57:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:59:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:60:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:61:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:63:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:64:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:65:15",className:"text-sm text-slate-200",children:e&&e.createdAt?new Date(e.createdAt).toLocaleDateString():"--"})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:71:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:72:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:73:13",className:"flex flex-wrap gap-2",children:e?.roles.map(m=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:75:17",variant:"outline",className:"border-slate-700 text-slate-400",children:m},m))})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserDetailDialog.tsx:83:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:84:11",variant:"outline",className:"border-slate-700 text-slate-300",children:[s.jsx(Qs,{"code-path":"src/components/system/UserDetailDialog.tsx:85:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:88:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(d(null),a(e))},children:[s.jsx(vs,{"code-path":"src/components/system/UserDetailDialog.tsx:97:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:d,importPreview:t,setImportPreview:a,importing:m,importResult:i,setImportResult:u,handleCsvUpload:T,handleBatchImport:N}){return s.jsx(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:n=>!n&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(ts,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(as,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),i?s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:120:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:121:13",className:`flex items-center gap-3 p-4 rounded-lg ${i.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[i.code===200?s.jsx(Ws,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:125:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/CsvImportDialog.tsx:127:15",className:"text-sm text-slate-200",children:i.message})]}),i.errors?.length>0&&s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:130:15",className:"max-h-32 overflow-auto rounded-lg bg-slate-800/50 p-3 space-y-1",children:i.errors.map((n,U)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:n},U))}),s.jsx(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:136:13",children:s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:137:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),u(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:61:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:62:15",className:"flex items-center gap-2",children:[s.jsxs(x,{"code-path":"src/components/system/CsvImportDialog.tsx:63:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q.downloadTemplate(),children:[s.jsx(de,{"code-path":"src/components/system/CsvImportDialog.tsx:64:19",className:"h-4 w-4 mr-1.5"}),"下载模板"]}),s.jsxs("label",{"code-path":"src/components/system/CsvImportDialog.tsx:67:17",className:"inline-flex items-center px-3 py-1.5 rounded-md text-sm bg-slate-800 border border-slate-700 text-slate-200 cursor-pointer hover:bg-slate-700 transition-colors",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:68:19",className:"h-4 w-4 mr-1.5"}),"选择 CSV 文件",s.jsx("input",{"code-path":"src/components/system/CsvImportDialog.tsx:70:19",type:"file",accept:".csv",className:"hidden",onChange:T})]})]}),t.length>0&&s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:75:17",className:"rounded-lg border border-slate-800 overflow-hidden",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:76:19",className:"px-3 py-2 bg-slate-800/50 text-xs text-slate-400",children:["预览:",t.length," 条数据"]}),s.jsxs(As,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(Ps,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((n,U)=>s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:90:25",className:"border-slate-800",children:[s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:91:27",className:"text-slate-200 text-xs",children:n.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:n.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:n.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:n.phone})]},U)),t.length>5&&s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:98:25",className:"border-slate-800",children:s.jsxs(w,{"code-path":"src/components/system/CsvImportDialog.tsx:99:27",colSpan:4,className:"text-slate-500 text-xs text-center",children:["还有 ",t.length-5," 条..."]})})]})]})]})]}),s.jsxs(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:110:13",children:[s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:111:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:114:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:N,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Pe({importDialogOpen:e,setImportDialogOpen:d,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:T,ldapImportOUDN:N,setLdapImportOUDN:n,loadLdapUsers:U,handleLdapImport:h,importing:D,importResult:b,setImportResult:S}){return s.jsx(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:y=>!y&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(as,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),b?s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:163:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:164:13",className:`flex items-center gap-3 p-4 rounded-lg ${b.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[b.code===200?s.jsx(Ws,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:168:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:170:15",className:"text-sm text-slate-200",children:b.message})]}),s.jsx(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:172:13",children:s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:173:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),S(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:72:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:73:15",className:"flex items-center gap-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:74:17",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:75:19",className:"text-xs text-slate-500 whitespace-nowrap",children:"选择 OU"}),s.jsxs("select",{"code-path":"src/components/system/LdapImportDialog.tsx:76:19",className:"bg-slate-800 border border-slate-700 text-slate-200 text-xs rounded-md px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",value:N,onChange:y=>{n(y.target.value),U(y.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),T.map(y=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:y.dn,children:y.name},y.dn))]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapImportDialog.tsx:90:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300 ml-auto",onClick:()=>U(N),disabled:u,children:[u?s.jsx(Ns,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:91:88",className:"h-4 w-4 mr-1.5"}),"刷新"]})]}),s.jsx("p",{"code-path":"src/components/system/LdapImportDialog.tsx:96:15",className:"text-xs text-slate-500",children:t.length>0?`找到 ${t.length} 个用户`:"选择 OU 或点击刷新获取用户列表"}),t.length>0&&s.jsx("div",{"code-path":"src/components/system/LdapImportDialog.tsx:101:17",className:"max-h-80 overflow-auto rounded-lg border border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:105:25",className:"w-10 text-slate-400 text-xs",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:106:27",type:"checkbox",className:"accent-blue-600",checked:m.size===t.length&&t.length>0,onChange:y=>{y.target.checked?i(new Set(t.map(R=>R.dn))):i(new Set)}})}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(y=>s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:127:25",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:128:27",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:129:29",type:"checkbox",className:"accent-blue-600",checked:m.has(y.dn),onChange:R=>{const C=new Set(m);R.target.checked?C.add(y.dn):C.delete(y.dn),i(C)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:y.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:y.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:y.mail}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:144:27",className:"text-slate-500 text-xs font-mono truncate max-w-[200px]",children:y.dn})]},y.dn))})]})})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:153:13",children:[s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:154:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:157:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:h,disabled:D||m.size===0,children:D?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function Ee({searchQuery:e,setSearchQuery:d,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,dialogOpen:T,setDialogOpen:N,editingUser:n,form:U,setForm:h,saving:D,handleSubmit:b,openCreate:S,openEdit:y,handleDelete:R,importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j,ldapUsers:_,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,setLdapUsers:K}){const{hasPermission:Q}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:116:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:117:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:118:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(f,{"code-path":"src/components/system/SystemUserTab.tsx:119:11",placeholder:"搜索用户...",value:e,onChange:v=>d(v.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:126:9",className:"flex items-center gap-2",children:[Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:128:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("csv"),children:[s.jsx(Gs,{"code-path":"src/components/system/SystemUserTab.tsx:129:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("ldap"),children:[s.jsx(Js,{"code-path":"src/components/system/SystemUserTab.tsx:135:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:140:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:S,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemUserTab.tsx:141:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(xs,{"code-path":"src/components/system/SystemUserTab.tsx:149:7",className:"bg-slate-900 border-slate-800",children:s.jsx(hs,{"code-path":"src/components/system/SystemUserTab.tsx:150:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:151:11",className:"border-t border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/SystemUserTab.tsx:152:13",children:[s.jsx(Ps,{"code-path":"src/components/system/SystemUserTab.tsx:153:15",children:s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:154:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:155:19",className:"text-slate-400",children:"用户信息"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:156:19",className:"text-slate-400",children:"联系方式"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"角色"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"来源"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"状态"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"最后登录"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/SystemUserTab.tsx:164:15",children:a?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:166:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:167:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:168:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:169:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:174:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:175:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(v=>s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:181:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:182:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:183:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:184:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(v.nickname||v.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:187:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:188:29",className:"text-sm font-medium text-slate-200",children:v.nickname||v.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:189:29",className:"text-xs text-slate-500",children:["@",v.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:193:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:194:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:195:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:196:29",className:"h-3.5 w-3.5"}),v.email||"--"]}),v.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:200:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:201:31",className:"h-3.5 w-3.5"}),v.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:207:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:208:25",className:"flex flex-wrap gap-1",children:(v.roles||[]).map(Y=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:210:29",variant:"outline",className:"border-slate-700 text-slate-400",children:Y},Y))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:216:23",children:v.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:218:27",variant:"outline",className:"border-cyan-500/30 text-cyan-400 bg-cyan-500/10",children:"LDAP"}):s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:222:27",variant:"outline",className:"border-slate-600/30 text-slate-400 bg-slate-600/10",children:"本地"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:227:23",children:u(v.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:228:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:229:25",className:"text-sm text-slate-400",children:v.lastLoginAt?new Date(v.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:233:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:234:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:235:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>i(v),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:241:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:244:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>y(v),children:s.jsx(vs,{"code-path":"src/components/system/SystemUserTab.tsx:250:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:254:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>R(v),children:s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:260:29",className:"h-4 w-4"})})]})})]},v.id))})]})})})}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:275:7",selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,openEdit:y}),s.jsx(Fe,{"code-path":"src/components/system/SystemUserTab.tsx:282:7",open:T,onOpenChange:N,editingUser:n,form:U,setForm:h,saving:D,onSubmit:b}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:292:7",importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:304:7",importDialogOpen:C,setImportDialogOpen:P,ldapUsers:_,setLdapUsers:K,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,importing:k,importResult:A,setImportResult:p})]})}const ze=[{key:"dashboard",label:"📊 仪表盘",prefixes:["dashboard:"]},{key:"server",label:"🖥️ 资产管理",prefixes:["server:"]},{key:"cloud",label:"☁️ 云资源",prefixes:["cloud:"]},{key:"k8s",label:"☸️ Kubernetes",prefixes:["k8s:"]},{key:"deploy",label:"🚀 应用发布",prefixes:["deploy:"]},{key:"monitor",label:"📡 监控告警",prefixes:["monitor:","agent:"]},{key:"auto",label:"⚙️ 自动化运维",prefixes:["auto:"]},{key:"aiops",label:"🤖 AIOps智能",prefixes:["aiops:"]},{key:"approval",label:"✅ 资源申请",prefixes:["approval:"]},{key:"audit",label:"🔍 安全审计",prefixes:["audit:"]},{key:"system",label:"🔧 系统管理",prefixes:["system:"]}];function $e(e){const d=ze.map(m=>({key:m.key,label:m.label,items:e.filter(i=>m.prefixes.some(u=>i.code.startsWith(u)))})).filter(m=>m.items.length>0),t=new Set(d.flatMap(m=>m.items.map(i=>i.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&d.push({key:"other",label:"📌 其他",items:a}),d}function Be({open:e,onOpenChange:d,editingRole:t,form:a,setForm:m,saving:i,onSubmit:u,permissions:T}){const N=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return D?S.add(h):S.delete(h),{...b,permission_ids:Array.from(S)}})},n=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return h.forEach(y=>D?S.add(y.id):S.delete(y.id)),{...b,permission_ids:Array.from(S)}})},U=$e(T);return s.jsx(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/RoleFormDialog.tsx:92:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(es,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(ts,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(se,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(as,{"code-path":"src/components/system/RoleFormDialog.tsx:98:11",className:"text-[var(--dg-text-secondary)]",children:t?"修改角色信息与权限":"创建新的系统角色并分配权限"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:103:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:104:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:105:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:107:15",value:a.name,onChange:h=>m({...a,name:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]",placeholder:"如:运维工程师"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:114:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:116:15",value:a.code,onChange:h=>m({...a,code:h.target.value}),disabled:!!t,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] disabled:opacity-60",placeholder:"如:ops_engineer"})]})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:125:11",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Re,{"code-path":"src/components/system/RoleFormDialog.tsx:127:13",value:a.description,onChange:h=>m({...a,description:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] resize-none",placeholder:"角色职责描述(可选)",rows:2})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:137:11",className:"space-y-2",children:[s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:138:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["权限分配",a.permission_ids.length>0&&s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:141:17",className:"ml-2 text-purple-400",children:["已选 ",a.permission_ids.length," 项"]})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:144:13",className:"max-h-[40vh] overflow-y-auto rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)] p-3 space-y-3",children:U.length===0?s.jsx("p",{"code-path":"src/components/system/RoleFormDialog.tsx:146:17",className:"text-xs text-[var(--dg-text-muted)] text-center py-4",children:"暂无可分配权限"}):U.map(h=>{const D=h.items.filter(S=>a.permission_ids.includes(S.id)).length,b=D===h.items.length&&h.items.length>0;return s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:152:21",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:153:23",className:"flex items-center justify-between mb-1.5",children:[s.jsxs("button",{"code-path":"src/components/system/RoleFormDialog.tsx:154:25",onClick:()=>n(h.items,!b),className:"text-xs font-medium text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1",children:[h.label,s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:159:27",className:"text-[var(--dg-text-muted)] text-[10px]",children:["(",D,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>n(h.items,!b),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:b?"取消全选":"全选"})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:170:23",className:"grid grid-cols-2 gap-x-3 gap-y-1 pl-1",children:h.items.map(S=>s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:172:27",className:"flex items-center gap-2 text-xs text-[var(--dg-text-secondary)] font-normal cursor-pointer hover:text-[var(--dg-text-primary)] py-0.5",children:[s.jsx(_e,{"code-path":"src/components/system/RoleFormDialog.tsx:176:29",checked:a.permission_ids.includes(S.id),onCheckedChange:y=>N(S.id,y===!0),className:"border-[var(--dg-border)] data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 h-3.5 w-3.5"}),s.jsx("span",{"code-path":"src/components/system/RoleFormDialog.tsx:181:29",className:"truncate",children:S.name})]},S.id))})]},h.key)})})]})]}),s.jsxs(ls,{"code-path":"src/components/system/RoleFormDialog.tsx:193:9",children:[s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:194:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:197:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}const Ve={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},He=[{label:"仪表盘",prefixes:["dashboard:"]},{label:"资产管理",prefixes:["server:"]},{label:"云资源",prefixes:["cloud:"]},{label:"K8s",prefixes:["k8s:"]},{label:"发布",prefixes:["deploy:"]},{label:"监控",prefixes:["monitor:","agent:"]},{label:"自动化",prefixes:["auto:"]},{label:"AI",prefixes:["aiops:"]},{label:"审批",prefixes:["approval:"]},{label:"审计",prefixes:["audit:"]},{label:"系统",prefixes:["system:"]}];function Ge(e,d){return He.map(a=>{const m=e.filter((i,u)=>a.prefixes.some(T=>(d[u]||"").startsWith(T)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Ke(e){const d=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:d.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:d.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:d.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function Qe({selectedRole:e,setSelectedRole:d}){const t=Ks(),[a,m]=o.useState([]),[i,u]=o.useState(!0),[T,N]=o.useState([]),[n,U]=o.useState(!1),[h,D]=o.useState(null),[b,S]=o.useState({...me}),[y,R]=o.useState(!1),C=o.useCallback(async()=>{u(!0);try{const O=(await q.getRoles())?.list??[];m(O.map(Ke))}catch{m([])}finally{u(!1)}},[]),P=o.useCallback(async()=>{try{const O=(await q.getPermissions())?.list??[];N(O.map(j=>({id:Number(j.id),name:j.name??j.code??"",code:j.code??"",type:j.type})))}catch{N([])}},[]);o.useEffect(()=>{C(),P()},[C,P]);const F=()=>{D(null),S({...me}),U(!0)},B=p=>{D(p._raw||p),S({name:p.name??"",code:p.code??"",description:p.description??"",permission_ids:Array.isArray(p._permissionIds)?[...p._permissionIds]:[]}),U(!0)},k=async()=>{if(!b.name.trim()){V.error("请输入角色名称");return}if(!b.code.trim()){V.error("请输入角色编码");return}R(!0);try{const p={name:b.name.trim(),code:b.code.trim(),description:b.description.trim(),permission_ids:b.permission_ids};h?(await q.updateRole(h.id,p),V.success("角色更新成功")):(await q.createRole(p),V.success("角色创建成功")),U(!1),await C()}catch(p){V.error(p?.message||"保存失败")}finally{R(!1)}},A=async p=>{if(p.isSystem){V.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${p.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await q.deleteRole(p.id),V.success("角色已删除"),await C()}catch(j){const _=j?.response?.data?.message||j?.message||"删除失败";V.error(_)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:187:7",className:"flex items-center justify-end gap-2",children:[s.jsxs("span",{"code-path":"src/components/system/SystemRolesTab.tsx:188:9",className:"text-xs text-[var(--dg-text-muted)]",children:[a.length," 个角色"]}),s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:189:9",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:F,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),i?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:195:9",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:196:11",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:199:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:200:11",className:"h-10 w-10 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:201:11",className:"text-sm",children:"暂无角色数据"})]}):s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:204:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:a.map(p=>{const O=p.permissions,j=p.permissionCodes,_=Ge(O,j),G=Ve[p.code]||"🛡️";return s.jsxs(xs,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${p.isSystem?"border-purple-500/20":""}`,children:[s.jsx(Ss,{"code-path":"src/components/system/SystemRolesTab.tsx:212:17",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:213:19",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:214:21",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:215:23",className:`w-10 h-10 rounded-lg flex items-center justify-center text-lg ${p.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:G}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(js,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[p.name,p.isSystem&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:224:29",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px] px-1 py-0",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(us,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:p.code})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:232:21",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:233:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>d(p),children:s.jsx(pe,{"code-path":"src/components/system/SystemRolesTab.tsx:238:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:240:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-blue-400",onClick:()=>B(p),children:s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:245:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:247:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-red-400",onClick:()=>A(p),disabled:p.isSystem,title:p.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${p.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(hs,{"code-path":"src/components/system/SystemRolesTab.tsx:259:17",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:260:19",className:"text-sm text-[var(--dg-text-secondary)] mb-3",children:p.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(E=>s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:264:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] text-[10px]",children:[E.label,"·",E.count]},E.label))}),O.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},p.id)})}),s.jsx(We,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>d(null),onEdit:p=>{d(null),B(p)}}),s.jsx(Be,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:n,onOpenChange:U,editingRole:h,form:b,setForm:S,saving:y,onSubmit:k,permissions:T})]})}function We({role:e,onClose:d,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(Z,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:i=>!i&&d(),children:s.jsxs(ss,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(es,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(ts,{"code-path":"src/components/system/SystemRolesTab.tsx:302:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Ce,{"code-path":"src/components/system/SystemRolesTab.tsx:303:13",className:"h-5 w-5 text-purple-400"}),e?.name,m&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:306:15",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px]",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(as,{"code-path":"src/components/system/SystemRolesTab.tsx:311:11",className:"text-[var(--dg-text-muted)]",children:["编码:",e?.code]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:313:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:314:11",className:"rounded-lg bg-[var(--dg-bg-tertiary)] p-4",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:315:13",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:"描述"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:316:13",className:"text-sm text-[var(--dg-text-primary)]",children:e?.description||"暂无描述"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:318:11",children:[s.jsxs("h4",{"code-path":"src/components/system/SystemRolesTab.tsx:319:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:["权限列表 (",e?.permissions?.length||0," 项)"]}),e&&e.permissions.length>0?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:323:15",className:"flex flex-wrap gap-2 max-h-60 overflow-y-auto",children:e.permissions.map((i,u)=>s.jsx(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:325:19",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:i},u))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(ls,{"code-path":"src/components/system/SystemRolesTab.tsx:335:9",children:s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:336:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>e&&t(e),children:[s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function qe(e){const{ldapConfig:d,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:i,setSelectedOUDN:u,ldapUsers:T,selectedLDAPUsers:N,setSelectedLDAPUsers:n,loadLdapOUs:U,loadLdapOUUsers:h,handleLdapImport:D,importing:b,importFeedback:S,importResultOpen:y,setImportResultOpen:R,createOUOpen:C,setCreateOUOpen:P,ouForm:F,setOuForm:B,handleCreateOU:k,ldapSaving:A,createUserOpen:p,setCreateUserOpen:O,newUser:j,setNewUser:_,handleCreateLDAPUser:G,ldapUserTestOpen:E,setLdapUserTestOpen:X,ldapTestUser:L,setLdapTestUser:rs,ldapTestPass:ns,setLdapTestPass:ds,ldapUserTesting:ps,ldapUserTestResult:K,handleLdapUserTest:Q,editLdapUser:v,setEditLdapUser:Y,editLdapForm:r,setEditLdapForm:z,handleUpdateLdapUser:os,handleDeleteLDAPEntry:fs,openEditLdapUser:ks}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const c=!t;a(c),c&&m.length===0&&U()},className:"w-full flex items-center gap-2 px-4 py-2.5 bg-slate-900/50 hover:bg-slate-800/50 text-slate-400 text-sm transition-colors",children:[s.jsx(Me,{"code-path":"src/components/system/LdapManagementSection.tsx:148:9",className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),s.jsx(ie,{"code-path":"src/components/system/LdapManagementSection.tsx:149:9",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:150:9",className:"text-slate-300",children:"LDAP 账号管理"})]}),t&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:154:9",className:"bg-slate-900/30 border-t border-slate-800/50 px-4 py-4 space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:155:11",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:E,onOpenChange:X,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:158:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:159:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Qs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:167:19",className:"text-slate-500",children:"输入 LDAP 用户凭据进行认证测试"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:169:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:170:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:171:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:L,onChange:c=>rs(c.target.value),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:179:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:180:21",className:"text-xs text-slate-500 mb-1 block",children:"密码"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:ns,onChange:c=>ds(c.target.value),onKeyDown:c=>c.key==="Enter"&&Q(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),K&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${K.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[K.message,K.user_info&&s.jsx("pre",{"code-path":"src/components/system/LdapManagementSection.tsx:194:25",className:"mt-2 text-xs whitespace-pre-wrap",children:JSON.stringify(K.user_info,null,2)})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:198:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:Q,disabled:ps||!L,children:[ps?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:203:40",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"验证"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:210:13",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",onClick:U,children:[s.jsx(Xs,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Us,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:i,onValueChange:c=>{u(c),h(c)},children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:217:15",className:"w-60 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs",children:s.jsx(Cs,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Ms,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(H,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:d.base_dn,children:["根 (",d.base_dn,")"]}),m.map(c=>s.jsx(H,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:c.dn,children:c.description?`${c.name} (${c.description})`:c.name},c.dn))]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:C,onOpenChange:P,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:232:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:233:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:241:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的组织单元 (OU)"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:243:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:244:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:245:21",className:"text-xs text-slate-500 mb-1 block",children:"OU 名称 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:F.ou_name,onChange:c=>B({...F,ou_name:c.target.value}),placeholder:"dev",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:248:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:249:21",className:"text-xs text-slate-500 mb-1 block",children:"父级 DN"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:F.parent_dn,onChange:c=>B({...F,parent_dn:c.target.value}),placeholder:d.base_dn,className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:252:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:253:21",className:"text-xs text-slate-500 mb-1 block",children:"描述"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:F.description,onChange:c=>B({...F,description:c.target.value}),placeholder:"开发团队",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:256:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:k,disabled:!F.ou_name||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:p,onOpenChange:O,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:266:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:267:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(ke,{"code-path":"src/components/system/LdapManagementSection.tsx:268:19",className:"h-3.5 w-3.5 mr-1"}),"添加用户"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:275:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的用户账号"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:277:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:278:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:279:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:j.username,onChange:c=>_({...j,username:c.target.value}),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:282:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:283:21",className:"text-xs text-slate-500 mb-1 block",children:"密码 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:j.password,onChange:c=>_({...j,password:c.target.value}),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:286:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:287:21",className:"text-xs text-slate-500 mb-1 block",children:"显示名称"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:j.display_name,onChange:c=>_({...j,display_name:c.target.value}),placeholder:"张三",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:290:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:291:21",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:j.email,onChange:c=>_({...j,email:c.target.value}),placeholder:"zs@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:294:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:295:21",className:"text-xs text-slate-500 mb-1 block",children:"目标 OU"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:j.ou_dn||i||d.base_dn,onChange:c=>_({...j,ou_dn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:298:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:G,disabled:!j.username||!j.password||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:299:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:307:13",variant:"outline",size:"sm",className:"border-blue-600/50 text-blue-400 hover:bg-blue-600/10 ml-auto",onClick:D,disabled:T.length===0||b,children:[b?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:314:28",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(de,{"code-path":"src/components/system/LdapManagementSection.tsx:314:84",className:"h-3.5 w-3.5 mr-1"}),N.length>0?`导入 (${N.length})`:`导入全部 (${T.length})`]})]}),S&&s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:y,onOpenChange:R,children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:324:19",className:"text-slate-500",children:"LDAP 用户导入到本地用户库的执行结果"})]}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:326:17",className:"py-3 text-sm text-slate-300",children:S}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:329:17",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>R(!1),children:"确定"})]})}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:337:11",className:"border border-slate-800 rounded-lg overflow-hidden",children:s.jsxs(As,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:341:19",className:"text-slate-400 w-8",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:342:21",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.length>0&&N.length===T.length,onChange:c=>n(c.target.checked?T.map(W=>W.dn):[])})}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:T.length===0?s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:358:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:359:21",colSpan:6,className:"text-center text-slate-500 py-8",children:"点击「刷新」加载 LDAP 用户"})}):T.map(c=>s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:365:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:366:23",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:367:25",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.includes(c.dn),onChange:W=>{W.target.checked?n([...N,c.dn]):n(N.filter(is=>is!==c.dn))}})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:377:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:378:25",className:"text-sm text-slate-200 font-medium",children:c.uid})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:380:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:381:25",className:"text-sm text-slate-300",children:c.cn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:383:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:384:25",className:"text-sm text-slate-400",children:c.mail||"-"})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:386:23",children:s.jsx("code",{"code-path":"src/components/system/LdapManagementSection.tsx:387:25",className:"text-xs text-slate-500",children:c.dn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:389:23",children:s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:390:25",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:391:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400 hover:text-blue-400 hover:bg-blue-500/10",onClick:()=>ks(c),children:s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:397:29",className:"h-3 w-3"})}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:399:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>fs(c.dn),children:s.jsx(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},c.dn))})]})})]}),s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!v,onOpenChange:c=>!c&&Y(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(as,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",v?.uid," 的属性"]})]}),v&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:431:13",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:432:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:433:17",className:"text-xs text-slate-500 mb-1 block",children:"用户名(只读)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:v.uid||"",disabled:!0,className:"bg-slate-800/50 border-slate-700 text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:436:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:437:17",className:"text-xs text-slate-500 mb-1 block",children:"显示名称 (cn)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:r.cn,onChange:c=>z({...r,cn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:440:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:441:17",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:r.mail,onChange:c=>z({...r,mail:c.target.value}),placeholder:"user@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:444:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:445:17",className:"text-xs text-slate-500 mb-1 block",children:"电话"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:r.phone,onChange:c=>z({...r,phone:c.target.value}),placeholder:"13800138000",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:448:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:449:17",className:"text-xs text-slate-500 mb-1 block",children:"职位/头衔"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:r.title,onChange:c=>z({...r,title:c.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapManagementSection.tsx:454:11",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:455:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Y(null),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:456:13",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:os,children:"保存"})]})]})})]})}function Je(e){const{ldapConfig:d,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:i,ldapTestResult:u,handleLdapSave:T,handleLdapTest:N}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:93:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:102:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:103:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:104:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:105:17",className:"text-sm font-medium text-slate-200",children:"强制密码复杂度"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:106:17",className:"text-xs text-slate-500",children:"要求密码包含大小写字母、数字和特殊字符"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:108:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:110:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:111:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:112:17",className:"text-sm font-medium text-slate-200",children:"登录失败锁定"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:113:17",className:"text-xs text-slate-500",children:"连续5次登录失败锁定账户30分钟"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:115:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:117:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:118:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:119:17",className:"text-sm font-medium text-slate-200",children:"双因素认证"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:120:17",className:"text-xs text-slate-500",children:"启用后需要手机验证码登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ie,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:135:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:136:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:137:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:138:17",className:"text-sm font-medium text-slate-200",children:"记录所有操作"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:139:17",className:"text-xs text-slate-500",children:"记录用户的所有操作行为"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:141:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:143:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:144:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:145:17",className:"text-sm font-medium text-slate-200",children:"日志保留时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:146:17",className:"text-xs text-slate-500",children:"操作日志保留180天"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:149:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:171:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:172:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:173:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:174:17",className:"text-sm font-medium text-slate-200",children:"会话超时时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:175:17",className:"text-xs text-slate-500",children:"用户无操作30分钟后自动登出"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:178:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:185:19",value:"120",children:"2小时"})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:189:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:190:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:191:17",className:"text-sm font-medium text-slate-200",children:"单点登录"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:192:17",className:"text-xs text-slate-500",children:"同一账号只能在一个设备登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:201:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(xe,{"code-path":"src/components/system/SystemSettingsTab.tsx:202:15",className:"h-5 w-5 text-purple-400"}),"系统信息"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:207:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:208:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:209:15",className:"text-sm text-slate-400",children:"系统版本"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:210:15",className:"text-sm text-slate-200",children:"v2.5.1"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:212:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:213:15",className:"text-sm text-slate-400",children:"运行时间"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:214:15",className:"text-sm text-slate-200",children:"30天 12小时"})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:222:9",children:s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:223:11",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:224:13",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:233:9",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:234:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:235:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:236:15",className:"text-xs text-slate-500",children:"LDAP 服务器地址"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:n=>a({...t,ldap_host:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ldap.example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:244:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:245:15",className:"text-xs text-slate-500",children:"端口"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:n=>a({...t,ldap_port:Number(n.target.value)}),className:"bg-slate-800/50 border-slate-700 text-slate-200",placeholder:"389"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:254:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:255:15",className:"text-xs text-slate-500",children:"Base DN(用户搜索基础)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:n=>a({...t,base_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ou=users,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:263:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:264:15",className:"text-xs text-slate-500",children:"管理员 Bind DN"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:n=>a({...t,admin_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"cn=admin,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:272:13",className:"space-y-1.5",children:[s.jsxs("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:273:15",className:"text-xs text-slate-500",children:["管理员密码 ",d&&"(留空不修改)"]}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:n=>a({...t,admin_password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"******"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:282:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:283:15",className:"text-xs text-slate-500",children:"搜索过滤器(可选,用 %s 代表用户名)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:n=>a({...t,search_filter:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"(uid=%s)"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:291:13",className:"flex items-center gap-2 col-span-2",children:[s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:n=>a({...t,use_ldaps:n}),className:"data-[state=checked]:bg-blue-600"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:297:15",className:"text-sm text-slate-300",children:"启用 LDAPS(SSL 加密)"})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:302:11",className:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-800",children:[u&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${u.includes("成功")?"text-emerald-400":"text-red-400"}`,children:u}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:308:13",className:"flex items-center gap-2 ml-auto",children:[s.jsxs(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:309:15",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,disabled:i,children:[i?s.jsx(Ns,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:88",className:"h-3.5 w-3.5 mr-1"}),"测试连接"]}),s.jsx(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:319:15",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:T,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),d&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(qe,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Xe(e){const d=Ks(),[t,a]=o.useState([]),[m,i]=o.useState(new Set),[u,T]=o.useState(!1),[N,n]=o.useState([]),[U,h]=o.useState(""),[D,b]=o.useState(null),[S,y]=o.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[R,C]=o.useState(!1),[P,F]=o.useState(!1),[B,k]=o.useState(null),[A,p]=o.useState(!1),[O,j]=o.useState(null),[_,G]=o.useState(!1),[E,X]=o.useState([]),[L,rs]=o.useState(""),[ns,ds]=o.useState([]),[ps,K]=o.useState(!1),[Q,v]=o.useState(!1),[Y,r]=o.useState({ou_name:"",parent_dn:"",description:""}),[z,os]=o.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[fs,ks]=o.useState(!1),[c,W]=o.useState(""),[is,Is]=o.useState(""),[Rs,Ds]=o.useState(!1),[_s,ys]=o.useState(null),[gs,g]=o.useState(null),[ms,Fs]=o.useState({cn:"",mail:"",phone:"",title:""}),[te,zs]=o.useState(!1),ae=async()=>{try{const l=await $.getConfig();l&&l.ldap_host&&(b(l),y({ldap_host:l.ldap_host||"",ldap_port:l.ldap_port||389,use_ldaps:l.use_ldaps||!1,admin_dn:l.admin_dn||"",admin_password:"",base_dn:l.base_dn||"",search_filter:l.search_filter||""}))}catch{}},he=async()=>{C(!0);try{await $.updateConfig(S),await ae()}catch(l){console.error("Failed to save LDAP config:",l)}finally{C(!1)}},ye=async()=>{F(!0),k(null);try{await $.updateConfig(S);const l=await $.testConnection();k(l?.message||(l?.success?"连接成功":"连接失败"))}catch(l){k(l?.message||"连接失败")}finally{F(!1)}},Ls=async l=>{try{const I=await $.listUsers(l);a(I||[])}catch(I){console.error("loadOUUsers",I)}},ce=async()=>{try{const l=await $.listOUs();X(l||[]),!L&&D?.base_dn&&(rs(D.base_dn),await Ls(D.base_dn))}catch(l){console.error("loadOUs",l)}},ge=async()=>{C(!0);try{await $.createOU(Y),K(!1),r({ou_name:"",parent_dn:"",description:""}),await ce()}catch(l){const I=l?.message||"";I.includes("Already Exists")||I.includes("68")?V.error(`OU "${Y.ou_name}" 已存在,请使用其他名称`):V.error("创建失败: "+I)}finally{C(!1)}},be=async()=>{C(!0);try{await $.createUser({...z,ou_dn:z.ou_dn||L||D?.base_dn}),v(!1),os({username:"",password:"",display_name:"",email:"",ou_dn:""}),await Ls(L)}catch(l){V.error(l?.message||"创建失败")}finally{C(!1)}},Se=async(l,I=!1)=>{if(!(!I&&!await d({title:"删除 LDAP 条目",description:`确定删除 ${l}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(l),I||await Ls(L)}catch(Os){I||V.error(Os?.message||"删除失败")}},je=l=>{g(l),Fs({cn:l.cn||"",mail:l.mail||"",phone:l.phone||"",title:l.title||""})},ue=async()=>{if(gs)try{await $.updateUser({dn:gs.dn,...ms}),g(null),await Ls(L)}catch(l){V.error(l?.message||"修改失败")}},Ne=async()=>{Ds(!0),ys(null);try{const l=await $.testConnection({test_user:c,test_password:is});ys(l)}catch(l){ys({success:!1,message:l?.message||"验证失败"})}finally{Ds(!1)}},ne=async l=>{T(!0);try{const I=await $.listUsers(l);a(Array.isArray(I)?I:[]),i(new Set)}catch{a([])}finally{T(!1)}},oe=async()=>{let l=[];if(ns.length>0?l=t.filter(I=>ns.includes(I.dn)):l=t,l.length!==0){zs(!0);try{const I=l.map($s=>({username:$s.uid||"",nickname:$s.cn||"",email:$s.mail||""})),Os=await $.batchImport(I);j(Os?.message||`成功导入 ${l.length} 个用户`),G(!0),ds([]),await e()}catch(I){j("导入失败: "+(I?.message||"未知错误")),G(!0)}finally{zs(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:N,ldapImportOUDN:U,setLdapImportOUDN:h,loadLdapUsers:ne,handleLdapImport:oe,loadImportDialogData:()=>{$.listOUs().then(l=>n(Array.isArray(l)?l:[])).catch(()=>{}),ne("")},importing:te,setImporting:zs,importFeedback:O,importResultOpen:_,setImportResultOpen:G,loadLdapConfig:ae,settingsTabProps:{ldapConfig:D,ldapForm:S,setLdapForm:y,ldapSaving:R,ldapTesting:P,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:A,setLdapMgmtOpen:p,ldapOUs:E,selectedOUDN:L,setSelectedOUDN:rs,ldapUsers:t,selectedLDAPUsers:ns,setSelectedLDAPUsers:ds,loadLdapOUs:ce,loadLdapOUUsers:Ls,handleLdapImport:oe,importing:te,importFeedback:O,importResultOpen:_,setImportResultOpen:G,createOUOpen:ps,setCreateOUOpen:K,ouForm:Y,setOuForm:r,handleCreateOU:ge,createUserOpen:Q,setCreateUserOpen:v,newUser:z,setNewUser:os,handleCreateLDAPUser:be,ldapUserTestOpen:fs,setLdapUserTestOpen:ks,ldapTestUser:c,setLdapTestUser:W,ldapTestPass:is,setLdapTestPass:Is,ldapUserTesting:Rs,ldapUserTestResult:_s,handleLdapUserTest:Ne,editLdapUser:gs,setEditLdapUser:g,editLdapForm:ms,setEditLdapForm:Fs,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function Ye(e){return{...e,status:e.status===1||e.status==="active"?"active":"inactive",roles:Array.isArray(e.roles)?e.roles:e.role?[e.role]:[],lastLoginAt:e.last_login??e.lastLoginAt,createdAt:e.created_at??e.createdAt,authSource:e.auth_source??e.authSource??"local"}}const le={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function yt(){const e=Ks(),d=fe(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=o.useState(t[d.pathname]||"users");o.useEffect(()=>{const r=t[d.pathname];r&&r!==a&&m(r)},[d.pathname]);const[i,u]=o.useState(""),[T,N]=o.useState([]),[n,U]=o.useState(!0),[h,D]=o.useState(null),[b,S]=o.useState(null),[y,R]=o.useState(!1),[C,P]=o.useState(null),[F,B]=o.useState(!1),[k,A]=o.useState({...le}),[p,O]=o.useState(null),[j,_]=o.useState([]),[G,E]=o.useState(null),X=async()=>{U(!0);try{const z=(await q.getUsers({page:1,page_size:100}))?.list??[];N(z.map(Ye))}catch(r){console.error("Failed to fetch users:",r),N([])}finally{U(!1)}},L=Xe(X);o.useEffect(()=>{X(),L.loadLdapConfig()},[]),o.useEffect(()=>{p==="ldap"&&L.loadImportDialogData()},[p]);const rs=T.filter(r=>(r.username||"").toLowerCase().includes(i.toLowerCase())||(r.nickname||"").toLowerCase().includes(i.toLowerCase())||(r.email||"").toLowerCase().includes(i.toLowerCase())),ns=r=>r==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:110:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Ws,{"code-path":"src/components/system/SystemManager.tsx:111:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:115:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:116:9",className:"h-3 w-3 mr-1"}),"禁用"]}),ds=()=>{P(null),A({...le}),R(!0)},ps=r=>{P(r),A({username:r.username||"",nickname:r.nickname||"",email:r.email||"",phone:r.phone||"",role:Array.isArray(r.roles)?r.roles[0]||"":r.role||"",password:"",status:r.status==="active"?1:0}),R(!0)},K=async()=>{B(!0);try{const r={username:k.username,nickname:k.nickname,email:k.email,phone:k.phone,role:k.role,status:k.status};k.password&&(r.password=k.password),C?await q.updateUser(C.id,r):await q.createUser(r),R(!1),await X()}catch(r){console.error("Failed to save user:",r)}finally{B(!1)}},Q=async r=>{if(await e({title:"删除用户",description:`确认删除用户「${r.nickname||r.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await q.deleteUser(r.id),await X()}catch(os){console.error("Failed to delete user:",os)}},v=r=>{const z=r.target.files?.[0];if(!z)return;const os=new FileReader;os.onload=fs=>{const c=(fs.target?.result).split(` `).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;gFs.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}; diff --git a/backend/static/assets/TerminalAuditTab-BzRHQUT2.js b/backend/static/assets/TerminalAuditTab-D4-qFyPi.js similarity index 98% rename from backend/static/assets/TerminalAuditTab-BzRHQUT2.js rename to backend/static/assets/TerminalAuditTab-D4-qFyPi.js index 2026ace..240c31a 100644 --- a/backend/static/assets/TerminalAuditTab-BzRHQUT2.js +++ b/backend/static/assets/TerminalAuditTab-D4-qFyPi.js @@ -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",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:"已关闭"})}const F=10;function Ae(s){const[r,i]=n.useState(0);return n.useEffect(()=>{if(!s)return;const c=new Date(s).getTime(),l=()=>i(Math.floor((Date.now()-c)/1e3));l();const p=setInterval(l,1e3);return()=>clearInterval(p)},[s]),r}function De({session:s,onKill:r,onMonitor:i}){const c=Ae(s.start_time);return e.jsxs(T,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:54:5",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:55:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:56:9",className:"text-sm text-slate-400",children:s.id})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:58:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:59:9",className:"text-sm text-slate-200",children:s.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:61:7",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:62:9",className:"flex flex-col",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:63:11",className:"text-sm text-slate-200",children:s.server_name||"--"}),e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:64:11",className:"text-xs text-slate-500",children:s.server_ip})]})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:67:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:68:9",className:"text-sm text-slate-400",children:s.server_port})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:70:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:71:9",className:"text-sm text-slate-400",children:s.start_time?new Date(s.start_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:75:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:76:9",className:"text-sm text-emerald-400 font-mono",children:re(c)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:78:7",children:ie(s.status)}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:79:7",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:80:9",className:"flex items-center justify-end gap-1",children:[e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:81:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400 hover:bg-slate-800",onClick:()=>r(s.id,s.username),title:"阻断会话",children:e.jsx(fe,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:88:13",className:"h-4 w-4"})}),e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:90:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>i(s.id),title:"实时查看",children:e.jsx(ye,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:97:13",className:"h-4 w-4"})})]})})]})}function He({userToggledOff:s,onUserToggledOff:r}){const i=ce(),{killMutation:c}=Ne(),{data:l=[],isLoading:p,refetch:f}=ne({page:1,page_size:100,status:"active"}),[u,y]=n.useState(""),[a,x]=n.useState(()=>!s),[g,t]=n.useState(!1),[P,v]=n.useState(null);n.useEffect(()=>{s||x(!0)},[s]),n.useEffect(()=>{if(!a)return;const o=setInterval(()=>f(),F*1e3);return()=>clearInterval(o)},[a,f]);const b=l.filter(o=>{const j=u.toLowerCase();return!j||(o.username||"").toLowerCase().includes(j)||(o.server_name||"").toLowerCase().includes(j)||(o.server_ip||"").toLowerCase().includes(j)}),A=async(o,j)=>{if(await i({title:"阻断会话",description:`确认强制断开用户「${j}」的当前会话吗?`,confirmText:"阻断",variant:"destructive"}))try{await c.mutateAsync(o)}catch{}},h=o=>{v(o),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:162:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:163:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:164: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/ActiveSessionsPanel.tsx:165:11",placeholder:"搜索用户/服务器...",value:u,onChange:o=>y(o.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/ActiveSessionsPanel.tsx:172:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>f(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:177:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:180:9",variant:a?"default":"outline",className:a?"bg-emerald-600 hover:bg-emerald-700 text-white":"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>{a&&r(),x(!a)},title:a?`每 ${F}s 自动刷新 · 点击关闭`:"点击开启自动刷新",children:a?e.jsxs(e.Fragment,{children:[e.jsx(ge,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:195:15",className:"h-4 w-4 mr-1.5 animate-pulse"}),F,"s"]}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:200:15",className:"h-4 w-4 mr-2"}),"自动刷新"]})})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:207:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:208:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:209:11",className:"border-t border-slate-800",children:p?e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:211:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:212:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):b.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:215:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(ee,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:216:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:217:17",className:"text-sm",children:"暂无在线会话"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:220:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:221:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:222:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:223:21",className:"text-slate-400",children:"ID"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:224:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:225:21",className:"text-slate-400",children:"目标服务器"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:226:21",className:"text-slate-400",children:"端口"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:227:21",className:"text-slate-400",children:"开始时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:228:21",className:"text-slate-400",children:"时长"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:229:21",className:"text-slate-400",children:"状态"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:230:21",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:233:17",children:b.map(o=>e.jsx(De,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:235:21",session:o,onKill:A,onMonitor:h},o.id))})]})})})}),e.jsx(we,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:244:7",open:g,onOpenChange:t,sessionId:P})]})}function Me({open:s,onOpenChange:r,sessionId:i}){const c=n.useRef(null),l=n.useRef(null),p=n.useRef(null),[f,u]=n.useState(!1),[y,a]=n.useState(""),[x,g]=n.useState(0);return n.useEffect(()=>{if(!s||!i)return;const t=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,cols:80,rows:24,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#0a0e14",selectionBackground:"rgba(255,255,255,0.2)"}}),P=new V.FitAddon;t.loadAddon(P),l.current=t;let v=!1;return u(!0),a(""),g(0),L.getRecord(i).then(b=>{if(v)return;const A=typeof b=="string"?b:b?.data||b?.record_data||"";if(!A||A.trim()===""){a("No recording data available for this session"),u(!1);return}if(c.current){t.open(c.current);try{P.fit()}catch{}}const h=A.split(` `).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:[e.jsx(K,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:86:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:87:17",className:"text-sm",children:"暂无历史会话"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:90:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:91:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:92:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:93:21",className:"text-slate-400",children:"ID"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:94:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:95:21",className:"text-slate-400",children:"目标服务器"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:96:21",className:"text-slate-400",children:"端口"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:97:21",className:"text-slate-400",children:"开始时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:98:21",className:"text-slate-400",children:"结束时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:99:21",className:"text-slate-400",children:"时长"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:100:21",className:"text-slate-400",children:"状态"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:101:21",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:104:17",children:a.map(t=>e.jsxs(T,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:106:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:107:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:108:25",className:"text-sm text-slate-400",children:t.id})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:110:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:111:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:113:23",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:114:25",className:"flex flex-col",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:115:27",className:"text-sm text-slate-200",children:t.server_name||"--"}),e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:116:27",className:"text-xs text-slate-500",children:t.server_ip})]})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:119:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:120:25",className:"text-sm text-slate-400",children:t.server_port})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:122:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:123:25",className:"text-sm text-slate-400",children:t.start_time?new Date(t.start_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:127:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:128:25",className:"text-sm text-slate-400",children:t.end_time?new Date(t.end_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:132:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:133:25",className:"text-sm text-slate-300",children:re(t.duration)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:135:23",children:ie(t.status)}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:136:23",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:137:25",className:"flex items-center justify-end gap-1",children:[e.jsx(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:138:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>x(t.id),title:"回放",children:e.jsx(je,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:145:29",className:"h-4 w-4"})}),e.jsx(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:147:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-green-400 hover:bg-slate-800",onClick:()=>g(t.id),title:"下载录制",children:e.jsx(Se,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:154:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})}),e.jsx(Me,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:167:7",open:u,onOpenChange:y,sessionId:p})]})}function ke(){const[s,r]=n.useState(""),[i,c]=n.useState(""),l=n.useMemo(()=>({page:1,page_size:200,...i?{session_id:Number(i)}:{}}),[i]),{data:p=[],isLoading:f,refetch:u}=Pe(l),y=p.filter(a=>{const x=s.toLowerCase();return!x||(a.username||"").toLowerCase().includes(x)||(a.command||"").toLowerCase().includes(x)});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:45:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:46:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:47: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/SessionCommandsPanel.tsx:48:11",placeholder:"搜索用户/命令...",value:s,onChange:a=>r(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsx($,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:55:9",placeholder:"会话 ID(可选)",value:i,onChange:a=>c(a.target.value),className:"w-32 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/SessionCommandsPanel.tsx:61:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:66:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:71:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:72:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:73:11",className:"border-t border-slate-800",children:f?e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:75:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:76:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):y.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:79:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:80:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:81:17",className:"text-sm",children:"暂无会话命令记录"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:84:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:85:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:86:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:87:21",className:"text-slate-400",children:"时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:88:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:89:21",className:"text-slate-400",children:"命令"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:90:21",className:"text-slate-400",children:"输出大小"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:91:21",className:"text-slate-400",children:"关联会话"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:94:17",children:y.map(a=>e.jsxs(T,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:96:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:97:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:98:25",className:"text-sm text-slate-400",children:a.created_at?new Date(a.created_at).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:102:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:103:25",className:"text-sm text-slate-200",children:a.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:105:23",children:e.jsx("code",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:106:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded max-w-[400px] truncate block",children:a.command||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:110:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:111:25",className:"text-sm text-slate-400",children:Ce(a.output_size)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:113:23",children:e.jsxs("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:114:25",className:"text-xs text-slate-500",children:["#",a.session_id]})})]},a.id))})]})})})})]})}const Le=[{id:"active",name:"在线会话",icon:ee},{id:"history",name:"历史会话",icon:K},{id:"commands",name:"会话命令",icon:_}];function Ue(){const[s,r]=n.useState("active"),[i,c]=n.useState(!1);return e.jsxs("div",{"code-path":"src/pages/TerminalAuditTab.tsx:22:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/pages/TerminalAuditTab.tsx:23:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)] w-fit",children:Le.map(l=>e.jsxs("button",{"code-path":"src/pages/TerminalAuditTab.tsx:25:11",onClick:()=>r(l.id),className:Q("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all",s===l.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(l.icon,{"code-path":"src/pages/TerminalAuditTab.tsx:35:13",className:"h-4 w-4"}),l.name]},l.id))}),s==="active"&&e.jsx(He,{"code-path":"src/pages/TerminalAuditTab.tsx:42:9",userToggledOff:i,onUserToggledOff:()=>c(!0)}),s==="history"&&e.jsx(Re,{"code-path":"src/pages/TerminalAuditTab.tsx:47:32"}),s==="commands"&&e.jsx(ke,{"code-path":"src/pages/TerminalAuditTab.tsx:48:33"})]})}export{Ue as TerminalAuditTab}; diff --git a/backend/static/assets/TopologyView-Feyh7bIr.js b/backend/static/assets/TopologyView-DdP6o9Mj.js similarity index 98% rename from backend/static/assets/TopologyView-Feyh7bIr.js rename to backend/static/assets/TopologyView-DdP6o9Mj.js index fd7e541..3d909be 100644 --- a/backend/static/assets/TopologyView-Feyh7bIr.js +++ b/backend/static/assets/TopologyView-DdP6o9Mj.js @@ -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.name)),c.length===0&&(c=T.filter(p=>p.namespace===o.namespace)),c.length===0&&(c=[T[0]]),c.slice(0,4).forEach(p=>l.push({id:`e-${i}-deploy-${p.id}`,source:i,target:`deploy-${p.id}`,label:"select"}))});const I=x.slice(0,12),J=N(I.length);I.forEach((o,i)=>{const c=`k8snode-${o.id}`;V.push({id:c,name:o.name,type:"server",x:J[i],y:r[4],data:{kind:"node",ip:o.ip,role:o.role,status:o.status,os:o.os,cpu:o.cpu,memory:o.memory,cpu_usage:o.cpu_usage,memory_usage:o.memory_usage,pod_count:o.pod_count}})});const y=I.filter(o=>(o.role||"").toLowerCase()==="worker"),O=y.length>0?y:I;return T.length>0&&O.length>0&&T.forEach(o=>{const i=`deploy-${o.id}`;O.slice(0,3).forEach(c=>l.push({id:`e-${i}-k8snode-${c.id}`,source:i,target:`k8snode-${c.id}`,label:"schedule"}))}),{nodes:V,edges:l}}function Ns(){const{clusterCode:u}=Ge(),h=Ke(),[D,Y]=d.useState([]),[x,V]=d.useState(""),[l,S]=d.useState({nodes:[],edges:[]}),[z,L]=d.useState(!1),[r,N]=d.useState(null),[E,R]=d.useState(""),[B,f]=d.useState("all"),[A,T]=d.useState(null),[H,I]=d.useState({x:0,y:0}),J=d.useRef(null),[y,O]=d.useState(!1),[o,i]=d.useState(!1),[c,p]=d.useState(null),[,g]=d.useState(null),[P,W]=d.useState(!1),[se,G]=d.useState(1),[De,Q]=d.useState(!1),[U,me]=d.useState(null),[w,F]=d.useState({name:"",type:"database",note:""}),ue=d.useCallback(async()=>{try{const n=(await _.getClusters())?.list||[];if(Y(n),!x)if(u){const t=n.find(a=>(a.code||String(a.id))===u);t&&V(String(t.id))}else n.length>0&&V(String(n[0].id))}catch{Y([])}},[u]);d.useEffect(()=>{ue()},[ue]);const xe=d.useCallback(async s=>{try{const t=await _.getTopology(s);if(t?.layout_data){const a=JSON.parse(t.layout_data);if(g(a),a.customNodes?.length>0){const m=Math.max(...a.customNodes.map(k=>{const b=k.id.match(/custom-(\d+)/);return b?parseInt(b[1]):0}));G(m+1)}return a}}catch{}return g(null),null},[]),K=d.useCallback(async()=>{if(x){L(!0);try{const s=C=>Array.isArray(C)?C:C?.list||[],[n,t,a,m]=await Promise.all([_.getNodes(x).catch(()=>[]),_.getServices(x).catch(()=>[]),_.getDeployments(x).catch(()=>[]),_.getIngresses(x).catch(()=>[])]),k=D.find(C=>String(C.id)===x)||{},b=us(k,s(m),s(t),s(a),s(n)),$=await xe(x);$&&($.positions&&(b.nodes=b.nodes.map(C=>{const te=$.positions[C.id];return te?{...C,x:te.x,y:te.y}:C})),$.customNodes&&(b.nodes=[...b.nodes,...$.customNodes]),$.customEdges&&(b.edges=[...b.edges,...$.customEdges])),S(b)}catch{S({nodes:[],edges:[]})}finally{L(!1)}}},[x,D,xe]);d.useEffect(()=>{K()},[K]);const Z=l.nodes.filter(s=>s.name.toLowerCase().includes(E.toLowerCase())&&(B==="all"||s.type===B)),he=new Set(Z.map(s=>s.id)),ge=s=>{const n=J.current;if(!n)return{x:0,y:0};const t=n.createSVGPoint();t.x=s.clientX,t.y=s.clientY;const a=n.getScreenCTM();return a?{x:t.matrixTransform(a.inverse()).x,y:t.matrixTransform(a.inverse()).y}:{x:0,y:0}},Le=(s,n)=>{if(o)return;s.stopPropagation();const t=ge(s);I({x:t.x-n.x,y:t.y-n.y}),T(n.id)},Re=s=>{if(!A)return;const n=ge(s);S(t=>({...t,nodes:t.nodes.map(a=>a.id===A?{...a,x:n.x-H.x,y:n.y-H.y}:a)}))},be=()=>T(null),Ae=s=>{if(!A){if(o){if(!c)p(s.id),j.info(`已选择源节点: ${s.name},请点击目标节点`);else if(c===s.id)j.info("不能连接自身");else{const n={id:`custom-edge-${Date.now()}`,source:c,target:s.id,label:"connect"};S(t=>({...t,edges:[...t.edges,n]})),j.success("连线已添加"),p(null),i(!1)}return}N(s)}},Ie=()=>{me(null),F({name:"",type:"database",note:""}),Q(!0)},ye=s=>{me(s),F({name:s.name,type:s.type,note:s.data?.note||""}),Q(!0)},Oe=()=>{if(!w.name.trim()){j.error("请输入节点名称");return}if(U)S(s=>({...s,nodes:s.nodes.map(n=>n.id===U.id?{...n,name:w.name,type:w.type,data:{...n.data,note:w.note}}:n)})),j.success("节点已更新");else{const n={id:`custom-${se}`,name:w.name,type:w.type,x:we/2+(Math.random()-.5)*100,y:ke/2+(Math.random()-.5)*100,data:{kind:"custom",note:w.note}};S(t=>({...t,nodes:[...t.nodes,n]})),G(t=>t+1),j.success("节点已添加")}Q(!1)},Pe=async s=>{await h({title:"删除节点",description:`确定删除「${s.name}」?相关连线也会一并删除`,variant:"destructive"})&&(S(t=>({nodes:t.nodes.filter(a=>a.id!==s.id),edges:t.edges.filter(a=>a.source!==s.id&&a.target!==s.id)})),N(null),j.success("节点已删除"))},Xe=async s=>{if(!s.id.startsWith("custom-edge")){j.info("Kubernetes 原生关系不可删除");return}await h({title:"删除连线",description:"确定删除此自定义连线?",variant:"destructive"})&&(S(t=>({...t,edges:t.edges.filter(a=>a.id!==s.id)})),j.success("连线已删除"))},Ye=async()=>{if(x){W(!0);try{const s={positions:Object.fromEntries(l.nodes.map(n=>[n.id,{x:n.x,y:n.y}])),customNodes:l.nodes.filter(n=>X(n.id)),customEdges:l.edges.filter(n=>n.id.startsWith("custom-edge"))};await _.saveTopology(x,JSON.stringify(s)),j.success("布局已保存")}catch{j.error("保存失败")}finally{W(!1)}}},ze=async()=>{if(await h({title:"重置布局",description:"将清除已保存的布局并重新自动排列",variant:"destructive"})){try{await _.saveTopology(x,"")}catch{}g(null),O(!1),i(!1),p(null),await K(),j.success("布局已重置")}},Be=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.x))+80:900,We=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.y))+80:700,we=Math.max(Be,900),ke=Math.max(We,700),fe=s=>l.nodes.filter(n=>n.type===s).length,Qe=()=>{if(l.nodes.length===0)return null;const s=[60,180,320,480,640],n=["集群","Ingress","Service","Deployment","Node"];return e.jsxs("svg",{"code-path":"src/components/kubernetes/TopologyView.tsx:291:7",ref:J,width:"100%",height:"100%",viewBox:`0 0 ${we} ${ke}`,className:"bg-slate-950 rounded-lg",preserveAspectRatio:"xMidYMin meet",onMouseMove:Re,onMouseUp:be,onMouseLeave:be,children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/TopologyView.tsx:293:9",children:[e.jsx("pattern",{"code-path":"src/components/kubernetes/TopologyView.tsx:294:11",id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:e.jsx("path",{"code-path":"src/components/kubernetes/TopologyView.tsx:295:13",d:"M 20 0 L 0 0 0 20",fill:"none",stroke:"#1e293b",strokeWidth:"0.5"})}),e.jsx("marker",{"code-path":"src/components/kubernetes/TopologyView.tsx:297:11",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"28",refY:"3.5",orient:"auto",children:e.jsx("polygon",{"code-path":"src/components/kubernetes/TopologyView.tsx:298:13",points:"0 0, 10 3.5, 0 7",fill:o?"#f59e0b":"#475569"})})]}),e.jsx("rect",{"code-path":"src/components/kubernetes/TopologyView.tsx:301:9",width:"100%",height:"100%",fill:"url(#grid)"}),n.map((t,a)=>e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:303:11",x:14,y:s[a]+4,fill:"#475569",fontSize:"11",className:"font-medium select-none",children:t},t)),l.edges.map(t=>{const a=l.nodes.find(b=>b.id===t.source),m=l.nodes.find(b=>b.id===t.target);if(!a||!m||!he.has(a.id)||!he.has(m.id))return null;const k=t.id.startsWith("custom-edge");return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:311:13",className:y&&k?"cursor-pointer":"",onClick:()=>{y&&k&&Xe(t)},children:[e.jsx("line",{"code-path":"src/components/kubernetes/TopologyView.tsx:312:15",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:k?"#f59e0b":"#475569",strokeWidth:k?2:1.5,strokeDasharray:k?"6 3":void 0,markerEnd:"url(#arrowhead)",opacity:k?.8:.6}),y&&k&&e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:317:17",x:(a.x+m.x)/2,y:(a.y+m.y)/2,fill:"#f59e0b",fontSize:"10",textAnchor:"middle",className:"select-none pointer-events-none",children:"✕ 删除"})]},t.id)}),Z.map(t=>{const a=X(t.id),m=c===t.id;return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:327:13",transform:`translate(${t.x}, ${t.y})`,className:o?"cursor-crosshair":A===t.id?"cursor-grabbing":"cursor-grab",onMouseDown:k=>Le(k,t),onClick:()=>Ae(t),onDoubleClick:()=>{y&&ye(t)},children:[e.jsx("circle",{"code-path":"src/components/kubernetes/TopologyView.tsx:332:15",r:"28",fill:"#0f172a",stroke:m?"#f59e0b":r?.id===t.id?"#3b82f6":a?"#f59e0b":"#334155",strokeWidth:m||r?.id===t.id?3:2,strokeDasharray:a?"4 2":void 0,className:"transition-all hover:stroke-blue-500"}),e.jsx("foreignObject",{"code-path":"src/components/kubernetes/TopologyView.tsx:337:15",x:"-12",y:"-12",width:"24",height:"24",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:338:17",className:`flex items-center justify-center w-full h-full ${ee(t.type).split(" ")[1]}`,children:M(t.type)})}),e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:340:15",y:"45",fill:a?"#f59e0b":"#94a3b8",fontSize:"12",textAnchor:"middle",className:"font-medium select-none",children:t.name.length>20?t.name.slice(0,18)+"…":t.name})]},t.id)})]})},Ue=s=>{const n=s.data||{},t=Object.entries(n).filter(([a])=>a!=="kind");return t.length===0?null:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:355:7",className:"grid grid-cols-2 gap-3",children:t.map(([a,m])=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:357:11",className:"p-2 rounded-lg bg-slate-800/50",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:358:13",className:"text-xs text-slate-500 mb-0.5",children:a}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:359:13",className:"text-sm text-slate-200 truncate",title:String(m),children:m==null?"—":String(m)})]},a))})};return e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:367:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:369:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:370:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/TopologyView.tsx:371:11",className:"text-2xl font-bold text-slate-100",children:"架构拓扑"}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:372:11",className:"text-sm text-slate-500 mt-1",children:["Kubernetes 集群资源拓扑可视化 · 拖拽节点调整布局",y&&e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:374:26",className:"text-amber-400 ml-2",children:"· 编辑模式"}),o&&e.jsxs("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:375:29",className:"text-amber-400 ml-1",children:["· 连线中",c?"(选择目标节点)":"(选择源节点)"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:378:9",className:"flex items-center gap-2",children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:379:11",value:x,onValueChange:s=>{V(s),N(null),O(!1)},children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:13",className:"w-44 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:97",placeholder:"选择集群"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:381:13",className:"bg-slate-800 border-slate-700",children:D.map(s=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:382:36",value:String(s.id),children:s.name},s.id))})]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:385:11",variant:y?"default":"outline",size:"sm",className:"h-9",onClick:()=>{O(!y),i(!1),p(null)},children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:387:13",className:"h-4 w-4 mr-1"}),y?"退出编辑":"编辑"]}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:389:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:K,disabled:z,children:z?e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:24",className:"h-4 w-4 animate-spin"}):e.jsx(cs,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:71",className:"h-4 w-4"})})]})]}),y&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:397:9",className:"flex items-center gap-2 p-3 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:398:11",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:Ie,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/TopologyView.tsx:399:13",className:"h-4 w-4 mr-1"}),"添加节点"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:401:11",size:"sm",variant:o?"default":"outline",className:o?"bg-amber-600 hover:bg-amber-700":"border-slate-600 text-slate-200",onClick:()=>{i(!o),p(null)},children:[e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:403:13",className:"h-4 w-4 mr-1"}),o?"取消连线":"添加连线"]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:405:11",className:"h-5 w-px bg-slate-600"}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:406:11",size:"sm",variant:"outline",className:"border-emerald-600/30 text-emerald-400 hover:bg-emerald-600/10",onClick:Ye,disabled:P,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/TopologyView.tsx:407:13",className:"h-4 w-4 mr-1"}),P?"保存中...":"保存布局"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:409:11",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:ze,children:[e.jsx(is,{"code-path":"src/components/kubernetes/TopologyView.tsx:410:13",className:"h-4 w-4 mr-1"}),"重置布局"]}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:412:11",className:"text-xs text-slate-500 ml-auto",children:"双击节点编辑 · 点击虚线删除 · 拖拽调整位置"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:417:7",className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[{label:"总节点数",value:l.nodes.length,icon:e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:419:64",className:"h-5 w-5"}),color:"text-blue-400",bg:"bg-blue-500/10"},{label:"连接数",value:l.edges.length,icon:e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:420:63",className:"h-5 w-5"}),color:"text-purple-400",bg:"bg-purple-500/10"},{label:"Service",value:fe("service"),icon:M("service"),color:"text-emerald-400",bg:"bg-emerald-500/10"},{label:"Deployment",value:fe("app"),icon:M("app"),color:"text-rose-400",bg:"bg-rose-500/10"},{label:"自定义",value:l.nodes.filter(s=>X(s.id)).length,icon:M("custom"),color:"text-amber-400",bg:"bg-amber-500/10"}].map(s=>e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:425:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:426:13",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:427:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:428:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:429:19",className:"text-sm text-slate-500",children:s.label}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:430:19",className:`text-2xl font-bold ${s.color}`,children:s.value})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:432:17",className:`p-3 rounded-lg ${s.bg} ${s.color}`,children:s.icon})]})})},s.label))}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:440:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:441:9",className:"relative w-48",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/TopologyView.tsx:442:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:443:11",placeholder:"搜索节点...",value:E,onChange:s=>R(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:445:9",value:B,onValueChange:f,children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:11",className:"w-36 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:95",placeholder:"节点类型"})}),e.jsxs(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:447:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:448:13",value:"all",children:"全部类型"}),Object.entries(de).map(([s,n])=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:449:63",value:s,children:n},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:455:7",className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:456:9",className:"lg:col-span-3",children:e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:457:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:458:13",className:"p-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:459:15",className:`h-[600px] overflow-auto ${o?"ring-2 ring-amber-500/30 rounded-lg":""}`,children:z?e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:461:19",className:"flex items-center justify-center h-full",children:e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:461:76",className:"h-8 w-8 animate-spin text-slate-600"})}):l.nodes.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:463:19",className:"flex flex-col items-center justify-center h-full text-slate-600",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:464:21",className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:465:21",className:"text-sm",children:x?"该集群暂无拓扑数据":"请选择集群查看拓扑"})]}):Qe()})})})}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:472:9",children:e.jsxs(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:473:11",className:"bg-slate-900 border-slate-800",children:[e.jsxs(Fe,{"code-path":"src/components/kubernetes/TopologyView.tsx:474:13",className:"pb-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/TopologyView.tsx:475:15",className:"text-base text-slate-100",children:"节点列表"}),e.jsx(Je,{"code-path":"src/components/kubernetes/TopologyView.tsx:476:15",className:"text-slate-500",children:"点击节点查看详情"})]}),e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:478:13",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:479:15",className:"space-y-2 max-h-[520px] overflow-auto",children:Z.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:481:19",className:"text-sm text-slate-600 text-center py-8",children:"暂无节点"}):Z.map(s=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:484:21",className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${r?.id===s.id?"bg-blue-500/10 border border-blue-500/30":"hover:bg-slate-800/50"}`,onClick:()=>N(s),children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:485:23",className:`p-2 rounded-lg ${ee(s.type)}`,children:M(s.type)}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:486:23",className:"flex-1 min-w-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:487:25",className:"text-sm font-medium text-slate-200 truncate",children:s.name}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:488:25",className:"text-xs text-slate-500",children:[de[s.type]||s.type,X(s.id)?" · 自定义":""]})]})]},s.id))})})]})})]}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:500:7",open:!!r,onOpenChange:()=>N(null),children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:501:9",className:"bg-slate-900 border-slate-800 max-w-lg",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:502:11",children:[e.jsxs(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:503:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:504:15",className:`p-2 rounded-lg ${ee(r?.type||"server")}`,children:r&&M(r.type)}),r?.name,r&&X(r.id)&&e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:506:65",variant:"outline",className:"border-amber-500/30 text-amber-400 text-xs",children:"自定义"})]}),e.jsxs(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:508:13",className:"text-slate-500",children:["类型: ",de[r?.type||""]||r?.type]})]}),r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:511:13",className:"space-y-4",children:[Ue(r),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:513:15",children:[e.jsx("h4",{"code-path":"src/components/kubernetes/TopologyView.tsx:514:17",className:"text-sm font-medium text-slate-300 mb-2",children:"关联连接"}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:515:17",className:"space-y-2",children:[l.edges.filter(s=>s.source===r.id||s.target===r.id).map(s=>{const n=s.source===r.id,t=l.nodes.find(a=>a.id===(n?s.target:s.source));return t?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:521:23",className:"flex items-center gap-2 p-2 rounded-lg bg-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:522:25",className:"text-sm text-slate-400",children:n?"→":"←"}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:523:25",className:`p-1 rounded ${ee(t.type)}`,children:M(t.type,"h-4 w-4")}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:524:25",className:"text-sm text-slate-300",children:t.name}),e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:525:25",variant:"outline",className:"ml-auto border-slate-700 text-slate-400 text-xs",children:s.label})]},s.id):null}),l.edges.filter(s=>s.source===r.id||s.target===r.id).length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:529:127",className:"text-xs text-slate-600",children:"无关联连接"})]})]}),y&&r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:534:17",className:"flex gap-2 pt-2 border-t border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:535:19",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:()=>ye(r),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:536:21",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),X(r.id)&&e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:539:21",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>Pe(r),children:[e.jsx(ps,{"code-path":"src/components/kubernetes/TopologyView.tsx:540:23",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]})}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:551:7",open:De,onOpenChange:Q,children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:552:9",className:"bg-slate-900 border-slate-800 max-w-md",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:553:11",children:[e.jsx(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:554:13",className:"text-slate-100",children:U?"编辑节点":"添加自定义节点"}),e.jsx(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:555:13",className:"text-slate-500",children:U?"修改节点属性":"添加数据库、外部服务等非 Kubernetes 资源节点"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:557:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:558:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:559:15",className:"text-slate-300",children:"名称"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:560:15",value:w.name,onChange:s=>F({...w,name:s.target.value}),placeholder:"如 MySQL 主库、Redis 集群",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:563:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:564:15",className:"text-slate-300",children:"类型"}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:565:15",value:w.type,onValueChange:s=>F({...w,type:s}),children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:92"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:567:17",className:"bg-slate-800 border-slate-700",children:ms.map(s=>e.jsxs(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:568:49",value:s.value,children:[s.label," — ",s.desc]},s.value))})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:572:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:573:15",className:"text-slate-300",children:"备注"}),e.jsx(qe,{"code-path":"src/components/kubernetes/TopologyView.tsx:574:15",value:w.note,onChange:s=>F({...w,note:s.target.value}),placeholder:"连接信息、用途说明等",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 resize-none"})]})]}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/TopologyView.tsx:578:11",children:[e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:579:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Q(!1),children:"取消"}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:580:13",onClick:Oe,children:U?"保存":"添加"})]})]})})]})}export{Ns as TopologyView}; +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.name)),c.length===0&&(c=T.filter(p=>p.namespace===o.namespace)),c.length===0&&(c=[T[0]]),c.slice(0,4).forEach(p=>l.push({id:`e-${i}-deploy-${p.id}`,source:i,target:`deploy-${p.id}`,label:"select"}))});const I=x.slice(0,12),J=N(I.length);I.forEach((o,i)=>{const c=`k8snode-${o.id}`;V.push({id:c,name:o.name,type:"server",x:J[i],y:r[4],data:{kind:"node",ip:o.ip,role:o.role,status:o.status,os:o.os,cpu:o.cpu,memory:o.memory,cpu_usage:o.cpu_usage,memory_usage:o.memory_usage,pod_count:o.pod_count}})});const y=I.filter(o=>(o.role||"").toLowerCase()==="worker"),O=y.length>0?y:I;return T.length>0&&O.length>0&&T.forEach(o=>{const i=`deploy-${o.id}`;O.slice(0,3).forEach(c=>l.push({id:`e-${i}-k8snode-${c.id}`,source:i,target:`k8snode-${c.id}`,label:"schedule"}))}),{nodes:V,edges:l}}function Ns(){const{clusterCode:u}=Ge(),h=Ke(),[D,Y]=d.useState([]),[x,V]=d.useState(""),[l,S]=d.useState({nodes:[],edges:[]}),[z,L]=d.useState(!1),[r,N]=d.useState(null),[E,R]=d.useState(""),[B,f]=d.useState("all"),[A,T]=d.useState(null),[H,I]=d.useState({x:0,y:0}),J=d.useRef(null),[y,O]=d.useState(!1),[o,i]=d.useState(!1),[c,p]=d.useState(null),[,g]=d.useState(null),[P,W]=d.useState(!1),[se,G]=d.useState(1),[De,Q]=d.useState(!1),[U,me]=d.useState(null),[w,F]=d.useState({name:"",type:"database",note:""}),ue=d.useCallback(async()=>{try{const n=(await _.getClusters())?.list||[];if(Y(n),!x)if(u){const t=n.find(a=>(a.code||String(a.id))===u);t&&V(String(t.id))}else n.length>0&&V(String(n[0].id))}catch{Y([])}},[u]);d.useEffect(()=>{ue()},[ue]);const xe=d.useCallback(async s=>{try{const t=await _.getTopology(s);if(t?.layout_data){const a=JSON.parse(t.layout_data);if(g(a),a.customNodes?.length>0){const m=Math.max(...a.customNodes.map(k=>{const b=k.id.match(/custom-(\d+)/);return b?parseInt(b[1]):0}));G(m+1)}return a}}catch{}return g(null),null},[]),K=d.useCallback(async()=>{if(x){L(!0);try{const s=C=>Array.isArray(C)?C:C?.list||[],[n,t,a,m]=await Promise.all([_.getNodes(x).catch(()=>[]),_.getServices(x).catch(()=>[]),_.getDeployments(x).catch(()=>[]),_.getIngresses(x).catch(()=>[])]),k=D.find(C=>String(C.id)===x)||{},b=us(k,s(m),s(t),s(a),s(n)),$=await xe(x);$&&($.positions&&(b.nodes=b.nodes.map(C=>{const te=$.positions[C.id];return te?{...C,x:te.x,y:te.y}:C})),$.customNodes&&(b.nodes=[...b.nodes,...$.customNodes]),$.customEdges&&(b.edges=[...b.edges,...$.customEdges])),S(b)}catch{S({nodes:[],edges:[]})}finally{L(!1)}}},[x,D,xe]);d.useEffect(()=>{K()},[K]);const Z=l.nodes.filter(s=>s.name.toLowerCase().includes(E.toLowerCase())&&(B==="all"||s.type===B)),he=new Set(Z.map(s=>s.id)),ge=s=>{const n=J.current;if(!n)return{x:0,y:0};const t=n.createSVGPoint();t.x=s.clientX,t.y=s.clientY;const a=n.getScreenCTM();return a?{x:t.matrixTransform(a.inverse()).x,y:t.matrixTransform(a.inverse()).y}:{x:0,y:0}},Le=(s,n)=>{if(o)return;s.stopPropagation();const t=ge(s);I({x:t.x-n.x,y:t.y-n.y}),T(n.id)},Re=s=>{if(!A)return;const n=ge(s);S(t=>({...t,nodes:t.nodes.map(a=>a.id===A?{...a,x:n.x-H.x,y:n.y-H.y}:a)}))},be=()=>T(null),Ae=s=>{if(!A){if(o){if(!c)p(s.id),j.info(`已选择源节点: ${s.name},请点击目标节点`);else if(c===s.id)j.info("不能连接自身");else{const n={id:`custom-edge-${Date.now()}`,source:c,target:s.id,label:"connect"};S(t=>({...t,edges:[...t.edges,n]})),j.success("连线已添加"),p(null),i(!1)}return}N(s)}},Ie=()=>{me(null),F({name:"",type:"database",note:""}),Q(!0)},ye=s=>{me(s),F({name:s.name,type:s.type,note:s.data?.note||""}),Q(!0)},Oe=()=>{if(!w.name.trim()){j.error("请输入节点名称");return}if(U)S(s=>({...s,nodes:s.nodes.map(n=>n.id===U.id?{...n,name:w.name,type:w.type,data:{...n.data,note:w.note}}:n)})),j.success("节点已更新");else{const n={id:`custom-${se}`,name:w.name,type:w.type,x:we/2+(Math.random()-.5)*100,y:ke/2+(Math.random()-.5)*100,data:{kind:"custom",note:w.note}};S(t=>({...t,nodes:[...t.nodes,n]})),G(t=>t+1),j.success("节点已添加")}Q(!1)},Pe=async s=>{await h({title:"删除节点",description:`确定删除「${s.name}」?相关连线也会一并删除`,variant:"destructive"})&&(S(t=>({nodes:t.nodes.filter(a=>a.id!==s.id),edges:t.edges.filter(a=>a.source!==s.id&&a.target!==s.id)})),N(null),j.success("节点已删除"))},Xe=async s=>{if(!s.id.startsWith("custom-edge")){j.info("Kubernetes 原生关系不可删除");return}await h({title:"删除连线",description:"确定删除此自定义连线?",variant:"destructive"})&&(S(t=>({...t,edges:t.edges.filter(a=>a.id!==s.id)})),j.success("连线已删除"))},Ye=async()=>{if(x){W(!0);try{const s={positions:Object.fromEntries(l.nodes.map(n=>[n.id,{x:n.x,y:n.y}])),customNodes:l.nodes.filter(n=>X(n.id)),customEdges:l.edges.filter(n=>n.id.startsWith("custom-edge"))};await _.saveTopology(x,JSON.stringify(s)),j.success("布局已保存")}catch{j.error("保存失败")}finally{W(!1)}}},ze=async()=>{if(await h({title:"重置布局",description:"将清除已保存的布局并重新自动排列",variant:"destructive"})){try{await _.saveTopology(x,"")}catch{}g(null),O(!1),i(!1),p(null),await K(),j.success("布局已重置")}},Be=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.x))+80:900,We=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.y))+80:700,we=Math.max(Be,900),ke=Math.max(We,700),fe=s=>l.nodes.filter(n=>n.type===s).length,Qe=()=>{if(l.nodes.length===0)return null;const s=[60,180,320,480,640],n=["集群","Ingress","Service","Deployment","Node"];return e.jsxs("svg",{"code-path":"src/components/kubernetes/TopologyView.tsx:291:7",ref:J,width:"100%",height:"100%",viewBox:`0 0 ${we} ${ke}`,className:"bg-slate-950 rounded-lg",preserveAspectRatio:"xMidYMin meet",onMouseMove:Re,onMouseUp:be,onMouseLeave:be,children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/TopologyView.tsx:293:9",children:[e.jsx("pattern",{"code-path":"src/components/kubernetes/TopologyView.tsx:294:11",id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:e.jsx("path",{"code-path":"src/components/kubernetes/TopologyView.tsx:295:13",d:"M 20 0 L 0 0 0 20",fill:"none",stroke:"#1e293b",strokeWidth:"0.5"})}),e.jsx("marker",{"code-path":"src/components/kubernetes/TopologyView.tsx:297:11",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"28",refY:"3.5",orient:"auto",children:e.jsx("polygon",{"code-path":"src/components/kubernetes/TopologyView.tsx:298:13",points:"0 0, 10 3.5, 0 7",fill:o?"#f59e0b":"#475569"})})]}),e.jsx("rect",{"code-path":"src/components/kubernetes/TopologyView.tsx:301:9",width:"100%",height:"100%",fill:"url(#grid)"}),n.map((t,a)=>e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:303:11",x:14,y:s[a]+4,fill:"#475569",fontSize:"11",className:"font-medium select-none",children:t},t)),l.edges.map(t=>{const a=l.nodes.find(b=>b.id===t.source),m=l.nodes.find(b=>b.id===t.target);if(!a||!m||!he.has(a.id)||!he.has(m.id))return null;const k=t.id.startsWith("custom-edge");return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:311:13",className:y&&k?"cursor-pointer":"",onClick:()=>{y&&k&&Xe(t)},children:[e.jsx("line",{"code-path":"src/components/kubernetes/TopologyView.tsx:312:15",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:k?"#f59e0b":"#475569",strokeWidth:k?2:1.5,strokeDasharray:k?"6 3":void 0,markerEnd:"url(#arrowhead)",opacity:k?.8:.6}),y&&k&&e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:317:17",x:(a.x+m.x)/2,y:(a.y+m.y)/2,fill:"#f59e0b",fontSize:"10",textAnchor:"middle",className:"select-none pointer-events-none",children:"✕ 删除"})]},t.id)}),Z.map(t=>{const a=X(t.id),m=c===t.id;return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:327:13",transform:`translate(${t.x}, ${t.y})`,className:o?"cursor-crosshair":A===t.id?"cursor-grabbing":"cursor-grab",onMouseDown:k=>Le(k,t),onClick:()=>Ae(t),onDoubleClick:()=>{y&&ye(t)},children:[e.jsx("circle",{"code-path":"src/components/kubernetes/TopologyView.tsx:332:15",r:"28",fill:"#0f172a",stroke:m?"#f59e0b":r?.id===t.id?"#3b82f6":a?"#f59e0b":"#334155",strokeWidth:m||r?.id===t.id?3:2,strokeDasharray:a?"4 2":void 0,className:"transition-all hover:stroke-blue-500"}),e.jsx("foreignObject",{"code-path":"src/components/kubernetes/TopologyView.tsx:337:15",x:"-12",y:"-12",width:"24",height:"24",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:338:17",className:`flex items-center justify-center w-full h-full ${ee(t.type).split(" ")[1]}`,children:M(t.type)})}),e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:340:15",y:"45",fill:a?"#f59e0b":"#94a3b8",fontSize:"12",textAnchor:"middle",className:"font-medium select-none",children:t.name.length>20?t.name.slice(0,18)+"…":t.name})]},t.id)})]})},Ue=s=>{const n=s.data||{},t=Object.entries(n).filter(([a])=>a!=="kind");return t.length===0?null:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:355:7",className:"grid grid-cols-2 gap-3",children:t.map(([a,m])=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:357:11",className:"p-2 rounded-lg bg-slate-800/50",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:358:13",className:"text-xs text-slate-500 mb-0.5",children:a}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:359:13",className:"text-sm text-slate-200 truncate",title:String(m),children:m==null?"—":String(m)})]},a))})};return e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:367:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:369:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:370:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/TopologyView.tsx:371:11",className:"text-2xl font-bold text-slate-100",children:"架构拓扑"}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:372:11",className:"text-sm text-slate-500 mt-1",children:["Kubernetes 集群资源拓扑可视化 · 拖拽节点调整布局",y&&e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:374:26",className:"text-amber-400 ml-2",children:"· 编辑模式"}),o&&e.jsxs("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:375:29",className:"text-amber-400 ml-1",children:["· 连线中",c?"(选择目标节点)":"(选择源节点)"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:378:9",className:"flex items-center gap-2",children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:379:11",value:x,onValueChange:s=>{V(s),N(null),O(!1)},children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:13",className:"w-44 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:97",placeholder:"选择集群"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:381:13",className:"bg-slate-800 border-slate-700",children:D.map(s=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:382:36",value:String(s.id),children:s.name},s.id))})]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:385:11",variant:y?"default":"outline",size:"sm",className:"h-9",onClick:()=>{O(!y),i(!1),p(null)},children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:387:13",className:"h-4 w-4 mr-1"}),y?"退出编辑":"编辑"]}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:389:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:K,disabled:z,children:z?e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:24",className:"h-4 w-4 animate-spin"}):e.jsx(cs,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:71",className:"h-4 w-4"})})]})]}),y&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:397:9",className:"flex items-center gap-2 p-3 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:398:11",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:Ie,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/TopologyView.tsx:399:13",className:"h-4 w-4 mr-1"}),"添加节点"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:401:11",size:"sm",variant:o?"default":"outline",className:o?"bg-amber-600 hover:bg-amber-700":"border-slate-600 text-slate-200",onClick:()=>{i(!o),p(null)},children:[e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:403:13",className:"h-4 w-4 mr-1"}),o?"取消连线":"添加连线"]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:405:11",className:"h-5 w-px bg-slate-600"}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:406:11",size:"sm",variant:"outline",className:"border-emerald-600/30 text-emerald-400 hover:bg-emerald-600/10",onClick:Ye,disabled:P,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/TopologyView.tsx:407:13",className:"h-4 w-4 mr-1"}),P?"保存中...":"保存布局"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:409:11",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:ze,children:[e.jsx(is,{"code-path":"src/components/kubernetes/TopologyView.tsx:410:13",className:"h-4 w-4 mr-1"}),"重置布局"]}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:412:11",className:"text-xs text-slate-500 ml-auto",children:"双击节点编辑 · 点击虚线删除 · 拖拽调整位置"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:417:7",className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[{label:"总节点数",value:l.nodes.length,icon:e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:419:64",className:"h-5 w-5"}),color:"text-blue-400",bg:"bg-blue-500/10"},{label:"连接数",value:l.edges.length,icon:e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:420:63",className:"h-5 w-5"}),color:"text-purple-400",bg:"bg-purple-500/10"},{label:"Service",value:fe("service"),icon:M("service"),color:"text-emerald-400",bg:"bg-emerald-500/10"},{label:"Deployment",value:fe("app"),icon:M("app"),color:"text-rose-400",bg:"bg-rose-500/10"},{label:"自定义",value:l.nodes.filter(s=>X(s.id)).length,icon:M("custom"),color:"text-amber-400",bg:"bg-amber-500/10"}].map(s=>e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:425:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:426:13",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:427:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:428:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:429:19",className:"text-sm text-slate-500",children:s.label}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:430:19",className:`text-2xl font-bold ${s.color}`,children:s.value})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:432:17",className:`p-3 rounded-lg ${s.bg} ${s.color}`,children:s.icon})]})})},s.label))}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:440:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:441:9",className:"relative w-48",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/TopologyView.tsx:442:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:443:11",placeholder:"搜索节点...",value:E,onChange:s=>R(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:445:9",value:B,onValueChange:f,children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:11",className:"w-36 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:95",placeholder:"节点类型"})}),e.jsxs(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:447:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:448:13",value:"all",children:"全部类型"}),Object.entries(de).map(([s,n])=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:449:63",value:s,children:n},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:455:7",className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:456:9",className:"lg:col-span-3",children:e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:457:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:458:13",className:"p-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:459:15",className:`h-[600px] overflow-auto ${o?"ring-2 ring-amber-500/30 rounded-lg":""}`,children:z?e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:461:19",className:"flex items-center justify-center h-full",children:e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:461:76",className:"h-8 w-8 animate-spin text-slate-600"})}):l.nodes.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:463:19",className:"flex flex-col items-center justify-center h-full text-slate-600",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:464:21",className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:465:21",className:"text-sm",children:x?"该集群暂无拓扑数据":"请选择集群查看拓扑"})]}):Qe()})})})}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:472:9",children:e.jsxs(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:473:11",className:"bg-slate-900 border-slate-800",children:[e.jsxs(Fe,{"code-path":"src/components/kubernetes/TopologyView.tsx:474:13",className:"pb-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/TopologyView.tsx:475:15",className:"text-base text-slate-100",children:"节点列表"}),e.jsx(Je,{"code-path":"src/components/kubernetes/TopologyView.tsx:476:15",className:"text-slate-500",children:"点击节点查看详情"})]}),e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:478:13",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:479:15",className:"space-y-2 max-h-[520px] overflow-auto",children:Z.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:481:19",className:"text-sm text-slate-600 text-center py-8",children:"暂无节点"}):Z.map(s=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:484:21",className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${r?.id===s.id?"bg-blue-500/10 border border-blue-500/30":"hover:bg-slate-800/50"}`,onClick:()=>N(s),children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:485:23",className:`p-2 rounded-lg ${ee(s.type)}`,children:M(s.type)}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:486:23",className:"flex-1 min-w-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:487:25",className:"text-sm font-medium text-slate-200 truncate",children:s.name}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:488:25",className:"text-xs text-slate-500",children:[de[s.type]||s.type,X(s.id)?" · 自定义":""]})]})]},s.id))})})]})})]}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:500:7",open:!!r,onOpenChange:()=>N(null),children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:501:9",className:"bg-slate-900 border-slate-800 max-w-lg",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:502:11",children:[e.jsxs(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:503:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:504:15",className:`p-2 rounded-lg ${ee(r?.type||"server")}`,children:r&&M(r.type)}),r?.name,r&&X(r.id)&&e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:506:65",variant:"outline",className:"border-amber-500/30 text-amber-400 text-xs",children:"自定义"})]}),e.jsxs(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:508:13",className:"text-slate-500",children:["类型: ",de[r?.type||""]||r?.type]})]}),r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:511:13",className:"space-y-4",children:[Ue(r),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:513:15",children:[e.jsx("h4",{"code-path":"src/components/kubernetes/TopologyView.tsx:514:17",className:"text-sm font-medium text-slate-300 mb-2",children:"关联连接"}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:515:17",className:"space-y-2",children:[l.edges.filter(s=>s.source===r.id||s.target===r.id).map(s=>{const n=s.source===r.id,t=l.nodes.find(a=>a.id===(n?s.target:s.source));return t?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:521:23",className:"flex items-center gap-2 p-2 rounded-lg bg-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:522:25",className:"text-sm text-slate-400",children:n?"→":"←"}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:523:25",className:`p-1 rounded ${ee(t.type)}`,children:M(t.type,"h-4 w-4")}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:524:25",className:"text-sm text-slate-300",children:t.name}),e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:525:25",variant:"outline",className:"ml-auto border-slate-700 text-slate-400 text-xs",children:s.label})]},s.id):null}),l.edges.filter(s=>s.source===r.id||s.target===r.id).length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:529:127",className:"text-xs text-slate-600",children:"无关联连接"})]})]}),y&&r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:534:17",className:"flex gap-2 pt-2 border-t border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:535:19",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:()=>ye(r),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:536:21",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),X(r.id)&&e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:539:21",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>Pe(r),children:[e.jsx(ps,{"code-path":"src/components/kubernetes/TopologyView.tsx:540:23",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]})}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:551:7",open:De,onOpenChange:Q,children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:552:9",className:"bg-slate-900 border-slate-800 max-w-md",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:553:11",children:[e.jsx(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:554:13",className:"text-slate-100",children:U?"编辑节点":"添加自定义节点"}),e.jsx(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:555:13",className:"text-slate-500",children:U?"修改节点属性":"添加数据库、外部服务等非 Kubernetes 资源节点"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:557:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:558:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:559:15",className:"text-slate-300",children:"名称"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:560:15",value:w.name,onChange:s=>F({...w,name:s.target.value}),placeholder:"如 MySQL 主库、Redis 集群",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:563:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:564:15",className:"text-slate-300",children:"类型"}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:565:15",value:w.type,onValueChange:s=>F({...w,type:s}),children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:92"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:567:17",className:"bg-slate-800 border-slate-700",children:ms.map(s=>e.jsxs(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:568:49",value:s.value,children:[s.label," — ",s.desc]},s.value))})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:572:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:573:15",className:"text-slate-300",children:"备注"}),e.jsx(qe,{"code-path":"src/components/kubernetes/TopologyView.tsx:574:15",value:w.note,onChange:s=>F({...w,note:s.target.value}),placeholder:"连接信息、用途说明等",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 resize-none"})]})]}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/TopologyView.tsx:578:11",children:[e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:579:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Q(!1),children:"取消"}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:580:13",onClick:Oe,children:U?"保存":"添加"})]})]})})]})}export{Ns as TopologyView}; diff --git a/backend/static/assets/TraceManager-CWjCmm6P.js b/backend/static/assets/TraceManager-JbMTFm_u.js similarity index 98% rename from backend/static/assets/TraceManager-CWjCmm6P.js rename to backend/static/assets/TraceManager-JbMTFm_u.js index d8a376b..eba0ae8 100644 --- a/backend/static/assets/TraceManager-CWjCmm6P.js +++ b/backend/static/assets/TraceManager-JbMTFm_u.js @@ -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/monitor/trace/TraceManager.tsx:234:13",className:"font-medium truncate",children:a.operationName}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:235:13",className:"text-xs text-muted-foreground",children:a.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:238:11",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:239:13",className:"w-32 h-4 bg-muted rounded overflow-hidden",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:240:15",className:`h-full ${ie(a.status)}`,style:{width:`${Math.max(x,1)}%`}})}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:245:13",className:"text-sm text-muted-foreground w-20 text-right",children:d(a.duration)}),a.status==="error"&&e.jsx(Ie,{"code-path":"src/components/monitor/trace/TraceManager.tsx:248:41",className:"w-4 h-4 text-red-500"})]})]}),c&&a.children?.map(T=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:253:11",span:T,level:t+1,totalDuration:i},T.spanId))]})};return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:260:5",className:"space-y-6",children:[e.jsx(ge,{"code-path":"src/components/monitor/trace/TraceManager.tsx:262:7",items:[{label:"总请求",value:p.reduce((a,t)=>a+t.requestCount,0).toLocaleString(),color:"blue"},{label:"错误率",value:`${(p.reduce((a,t)=>a+t.errorRate,0)/(p.length||1)).toFixed(2)}%`,color:"red"},{label:"平均延迟",value:d(p.reduce((a,t)=>a+t.avgDuration,0)/(p.length||1)),color:"amber"},{label:"服务数",value:p.length,color:"purple"}]}),e.jsxs(ue,{"code-path":"src/components/monitor/trace/TraceManager.tsx:271:7",value:ee,onValueChange:ae,children:[e.jsxs(Te,{"code-path":"src/components/monitor/trace/TraceManager.tsx:272:9",className:"grid w-full grid-cols-3 lg:w-[400px]",children:[e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:273:11",value:"traces",children:"链路追踪"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:274:11",value:"services",children:"服务拓扑"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:275:11",value:"metrics",children:"性能指标"})]}),e.jsxs(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:278:9",value:"traces",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:280:11",className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:281:13",className:"flex items-center gap-2 flex-1 min-w-[400px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:282:15",className:"relative flex-1",children:[e.jsx(je,{"code-path":"src/components/monitor/trace/TraceManager.tsx:283:17",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(he,{"code-path":"src/components/monitor/trace/TraceManager.tsx:284:17",placeholder:"搜索Trace ID、操作名...",value:f,onChange:a=>Z(a.target.value),className:"pl-10"})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:291:15",value:l,onValueChange:W,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:292:17",className:"w-[150px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:293:19",placeholder:"服务"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:295:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:296:19",value:"all",children:"全部服务"}),pe.map(a=>e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:298:21",value:a,children:a},a))]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:302:15",value:h,onValueChange:Y,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:303:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:304:19",placeholder:"状态"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:306:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:307:19",value:"all",children:"全部状态"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:308:19",value:"success",children:"成功"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:309:19",value:"error",children:"错误"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:310:19",value:"pending",children:"进行中"})]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:313:15",value:g,onValueChange:_,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:314:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:315:19"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:317:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:318:19",value:"15m",children:"15分钟"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:319:19",value:"1h",children:"1小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:320:19",value:"6h",children:"6小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:321:19",value:"24h",children:"24小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:322:19",value:"7d",children:"7天"})]})]})]}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:326:13",className:"flex items-center gap-2",children:e.jsxs(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:327:15",variant:"outline",onClick:P,children:[e.jsx(Me,{"code-path":"src/components/monitor/trace/TraceManager.tsx:328:17",className:"w-4 h-4 mr-2"}),"刷新"]})})]}),e.jsx(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:335:11",children:e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:336:13",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:337:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:338:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:339:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:340:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:341:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Trace ID"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:342:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务 / 操作"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:343:23",className:"px-4 py-3 text-left text-sm font-medium",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:344:23",className:"px-4 py-3 text-left text-sm font-medium",children:"耗时"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:345:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Span数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:346:23",className:"px-4 py-3 text-left text-sm font-medium",children:"时间"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:347:23",className:"px-4 py-3 text-left text-sm font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:350:19",className:"divide-y",children:X?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:352:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:353:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"加载中..."})}):V.length===0?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:356:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:357:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"暂无链路数据"})}):V.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:361:25",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:362:27",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:363:29",className:"font-mono text-sm text-blue-500",children:[a.traceId.slice(0,16),"..."]})}),e.jsxs("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:365:27",className:"px-4 py-3",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:366:29",className:"font-medium",children:a.operationName}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:367:29",className:"text-sm text-muted-foreground",children:a.serviceName})]}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:369:27",className:"px-4 py-3",children:v(a.status)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:370:27",className:"px-4 py-3 text-sm",children:d(a.duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:371:27",className:"px-4 py-3 text-sm",children:a.spanCount}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:372:27",className:"px-4 py-3 text-sm text-muted-foreground",children:a.startTime}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:373:27",className:"px-4 py-3",children:e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:374:29",variant:"ghost",size:"sm",onClick:async()=>{const t=await me(a.traceId);t&&(te({...a,spans:t.spans}),$(!0))},children:e.jsx(Ne,{"code-path":"src/components/monitor/trace/TraceManager.tsx:385:31",className:"w-4 h-4"})})})]},a.id))})]})})})})]}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:398:9",value:"services",className:"space-y-4",children:e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:399:11",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:400:13",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:401:15",children:"服务性能概览"})}),e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:403:13",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:404:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:405:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:406:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:407:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:408:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务名称"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:409:23",className:"px-4 py-3 text-left text-sm font-medium",children:"请求数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:410:23",className:"px-4 py-3 text-left text-sm font-medium",children:"错误率"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:411:23",className:"px-4 py-3 text-left text-sm font-medium",children:"平均延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:412:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P95延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:413:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P99延迟"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:416:19",className:"divide-y",children:p.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:418:23",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:419:25",className:"px-4 py-3 font-medium",children:a.serviceName}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:420:25",className:"px-4 py-3",children:a.requestCount.toLocaleString()}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:421:25",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:422:27",className:a.errorRate>1?"text-red-500":"text-green-500",children:[a.errorRate.toFixed(2),"%"]})}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:426:25",className:"px-4 py-3",children:d(a.avgDuration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:427:25",className:"px-4 py-3",children:d(a.p95Duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:428:25",className:"px-4 py-3",children:d(a.p99Duration)})]},a.serviceName))})]})})})]})}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:438:9",value:"metrics",className:"space-y-4",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:439:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:440:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:441:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:442:17",children:"延迟分布"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:444:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:445:17",className:"w-16 h-16 mr-4"}),"延迟分布图表(集成图表库后显示)"]})]}),e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:449:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:450:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:451:17",children:"错误率趋势"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:453:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:454:17",className:"w-16 h-16 mr-4"}),"错误率趋势图表(集成图表库后显示)"]})]})]})})]}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:463:7",open:ce,onOpenChange:$,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:464:9",className:"max-w-6xl max-h-[90vh]",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:465:11",children:[e.jsxs(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:466:13",className:"flex items-center gap-2",children:[e.jsx(ye,{"code-path":"src/components/monitor/trace/TraceManager.tsx:467:15",className:"w-5 h-5"}),"Trace详情",e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:469:15",className:"font-mono text-sm text-muted-foreground",children:m?.traceId})]}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:471:13",className:"sr-only",children:"描述"})]}),m&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:474:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:475:15",className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:476:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:477:19",className:"text-xs text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:478:19",className:"font-medium",children:m.serviceName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:480:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:481:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:482:19",className:"text-xs text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:483:19",className:"font-medium",children:m.operationName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:485:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:486:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:487:19",className:"text-xs text-muted-foreground",children:"总耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:488:19",className:"font-medium",children:d(m.duration)})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:490:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:491:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:492:19",className:"text-xs text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:493:19",children:v(m.status)})]})]}),e.jsx(le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:497:15",className:"h-[500px]",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:498:17",className:"border rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:499:19",className:"flex items-center px-4 py-2 bg-muted/50 border-b text-sm font-medium",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:500:21",className:"flex-1",children:"Span名称"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:501:21",className:"w-32",children:"时间线"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:502:21",className:"w-20 text-right",children:"耗时"})]}),m.spans&&xe(m.spans).map(a=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:506:21",span:a,level:0,totalDuration:m.duration},a.spanId))]})})]})]})}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:516:7",open:se,onOpenChange:A,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:517:9",className:"max-w-2xl",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:518:11",children:[e.jsx(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:519:13",children:"Span详情"}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:520:13",className:"sr-only",children:"描述"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:523:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:524:15",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:525:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:526:19",className:"text-muted-foreground",children:"Span ID"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:527:19",className:"font-mono text-sm",children:o.spanId})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:529:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:530:19",className:"text-muted-foreground",children:"类型"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:531:19",className:"capitalize",children:o.kind})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:533:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:534:19",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:535:19",className:"font-medium",children:o.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:537:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:538:19",className:"text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:539:19",className:"font-medium",children:o.operationName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:541:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:542:19",className:"text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:543:19",children:v(o.status)})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:545:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:546:19",className:"text-muted-foreground",children:"耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:547:19",className:"font-medium",children:d(o.duration)})]})]}),Object.keys(o.tags).length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:552:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:553:19",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:554:19",className:"mt-1 p-3 bg-muted rounded-lg",children:Object.entries(o.tags).map(([a,t])=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:556:23",className:"flex justify-between text-sm py-1",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:557:25",className:"text-muted-foreground",children:a}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:558:25",className:"font-mono",children:t})]},a))})]}),o.logs?.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:566:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:567:19",className:"text-muted-foreground",children:"日志"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:568:19",className:"mt-1 space-y-2",children:o.logs.map((a,t)=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:570:23",className:"p-2 bg-muted rounded text-sm",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:571:25",className:"text-muted-foreground",children:a.timestamp}),e.jsx("pre",{"code-path":"src/components/monitor/trace/TraceManager.tsx:572:25",className:"mt-1 text-xs",children:JSON.stringify(a.fields,null,2)})]},t))})]})]})]})})]})};export{Ke as default}; +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/monitor/trace/TraceManager.tsx:234:13",className:"font-medium truncate",children:a.operationName}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:235:13",className:"text-xs text-muted-foreground",children:a.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:238:11",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:239:13",className:"w-32 h-4 bg-muted rounded overflow-hidden",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:240:15",className:`h-full ${ie(a.status)}`,style:{width:`${Math.max(x,1)}%`}})}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:245:13",className:"text-sm text-muted-foreground w-20 text-right",children:d(a.duration)}),a.status==="error"&&e.jsx(Ie,{"code-path":"src/components/monitor/trace/TraceManager.tsx:248:41",className:"w-4 h-4 text-red-500"})]})]}),c&&a.children?.map(T=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:253:11",span:T,level:t+1,totalDuration:i},T.spanId))]})};return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:260:5",className:"space-y-6",children:[e.jsx(ge,{"code-path":"src/components/monitor/trace/TraceManager.tsx:262:7",items:[{label:"总请求",value:p.reduce((a,t)=>a+t.requestCount,0).toLocaleString(),color:"blue"},{label:"错误率",value:`${(p.reduce((a,t)=>a+t.errorRate,0)/(p.length||1)).toFixed(2)}%`,color:"red"},{label:"平均延迟",value:d(p.reduce((a,t)=>a+t.avgDuration,0)/(p.length||1)),color:"amber"},{label:"服务数",value:p.length,color:"purple"}]}),e.jsxs(ue,{"code-path":"src/components/monitor/trace/TraceManager.tsx:271:7",value:ee,onValueChange:ae,children:[e.jsxs(Te,{"code-path":"src/components/monitor/trace/TraceManager.tsx:272:9",className:"grid w-full grid-cols-3 lg:w-[400px]",children:[e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:273:11",value:"traces",children:"链路追踪"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:274:11",value:"services",children:"服务拓扑"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:275:11",value:"metrics",children:"性能指标"})]}),e.jsxs(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:278:9",value:"traces",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:280:11",className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:281:13",className:"flex items-center gap-2 flex-1 min-w-[400px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:282:15",className:"relative flex-1",children:[e.jsx(je,{"code-path":"src/components/monitor/trace/TraceManager.tsx:283:17",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(he,{"code-path":"src/components/monitor/trace/TraceManager.tsx:284:17",placeholder:"搜索Trace ID、操作名...",value:f,onChange:a=>Z(a.target.value),className:"pl-10"})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:291:15",value:l,onValueChange:W,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:292:17",className:"w-[150px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:293:19",placeholder:"服务"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:295:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:296:19",value:"all",children:"全部服务"}),pe.map(a=>e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:298:21",value:a,children:a},a))]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:302:15",value:h,onValueChange:Y,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:303:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:304:19",placeholder:"状态"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:306:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:307:19",value:"all",children:"全部状态"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:308:19",value:"success",children:"成功"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:309:19",value:"error",children:"错误"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:310:19",value:"pending",children:"进行中"})]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:313:15",value:g,onValueChange:_,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:314:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:315:19"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:317:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:318:19",value:"15m",children:"15分钟"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:319:19",value:"1h",children:"1小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:320:19",value:"6h",children:"6小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:321:19",value:"24h",children:"24小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:322:19",value:"7d",children:"7天"})]})]})]}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:326:13",className:"flex items-center gap-2",children:e.jsxs(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:327:15",variant:"outline",onClick:P,children:[e.jsx(Me,{"code-path":"src/components/monitor/trace/TraceManager.tsx:328:17",className:"w-4 h-4 mr-2"}),"刷新"]})})]}),e.jsx(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:335:11",children:e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:336:13",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:337:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:338:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:339:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:340:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:341:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Trace ID"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:342:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务 / 操作"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:343:23",className:"px-4 py-3 text-left text-sm font-medium",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:344:23",className:"px-4 py-3 text-left text-sm font-medium",children:"耗时"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:345:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Span数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:346:23",className:"px-4 py-3 text-left text-sm font-medium",children:"时间"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:347:23",className:"px-4 py-3 text-left text-sm font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:350:19",className:"divide-y",children:X?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:352:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:353:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"加载中..."})}):V.length===0?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:356:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:357:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"暂无链路数据"})}):V.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:361:25",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:362:27",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:363:29",className:"font-mono text-sm text-blue-500",children:[a.traceId.slice(0,16),"..."]})}),e.jsxs("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:365:27",className:"px-4 py-3",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:366:29",className:"font-medium",children:a.operationName}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:367:29",className:"text-sm text-muted-foreground",children:a.serviceName})]}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:369:27",className:"px-4 py-3",children:v(a.status)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:370:27",className:"px-4 py-3 text-sm",children:d(a.duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:371:27",className:"px-4 py-3 text-sm",children:a.spanCount}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:372:27",className:"px-4 py-3 text-sm text-muted-foreground",children:a.startTime}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:373:27",className:"px-4 py-3",children:e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:374:29",variant:"ghost",size:"sm",onClick:async()=>{const t=await me(a.traceId);t&&(te({...a,spans:t.spans}),$(!0))},children:e.jsx(Ne,{"code-path":"src/components/monitor/trace/TraceManager.tsx:385:31",className:"w-4 h-4"})})})]},a.id))})]})})})})]}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:398:9",value:"services",className:"space-y-4",children:e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:399:11",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:400:13",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:401:15",children:"服务性能概览"})}),e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:403:13",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:404:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:405:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:406:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:407:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:408:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务名称"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:409:23",className:"px-4 py-3 text-left text-sm font-medium",children:"请求数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:410:23",className:"px-4 py-3 text-left text-sm font-medium",children:"错误率"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:411:23",className:"px-4 py-3 text-left text-sm font-medium",children:"平均延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:412:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P95延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:413:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P99延迟"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:416:19",className:"divide-y",children:p.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:418:23",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:419:25",className:"px-4 py-3 font-medium",children:a.serviceName}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:420:25",className:"px-4 py-3",children:a.requestCount.toLocaleString()}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:421:25",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:422:27",className:a.errorRate>1?"text-red-500":"text-green-500",children:[a.errorRate.toFixed(2),"%"]})}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:426:25",className:"px-4 py-3",children:d(a.avgDuration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:427:25",className:"px-4 py-3",children:d(a.p95Duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:428:25",className:"px-4 py-3",children:d(a.p99Duration)})]},a.serviceName))})]})})})]})}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:438:9",value:"metrics",className:"space-y-4",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:439:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:440:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:441:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:442:17",children:"延迟分布"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:444:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:445:17",className:"w-16 h-16 mr-4"}),"延迟分布图表(集成图表库后显示)"]})]}),e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:449:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:450:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:451:17",children:"错误率趋势"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:453:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:454:17",className:"w-16 h-16 mr-4"}),"错误率趋势图表(集成图表库后显示)"]})]})]})})]}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:463:7",open:ce,onOpenChange:$,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:464:9",className:"max-w-6xl max-h-[90vh]",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:465:11",children:[e.jsxs(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:466:13",className:"flex items-center gap-2",children:[e.jsx(ye,{"code-path":"src/components/monitor/trace/TraceManager.tsx:467:15",className:"w-5 h-5"}),"Trace详情",e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:469:15",className:"font-mono text-sm text-muted-foreground",children:m?.traceId})]}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:471:13",className:"sr-only",children:"描述"})]}),m&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:474:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:475:15",className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:476:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:477:19",className:"text-xs text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:478:19",className:"font-medium",children:m.serviceName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:480:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:481:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:482:19",className:"text-xs text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:483:19",className:"font-medium",children:m.operationName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:485:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:486:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:487:19",className:"text-xs text-muted-foreground",children:"总耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:488:19",className:"font-medium",children:d(m.duration)})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:490:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:491:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:492:19",className:"text-xs text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:493:19",children:v(m.status)})]})]}),e.jsx(le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:497:15",className:"h-[500px]",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:498:17",className:"border rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:499:19",className:"flex items-center px-4 py-2 bg-muted/50 border-b text-sm font-medium",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:500:21",className:"flex-1",children:"Span名称"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:501:21",className:"w-32",children:"时间线"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:502:21",className:"w-20 text-right",children:"耗时"})]}),m.spans&&xe(m.spans).map(a=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:506:21",span:a,level:0,totalDuration:m.duration},a.spanId))]})})]})]})}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:516:7",open:se,onOpenChange:A,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:517:9",className:"max-w-2xl",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:518:11",children:[e.jsx(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:519:13",children:"Span详情"}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:520:13",className:"sr-only",children:"描述"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:523:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:524:15",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:525:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:526:19",className:"text-muted-foreground",children:"Span ID"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:527:19",className:"font-mono text-sm",children:o.spanId})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:529:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:530:19",className:"text-muted-foreground",children:"类型"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:531:19",className:"capitalize",children:o.kind})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:533:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:534:19",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:535:19",className:"font-medium",children:o.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:537:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:538:19",className:"text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:539:19",className:"font-medium",children:o.operationName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:541:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:542:19",className:"text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:543:19",children:v(o.status)})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:545:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:546:19",className:"text-muted-foreground",children:"耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:547:19",className:"font-medium",children:d(o.duration)})]})]}),Object.keys(o.tags).length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:552:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:553:19",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:554:19",className:"mt-1 p-3 bg-muted rounded-lg",children:Object.entries(o.tags).map(([a,t])=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:556:23",className:"flex justify-between text-sm py-1",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:557:25",className:"text-muted-foreground",children:a}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:558:25",className:"font-mono",children:t})]},a))})]}),o.logs?.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:566:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:567:19",className:"text-muted-foreground",children:"日志"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:568:19",className:"mt-1 space-y-2",children:o.logs.map((a,t)=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:570:23",className:"p-2 bg-muted rounded text-sm",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:571:25",className:"text-muted-foreground",children:a.timestamp}),e.jsx("pre",{"code-path":"src/components/monitor/trace/TraceManager.tsx:572:25",className:"mt-1 text-xs",children:JSON.stringify(a.fields,null,2)})]},t))})]})]})]})})]})};export{Ke as default}; diff --git a/backend/static/assets/UserGroupsManager-UM46GMcV.js b/backend/static/assets/UserGroupsManager-CjYJT4qh.js similarity index 97% rename from backend/static/assets/UserGroupsManager-UM46GMcV.js rename to backend/static/assets/UserGroupsManager-CjYJT4qh.js index 41877f4..8b3fb30 100644 --- a/backend/static/assets/UserGroupsManager-UM46GMcV.js +++ b/backend/static/assets/UserGroupsManager-CjYJT4qh.js @@ -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:114:17",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:115:19",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{M(s.id),m(s.name),h(s.description||""),p(!0)},children:e.jsx(X,{"code-path":"src/components/deploy/UserGroupsManager.tsx:116:21",className:"w-4 h-4"})}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:118:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>L(s),children:e.jsx(_,{"code-path":"src/components/deploy/UserGroupsManager.tsx:119:21",className:"w-4 h-4"})})]})]}),S[s.id]&&e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:125:17",className:"border-t border-[var(--dg-border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:127:19",className:"flex items-end gap-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:21",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:55",className:"text-xs",children:"添加用户"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:129:23",value:f[s.id]||"",onChange:r=>N(d=>({...d,[s.id]:r.target.value})),placeholder:"输入用户名",className:"h-8 text-sm",onKeyDown:r=>r.key==="Enter"&&b(s.id)})]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:21",size:"sm",className:"h-8",onClick:()=>b(s.id),children:[e.jsx(q,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:93",className:"w-3.5 h-3.5 mr-1"}),"添加"]})]}),(s.members||[]).length===0?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:135:21",className:"text-xs text-[var(--dg-text-secondary)] py-2",children:"暂无成员"}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:137:21",className:"flex flex-wrap gap-2",children:(s.members||[]).map(r=>e.jsxs(I,{"code-path":"src/components/deploy/UserGroupsManager.tsx:139:25",variant:"secondary",className:"flex items-center gap-1 pl-2 pr-1 py-1.5",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:140:27",className:"w-3 h-3"}),r.username,e.jsx("button",{"code-path":"src/components/deploy/UserGroupsManager.tsx:141:27",className:"ml-1 hover:text-red-400",onClick:()=>B(s.id,r.id,r.username),children:e.jsx(J,{"code-path":"src/components/deploy/UserGroupsManager.tsx:142:29",className:"w-3 h-3"})})]},r.id))})]})]},s.id))}),e.jsx(F,{"code-path":"src/components/deploy/UserGroupsManager.tsx:156:7",open:E,onOpenChange:p,children:e.jsxs(O,{"code-path":"src/components/deploy/UserGroupsManager.tsx:157:9",children:[e.jsx(T,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:11",children:e.jsx(A,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:25",children:l?"编辑用户组":"新建用户组"})}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:159:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:40",children:"组名"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:57",value:i,onChange:s=>m(s.target.value),placeholder:"例如: 后端开发组"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:40",children:"描述"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:57",value:x,onChange:s=>h(s.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:163:11",className:"flex justify-end gap-2 mt-4 pt-4 border-t",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:164:13",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:165:13",onClick:z,disabled:U,children:U?"...":"保存"})]})]})})]})}export{oe as default}; +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:114:17",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:115:19",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{M(s.id),m(s.name),h(s.description||""),p(!0)},children:e.jsx(X,{"code-path":"src/components/deploy/UserGroupsManager.tsx:116:21",className:"w-4 h-4"})}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:118:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>L(s),children:e.jsx(_,{"code-path":"src/components/deploy/UserGroupsManager.tsx:119:21",className:"w-4 h-4"})})]})]}),S[s.id]&&e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:125:17",className:"border-t border-[var(--dg-border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:127:19",className:"flex items-end gap-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:21",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:55",className:"text-xs",children:"添加用户"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:129:23",value:f[s.id]||"",onChange:r=>N(d=>({...d,[s.id]:r.target.value})),placeholder:"输入用户名",className:"h-8 text-sm",onKeyDown:r=>r.key==="Enter"&&b(s.id)})]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:21",size:"sm",className:"h-8",onClick:()=>b(s.id),children:[e.jsx(q,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:93",className:"w-3.5 h-3.5 mr-1"}),"添加"]})]}),(s.members||[]).length===0?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:135:21",className:"text-xs text-[var(--dg-text-secondary)] py-2",children:"暂无成员"}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:137:21",className:"flex flex-wrap gap-2",children:(s.members||[]).map(r=>e.jsxs(I,{"code-path":"src/components/deploy/UserGroupsManager.tsx:139:25",variant:"secondary",className:"flex items-center gap-1 pl-2 pr-1 py-1.5",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:140:27",className:"w-3 h-3"}),r.username,e.jsx("button",{"code-path":"src/components/deploy/UserGroupsManager.tsx:141:27",className:"ml-1 hover:text-red-400",onClick:()=>B(s.id,r.id,r.username),children:e.jsx(J,{"code-path":"src/components/deploy/UserGroupsManager.tsx:142:29",className:"w-3 h-3"})})]},r.id))})]})]},s.id))}),e.jsx(F,{"code-path":"src/components/deploy/UserGroupsManager.tsx:156:7",open:E,onOpenChange:p,children:e.jsxs(O,{"code-path":"src/components/deploy/UserGroupsManager.tsx:157:9",children:[e.jsx(T,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:11",children:e.jsx(A,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:25",children:l?"编辑用户组":"新建用户组"})}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:159:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:40",children:"组名"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:57",value:i,onChange:s=>m(s.target.value),placeholder:"例如: 后端开发组"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:40",children:"描述"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:57",value:x,onChange:s=>h(s.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:163:11",className:"flex justify-end gap-2 mt-4 pt-4 border-t",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:164:13",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:165:13",onClick:z,disabled:U,children:U?"...":"保存"})]})]})})]})}export{oe as default}; diff --git a/backend/static/assets/WorkloadViewPage-B53qfPO6.js b/backend/static/assets/WorkloadViewPage-DSiv67B6.js similarity index 98% rename from backend/static/assets/WorkloadViewPage-B53qfPO6.js rename to backend/static/assets/WorkloadViewPage-DSiv67B6.js index 5b9e62b..54048bb 100644 --- a/backend/static/assets/WorkloadViewPage-B53qfPO6.js +++ b/backend/static/assets/WorkloadViewPage-DSiv67B6.js @@ -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:197:11",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:198:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:199:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:200:15",className:"text-lg font-bold text-slate-100",children:l}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:201:15",variant:"outline",className:"border-slate-700 text-slate-400",children:p}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-400",children:r}),z?e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:204:19",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"健康"}):e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:205:19",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:"更新中"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:207:13",className:"text-xs text-slate-500 mt-0.5",children:["集群: ",n]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:210:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:212:11",className:"flex items-center gap-1 bg-slate-900 border border-slate-800 rounded-lg p-0.5",children:[e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:213:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="view"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:217:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="yaml"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("yaml"),children:"YAML"})]}),g&&e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:224:13",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>{F(B),L(!0)},children:[e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:226:15",className:"h-3.5 w-3.5 mr-1"}),"伸缩"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:229:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",disabled:$,onClick:Pe,children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:231:13",className:"h-3.5 w-3.5 mr-1"}),$?"重启中...":"重启"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:233:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>G(!0),children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:235:13",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})]}),ge?e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:241:9",className:"text-center text-slate-500 py-20",children:"加载中..."}):T==="yaml"?e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:243:9",className:"bg-slate-900 border-slate-800",children:e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:244:11",className:"p-4",children:e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:245:13",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>{},inline:!0,autoEdit:!0})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:259:11",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:262:17",label:"副本就绪",value:`${ee}/${B}`,color:z?w.green:w.orange,sub:z?"全部就绪":"部分未就绪"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:263:17",label:"当前副本",value:We,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:264:17",label:"已更新副本",value:Ne,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:265:17",label:"服务名",value:k.serviceName||"-",color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:266:17",label:"Pod 数量",value:R.length,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:271:17",label:"期望调度",value:H,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:272:17",label:"当前调度",value:fe,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:273:17",label:"就绪数量",value:se,color:z?w.green:w.orange}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:274:17",label:"可用数量",value:ve,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:275:17",label:"已更新",value:ye,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:282:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:283:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:284:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:285:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:286:19",className:"h-4 w-4 text-amber-400"}),"更新策略"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:289:15",className:"pt-0 space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:290:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:291:19",className:"text-slate-500",children:"策略类型"}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:292:19",variant:"outline",className:"border-slate-700 text-slate-300",children:Y})]}),Y==="RollingUpdate"&&g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:296:21",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:297:23",className:"text-slate-500",children:"分区 (partition)"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:298:23",className:"text-slate-300 font-mono",children:a.rollingUpdate.partition??0})]}),a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:301:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:302:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:303:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]})]}),Y==="RollingUpdate"&&!g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:311:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:312:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:313:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]}),a.rollingUpdate.maxSurge&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:317:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:318:25",className:"text-slate-500",children:"最大 surge"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:319:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxSurge=="object"?JSON.stringify(a.rollingUpdate.maxSurge):a.rollingUpdate.maxSurge})]})]}),g&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:325:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:326:21",className:"text-slate-500",children:"Pod 管理策略"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:327:21",className:"text-slate-300 font-mono",children:k.podManagementPolicy||"OrderedReady"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:330:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:331:19",className:"text-slate-500",children:"修订历史限制"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:332:19",className:"text-slate-300 font-mono",children:k.revisionHistoryLimit??10})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:337:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:338:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:339:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:340:19",className:"h-4 w-4 text-purple-400"}),"选择器与标签"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:343:15",className:"pt-0 space-y-3 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:344:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:345:19",className:"text-slate-500 mb-1.5",children:"Selector (matchLabels)"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:346:19",labels:Se})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:348:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:349:19",className:"text-slate-500 mb-1.5",children:"Labels"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:350:19",labels:Ce})]}),Object.keys(ae).length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:353:19",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:354:21",className:"text-slate-500 mb-1.5",children:"Annotations"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:355:21",className:"flex flex-wrap gap-1.5",children:Object.entries(ae).slice(0,8).map(([s,o])=>e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:357:25",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px] font-mono max-w-[300px] truncate",children:s},s))})]})]})]})]}),g&&te.length>0&&e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:370:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:371:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:372:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:373:19",className:"h-4 w-4 text-cyan-400"}),"存储卷声明模板 (VolumeClaimTemplates)"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:376:15",className:"pt-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:377:17",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:378:19",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:379:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:380:23",className:"text-slate-400",children:"名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:381:23",className:"text-slate-400",children:"访问模式"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:382:23",className:"text-slate-400",children:"存储类"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:383:23",className:"text-slate-400",children:"大小"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:386:19",children:te.map((s,o)=>{const f=(s.spec?.accessModes||[]).join(", "),oe=s.spec?.storageClassName||s.spec?.storageClassName||"-",E=s.spec?.resources?.requests?.storage||"-";return e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:392:25",className:"border-slate-800",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:393:27",className:"font-medium text-slate-200",children:s.metadata?.name||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:394:27",className:"text-sm text-slate-400",children:f||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:395:27",className:"text-sm text-slate-400",children:oe}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:396:27",className:"text-sm text-slate-300 font-mono",children:E})]},o)})})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:407:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:408:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:409:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:410:17",className:"h-4 w-4 text-blue-400"}),"容器模板(Pod Template)"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:413:13",className:"pt-0",children:[Z.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:415:17",className:"mb-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:416:19",className:"text-[11px] text-slate-500 mb-2 uppercase tracking-wide",children:"Init Containers"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:417:19",className:"space-y-2",children:Z.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:419:23",c:s},`init-${o}`))})]}),X.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:425:17",className:"text-xs text-slate-500 py-3",children:"暂无容器数据,请查看 YAML"}):e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:427:17",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:428:19",className:"text-[11px] text-slate-500 mb-1 uppercase tracking-wide",children:"Containers"}),X.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:430:21",c:s},o))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:438:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:439:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:440:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ye,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:441:17",className:"h-4 w-4 text-emerald-400"}),"Pod 实例 (",R.length,")"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:444:13",className:"p-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:445:15",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:446:17",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:447:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:448:21",className:"text-slate-400",children:"Pod 名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:449:21",className:"text-slate-400",children:"状态"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:450:21",className:"text-slate-400",children:"所在节点"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:451:21",className:"text-slate-400",children:"Pod IP"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:452:21",className:"text-slate-400",children:"重启"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:453:21",className:"text-slate-400",children:"操作"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:456:17",children:R.length===0?e.jsx(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:21",children:e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:31",colSpan:6,className:"text-center text-slate-500 py-8",children:"暂无 Pod"})}):R.map(s=>e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:460:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:461:23",className:"font-medium text-slate-200",children:s.name}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:462:23",children:e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:463:25",style:{background:`${q(s.status)}22`,color:q(s.status),border:`1px solid ${q(s.status)}44`},children:s.status||"Unknown"})}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:467:23",className:"text-sm text-slate-400",children:s.node_name||s.node||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:468:23",className:"text-sm text-slate-400 font-mono",children:s.ip||s.pod_ip||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:469:23",className:(s.restart_count||0)>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:470:23",children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:471:25",className:"flex items-center gap-1",children:[e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:472:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",onClick:()=>J(s),children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:474:29",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:476:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",onClick:()=>K(s),children:[e.jsx(qe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:478:29",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]})]})})]},s.name))})]})})]})]}),we&&e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:493:9",className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>L(!1),children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:494:11",className:"bg-slate-900 border border-slate-800 rounded-lg p-6 w-80",onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:495:13",className:"text-sm font-semibold text-slate-200 mb-4",children:"伸缩 StatefulSet"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:496:13",className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:497:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(Math.max(0,v-1)),children:e.jsx(Ie,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:498:17",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:500:15",className:"text-2xl font-bold text-slate-100 w-12 text-center",children:v}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:501:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(v+1),children:e.jsx(Je,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:502:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:505:13",className:"flex gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:506:15",variant:"outline",size:"sm",className:"flex-1 border-slate-700 text-slate-400",onClick:()=>L(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:507:15",size:"sm",className:"flex-1 bg-blue-600 hover:bg-blue-500",disabled:$,onClick:Ve,children:$?"执行中...":"确认"})]})]})}),je&&e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:517:9",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>G(!1)}),_&&e.jsx(Me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:528:9",open:!0,onOpenChange:s=>{s||J(null)},clusterId:n,namespace:r,podName:_.name,containers:_.containers?.map(s=>s.name).filter(Boolean)||[]}),D&&e.jsx(Be,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:540:9",open:!0,onOpenChange:s=>{s||K(null)},clusterCode:n,namespace:r,podName:D.name,containers:D.containers?.map(s=>s.name).filter(Boolean)||[]})]})}function me({c:t}){return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:556:5",className:"border border-slate-800 rounded-lg p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:557:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:558:9",className:"flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:559:11",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:560:11",className:"text-sm font-semibold text-slate-200",children:t.name})]}),e.jsx("code",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:562:9",className:"text-[11px] text-slate-400 font-mono truncate max-w-[400px]",children:t.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:564:7",className:"grid grid-cols-2 md:grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:565:9",className:"text-slate-400",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:566:16",className:"text-slate-200 font-mono",children:[t.resources?.requests?.cpu||"-","/",t.resources?.limits?.cpu||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:568:9",className:"text-slate-400",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:569:15",className:"text-slate-200 font-mono",children:[t.resources?.requests?.memory||"-","/",t.resources?.limits?.memory||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:571:9",className:"text-slate-400",children:["端口: ",e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:572:15",className:"text-slate-200 font-mono",children:(t.ports||[]).map(x=>x.containerPort||x.port).join(", ")||"-"})]})]})]})}export{cs as default}; +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:197:11",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:198:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:199:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:200:15",className:"text-lg font-bold text-slate-100",children:l}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:201:15",variant:"outline",className:"border-slate-700 text-slate-400",children:p}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-400",children:r}),z?e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:204:19",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"健康"}):e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:205:19",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:"更新中"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:207:13",className:"text-xs text-slate-500 mt-0.5",children:["集群: ",n]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:210:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:212:11",className:"flex items-center gap-1 bg-slate-900 border border-slate-800 rounded-lg p-0.5",children:[e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:213:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="view"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:217:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="yaml"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("yaml"),children:"YAML"})]}),g&&e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:224:13",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>{F(B),L(!0)},children:[e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:226:15",className:"h-3.5 w-3.5 mr-1"}),"伸缩"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:229:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",disabled:$,onClick:Pe,children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:231:13",className:"h-3.5 w-3.5 mr-1"}),$?"重启中...":"重启"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:233:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>G(!0),children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:235:13",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})]}),ge?e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:241:9",className:"text-center text-slate-500 py-20",children:"加载中..."}):T==="yaml"?e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:243:9",className:"bg-slate-900 border-slate-800",children:e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:244:11",className:"p-4",children:e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:245:13",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>{},inline:!0,autoEdit:!0})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:259:11",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:262:17",label:"副本就绪",value:`${ee}/${B}`,color:z?w.green:w.orange,sub:z?"全部就绪":"部分未就绪"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:263:17",label:"当前副本",value:We,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:264:17",label:"已更新副本",value:Ne,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:265:17",label:"服务名",value:k.serviceName||"-",color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:266:17",label:"Pod 数量",value:R.length,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:271:17",label:"期望调度",value:H,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:272:17",label:"当前调度",value:fe,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:273:17",label:"就绪数量",value:se,color:z?w.green:w.orange}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:274:17",label:"可用数量",value:ve,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:275:17",label:"已更新",value:ye,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:282:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:283:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:284:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:285:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:286:19",className:"h-4 w-4 text-amber-400"}),"更新策略"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:289:15",className:"pt-0 space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:290:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:291:19",className:"text-slate-500",children:"策略类型"}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:292:19",variant:"outline",className:"border-slate-700 text-slate-300",children:Y})]}),Y==="RollingUpdate"&&g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:296:21",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:297:23",className:"text-slate-500",children:"分区 (partition)"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:298:23",className:"text-slate-300 font-mono",children:a.rollingUpdate.partition??0})]}),a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:301:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:302:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:303:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]})]}),Y==="RollingUpdate"&&!g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:311:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:312:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:313:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]}),a.rollingUpdate.maxSurge&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:317:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:318:25",className:"text-slate-500",children:"最大 surge"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:319:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxSurge=="object"?JSON.stringify(a.rollingUpdate.maxSurge):a.rollingUpdate.maxSurge})]})]}),g&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:325:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:326:21",className:"text-slate-500",children:"Pod 管理策略"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:327:21",className:"text-slate-300 font-mono",children:k.podManagementPolicy||"OrderedReady"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:330:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:331:19",className:"text-slate-500",children:"修订历史限制"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:332:19",className:"text-slate-300 font-mono",children:k.revisionHistoryLimit??10})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:337:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:338:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:339:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:340:19",className:"h-4 w-4 text-purple-400"}),"选择器与标签"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:343:15",className:"pt-0 space-y-3 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:344:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:345:19",className:"text-slate-500 mb-1.5",children:"Selector (matchLabels)"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:346:19",labels:Se})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:348:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:349:19",className:"text-slate-500 mb-1.5",children:"Labels"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:350:19",labels:Ce})]}),Object.keys(ae).length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:353:19",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:354:21",className:"text-slate-500 mb-1.5",children:"Annotations"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:355:21",className:"flex flex-wrap gap-1.5",children:Object.entries(ae).slice(0,8).map(([s,o])=>e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:357:25",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px] font-mono max-w-[300px] truncate",children:s},s))})]})]})]})]}),g&&te.length>0&&e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:370:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:371:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:372:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:373:19",className:"h-4 w-4 text-cyan-400"}),"存储卷声明模板 (VolumeClaimTemplates)"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:376:15",className:"pt-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:377:17",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:378:19",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:379:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:380:23",className:"text-slate-400",children:"名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:381:23",className:"text-slate-400",children:"访问模式"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:382:23",className:"text-slate-400",children:"存储类"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:383:23",className:"text-slate-400",children:"大小"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:386:19",children:te.map((s,o)=>{const f=(s.spec?.accessModes||[]).join(", "),oe=s.spec?.storageClassName||s.spec?.storageClassName||"-",E=s.spec?.resources?.requests?.storage||"-";return e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:392:25",className:"border-slate-800",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:393:27",className:"font-medium text-slate-200",children:s.metadata?.name||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:394:27",className:"text-sm text-slate-400",children:f||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:395:27",className:"text-sm text-slate-400",children:oe}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:396:27",className:"text-sm text-slate-300 font-mono",children:E})]},o)})})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:407:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:408:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:409:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:410:17",className:"h-4 w-4 text-blue-400"}),"容器模板(Pod Template)"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:413:13",className:"pt-0",children:[Z.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:415:17",className:"mb-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:416:19",className:"text-[11px] text-slate-500 mb-2 uppercase tracking-wide",children:"Init Containers"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:417:19",className:"space-y-2",children:Z.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:419:23",c:s},`init-${o}`))})]}),X.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:425:17",className:"text-xs text-slate-500 py-3",children:"暂无容器数据,请查看 YAML"}):e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:427:17",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:428:19",className:"text-[11px] text-slate-500 mb-1 uppercase tracking-wide",children:"Containers"}),X.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:430:21",c:s},o))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:438:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:439:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:440:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ye,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:441:17",className:"h-4 w-4 text-emerald-400"}),"Pod 实例 (",R.length,")"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:444:13",className:"p-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:445:15",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:446:17",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:447:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:448:21",className:"text-slate-400",children:"Pod 名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:449:21",className:"text-slate-400",children:"状态"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:450:21",className:"text-slate-400",children:"所在节点"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:451:21",className:"text-slate-400",children:"Pod IP"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:452:21",className:"text-slate-400",children:"重启"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:453:21",className:"text-slate-400",children:"操作"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:456:17",children:R.length===0?e.jsx(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:21",children:e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:31",colSpan:6,className:"text-center text-slate-500 py-8",children:"暂无 Pod"})}):R.map(s=>e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:460:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:461:23",className:"font-medium text-slate-200",children:s.name}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:462:23",children:e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:463:25",style:{background:`${q(s.status)}22`,color:q(s.status),border:`1px solid ${q(s.status)}44`},children:s.status||"Unknown"})}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:467:23",className:"text-sm text-slate-400",children:s.node_name||s.node||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:468:23",className:"text-sm text-slate-400 font-mono",children:s.ip||s.pod_ip||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:469:23",className:(s.restart_count||0)>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:470:23",children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:471:25",className:"flex items-center gap-1",children:[e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:472:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",onClick:()=>J(s),children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:474:29",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:476:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",onClick:()=>K(s),children:[e.jsx(qe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:478:29",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]})]})})]},s.name))})]})})]})]}),we&&e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:493:9",className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>L(!1),children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:494:11",className:"bg-slate-900 border border-slate-800 rounded-lg p-6 w-80",onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:495:13",className:"text-sm font-semibold text-slate-200 mb-4",children:"伸缩 StatefulSet"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:496:13",className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:497:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(Math.max(0,v-1)),children:e.jsx(Ie,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:498:17",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:500:15",className:"text-2xl font-bold text-slate-100 w-12 text-center",children:v}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:501:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(v+1),children:e.jsx(Je,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:502:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:505:13",className:"flex gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:506:15",variant:"outline",size:"sm",className:"flex-1 border-slate-700 text-slate-400",onClick:()=>L(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:507:15",size:"sm",className:"flex-1 bg-blue-600 hover:bg-blue-500",disabled:$,onClick:Ve,children:$?"执行中...":"确认"})]})]})}),je&&e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:517:9",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>G(!1)}),_&&e.jsx(Me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:528:9",open:!0,onOpenChange:s=>{s||J(null)},clusterId:n,namespace:r,podName:_.name,containers:_.containers?.map(s=>s.name).filter(Boolean)||[]}),D&&e.jsx(Be,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:540:9",open:!0,onOpenChange:s=>{s||K(null)},clusterCode:n,namespace:r,podName:D.name,containers:D.containers?.map(s=>s.name).filter(Boolean)||[]})]})}function me({c:t}){return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:556:5",className:"border border-slate-800 rounded-lg p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:557:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:558:9",className:"flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:559:11",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:560:11",className:"text-sm font-semibold text-slate-200",children:t.name})]}),e.jsx("code",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:562:9",className:"text-[11px] text-slate-400 font-mono truncate max-w-[400px]",children:t.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:564:7",className:"grid grid-cols-2 md:grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:565:9",className:"text-slate-400",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:566:16",className:"text-slate-200 font-mono",children:[t.resources?.requests?.cpu||"-","/",t.resources?.limits?.cpu||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:568:9",className:"text-slate-400",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:569:15",className:"text-slate-200 font-mono",children:[t.resources?.requests?.memory||"-","/",t.resources?.limits?.memory||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:571:9",className:"text-slate-400",children:["端口: ",e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:572:15",className:"text-slate-200 font-mono",children:(t.ports||[]).map(x=>x.containerPort||x.port).join(", ")||"-"})]})]})]})}export{cs as default}; diff --git a/backend/static/assets/account-DwPCbdbn.js b/backend/static/assets/account-Dzyhyahe.js similarity index 91% rename from backend/static/assets/account-DwPCbdbn.js rename to backend/static/assets/account-Dzyhyahe.js index 5ebd4d6..b05175d 100644 --- a/backend/static/assets/account-DwPCbdbn.js +++ b/backend/static/assets/account-Dzyhyahe.js @@ -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}; diff --git a/backend/static/assets/agent-D_rvbJT8.js b/backend/static/assets/agent-g0Vk8FYK.js similarity index 94% rename from backend/static/assets/agent-D_rvbJT8.js rename to backend/static/assets/agent-g0Vk8FYK.js index d5b10c7..5d9d78f 100644 --- a/backend/static/assets/agent-D_rvbJT8.js +++ b/backend/static/assets/agent-g0Vk8FYK.js @@ -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}; diff --git a/backend/static/assets/ai-CEIZUoip.js b/backend/static/assets/ai-BMSiZ3PN.js similarity index 95% rename from backend/static/assets/ai-CEIZUoip.js rename to backend/static/assets/ai-BMSiZ3PN.js index f250e34..bb581fe 100644 --- a/backend/static/assets/ai-CEIZUoip.js +++ b/backend/static/assets/ai-BMSiZ3PN.js @@ -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}; diff --git a/backend/static/assets/alert-B4v9izj6.js b/backend/static/assets/alert-C4MMKcUL.js similarity index 94% rename from backend/static/assets/alert-B4v9izj6.js rename to backend/static/assets/alert-C4MMKcUL.js index b9dc20a..23f304b 100644 --- a/backend/static/assets/alert-B4v9izj6.js +++ b/backend/static/assets/alert-C4MMKcUL.js @@ -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}; diff --git a/backend/static/assets/alert-center-C2gx2r-S.js b/backend/static/assets/alert-center-dJk4LGZM.js similarity index 91% rename from backend/static/assets/alert-center-C2gx2r-S.js rename to backend/static/assets/alert-center-dJk4LGZM.js index 8017dac..2a31d8a 100644 --- a/backend/static/assets/alert-center-C2gx2r-S.js +++ b/backend/static/assets/alert-center-dJk4LGZM.js @@ -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}; diff --git a/backend/static/assets/approval-DPMUbhSE.js b/backend/static/assets/approval-DmGRfKd6.js similarity index 93% rename from backend/static/assets/approval-DPMUbhSE.js rename to backend/static/assets/approval-DmGRfKd6.js index 904ab7e..b8c89a5 100644 --- a/backend/static/assets/approval-DPMUbhSE.js +++ b/backend/static/assets/approval-DmGRfKd6.js @@ -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}; diff --git a/backend/static/assets/audit-Z4oPE2dM.js b/backend/static/assets/audit-BiL35K5G.js similarity index 88% rename from backend/static/assets/audit-Z4oPE2dM.js rename to backend/static/assets/audit-BiL35K5G.js index 549af9d..251a9c2 100644 --- a/backend/static/assets/audit-Z4oPE2dM.js +++ b/backend/static/assets/audit-BiL35K5G.js @@ -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}; diff --git a/backend/static/assets/automation-_t6YTgo2.js b/backend/static/assets/automation-BrmX02Sx.js similarity index 92% rename from backend/static/assets/automation-_t6YTgo2.js rename to backend/static/assets/automation-BrmX02Sx.js index 5c7d488..eb5008d 100644 --- a/backend/static/assets/automation-_t6YTgo2.js +++ b/backend/static/assets/automation-BrmX02Sx.js @@ -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}; diff --git a/backend/static/assets/badge-BodqHT_V.js b/backend/static/assets/badge-B0F5ZNtn.js similarity index 94% rename from backend/static/assets/badge-BodqHT_V.js rename to backend/static/assets/badge-B0F5ZNtn.js index b4d032a..6a115c0 100644 --- a/backend/static/assets/badge-BodqHT_V.js +++ b/backend/static/assets/badge-B0F5ZNtn.js @@ -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}; diff --git a/backend/static/assets/billing-CoX12im7.js b/backend/static/assets/billing-9Cbmzl6K.js similarity index 90% rename from backend/static/assets/billing-CoX12im7.js rename to backend/static/assets/billing-9Cbmzl6K.js index f973064..038ae8a 100644 --- a/backend/static/assets/billing-CoX12im7.js +++ b/backend/static/assets/billing-9Cbmzl6K.js @@ -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}; diff --git a/backend/static/assets/card-BVNSlZ0C.js b/backend/static/assets/card-B-RtdR4H.js similarity index 94% rename from backend/static/assets/card-BVNSlZ0C.js rename to backend/static/assets/card-B-RtdR4H.js index 7acfa0b..c59b776 100644 --- a/backend/static/assets/card-BVNSlZ0C.js +++ b/backend/static/assets/card-B-RtdR4H.js @@ -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}; diff --git a/backend/static/assets/checkbox-CY3XhE_w.js b/backend/static/assets/checkbox-DL3onEGv.js similarity index 98% rename from backend/static/assets/checkbox-CY3XhE_w.js rename to backend/static/assets/checkbox-DL3onEGv.js index 13b52f7..fd3d6c8 100644 --- a/backend/static/assets/checkbox-CY3XhE_w.js +++ b/backend/static/assets/checkbox-DL3onEGv.js @@ -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}; diff --git a/backend/static/assets/config-DLOuMLhF.js b/backend/static/assets/config-DAXaHuse.js similarity index 96% rename from backend/static/assets/config-DLOuMLhF.js rename to backend/static/assets/config-DAXaHuse.js index 8530d5a..220a365 100644 --- a/backend/static/assets/config-DLOuMLhF.js +++ b/backend/static/assets/config-DAXaHuse.js @@ -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}; diff --git a/backend/static/assets/credential-BFQGM5tX.js b/backend/static/assets/credential-CwQY-4Ba.js similarity index 83% rename from backend/static/assets/credential-BFQGM5tX.js rename to backend/static/assets/credential-CwQY-4Ba.js index 6cd2de2..7369cdb 100644 --- a/backend/static/assets/credential-BFQGM5tX.js +++ b/backend/static/assets/credential-CwQY-4Ba.js @@ -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}; diff --git a/backend/static/assets/dashboard-BNyMEfo2.js b/backend/static/assets/dashboard-7Sl2aero.js similarity index 80% rename from backend/static/assets/dashboard-BNyMEfo2.js rename to backend/static/assets/dashboard-7Sl2aero.js index a48e0d1..5e4c43e 100644 --- a/backend/static/assets/dashboard-BNyMEfo2.js +++ b/backend/static/assets/dashboard-7Sl2aero.js @@ -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}; diff --git a/backend/static/assets/datasource-C4Fvm0Oq.js b/backend/static/assets/datasource-DuIT0c1H.js similarity index 91% rename from backend/static/assets/datasource-C4Fvm0Oq.js rename to backend/static/assets/datasource-DuIT0c1H.js index 36d237f..65a577c 100644 --- a/backend/static/assets/datasource-C4Fvm0Oq.js +++ b/backend/static/assets/datasource-DuIT0c1H.js @@ -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}; diff --git a/backend/static/assets/index-7YeEJX-w.css b/backend/static/assets/index-7YeEJX-w.css deleted file mode 100644 index 1d3e2c2..0000000 --- a/backend/static/assets/index-7YeEJX-w.css +++ /dev/null @@ -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 0% 100%;--secondary: 220 13% 14%;--secondary-foreground: 210 40% 98%;--muted: 220 13% 14%;--muted-foreground: 215 20% 55%;--accent: 220 13% 14%;--accent-foreground: 210 40% 98%;--destructive: 0 62% 50%;--destructive-foreground: 0 0% 100%;--border: 220 13% 18%;--input: 220 13% 14%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 220 13% 7%;--sidebar-foreground: 210 40% 90%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 13% 14%;--sidebar-accent-foreground: 210 40% 98%;--sidebar-border: 220 13% 18%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #0d1117;--dg-bg-secondary: #161b22;--dg-bg-tertiary: #21262d;--dg-bg-hover: #30363d;--dg-bg-active: #3d444d;--dg-border: #30363d;--dg-border-light: #21262d;--dg-border-hover: #484f58;--dg-text-primary: #f0f6fc;--dg-text-secondary: #8b949e;--dg-text-muted: #6e7681;--dg-blue: #58a6ff;--dg-green: #3fb950;--dg-red: #f85149;--dg-orange: #f0883e;--dg-purple: #8957e5;--dg-cyan: #39c5cf;--dg-yellow: #d29922;--dg-card-hover-border: rgba(88, 166, 255, .5);--dg-gradient-start: #2563eb;--dg-gradient-end: #9333ea;--dg-gradient-text-start: #60a5fa;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(96, 165, 250, .2);--chart-grid: #1e293b;--chart-axis: #475569;--chart-tooltip-bg: #0f172a;--chart-tooltip-border: #1e293b;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(88, 166, 255, .15);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #21262d;--skeleton-highlight: #30363d}[data-theme=light-professional],[data-theme=light]{--background: 0 0% 100%;--foreground: 220 14% 10%;--card: 0 0% 100%;--card-foreground: 220 14% 10%;--popover: 0 0% 100%;--popover-foreground: 220 14% 10%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 14% 96%;--secondary-foreground: 220 14% 10%;--muted: 220 14% 96%;--muted-foreground: 220 10% 46%;--accent: 220 14% 96%;--accent-foreground: 220 14% 10%;--destructive: 0 72% 51%;--destructive-foreground: 0 0% 100%;--border: 220 13% 91%;--input: 220 13% 91%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 0 0% 98%;--sidebar-foreground: 220 14% 20%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 14% 94%;--sidebar-accent-foreground: 220 14% 10%;--sidebar-border: 220 13% 91%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #ffffff;--dg-bg-secondary: #f8f9fb;--dg-bg-tertiary: #f0f1f5;--dg-bg-hover: #e8eaef;--dg-bg-active: #dfe1e8;--dg-border: #e2e5eb;--dg-border-light: #eaecf0;--dg-border-hover: #d0d5dd;--dg-text-primary: #1a1d23;--dg-text-secondary: #5c6370;--dg-text-muted: #9ca3af;--dg-blue: #2563eb;--dg-green: #16a34a;--dg-red: #dc2626;--dg-orange: #ea580c;--dg-purple: #7c3aed;--dg-cyan: #0891b2;--dg-yellow: #ca8a04;--dg-card-hover-border: rgba(37, 99, 235, .3);--dg-gradient-start: #2563eb;--dg-gradient-end: #7c3aed;--dg-gradient-text-start: #1d4ed8;--dg-gradient-text-end: #6d28d9;--dg-input-focus-ring: rgba(37, 99, 235, .15);--chart-grid: #e2e5eb;--chart-axis: #9ca3af;--chart-tooltip-bg: #ffffff;--chart-tooltip-border: #e2e5eb;--shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .1), 0 0 0 1px rgba(37, 99, 235, .1);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .12);--skeleton-base: #f0f1f5;--skeleton-highlight: #e8eaef}[data-theme=midnight-purple]{--background: 264 56% 4%;--foreground: 280 100% 98%;--card: 264 48% 8%;--card-foreground: 280 100% 98%;--popover: 264 48% 8%;--popover-foreground: 280 100% 98%;--primary: 270 91% 65%;--primary-foreground: 0 0% 100%;--secondary: 264 40% 20%;--secondary-foreground: 280 100% 98%;--muted: 264 40% 20%;--muted-foreground: 280 30% 60%;--accent: 264 40% 20%;--accent-foreground: 280 100% 98%;--destructive: 348 100% 72%;--destructive-foreground: 264 56% 4%;--border: 264 40% 20%;--input: 264 40% 20%;--ring: 270 91% 65%;--radius: .625rem;--sidebar-background: 264 48% 6%;--sidebar-foreground: 280 100% 92%;--sidebar-primary: 270 91% 65%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 264 40% 20%;--sidebar-accent-foreground: 280 100% 98%;--sidebar-border: 264 40% 20%;--sidebar-ring: 270 91% 65%;--dg-bg-primary: #0a0612;--dg-bg-secondary: #130c21;--dg-bg-tertiary: #1c1330;--dg-bg-hover: #2d1f4a;--dg-bg-active: #3d2a5e;--dg-border: #2d1f4a;--dg-border-light: #1c1330;--dg-border-hover: #3d2a5e;--dg-text-primary: #faf5ff;--dg-text-secondary: #b794c7;--dg-text-muted: #7c5a8a;--dg-blue: #818cf8;--dg-green: #34d399;--dg-red: #fb7185;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #22d3ee;--dg-yellow: #facc15;--dg-card-hover-border: rgba(192, 132, 252, .5);--dg-gradient-start: #9333ea;--dg-gradient-end: #c084fc;--dg-gradient-text-start: #a855f7;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(192, 132, 252, .2);--chart-grid: #2d1f4a;--chart-axis: #7c5a8a;--chart-tooltip-bg: #130c21;--chart-tooltip-border: #2d1f4a;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(192, 132, 252, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(192, 132, 252, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #1c1330;--skeleton-highlight: #2d1f4a}[data-theme=pine-green]{--background: 150 25% 5%;--foreground: 140 60% 97%;--card: 150 25% 9%;--card-foreground: 140 60% 97%;--popover: 150 25% 9%;--popover-foreground: 140 60% 97%;--primary: 142 71% 45%;--primary-foreground: 150 25% 5%;--secondary: 150 20% 18%;--secondary-foreground: 140 60% 97%;--muted: 150 20% 18%;--muted-foreground: 150 20% 55%;--accent: 150 20% 18%;--accent-foreground: 140 60% 97%;--destructive: 0 90% 72%;--destructive-foreground: 150 25% 5%;--border: 150 20% 18%;--input: 150 20% 18%;--ring: 142 71% 45%;--radius: .625rem;--sidebar-background: 150 25% 7%;--sidebar-foreground: 140 40% 88%;--sidebar-primary: 142 71% 45%;--sidebar-primary-foreground: 150 25% 5%;--sidebar-accent: 150 20% 18%;--sidebar-accent-foreground: 140 60% 97%;--sidebar-border: 150 20% 18%;--sidebar-ring: 142 71% 45%;--dg-bg-primary: #0a1210;--dg-bg-secondary: #111f1a;--dg-bg-tertiary: #192c24;--dg-bg-hover: #253d32;--dg-bg-active: #2f4f3e;--dg-border: #253d32;--dg-border-light: #192c24;--dg-border-hover: #2f4f3e;--dg-text-primary: #f0fdf4;--dg-text-secondary: #86b8a0;--dg-text-muted: #5a7c6b;--dg-blue: #38bdf8;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #2dd4bf;--dg-yellow: #facc15;--dg-card-hover-border: rgba(74, 222, 128, .5);--dg-gradient-start: #059669;--dg-gradient-end: #10b981;--dg-gradient-text-start: #059669;--dg-gradient-text-end: #34d399;--dg-input-focus-ring: rgba(74, 222, 128, .2);--chart-grid: #253d32;--chart-axis: #5a7c6b;--chart-tooltip-bg: #111f1a;--chart-tooltip-border: #253d32;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(74, 222, 128, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(74, 222, 128, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #192c24;--skeleton-highlight: #253d32}[data-theme=orange-vitality]{--background: 30 35% 5%;--foreground: 30 100% 97%;--card: 30 30% 9%;--card-foreground: 30 100% 97%;--popover: 30 30% 9%;--popover-foreground: 30 100% 97%;--primary: 25 95% 53%;--primary-foreground: 0 0% 100%;--secondary: 30 25% 18%;--secondary-foreground: 30 100% 97%;--muted: 30 25% 18%;--muted-foreground: 30 25% 55%;--accent: 30 25% 18%;--accent-foreground: 30 100% 97%;--destructive: 0 80% 70%;--destructive-foreground: 30 35% 5%;--border: 30 25% 18%;--input: 30 25% 18%;--ring: 25 95% 53%;--radius: .625rem;--sidebar-background: 30 30% 7%;--sidebar-foreground: 30 80% 88%;--sidebar-primary: 25 95% 53%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 30 25% 18%;--sidebar-accent-foreground: 30 100% 97%;--sidebar-border: 30 25% 18%;--sidebar-ring: 25 95% 53%;--dg-bg-primary: #110d08;--dg-bg-secondary: #1d1610;--dg-bg-tertiary: #2b1f16;--dg-bg-hover: #3d2d20;--dg-bg-active: #4d3928;--dg-border: #3d2d20;--dg-border-light: #2b1f16;--dg-border-hover: #4d3928;--dg-text-primary: #fef7ed;--dg-text-secondary: #d4a574;--dg-text-muted: #9c7a54;--dg-blue: #60a5fa;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #a78bfa;--dg-cyan: #2dd4bf;--dg-yellow: #fcd34d;--dg-card-hover-border: rgba(251, 146, 60, .5);--dg-gradient-start: #ea580c;--dg-gradient-end: #f59e0b;--dg-gradient-text-start: #f97316;--dg-gradient-text-end: #fbbf24;--dg-input-focus-ring: rgba(251, 146, 60, .2);--chart-grid: #3d2d20;--chart-axis: #9c7a54;--chart-tooltip-bg: #1d1610;--chart-tooltip-border: #3d2d20;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(251, 146, 60, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(251, 146, 60, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #2b1f16;--skeleton-highlight: #3d2d20}*{border-color:hsl(var(--border))}html{scroll-behavior:smooth}body{background-color:var(--dg-bg-primary);color:var(--dg-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;font-feature-settings:"rlig" 1,"calt" 1;transition:background-color .3s ease,color .3s ease}body[data-scroll-locked],body[data-radix-scroll-locked],body[style*=padding-right]{padding-right:0!important}code,pre,.font-mono{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace}::-moz-selection{background-color:var(--dg-blue);color:#fff}::selection{background-color:var(--dg-blue);color:#fff}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.\!left-0{left:0!important}.\!top-0{top:0!important}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-0\.5{right:-.125rem}.-right-12{right:-3rem}.-top-0\.5{top:-.125rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.order-first{order:-9999}.order-last{order:9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-full{grid-column:1 / -1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2 / span 2}.row-start-1{grid-row-start:1}.\!m-0{margin:0!important}.m-4{margin:1rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-px{margin-left:-1px;margin-right:-1px}.-my-2{margin-top:-.5rem;margin-bottom:-.5rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0{margin-top:0;margin-bottom:0}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-2\.5{margin-left:.625rem}.ml-4{margin-left:1rem}.ml-9{margin-left:2.25rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-2\.5{margin-right:.625rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-10{width:2.5rem;height:2.5rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-auto{width:auto;height:auto}.size-full{width:100%;height:100%}.\!h-screen{height:100vh!important}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1\.15rem\]{height:1.15rem}.h-\[120px\]{height:120px}.h-\[180px\]{height:180px}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-\[80vh\]{height:80vh}.h-\[88vh\]{height:88vh}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[120px\]{max-height:120px}.max-h-\[180px\]{max-height:180px}.max-h-\[220px\]{max-height:220px}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[40vh\]{max-height:40vh}.max-h-\[420px\]{max-height:420px}.max-h-\[45vh\]{max-height:45vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[520px\]{max-height:520px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[800px\]{max-height:800px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-0{min-height:0px}.min-h-16{min-height:4rem}.min-h-4{min-height:1rem}.min-h-\[100px\]{min-height:100px}.min-h-\[200px\]{min-height:200px}.min-h-\[360px\]{min-height:360px}.min-h-\[36px\]{min-height:36px}.min-h-\[400px\]{min-height:400px}.min-h-\[50px\]{min-height:50px}.min-h-\[50vh\]{min-height:50vh}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[70px\]{min-height:70px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-screen{width:100vw!important}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[100px\]{width:100px}.w-\[110px\]{width:110px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[16\%\]{width:16%}.w-\[160px\]{width:160px}.w-\[170px\]{width:170px}.w-\[20\%\]{width:20%}.w-\[200px\]{width:200px}.w-\[240px\]{width:240px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[40\%\]{width:40%}.w-\[460px\]{width:460px}.w-\[480px\]{width:480px}.w-\[60px\]{width:60px}.w-\[72px\]{width:72px}.w-\[8\%\]{width:8%}.w-\[80px\]{width:80px}.w-\[88px\]{width:88px}.w-\[90px\]{width:90px}.w-\[90vw\]{width:90vw}.w-\[92vw\]{width:92vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-10{min-width:2.5rem}.min-w-5{min-width:1.25rem}.min-w-8{min-width:2rem}.min-w-9{min-width:2.25rem}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.min-w-\[28px\]{min-width:28px}.min-w-\[300px\]{min-width:300px}.min-w-\[30px\]{min-width:30px}.min-w-\[400px\]{min-width:400px}.min-w-\[40px\]{min-width:40px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[90px\]{min-width:90px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.\!max-w-none{max-width:none!important}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[320px\]{max-width:320px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.\!translate-x-0{--tw-translate-x: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.\!translate-y-0{--tw-translate-y: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.animate-caret-blink{animation:caret-blink 1.25s ease-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize-y{resize:vertical}.resize{resize:both}.scroll-my-1{scroll-margin-top:.25rem;scroll-margin-bottom:.25rem}.scroll-py-1{scroll-padding-top:.25rem;scroll-padding-bottom:.25rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-cols-\[1fr_1\.4fr_auto\]{grid-template-columns:1fr 1.4fr auto}.grid-cols-\[1fr_100px_1fr_60px_28px\]{grid-template-columns:1fr 100px 1fr 60px 28px}.grid-cols-\[1fr_1fr_100px_auto\]{grid-template-columns:1fr 1fr 100px auto}.grid-cols-\[1fr_1fr_1fr_60px_auto\]{grid-template-columns:1fr 1fr 1fr 60px auto}.grid-cols-\[1fr_80px_1fr_100px_80px_auto\]{grid-template-columns:1fr 80px 1fr 100px 80px auto}.grid-cols-\[1fr_80px_80px_80px_80px_32px\]{grid-template-columns:1fr 80px 80px 80px 80px 32px}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-start{justify-items:start}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-7{gap:1.75rem}.gap-\[--spacing\(var\(--gap\)\)\]{gap:var(--spacing(var(--gap)))}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.gap-y-3{row-gap:.75rem}.gap-y-4{row-gap:1rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--dg-border\)\]>:not([hidden])~:not([hidden]){border-color:var(--dg-border)}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.justify-self-end{justify-self:end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[calc\(var\(--radius\)-5px\)\]{border-radius:calc(var(--radius) - 5px)}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:calc(var(--radius) - 6px)}.rounded-b-md{border-bottom-right-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.rounded-t-sm{border-top-left-radius:calc(var(--radius) - 4px);border-top-right-radius:calc(var(--radius) - 4px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[var\(--dg-blue\)\]{border-color:var(--dg-blue)}.border-\[var\(--dg-border\)\]{border-color:var(--dg-border)}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/50{border-color:#f59e0b80}.border-amber-600{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.border-amber-700\/50{border-color:#b4530980}.border-amber-800\/30{border-color:#92400e4d}.border-amber-800\/40{border-color:#92400e66}.border-amber-800\/50{border-color:#92400e80}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/20{border-color:#60a5fa33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-blue-600\/50{border-color:#2563eb80}.border-blue-700\/50{border-color:#1d4ed880}.border-blue-800\/50{border-color:#1e40af80}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-cyan-500{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-400\/50{border-color:#34d39980}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-600{--tw-border-opacity: 1;border-color:rgb(5 150 105 / var(--tw-border-opacity, 1))}.border-emerald-600\/30{border-color:#0596694d}.border-emerald-700\/50{border-color:#04785780}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-400\/50{border-color:#818cf880}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-700\/50{border-color:#7e22ce80}.border-purple-800\/50{border-color:#6b21a880}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/40{border-color:#ef444466}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-red-600\/30{border-color:#dc26264d}.border-red-700\/50{border-color:#b91c1c80}.border-rose-500\/30{border-color:#f43f5e4d}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-500{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/30{border-color:#4755694d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/30{border-color:#1e293b4d}.border-slate-800\/50{border-color:#1e293b80}.border-slate-800\/60{border-color:#1e293b99}.border-transparent{border-color:transparent}.border-violet-500\/30{border-color:#8b5cf64d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-l-\[var\(--dg-warning\)\]{border-left-color:var(--dg-warning)}.border-l-transparent{border-left-color:transparent}.border-t-\[var\(--dg-blue\)\]{border-top-color:var(--dg-blue)}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-\[\#0a0e14\]{--tw-bg-opacity: 1;background-color:rgb(10 14 20 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1117\]{--tw-bg-opacity: 1;background-color:rgb(13 17 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0f172a\]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-\[var\(--dg-accent\)\]{background-color:var(--dg-accent)}.bg-\[var\(--dg-bg-hover\)\]{background-color:var(--dg-bg-hover)}.bg-\[var\(--dg-bg-primary\)\]{background-color:var(--dg-bg-primary)}.bg-\[var\(--dg-bg-secondary\)\]{background-color:var(--dg-bg-secondary)}.bg-\[var\(--dg-bg-tertiary\)\]{background-color:var(--dg-bg-tertiary)}.bg-\[var\(--dg-blue\)\]{background-color:var(--dg-blue)}.bg-\[var\(--dg-border\)\]{background-color:var(--dg-border)}.bg-\[var\(--dg-green\)\]{background-color:var(--dg-green)}.bg-\[var\(--dg-purple\)\]{background-color:var(--dg-purple)}.bg-\[var\(--dg-red\)\]{background-color:var(--dg-red)}.bg-\[var\(--dg-text-secondary\)\]{background-color:var(--dg-text-secondary)}.bg-\[var\(--dg-yellow\)\]{background-color:var(--dg-yellow)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-400\/40{background-color:#fbbf2466}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-500\/60{background-color:#f59e0b99}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-600\/40{background-color:#d9770666}.bg-amber-950\/30{background-color:#451a034d}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-400\/10{background-color:#60a5fa1a}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-500\/5{background-color:#3b82f60d}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-950\/20{background-color:#17255433}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/20{background-color:#06b6d433}.bg-destructive{--tw-bg-opacity: 1;background-color:hsl(var(--destructive) / var(--tw-bg-opacity, 1))}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/30{background-color:#10b9814d}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-500\/60{background-color:#10b98199}.bg-emerald-500\/90{background-color:#10b981e6}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-600\/30{background-color:#0596694d}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-indigo-400\/10{background-color:#818cf81a}.bg-indigo-500\/10{background-color:#6366f11a}.bg-input{background-color:hsl(var(--input))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-500\/5{background-color:#a855f70d}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/20{background-color:#3b076433}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/20{background-color:#dc262633}.bg-red-600\/40{background-color:#dc262666}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/20{background-color:#f43f5e33}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/10{background-color:#64748b1a}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/10{background-color:#4755691a}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/50{background-color:#33415580}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/30{background-color:#1e293b4d}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/30{background-color:#0f172a4d}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/30{background-color:#0206174d}.bg-slate-950\/50{background-color:#02061780}.bg-slate-950\/80{background-color:#020617cc}.bg-transparent{background-color:transparent}.bg-violet-500\/20{background-color:#8b5cf633}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-400\/15{background-color:#facc1526}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[var\(--dg-blue\)\]{--tw-gradient-from: var(--dg-blue) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500\/50{--tw-gradient-from: rgb(59 130 246 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600\/60{--tw-gradient-from: rgb(37 99 235 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\[var\(--dg-cyan\)\]{--tw-gradient-to: var(--dg-cyan) var(--tw-gradient-to-position)}.to-\[var\(--dg-purple\)\]{--tw-gradient-to: var(--dg-purple) var(--tw-gradient-to-position)}.to-amber-500{--tw-gradient-to: #f59e0b var(--tw-gradient-to-position)}.to-blue-400\/80{--tw-gradient-to: rgb(96 165 250 / .8) var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-primary{fill:hsl(var(--primary))}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-px{padding-bottom:1px}.pl-1{padding-left:.25rem}.pl-1\.5{padding-left:.375rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pl-\[88px\]{padding-left:88px}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-\[var\(--header-height\)\]{padding-top:var(--header-height)}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[15px\]{font-size:15px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-sm\/relaxed{font-size:.875rem;line-height:1.625}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-5{line-height:1.25rem}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[var\(--dg-blue\)\]{color:var(--dg-blue)}.text-\[var\(--dg-border\)\]{color:var(--dg-border)}.text-\[var\(--dg-cyan\)\]{color:var(--dg-cyan)}.text-\[var\(--dg-green\)\]{color:var(--dg-green)}.text-\[var\(--dg-orange\)\]{color:var(--dg-orange)}.text-\[var\(--dg-purple\)\]{color:var(--dg-purple)}.text-\[var\(--dg-red\)\]{color:var(--dg-red)}.text-\[var\(--dg-text-muted\)\]{color:var(--dg-text-muted)}.text-\[var\(--dg-text-primary\)\]{color:var(--dg-text-primary)}.text-\[var\(--dg-text-secondary\)\]{color:var(--dg-text-secondary)}.text-\[var\(--dg-warning\)\]{color:var(--dg-warning)}.text-\[var\(--dg-yellow\)\]{color:var(--dg-yellow)}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/80{color:#fcd34dcc}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-500\/70{color:#f59e0bb3}.text-background{color:hsl(var(--background))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-destructive{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-400\/70{color:#4ade80b3}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-muted{color:hsl(var(--muted))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/70{color:#f87171b3}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-400\/80{color:#facc15cc}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-blue-500{accent-color:#3b82f6}.accent-blue-600{accent-color:#2563eb}.accent-cyan-500{accent-color:#06b6d4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-500\/30{--tw-ring-color: rgb(245 158 11 / .3)}.ring-blue-500\/30{--tw-ring-color: rgb(59 130 246 / .3)}.ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-0{--tw-ring-offset-width: 0px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.\!transition-none{transition-property:none!important}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\!duration-0{transition-duration:0s!important}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in,.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.\!duration-0{animation-duration:0s!important}.duration-100{animation-duration:.1s}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.dg-card{border-radius:calc(var(--radius) + 4px);border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-secondary);box-shadow:var(--shadow-card);transition:background-color .3s ease,border-color .3s ease,box-shadow .3s ease,transform .3s ease}.dg-card-hover{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s;animation-duration:.3s}.dg-card-hover:hover{border-color:var(--dg-card-hover-border);box-shadow:var(--shadow-card-hover);transform:translateY(-2px)}.dg-input{border-radius:var(--radius);border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary)}.dg-input::-moz-placeholder{color:var(--dg-text-muted)}.dg-input::placeholder{color:var(--dg-text-muted)}.dg-input:focus{border-color:var(--dg-blue);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.dg-input{transition:border-color .2s ease,box-shadow .2s ease}.dg-input:focus{--tw-ring-color: var(--dg-input-focus-ring);box-shadow:0 0 0 3px var(--dg-input-focus-ring)}.dg-gradient-text{background:linear-gradient(to right,var(--dg-gradient-text-start),var(--dg-gradient-text-end));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.dg-gradient-bg{background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end))}.dg-page>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.dg-page{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.dg-page-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem}.dg-page-title{font-size:1.5rem;line-height:2rem;font-weight:700;letter-spacing:-.025em;color:var(--dg-text-primary)}.dg-page-subtitle{margin-top:.25rem;font-size:.875rem;line-height:1.25rem;color:var(--dg-text-muted)}.dg-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.dg-btn-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end));display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-primary:hover{opacity:.9}.dg-btn-primary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-primary{box-shadow:0 4px 16px color-mix(in srgb,var(--dg-gradient-start) 25%,transparent)}.dg-btn-primary:hover{box-shadow:0 6px 24px color-mix(in srgb,var(--dg-gradient-start) 35%,transparent)}.dg-btn-secondary{border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-secondary:hover{border-color:var(--dg-border-hover);background-color:var(--dg-bg-hover)}.dg-btn-secondary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-ghost{color:var(--dg-text-secondary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-ghost:hover{background-color:var(--dg-bg-hover);color:var(--dg-text-primary)}.dg-badge-blue{background-color:#3b82f61a;--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-green{background-color:#22c55e1a;--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-red{background-color:#ef44441a;--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-yellow{background-color:#eab3081a;--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-purple{background-color:#a855f71a;--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:var(--dg-border) transparent}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--dg-border);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--dg-text-muted)}@keyframes fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.animate-fade-in-delay-1{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .05s both}.animate-fade-in-delay-2{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .1s both}.animate-fade-in-delay-3{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .15s both}.animate-fade-in-delay-4{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .2s both}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scale-in .25s cubic-bezier(.16,1,.3,1) forwards}@keyframes slide-in-right{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes pulse-ring{0%{transform:scale(.8);opacity:.5}to{transform:scale(1.2);opacity:0}}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.dg-skeleton{background:linear-gradient(90deg,var(--skeleton-base) 25%,var(--skeleton-highlight) 50%,var(--skeleton-base) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:.5rem}.glass{background:color-mix(in srgb,var(--dg-bg-secondary) 75%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid var(--dg-border)}.chart-grid-stroke{stroke:var(--chart-grid)}.chart-tooltip{background-color:var(--chart-tooltip-bg)!important;border:1px solid var(--chart-tooltip-border)!important;border-radius:6px!important;color:var(--dg-text-primary)!important;box-shadow:var(--shadow-dropdown)!important}.\[--cell-size\:--spacing\(8\)\]{--cell-size: var(--spacing(8))}pre{overflow-x:auto;border-radius:var(--radius);padding:1rem;background-color:var(--dg-bg-tertiary);border:1px solid var(--dg-border)}code{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem}table{width:100%}th{text-align:left;font-size:.75rem;line-height:1rem;font-weight:500;text-transform:uppercase;letter-spacing:.05em;color:var(--dg-text-secondary)}td{font-size:.875rem;line-height:1.25rem;color:var(--dg-text-primary)}input:focus,textarea:focus,select:focus{outline:none;box-shadow:0 0 0 2px var(--dg-bg-primary),0 0 0 4px var(--dg-blue);border-color:var(--dg-blue)}button{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.terminal{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem;background-color:var(--dg-bg-primary);color:var(--dg-text-secondary)}.terminal .prompt{color:var(--dg-green)}.terminal .command{color:var(--dg-text-primary)}.terminal .output{color:var(--dg-text-muted)}.recharts-tooltip-wrapper{z-index:50}.recharts-default-tooltip{background-color:var(--chart-tooltip-bg)!important;border-color:var(--chart-tooltip-border)!important;color:var(--dg-text-primary)!important;border-radius:6px!important;box-shadow:var(--shadow-dropdown)!important}[data-state=open]>[data-radix-dialog-overlay]{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:color-mix(in srgb,var(--dg-bg-primary) 80%,transparent)}[role=menuitem]{cursor:pointer}@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(100%)}}.progress-indeterminate:after{content:"";position:absolute;inset:0;background-color:currentColor;animation:progress-indeterminate 1.5s ease-in-out infinite}.xterm-terminal-host{width:100%;overflow:hidden;background:#0a0e14}.xterm-terminal-host .xterm{height:100%}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.dg-skeleton{animation:none;background:var(--skeleton-base)}}.selection\:bg-primary *::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary *::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground *::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground *::selection{color:hsl(var(--primary-foreground))}.selection\:bg-primary::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:hsl(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:1.75rem}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-\[var\(--dg-text-muted\)\]::-moz-placeholder{color:var(--dg-text-muted)}.placeholder\:text-\[var\(--dg-text-muted\)\]::placeholder{color:var(--dg-text-muted)}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:mt-0:last-child{margin-top:0}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:border-r-0:last-child{border-right-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--dg-border\)\]:hover{border-color:var(--dg-border)}.hover\:border-\[var\(--dg-border-hover\)\]:hover{border-color:var(--dg-border-hover)}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/50:hover{border-color:#3b82f680}.hover\:border-orange-500\/30:hover{border-color:#f973164d}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-slate-400:hover{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-\[var\(--dg-bg-hover\)\]:hover{background-color:var(--dg-bg-hover)}.hover\:bg-\[var\(--dg-bg-primary\)\]:hover{background-color:var(--dg-bg-primary)}.hover\:bg-\[var\(--dg-bg-tertiary\)\]:hover{background-color:var(--dg-bg-tertiary)}.hover\:bg-\[var\(--dg-blue-hover\)\]:hover{background-color:var(--dg-blue-hover)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-600\/20:hover{background-color:#d9770633}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-600\/10:hover{background-color:#2563eb1a}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500\/20:hover{background-color:#06b6d433}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-600\/10:hover{background-color:#0596691a}.hover\:bg-emerald-600\/20:hover{background-color:#05966933}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-green-500\/10:hover{background-color:#22c55e1a}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/20:hover{background-color:#dc262633}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:bg-yellow-500\/10:hover{background-color:#eab3081a}.hover\:stroke-blue-500:hover{stroke:#3b82f6}.hover\:text-\[var\(--dg-blue\)\]:hover{color:var(--dg-blue)}.hover\:text-\[var\(--dg-text-primary\)\]:hover{color:var(--dg-text-primary)}.hover\:text-\[var\(--dg-text-secondary\)\]:hover{color:var(--dg-text-secondary)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-400:hover{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-400:hover{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:z-10:focus{z-index:10}.focus\:border-\[var\(--dg-blue\)\]:focus{border-color:var(--dg-blue)}.focus\:border-amber-600:focus{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-\[var\(--dg-bg-hover\)\]:focus{background-color:var(--dg-bg-hover)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-red-500\/10:focus{background-color:#ef44441a}.focus\:bg-slate-700:focus{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.focus\:text-\[var\(--dg-text-primary\)\]:focus{color:var(--dg-text-primary)}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-blue-300:focus{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.focus\:text-cyan-300:focus{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.focus\:text-emerald-300:focus{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.focus\:text-red-400:focus{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.focus\:text-slate-100:focus{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-ring:focus-visible{border-color:hsl(var(--ring))}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-4:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color: hsl(var(--destructive) / .2)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color: hsl(var(--ring) / .5)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.group:hover .group-hover\:to-blue-300{--tw-gradient-to: #93c5fd var(--tw-gradient-to-position)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.group\/cmd:hover .group-hover\/cmd\:opacity-100,.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-50{opacity:.5}.has-\[\>button\]\:ml-\[-0\.45rem\]:has(>button){margin-left:-.45rem}.has-\[\>button\]\:mr-\[-0\.45rem\]:has(>button){margin-right:-.45rem}.has-\[\>kbd\]\:ml-\[-0\.35rem\]:has(>kbd){margin-left:-.35rem}.has-\[\>kbd\]\:mr-\[-0\.35rem\]:has(>kbd){margin-right:-.35rem}.has-\[\>\[data-align\=block-end\]\]\:h-auto:has(>[data-align=block-end]){height:auto}.has-\[\>\[data-align\=block-start\]\]\:h-auto:has(>[data-align=block-start]){height:auto}.has-\[\>textarea\]\:h-auto:has(>textarea){height:auto}.has-\[\>\[data-slot\=field\]\]\:w-full:has(>[data-slot=field]){width:100%}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>\[data-align\=block-end\]\]\:flex-col:has(>[data-align=block-end]){flex-direction:column}.has-\[\>\[data-align\=block-start\]\]\:flex-col:has(>[data-align=block-start]){flex-direction:column}.has-\[\>\[data-slot\=field\]\]\:flex-col:has(>[data-slot=field]){flex-direction:column}.has-\[\>\[data-slot\=field-content\]\]\:items-start:has(>[data-slot=field-content]){align-items:flex-start}.has-\[\>\[data-slot\=button-group\]\]\:gap-2:has(>[data-slot=button-group]){gap:.5rem}.has-\[\>\[data-slot\=checkbox-group\]\]\:gap-3:has(>[data-slot=checkbox-group]){gap:.75rem}.has-\[\>\[data-slot\=radio-group\]\]\:gap-3:has(>[data-slot=radio-group]){gap:.75rem}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:.75rem;column-gap:.75rem}.has-\[\>\[data-slot\=field\]\]\:rounded-md:has(>[data-slot=field]){border-radius:calc(var(--radius) - 2px)}.has-\[\>\[data-slot\=field\]\]\:border:has(>[data-slot=field]){border-width:1px}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:border-ring:has([data-slot=input-group-control]:focus-visible){border-color:hsl(var(--ring))}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:border-destructive:has([data-slot][aria-invalid=true]){--tw-border-opacity: 1;border-color:hsl(var(--destructive) / var(--tw-border-opacity, 1))}.has-\[\>svg\]\:p-0:has(>svg){padding:0}.has-\[\>svg\]\:px-2:has(>svg){padding-left:.5rem;padding-right:.5rem}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-left:.625rem;padding-right:.625rem}.has-\[\>svg\]\:px-3:has(>svg){padding-left:.75rem;padding-right:.75rem}.has-\[\>svg\]\:px-4:has(>svg){padding-left:1rem;padding-right:1rem}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-\[3px\]:has([data-slot=input-group-control]:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-ring\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color: hsl(var(--ring) / .5)}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/20:has([data-slot][aria-invalid=true]){--tw-ring-color: hsl(var(--destructive) / .2)}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:self-start{align-self:flex-start}.group\/field:has([data-orientation=horizontal]) .group-has-\[\[data-orientation\=horizontal\]\]\/field\:text-balance{text-wrap:balance}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pb-2\.5{padding-bottom:.625rem}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pt-2\.5{padding-top:.625rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{left:0;right:0}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{top:0;bottom:0}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{left:0;right:0}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:0}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:0}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:0}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:0}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:6rem}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:6rem}.data-\[orientation\=horizontal\]\:h-1\.5[data-orientation=horizontal]{height:.375rem}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=vertical\]\:h-auto[data-orientation=vertical]{height:auto}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[size\=default\]\:h-9[data-size=default]{height:2.25rem}.data-\[size\=sm\]\:h-8[data-size=sm]{height:2rem}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom],.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:11rem}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:.375rem}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical],.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[slot\=checkbox-group\]\:gap-3[data-slot=checkbox-group]{gap:.75rem}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true],.data-\[spacing\=0\]\:rounded-none[data-spacing="0"]{border-radius:0}.data-\[range-end\=true\]\:rounded-r-md[data-range-end=true]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[range-start\=true\]\:rounded-l-md[data-range-start=true]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:border-l-0[data-variant=outline][data-spacing="0"]{border-left-width:0px}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-width:1px}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:hsl(var(--ring))}.data-\[state\=checked\]\:border-blue-600[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:hsl(var(--primary))}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:hsl(var(--accent) / .5)}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-\[var\(--dg-bg-primary\)\][data-state=active]{background-color:var(--dg-bg-primary)}.data-\[state\=active\]\:bg-\[var\(--dg-bg-tertiary\)\][data-state=active]{background-color:var(--dg-bg-tertiary)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:bg-orange-500\/10[data-state=active]{background-color:#f973161a}.data-\[state\=active\]\:bg-slate-700[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-blue-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[inset\]\:pl-8[data-inset]{padding-left:2rem}.data-\[variant\=label\]\:text-sm[data-variant=label]{font-size:.875rem;line-height:1.25rem}.data-\[variant\=legend\]\:text-base[data-variant=legend]{font-size:1rem;line-height:1.5rem}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:hsl(var(--accent-foreground))}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[error\=true\]\:text-destructive[data-error=true],.data-\[invalid\=true\]\:text-destructive[data-invalid=true]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-orange-400[data-state=active]{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[spacing\=0\]\:shadow-none[data-spacing="0"]{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[spacing\=default\]\:data-\[variant\=outline\]\:shadow-xs[data-variant=outline][data-spacing=default],.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color: hsl(var(--ring) / .5)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.\*\:data-\[slot\=select-value\]\:line-clamp-1[data-slot=select-value]>*{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\*\:data-\[slot\=select-value\]\:flex[data-slot=select-value]>*{display:flex}.\*\:data-\[slot\=select-value\]\:items-center[data-slot=select-value]>*{align-items:center}.\*\:data-\[slot\=select-value\]\:gap-2[data-slot=select-value]>*{gap:.5rem}.\*\:data-\[slot\=alert-description\]\:text-destructive\/90[data-slot=alert-description]>*{color:hsl(var(--destructive) / .9)}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[spacing\=0\]\:first\:rounded-l-md:first-child[data-spacing="0"]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:first\:border-l:first-child[data-variant=outline][data-spacing="0"]{border-left-width:1px}.data-\[spacing\=0\]\:last\:rounded-r-md:last-child[data-spacing="0"]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[active\=true\]\:hover\:bg-accent:hover[data-active=true],.data-\[state\=open\]\:hover\:bg-accent:hover[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.data-\[active\=true\]\:focus\:bg-accent:focus[data-active=true]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:focus\:bg-accent:focus[data-state=open]{background-color:hsl(var(--accent))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10:focus[data-variant=destructive]{background-color:hsl(var(--destructive) / .1)}.data-\[variant\=destructive\]\:focus\:text-destructive:focus[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.group[data-disabled=true] .group-data-\[disabled\=true\]\:pointer-events-none{pointer-events:none}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:top-full{top:100%}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group\/field-group[data-variant=outline] .group-data-\[variant\=outline\]\/field-group\:-mb-2{margin-bottom:-.5rem}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5{margin-top:.375rem}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block{display:block}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)) + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:bg-popover{background-color:hsl(var(--popover))}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:text-center,.group\/drawer-content[data-vaul-drawer-direction=top] .group-data-\[vaul-drawer-direction\=top\]\/drawer-content\:text-center{text-align:center}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground{color:hsl(var(--popover-foreground))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group\/field[data-disabled=true] .group-data-\[disabled\=true\]\/field\:opacity-50,.group\/input-group[data-disabled=true] .group-data-\[disabled\=true\]\/input-group\:opacity-50,.group[data-disabled=true] .group-data-\[disabled\=true\]\:opacity-50{opacity:.5}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:duration-200{transition-duration:.2s;animation-duration:.2s}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-input:is(.dark *){border-color:hsl(var(--input))}.dark\:bg-destructive\/60:is(.dark *){background-color:hsl(var(--destructive) / .6)}.dark\:bg-input\/30:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-transparent:is(.dark *){background-color:transparent}.dark\:text-muted-foreground:is(.dark *){color:hsl(var(--muted-foreground))}.dark\:hover\:bg-accent\/50:hover:is(.dark *){background-color:hsl(var(--accent) / .5)}.dark\:hover\:bg-input\/50:hover:is(.dark *){background-color:hsl(var(--input) / .5)}.dark\:hover\:text-accent-foreground:hover:is(.dark *){color:hsl(var(--accent-foreground))}.dark\:focus-visible\:ring-destructive\/40:focus-visible:is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/40:has([data-slot][aria-invalid=true]):is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:data-\[state\=active\]\:border-input[data-state=active]:is(.dark *){border-color:hsl(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30[data-state=active]:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:data-\[state\=checked\]\:bg-primary[data-state=checked]:is(.dark *){background-color:hsl(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground[data-state=checked]:is(.dark *){background-color:hsl(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground[data-state=unchecked]:is(.dark *){background-color:hsl(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input\/80[data-state=unchecked]:is(.dark *){background-color:hsl(var(--input) / .8)}.dark\:data-\[state\=active\]\:text-foreground[data-state=active]:is(.dark *){color:hsl(var(--foreground))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:focus[data-variant=destructive]:is(.dark *){background-color:hsl(var(--destructive) / .2)}@media(min-width:640px){.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:table-cell{display:table-cell}.sm\:max-w-\[300px\]{max-width:300px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[620px\]{max-width:620px}.sm\:max-w-\[680px\]{max-width:680px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:.5rem}.sm\:gap-2\.5{gap:.625rem}.sm\:pl-2\.5{padding-left:.625rem}.sm\:pr-2\.5{padding-right:.625rem}.sm\:text-left{text-align:left}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:24rem}}@media(min-width:768px){.md\:absolute{position:absolute}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:table-cell{display:table-cell}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[400px\]{max-width:400px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-1\.5{gap:.375rem}.md\:p-12{padding:3rem}.md\:text-left{text-align:left}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.md\:after\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset][data-state=collapsed]~.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:calc(var(--radius) + 4px)}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:table-cell{display:table-cell}.lg\:w-\[360px\]{width:360px}.lg\:w-\[400px\]{width:400px}.lg\:w-\[600px\]{width:600px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:1280px){.xl\:table-cell{display:table-cell}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.\[\&\+\[data-slot\=item-content\]\]\:flex-none+[data-slot=item-content]{flex:none}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:nth-child\(2\)\[data-selected\=true\]_button\]\:rounded-l-md:nth-child(2)[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-l-none>*:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-t-none>*:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:border-l-0>*:not(:first-child){border-left-width:0px}.\[\&\>\*\:not\(\:first-child\)\]\:border-t-0>*:not(:first-child){border-top-width:0px}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-b-none>*:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-r-none>*:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.\[\&\>\*\]\:w-full>*{width:100%}.\[\&\>\*\]\:focus-visible\:relative:focus-visible>*{position:relative}.\[\&\>\*\]\:focus-visible\:z-10:focus-visible>*{z-index:10}.\[\&\>\*\]\:data-\[slot\=field\]\:p-4[data-slot=field]>*{padding:1rem}.\[\&\>\.sr-only\]\:w-auto>.sr-only{width:auto}.\[\&\>\[data-slot\=field-group\]\]\:gap-4>[data-slot=field-group]{gap:1rem}.\[\&\>\[data-slot\=field-label\]\]\:flex-auto>[data-slot=field-label]{flex:1 1 auto}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-amber-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-emerald-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-red-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.has-\[select\[aria-hidden\=true\]\:last-child\]\:\[\&\>\[data-slot\=select-trigger\]\:last-of-type\]\:rounded-r-md>[data-slot=select-trigger]:last-of-type:has(select[aria-hidden=true]:last-child){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[data-slot\=select-trigger\]\:not\(\[class\*\=\'w-\'\]\)\]\:w-fit>[data-slot=select-trigger]:not([class*=w-]){width:-moz-fit-content;width:fit-content}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>a\:hover\]\:text-primary>a:hover{color:hsl(var(--primary))}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>input\]\:flex-1>input{flex:1 1 0%}.has-\[\>\[data-align\=block-end\]\]\:\[\&\>input\]\:pt-3>input:has(>[data-align=block-end]){padding-top:.75rem}.has-\[\>\[data-align\=block-start\]\]\:\[\&\>input\]\:pb-3>input:has(>[data-align=block-start]){padding-bottom:.75rem}.has-\[\>\[data-align\=inline-end\]\]\:\[\&\>input\]\:pr-2>input:has(>[data-align=inline-end]){padding-right:.5rem}.has-\[\>\[data-align\=inline-start\]\]\:\[\&\>input\]\:pl-2>input:has(>[data-align=inline-start]){padding-left:.5rem}.\[\&\>kbd\]\:rounded-\[calc\(var\(--radius\)-5px\)\]>kbd{border-radius:calc(var(--radius) - 5px)}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5>svg:not([class*=size-]){width:.875rem;height:.875rem}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4>svg:not([class*=size-]){width:1rem;height:1rem}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:.75rem;height:.75rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_img\]\:size-full img{width:100%;height:100%}.\[\&_img\]\:object-cover img{-o-object-fit:cover;object-fit:cover}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:.75rem;height:.75rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:1rem;height:1rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:1.5rem;height:1.5rem}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:hsl(var(--muted-foreground))}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/20{background-color:hsl(var(--background) / .2)}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:text-background{color:hsl(var(--background))}[data-slot=tooltip-content] .dark\:\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/10:is(.dark *){background-color:hsl(var(--background) / .1)}[data-variant=legend]+.\[\[data-variant\=legend\]\+\&\]\:-mt-1\.5{margin-top:-.375rem}a.\[a\&\]\:hover\:bg-accent:hover{background-color:hsl(var(--accent))}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))} diff --git a/backend/static/assets/index-BlowzRFW.js b/backend/static/assets/index-BlowzRFW.js deleted file mode 100644 index 832eeed..0000000 --- a/backend/static/assets/index-BlowzRFW.js +++ /dev/null @@ -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}; diff --git a/backend/static/assets/index-BzYDIT5o.css b/backend/static/assets/index-BzYDIT5o.css new file mode 100644 index 0000000..8d132bc --- /dev/null +++ b/backend/static/assets/index-BzYDIT5o.css @@ -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 0% 100%;--secondary: 220 13% 14%;--secondary-foreground: 210 40% 98%;--muted: 220 13% 14%;--muted-foreground: 215 20% 55%;--accent: 220 13% 14%;--accent-foreground: 210 40% 98%;--destructive: 0 62% 50%;--destructive-foreground: 0 0% 100%;--border: 220 13% 18%;--input: 220 13% 14%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 220 13% 7%;--sidebar-foreground: 210 40% 90%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 13% 14%;--sidebar-accent-foreground: 210 40% 98%;--sidebar-border: 220 13% 18%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #0d1117;--dg-bg-secondary: #161b22;--dg-bg-tertiary: #21262d;--dg-bg-hover: #30363d;--dg-bg-active: #3d444d;--dg-border: #30363d;--dg-border-light: #21262d;--dg-border-hover: #484f58;--dg-text-primary: #f0f6fc;--dg-text-secondary: #8b949e;--dg-text-muted: #6e7681;--dg-blue: #58a6ff;--dg-green: #3fb950;--dg-red: #f85149;--dg-orange: #f0883e;--dg-purple: #8957e5;--dg-cyan: #39c5cf;--dg-yellow: #d29922;--dg-card-hover-border: rgba(88, 166, 255, .5);--dg-gradient-start: #2563eb;--dg-gradient-end: #9333ea;--dg-gradient-text-start: #60a5fa;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(96, 165, 250, .2);--chart-grid: #1e293b;--chart-axis: #475569;--chart-tooltip-bg: #0f172a;--chart-tooltip-border: #1e293b;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(88, 166, 255, .15);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #21262d;--skeleton-highlight: #30363d}[data-theme=light-professional],[data-theme=light]{--background: 0 0% 100%;--foreground: 220 14% 10%;--card: 0 0% 100%;--card-foreground: 220 14% 10%;--popover: 0 0% 100%;--popover-foreground: 220 14% 10%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 14% 96%;--secondary-foreground: 220 14% 10%;--muted: 220 14% 96%;--muted-foreground: 220 10% 46%;--accent: 220 14% 96%;--accent-foreground: 220 14% 10%;--destructive: 0 72% 51%;--destructive-foreground: 0 0% 100%;--border: 220 13% 91%;--input: 220 13% 91%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 0 0% 98%;--sidebar-foreground: 220 14% 20%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 14% 94%;--sidebar-accent-foreground: 220 14% 10%;--sidebar-border: 220 13% 91%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #ffffff;--dg-bg-secondary: #f8f9fb;--dg-bg-tertiary: #f0f1f5;--dg-bg-hover: #e8eaef;--dg-bg-active: #dfe1e8;--dg-border: #e2e5eb;--dg-border-light: #eaecf0;--dg-border-hover: #d0d5dd;--dg-text-primary: #1a1d23;--dg-text-secondary: #5c6370;--dg-text-muted: #9ca3af;--dg-blue: #2563eb;--dg-green: #16a34a;--dg-red: #dc2626;--dg-orange: #ea580c;--dg-purple: #7c3aed;--dg-cyan: #0891b2;--dg-yellow: #ca8a04;--dg-card-hover-border: rgba(37, 99, 235, .3);--dg-gradient-start: #2563eb;--dg-gradient-end: #7c3aed;--dg-gradient-text-start: #1d4ed8;--dg-gradient-text-end: #6d28d9;--dg-input-focus-ring: rgba(37, 99, 235, .15);--chart-grid: #e2e5eb;--chart-axis: #9ca3af;--chart-tooltip-bg: #ffffff;--chart-tooltip-border: #e2e5eb;--shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .1), 0 0 0 1px rgba(37, 99, 235, .1);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .12);--skeleton-base: #f0f1f5;--skeleton-highlight: #e8eaef}[data-theme=midnight-purple]{--background: 264 56% 4%;--foreground: 280 100% 98%;--card: 264 48% 8%;--card-foreground: 280 100% 98%;--popover: 264 48% 8%;--popover-foreground: 280 100% 98%;--primary: 270 91% 65%;--primary-foreground: 0 0% 100%;--secondary: 264 40% 20%;--secondary-foreground: 280 100% 98%;--muted: 264 40% 20%;--muted-foreground: 280 30% 60%;--accent: 264 40% 20%;--accent-foreground: 280 100% 98%;--destructive: 348 100% 72%;--destructive-foreground: 264 56% 4%;--border: 264 40% 20%;--input: 264 40% 20%;--ring: 270 91% 65%;--radius: .625rem;--sidebar-background: 264 48% 6%;--sidebar-foreground: 280 100% 92%;--sidebar-primary: 270 91% 65%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 264 40% 20%;--sidebar-accent-foreground: 280 100% 98%;--sidebar-border: 264 40% 20%;--sidebar-ring: 270 91% 65%;--dg-bg-primary: #0a0612;--dg-bg-secondary: #130c21;--dg-bg-tertiary: #1c1330;--dg-bg-hover: #2d1f4a;--dg-bg-active: #3d2a5e;--dg-border: #2d1f4a;--dg-border-light: #1c1330;--dg-border-hover: #3d2a5e;--dg-text-primary: #faf5ff;--dg-text-secondary: #b794c7;--dg-text-muted: #7c5a8a;--dg-blue: #818cf8;--dg-green: #34d399;--dg-red: #fb7185;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #22d3ee;--dg-yellow: #facc15;--dg-card-hover-border: rgba(192, 132, 252, .5);--dg-gradient-start: #9333ea;--dg-gradient-end: #c084fc;--dg-gradient-text-start: #a855f7;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(192, 132, 252, .2);--chart-grid: #2d1f4a;--chart-axis: #7c5a8a;--chart-tooltip-bg: #130c21;--chart-tooltip-border: #2d1f4a;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(192, 132, 252, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(192, 132, 252, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #1c1330;--skeleton-highlight: #2d1f4a}[data-theme=pine-green]{--background: 150 25% 5%;--foreground: 140 60% 97%;--card: 150 25% 9%;--card-foreground: 140 60% 97%;--popover: 150 25% 9%;--popover-foreground: 140 60% 97%;--primary: 142 71% 45%;--primary-foreground: 150 25% 5%;--secondary: 150 20% 18%;--secondary-foreground: 140 60% 97%;--muted: 150 20% 18%;--muted-foreground: 150 20% 55%;--accent: 150 20% 18%;--accent-foreground: 140 60% 97%;--destructive: 0 90% 72%;--destructive-foreground: 150 25% 5%;--border: 150 20% 18%;--input: 150 20% 18%;--ring: 142 71% 45%;--radius: .625rem;--sidebar-background: 150 25% 7%;--sidebar-foreground: 140 40% 88%;--sidebar-primary: 142 71% 45%;--sidebar-primary-foreground: 150 25% 5%;--sidebar-accent: 150 20% 18%;--sidebar-accent-foreground: 140 60% 97%;--sidebar-border: 150 20% 18%;--sidebar-ring: 142 71% 45%;--dg-bg-primary: #0a1210;--dg-bg-secondary: #111f1a;--dg-bg-tertiary: #192c24;--dg-bg-hover: #253d32;--dg-bg-active: #2f4f3e;--dg-border: #253d32;--dg-border-light: #192c24;--dg-border-hover: #2f4f3e;--dg-text-primary: #f0fdf4;--dg-text-secondary: #86b8a0;--dg-text-muted: #5a7c6b;--dg-blue: #38bdf8;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #2dd4bf;--dg-yellow: #facc15;--dg-card-hover-border: rgba(74, 222, 128, .5);--dg-gradient-start: #059669;--dg-gradient-end: #10b981;--dg-gradient-text-start: #059669;--dg-gradient-text-end: #34d399;--dg-input-focus-ring: rgba(74, 222, 128, .2);--chart-grid: #253d32;--chart-axis: #5a7c6b;--chart-tooltip-bg: #111f1a;--chart-tooltip-border: #253d32;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(74, 222, 128, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(74, 222, 128, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #192c24;--skeleton-highlight: #253d32}[data-theme=orange-vitality]{--background: 30 35% 5%;--foreground: 30 100% 97%;--card: 30 30% 9%;--card-foreground: 30 100% 97%;--popover: 30 30% 9%;--popover-foreground: 30 100% 97%;--primary: 25 95% 53%;--primary-foreground: 0 0% 100%;--secondary: 30 25% 18%;--secondary-foreground: 30 100% 97%;--muted: 30 25% 18%;--muted-foreground: 30 25% 55%;--accent: 30 25% 18%;--accent-foreground: 30 100% 97%;--destructive: 0 80% 70%;--destructive-foreground: 30 35% 5%;--border: 30 25% 18%;--input: 30 25% 18%;--ring: 25 95% 53%;--radius: .625rem;--sidebar-background: 30 30% 7%;--sidebar-foreground: 30 80% 88%;--sidebar-primary: 25 95% 53%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 30 25% 18%;--sidebar-accent-foreground: 30 100% 97%;--sidebar-border: 30 25% 18%;--sidebar-ring: 25 95% 53%;--dg-bg-primary: #110d08;--dg-bg-secondary: #1d1610;--dg-bg-tertiary: #2b1f16;--dg-bg-hover: #3d2d20;--dg-bg-active: #4d3928;--dg-border: #3d2d20;--dg-border-light: #2b1f16;--dg-border-hover: #4d3928;--dg-text-primary: #fef7ed;--dg-text-secondary: #d4a574;--dg-text-muted: #9c7a54;--dg-blue: #60a5fa;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #a78bfa;--dg-cyan: #2dd4bf;--dg-yellow: #fcd34d;--dg-card-hover-border: rgba(251, 146, 60, .5);--dg-gradient-start: #ea580c;--dg-gradient-end: #f59e0b;--dg-gradient-text-start: #f97316;--dg-gradient-text-end: #fbbf24;--dg-input-focus-ring: rgba(251, 146, 60, .2);--chart-grid: #3d2d20;--chart-axis: #9c7a54;--chart-tooltip-bg: #1d1610;--chart-tooltip-border: #3d2d20;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(251, 146, 60, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(251, 146, 60, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #2b1f16;--skeleton-highlight: #3d2d20}*{border-color:hsl(var(--border))}html{scroll-behavior:smooth}body{background-color:var(--dg-bg-primary);color:var(--dg-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;font-feature-settings:"rlig" 1,"calt" 1;transition:background-color .3s ease,color .3s ease}body[data-scroll-locked],body[data-radix-scroll-locked],body[style*=padding-right]{padding-right:0!important}code,pre,.font-mono{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace}::-moz-selection{background-color:var(--dg-blue);color:#fff}::selection{background-color:var(--dg-blue);color:#fff}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.\!left-0{left:0!important}.\!top-0{top:0!important}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-0\.5{right:-.125rem}.-right-12{right:-3rem}.-top-0\.5{top:-.125rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.order-first{order:-9999}.order-last{order:9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-full{grid-column:1 / -1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2 / span 2}.row-start-1{grid-row-start:1}.\!m-0{margin:0!important}.m-4{margin:1rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-px{margin-left:-1px;margin-right:-1px}.-my-2{margin-top:-.5rem;margin-bottom:-.5rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0{margin-top:0;margin-bottom:0}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-2\.5{margin-left:.625rem}.ml-4{margin-left:1rem}.ml-9{margin-left:2.25rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-2\.5{margin-right:.625rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-10{width:2.5rem;height:2.5rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-auto{width:auto;height:auto}.size-full{width:100%;height:100%}.\!h-screen{height:100vh!important}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1\.15rem\]{height:1.15rem}.h-\[120px\]{height:120px}.h-\[180px\]{height:180px}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-\[80vh\]{height:80vh}.h-\[88vh\]{height:88vh}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[120px\]{max-height:120px}.max-h-\[180px\]{max-height:180px}.max-h-\[220px\]{max-height:220px}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[40vh\]{max-height:40vh}.max-h-\[420px\]{max-height:420px}.max-h-\[45vh\]{max-height:45vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[520px\]{max-height:520px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[800px\]{max-height:800px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-0{min-height:0px}.min-h-16{min-height:4rem}.min-h-4{min-height:1rem}.min-h-\[100px\]{min-height:100px}.min-h-\[200px\]{min-height:200px}.min-h-\[360px\]{min-height:360px}.min-h-\[36px\]{min-height:36px}.min-h-\[400px\]{min-height:400px}.min-h-\[50px\]{min-height:50px}.min-h-\[50vh\]{min-height:50vh}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[70px\]{min-height:70px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-screen{width:100vw!important}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[100px\]{width:100px}.w-\[110px\]{width:110px}.w-\[120px\]{width:120px}.w-\[128px\]{width:128px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[16\%\]{width:16%}.w-\[160px\]{width:160px}.w-\[170px\]{width:170px}.w-\[20\%\]{width:20%}.w-\[200px\]{width:200px}.w-\[240px\]{width:240px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[40\%\]{width:40%}.w-\[460px\]{width:460px}.w-\[480px\]{width:480px}.w-\[60px\]{width:60px}.w-\[72px\]{width:72px}.w-\[8\%\]{width:8%}.w-\[80px\]{width:80px}.w-\[88px\]{width:88px}.w-\[90px\]{width:90px}.w-\[90vw\]{width:90vw}.w-\[92vw\]{width:92vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-10{min-width:2.5rem}.min-w-5{min-width:1.25rem}.min-w-8{min-width:2rem}.min-w-9{min-width:2.25rem}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.min-w-\[28px\]{min-width:28px}.min-w-\[300px\]{min-width:300px}.min-w-\[30px\]{min-width:30px}.min-w-\[400px\]{min-width:400px}.min-w-\[40px\]{min-width:40px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[90px\]{min-width:90px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.\!max-w-none{max-width:none!important}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[320px\]{max-width:320px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.\!translate-x-0{--tw-translate-x: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.\!translate-y-0{--tw-translate-y: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.animate-caret-blink{animation:caret-blink 1.25s ease-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize-y{resize:vertical}.resize{resize:both}.scroll-my-1{scroll-margin-top:.25rem;scroll-margin-bottom:.25rem}.scroll-py-1{scroll-padding-top:.25rem;scroll-padding-bottom:.25rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-cols-\[1fr_1\.4fr_auto\]{grid-template-columns:1fr 1.4fr auto}.grid-cols-\[1fr_100px_1fr_60px_28px\]{grid-template-columns:1fr 100px 1fr 60px 28px}.grid-cols-\[1fr_1fr_100px_auto\]{grid-template-columns:1fr 1fr 100px auto}.grid-cols-\[1fr_1fr_1fr_60px_auto\]{grid-template-columns:1fr 1fr 1fr 60px auto}.grid-cols-\[1fr_80px_1fr_100px_80px_auto\]{grid-template-columns:1fr 80px 1fr 100px 80px auto}.grid-cols-\[1fr_80px_80px_80px_80px_32px\]{grid-template-columns:1fr 80px 80px 80px 80px 32px}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-start{justify-items:start}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-7{gap:1.75rem}.gap-\[--spacing\(var\(--gap\)\)\]{gap:var(--spacing(var(--gap)))}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.gap-y-3{row-gap:.75rem}.gap-y-4{row-gap:1rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--dg-border\)\]>:not([hidden])~:not([hidden]){border-color:var(--dg-border)}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.justify-self-end{justify-self:end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[calc\(var\(--radius\)-5px\)\]{border-radius:calc(var(--radius) - 5px)}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:calc(var(--radius) - 6px)}.rounded-b-md{border-bottom-right-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.rounded-t-sm{border-top-left-radius:calc(var(--radius) - 4px);border-top-right-radius:calc(var(--radius) - 4px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[var\(--dg-blue\)\]{border-color:var(--dg-blue)}.border-\[var\(--dg-border\)\]{border-color:var(--dg-border)}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/50{border-color:#f59e0b80}.border-amber-600{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.border-amber-700\/50{border-color:#b4530980}.border-amber-800\/30{border-color:#92400e4d}.border-amber-800\/40{border-color:#92400e66}.border-amber-800\/50{border-color:#92400e80}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/20{border-color:#60a5fa33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-blue-600\/50{border-color:#2563eb80}.border-blue-700\/50{border-color:#1d4ed880}.border-blue-800\/50{border-color:#1e40af80}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-cyan-500{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-400\/50{border-color:#34d39980}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-600{--tw-border-opacity: 1;border-color:rgb(5 150 105 / var(--tw-border-opacity, 1))}.border-emerald-600\/30{border-color:#0596694d}.border-emerald-700\/50{border-color:#04785780}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-400\/50{border-color:#818cf880}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-700\/50{border-color:#7e22ce80}.border-purple-800\/50{border-color:#6b21a880}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/40{border-color:#ef444466}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-red-600\/30{border-color:#dc26264d}.border-red-700\/50{border-color:#b91c1c80}.border-rose-500\/30{border-color:#f43f5e4d}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-500{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/30{border-color:#4755694d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/30{border-color:#1e293b4d}.border-slate-800\/50{border-color:#1e293b80}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.border-transparent{border-color:transparent}.border-violet-500\/30{border-color:#8b5cf64d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-l-\[var\(--dg-warning\)\]{border-left-color:var(--dg-warning)}.border-l-transparent{border-left-color:transparent}.border-t-\[var\(--dg-blue\)\]{border-top-color:var(--dg-blue)}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-\[\#0a0e14\]{--tw-bg-opacity: 1;background-color:rgb(10 14 20 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1117\]{--tw-bg-opacity: 1;background-color:rgb(13 17 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0f172a\]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-\[var\(--dg-accent\)\]{background-color:var(--dg-accent)}.bg-\[var\(--dg-bg-hover\)\]{background-color:var(--dg-bg-hover)}.bg-\[var\(--dg-bg-primary\)\]{background-color:var(--dg-bg-primary)}.bg-\[var\(--dg-bg-secondary\)\]{background-color:var(--dg-bg-secondary)}.bg-\[var\(--dg-bg-tertiary\)\]{background-color:var(--dg-bg-tertiary)}.bg-\[var\(--dg-blue\)\]{background-color:var(--dg-blue)}.bg-\[var\(--dg-border\)\]{background-color:var(--dg-border)}.bg-\[var\(--dg-green\)\]{background-color:var(--dg-green)}.bg-\[var\(--dg-purple\)\]{background-color:var(--dg-purple)}.bg-\[var\(--dg-red\)\]{background-color:var(--dg-red)}.bg-\[var\(--dg-text-secondary\)\]{background-color:var(--dg-text-secondary)}.bg-\[var\(--dg-yellow\)\]{background-color:var(--dg-yellow)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-400\/40{background-color:#fbbf2466}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-500\/60{background-color:#f59e0b99}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-600\/40{background-color:#d9770666}.bg-amber-950\/30{background-color:#451a034d}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-400\/10{background-color:#60a5fa1a}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-500\/5{background-color:#3b82f60d}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-950\/20{background-color:#17255433}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/20{background-color:#06b6d433}.bg-destructive{--tw-bg-opacity: 1;background-color:hsl(var(--destructive) / var(--tw-bg-opacity, 1))}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/30{background-color:#10b9814d}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-500\/60{background-color:#10b98199}.bg-emerald-500\/90{background-color:#10b981e6}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-600\/30{background-color:#0596694d}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-indigo-400\/10{background-color:#818cf81a}.bg-indigo-500\/10{background-color:#6366f11a}.bg-input{background-color:hsl(var(--input))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-500\/5{background-color:#a855f70d}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/20{background-color:#3b076433}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/20{background-color:#dc262633}.bg-red-600\/40{background-color:#dc262666}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/20{background-color:#f43f5e33}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/10{background-color:#64748b1a}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/10{background-color:#4755691a}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/50{background-color:#33415580}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/30{background-color:#1e293b4d}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/30{background-color:#0f172a4d}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/30{background-color:#0206174d}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/80{background-color:#020617cc}.bg-transparent{background-color:transparent}.bg-violet-500\/20{background-color:#8b5cf633}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-400\/15{background-color:#facc1526}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[var\(--dg-blue\)\]{--tw-gradient-from: var(--dg-blue) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500\/50{--tw-gradient-from: rgb(59 130 246 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600\/60{--tw-gradient-from: rgb(37 99 235 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\[var\(--dg-cyan\)\]{--tw-gradient-to: var(--dg-cyan) var(--tw-gradient-to-position)}.to-\[var\(--dg-purple\)\]{--tw-gradient-to: var(--dg-purple) var(--tw-gradient-to-position)}.to-amber-500{--tw-gradient-to: #f59e0b var(--tw-gradient-to-position)}.to-blue-400\/80{--tw-gradient-to: rgb(96 165 250 / .8) var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-primary{fill:hsl(var(--primary))}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-px{padding-bottom:1px}.pl-1{padding-left:.25rem}.pl-1\.5{padding-left:.375rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-\[var\(--header-height\)\]{padding-top:var(--header-height)}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[15px\]{font-size:15px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-sm\/relaxed{font-size:.875rem;line-height:1.625}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-5{line-height:1.25rem}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[var\(--dg-blue\)\]{color:var(--dg-blue)}.text-\[var\(--dg-border\)\]{color:var(--dg-border)}.text-\[var\(--dg-cyan\)\]{color:var(--dg-cyan)}.text-\[var\(--dg-green\)\]{color:var(--dg-green)}.text-\[var\(--dg-orange\)\]{color:var(--dg-orange)}.text-\[var\(--dg-purple\)\]{color:var(--dg-purple)}.text-\[var\(--dg-red\)\]{color:var(--dg-red)}.text-\[var\(--dg-text-muted\)\]{color:var(--dg-text-muted)}.text-\[var\(--dg-text-primary\)\]{color:var(--dg-text-primary)}.text-\[var\(--dg-text-secondary\)\]{color:var(--dg-text-secondary)}.text-\[var\(--dg-warning\)\]{color:var(--dg-warning)}.text-\[var\(--dg-yellow\)\]{color:var(--dg-yellow)}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/80{color:#fcd34dcc}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-500\/70{color:#f59e0bb3}.text-background{color:hsl(var(--background))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-destructive{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-400\/70{color:#4ade80b3}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-muted{color:hsl(var(--muted))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/70{color:#f87171b3}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-400\/80{color:#facc15cc}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-blue-500{accent-color:#3b82f6}.accent-blue-600{accent-color:#2563eb}.accent-cyan-500{accent-color:#06b6d4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-500\/30{--tw-ring-color: rgb(245 158 11 / .3)}.ring-blue-500\/30{--tw-ring-color: rgb(59 130 246 / .3)}.ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-0{--tw-ring-offset-width: 0px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.\!transition-none{transition-property:none!important}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\!duration-0{transition-duration:0s!important}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in,.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.\!duration-0{animation-duration:0s!important}.duration-100{animation-duration:.1s}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.dg-card{border-radius:calc(var(--radius) + 4px);border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-secondary);box-shadow:var(--shadow-card);transition:background-color .3s ease,border-color .3s ease,box-shadow .3s ease,transform .3s ease}.dg-card-hover{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s;animation-duration:.3s}.dg-card-hover:hover{border-color:var(--dg-card-hover-border);box-shadow:var(--shadow-card-hover);transform:translateY(-2px)}.dg-input{border-radius:var(--radius);border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary)}.dg-input::-moz-placeholder{color:var(--dg-text-muted)}.dg-input::placeholder{color:var(--dg-text-muted)}.dg-input:focus{border-color:var(--dg-blue);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.dg-input{transition:border-color .2s ease,box-shadow .2s ease}.dg-input:focus{--tw-ring-color: var(--dg-input-focus-ring);box-shadow:0 0 0 3px var(--dg-input-focus-ring)}.dg-gradient-text{background:linear-gradient(to right,var(--dg-gradient-text-start),var(--dg-gradient-text-end));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.dg-gradient-bg{background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end))}.dg-page>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.dg-page{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.dg-page-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem}.dg-page-title{font-size:1.5rem;line-height:2rem;font-weight:700;letter-spacing:-.025em;color:var(--dg-text-primary)}.dg-page-subtitle{margin-top:.25rem;font-size:.875rem;line-height:1.25rem;color:var(--dg-text-muted)}.dg-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.dg-btn-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end));display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-primary:hover{opacity:.9}.dg-btn-primary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-primary{box-shadow:0 4px 16px color-mix(in srgb,var(--dg-gradient-start) 25%,transparent)}.dg-btn-primary:hover{box-shadow:0 6px 24px color-mix(in srgb,var(--dg-gradient-start) 35%,transparent)}.dg-btn-secondary{border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-secondary:hover{border-color:var(--dg-border-hover);background-color:var(--dg-bg-hover)}.dg-btn-secondary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-ghost{color:var(--dg-text-secondary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-ghost:hover{background-color:var(--dg-bg-hover);color:var(--dg-text-primary)}.dg-badge-blue{background-color:#3b82f61a;--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-green{background-color:#22c55e1a;--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-red{background-color:#ef44441a;--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-yellow{background-color:#eab3081a;--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-purple{background-color:#a855f71a;--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:var(--dg-border) transparent}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--dg-border);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--dg-text-muted)}@keyframes fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.animate-fade-in-delay-1{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .05s both}.animate-fade-in-delay-2{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .1s both}.animate-fade-in-delay-3{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .15s both}.animate-fade-in-delay-4{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .2s both}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scale-in .25s cubic-bezier(.16,1,.3,1) forwards}@keyframes slide-in-right{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes pulse-ring{0%{transform:scale(.8);opacity:.5}to{transform:scale(1.2);opacity:0}}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.dg-skeleton{background:linear-gradient(90deg,var(--skeleton-base) 25%,var(--skeleton-highlight) 50%,var(--skeleton-base) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:.5rem}.glass{background:color-mix(in srgb,var(--dg-bg-secondary) 75%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid var(--dg-border)}.chart-grid-stroke{stroke:var(--chart-grid)}.chart-tooltip{background-color:var(--chart-tooltip-bg)!important;border:1px solid var(--chart-tooltip-border)!important;border-radius:6px!important;color:var(--dg-text-primary)!important;box-shadow:var(--shadow-dropdown)!important}.\[--cell-size\:--spacing\(8\)\]{--cell-size: var(--spacing(8))}pre{overflow-x:auto;border-radius:var(--radius);padding:1rem;background-color:var(--dg-bg-tertiary);border:1px solid var(--dg-border)}code{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem}table{width:100%}th{text-align:left;font-size:.75rem;line-height:1rem;font-weight:500;text-transform:uppercase;letter-spacing:.05em;color:var(--dg-text-secondary)}td{font-size:.875rem;line-height:1.25rem;color:var(--dg-text-primary)}input:focus,textarea:focus,select:focus{outline:none;box-shadow:0 0 0 2px var(--dg-bg-primary),0 0 0 4px var(--dg-blue);border-color:var(--dg-blue)}button{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.terminal{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem;background-color:var(--dg-bg-primary);color:var(--dg-text-secondary)}.terminal .prompt{color:var(--dg-green)}.terminal .command{color:var(--dg-text-primary)}.terminal .output{color:var(--dg-text-muted)}.recharts-tooltip-wrapper{z-index:50}.recharts-default-tooltip{background-color:var(--chart-tooltip-bg)!important;border-color:var(--chart-tooltip-border)!important;color:var(--dg-text-primary)!important;border-radius:6px!important;box-shadow:var(--shadow-dropdown)!important}[data-state=open]>[data-radix-dialog-overlay]{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:color-mix(in srgb,var(--dg-bg-primary) 80%,transparent)}[role=menuitem]{cursor:pointer}@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(100%)}}.progress-indeterminate:after{content:"";position:absolute;inset:0;background-color:currentColor;animation:progress-indeterminate 1.5s ease-in-out infinite}.xterm-terminal-host{width:100%;overflow:hidden;background:#0a0e14}.xterm-terminal-host .xterm{height:100%}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.dg-skeleton{animation:none;background:var(--skeleton-base)}}.selection\:bg-primary *::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary *::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground *::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground *::selection{color:hsl(var(--primary-foreground))}.selection\:bg-primary::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:hsl(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:1.75rem}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-\[var\(--dg-text-muted\)\]::-moz-placeholder{color:var(--dg-text-muted)}.placeholder\:text-\[var\(--dg-text-muted\)\]::placeholder{color:var(--dg-text-muted)}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:mt-0:last-child{margin-top:0}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:border-r-0:last-child{border-right-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--dg-border\)\]:hover{border-color:var(--dg-border)}.hover\:border-\[var\(--dg-border-hover\)\]:hover{border-color:var(--dg-border-hover)}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/50:hover{border-color:#3b82f680}.hover\:border-orange-500\/30:hover{border-color:#f973164d}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-slate-400:hover{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-\[var\(--dg-bg-hover\)\]:hover{background-color:var(--dg-bg-hover)}.hover\:bg-\[var\(--dg-bg-primary\)\]:hover{background-color:var(--dg-bg-primary)}.hover\:bg-\[var\(--dg-bg-tertiary\)\]:hover{background-color:var(--dg-bg-tertiary)}.hover\:bg-\[var\(--dg-blue-hover\)\]:hover{background-color:var(--dg-blue-hover)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-600\/20:hover{background-color:#d9770633}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-600\/10:hover{background-color:#2563eb1a}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500\/20:hover{background-color:#06b6d433}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-600\/10:hover{background-color:#0596691a}.hover\:bg-emerald-600\/20:hover{background-color:#05966933}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-green-500\/10:hover{background-color:#22c55e1a}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/20:hover{background-color:#dc262633}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:bg-yellow-500\/10:hover{background-color:#eab3081a}.hover\:stroke-blue-500:hover{stroke:#3b82f6}.hover\:text-\[var\(--dg-blue\)\]:hover{color:var(--dg-blue)}.hover\:text-\[var\(--dg-text-primary\)\]:hover{color:var(--dg-text-primary)}.hover\:text-\[var\(--dg-text-secondary\)\]:hover{color:var(--dg-text-secondary)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-400:hover{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-400:hover{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:z-10:focus{z-index:10}.focus\:border-\[var\(--dg-blue\)\]:focus{border-color:var(--dg-blue)}.focus\:border-amber-600:focus{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-\[var\(--dg-bg-hover\)\]:focus{background-color:var(--dg-bg-hover)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-red-500\/10:focus{background-color:#ef44441a}.focus\:bg-slate-700:focus{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.focus\:text-\[var\(--dg-text-primary\)\]:focus{color:var(--dg-text-primary)}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-blue-300:focus{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.focus\:text-cyan-300:focus{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.focus\:text-emerald-300:focus{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.focus\:text-red-400:focus{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.focus\:text-slate-100:focus{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-ring:focus-visible{border-color:hsl(var(--ring))}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-4:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color: hsl(var(--destructive) / .2)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color: hsl(var(--ring) / .5)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.group:hover .group-hover\:to-blue-300{--tw-gradient-to: #93c5fd var(--tw-gradient-to-position)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.group\/cmd:hover .group-hover\/cmd\:opacity-100,.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-50{opacity:.5}.has-\[\>button\]\:ml-\[-0\.45rem\]:has(>button){margin-left:-.45rem}.has-\[\>button\]\:mr-\[-0\.45rem\]:has(>button){margin-right:-.45rem}.has-\[\>kbd\]\:ml-\[-0\.35rem\]:has(>kbd){margin-left:-.35rem}.has-\[\>kbd\]\:mr-\[-0\.35rem\]:has(>kbd){margin-right:-.35rem}.has-\[\>\[data-align\=block-end\]\]\:h-auto:has(>[data-align=block-end]){height:auto}.has-\[\>\[data-align\=block-start\]\]\:h-auto:has(>[data-align=block-start]){height:auto}.has-\[\>textarea\]\:h-auto:has(>textarea){height:auto}.has-\[\>\[data-slot\=field\]\]\:w-full:has(>[data-slot=field]){width:100%}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>\[data-align\=block-end\]\]\:flex-col:has(>[data-align=block-end]){flex-direction:column}.has-\[\>\[data-align\=block-start\]\]\:flex-col:has(>[data-align=block-start]){flex-direction:column}.has-\[\>\[data-slot\=field\]\]\:flex-col:has(>[data-slot=field]){flex-direction:column}.has-\[\>\[data-slot\=field-content\]\]\:items-start:has(>[data-slot=field-content]){align-items:flex-start}.has-\[\>\[data-slot\=button-group\]\]\:gap-2:has(>[data-slot=button-group]){gap:.5rem}.has-\[\>\[data-slot\=checkbox-group\]\]\:gap-3:has(>[data-slot=checkbox-group]){gap:.75rem}.has-\[\>\[data-slot\=radio-group\]\]\:gap-3:has(>[data-slot=radio-group]){gap:.75rem}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:.75rem;column-gap:.75rem}.has-\[\>\[data-slot\=field\]\]\:rounded-md:has(>[data-slot=field]){border-radius:calc(var(--radius) - 2px)}.has-\[\>\[data-slot\=field\]\]\:border:has(>[data-slot=field]){border-width:1px}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:border-ring:has([data-slot=input-group-control]:focus-visible){border-color:hsl(var(--ring))}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:border-destructive:has([data-slot][aria-invalid=true]){--tw-border-opacity: 1;border-color:hsl(var(--destructive) / var(--tw-border-opacity, 1))}.has-\[\>svg\]\:p-0:has(>svg){padding:0}.has-\[\>svg\]\:px-2:has(>svg){padding-left:.5rem;padding-right:.5rem}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-left:.625rem;padding-right:.625rem}.has-\[\>svg\]\:px-3:has(>svg){padding-left:.75rem;padding-right:.75rem}.has-\[\>svg\]\:px-4:has(>svg){padding-left:1rem;padding-right:1rem}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-\[3px\]:has([data-slot=input-group-control]:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-ring\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color: hsl(var(--ring) / .5)}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/20:has([data-slot][aria-invalid=true]){--tw-ring-color: hsl(var(--destructive) / .2)}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:self-start{align-self:flex-start}.group\/field:has([data-orientation=horizontal]) .group-has-\[\[data-orientation\=horizontal\]\]\/field\:text-balance{text-wrap:balance}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pb-2\.5{padding-bottom:.625rem}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pt-2\.5{padding-top:.625rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{left:0;right:0}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{top:0;bottom:0}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{left:0;right:0}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:0}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:0}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:0}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:0}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:6rem}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:6rem}.data-\[orientation\=horizontal\]\:h-1\.5[data-orientation=horizontal]{height:.375rem}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=vertical\]\:h-auto[data-orientation=vertical]{height:auto}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[size\=default\]\:h-9[data-size=default]{height:2.25rem}.data-\[size\=sm\]\:h-8[data-size=sm]{height:2rem}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom],.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:11rem}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:.375rem}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical],.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[slot\=checkbox-group\]\:gap-3[data-slot=checkbox-group]{gap:.75rem}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true],.data-\[spacing\=0\]\:rounded-none[data-spacing="0"]{border-radius:0}.data-\[range-end\=true\]\:rounded-r-md[data-range-end=true]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[range-start\=true\]\:rounded-l-md[data-range-start=true]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:border-l-0[data-variant=outline][data-spacing="0"]{border-left-width:0px}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-width:1px}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:hsl(var(--ring))}.data-\[state\=checked\]\:border-blue-600[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:hsl(var(--primary))}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:hsl(var(--accent) / .5)}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-\[var\(--dg-bg-primary\)\][data-state=active]{background-color:var(--dg-bg-primary)}.data-\[state\=active\]\:bg-\[var\(--dg-bg-tertiary\)\][data-state=active]{background-color:var(--dg-bg-tertiary)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:bg-orange-500\/10[data-state=active]{background-color:#f973161a}.data-\[state\=active\]\:bg-slate-700[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-blue-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[inset\]\:pl-8[data-inset]{padding-left:2rem}.data-\[variant\=label\]\:text-sm[data-variant=label]{font-size:.875rem;line-height:1.25rem}.data-\[variant\=legend\]\:text-base[data-variant=legend]{font-size:1rem;line-height:1.5rem}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:hsl(var(--accent-foreground))}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[error\=true\]\:text-destructive[data-error=true],.data-\[invalid\=true\]\:text-destructive[data-invalid=true]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-orange-400[data-state=active]{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[spacing\=0\]\:shadow-none[data-spacing="0"]{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[spacing\=default\]\:data-\[variant\=outline\]\:shadow-xs[data-variant=outline][data-spacing=default],.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color: hsl(var(--ring) / .5)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.\*\:data-\[slot\=select-value\]\:line-clamp-1[data-slot=select-value]>*{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\*\:data-\[slot\=select-value\]\:flex[data-slot=select-value]>*{display:flex}.\*\:data-\[slot\=select-value\]\:items-center[data-slot=select-value]>*{align-items:center}.\*\:data-\[slot\=select-value\]\:gap-2[data-slot=select-value]>*{gap:.5rem}.\*\:data-\[slot\=alert-description\]\:text-destructive\/90[data-slot=alert-description]>*{color:hsl(var(--destructive) / .9)}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[spacing\=0\]\:first\:rounded-l-md:first-child[data-spacing="0"]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:first\:border-l:first-child[data-variant=outline][data-spacing="0"]{border-left-width:1px}.data-\[spacing\=0\]\:last\:rounded-r-md:last-child[data-spacing="0"]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[active\=true\]\:hover\:bg-accent:hover[data-active=true],.data-\[state\=open\]\:hover\:bg-accent:hover[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.data-\[active\=true\]\:focus\:bg-accent:focus[data-active=true]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:focus\:bg-accent:focus[data-state=open]{background-color:hsl(var(--accent))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10:focus[data-variant=destructive]{background-color:hsl(var(--destructive) / .1)}.data-\[variant\=destructive\]\:focus\:text-destructive:focus[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.group[data-disabled=true] .group-data-\[disabled\=true\]\:pointer-events-none{pointer-events:none}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:top-full{top:100%}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group\/field-group[data-variant=outline] .group-data-\[variant\=outline\]\/field-group\:-mb-2{margin-bottom:-.5rem}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5{margin-top:.375rem}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block{display:block}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)) + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:bg-popover{background-color:hsl(var(--popover))}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:text-center,.group\/drawer-content[data-vaul-drawer-direction=top] .group-data-\[vaul-drawer-direction\=top\]\/drawer-content\:text-center{text-align:center}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground{color:hsl(var(--popover-foreground))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group\/field[data-disabled=true] .group-data-\[disabled\=true\]\/field\:opacity-50,.group\/input-group[data-disabled=true] .group-data-\[disabled\=true\]\/input-group\:opacity-50,.group[data-disabled=true] .group-data-\[disabled\=true\]\:opacity-50{opacity:.5}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:duration-200{transition-duration:.2s;animation-duration:.2s}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-input:is(.dark *){border-color:hsl(var(--input))}.dark\:bg-destructive\/60:is(.dark *){background-color:hsl(var(--destructive) / .6)}.dark\:bg-input\/30:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-transparent:is(.dark *){background-color:transparent}.dark\:text-muted-foreground:is(.dark *){color:hsl(var(--muted-foreground))}.dark\:hover\:bg-accent\/50:hover:is(.dark *){background-color:hsl(var(--accent) / .5)}.dark\:hover\:bg-input\/50:hover:is(.dark *){background-color:hsl(var(--input) / .5)}.dark\:hover\:text-accent-foreground:hover:is(.dark *){color:hsl(var(--accent-foreground))}.dark\:focus-visible\:ring-destructive\/40:focus-visible:is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/40:has([data-slot][aria-invalid=true]):is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:data-\[state\=active\]\:border-input[data-state=active]:is(.dark *){border-color:hsl(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30[data-state=active]:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:data-\[state\=checked\]\:bg-primary[data-state=checked]:is(.dark *){background-color:hsl(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground[data-state=checked]:is(.dark *){background-color:hsl(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground[data-state=unchecked]:is(.dark *){background-color:hsl(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input\/80[data-state=unchecked]:is(.dark *){background-color:hsl(var(--input) / .8)}.dark\:data-\[state\=active\]\:text-foreground[data-state=active]:is(.dark *){color:hsl(var(--foreground))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:focus[data-variant=destructive]:is(.dark *){background-color:hsl(var(--destructive) / .2)}@media(min-width:640px){.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:table-cell{display:table-cell}.sm\:max-w-\[300px\]{max-width:300px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[620px\]{max-width:620px}.sm\:max-w-\[680px\]{max-width:680px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:.5rem}.sm\:gap-2\.5{gap:.625rem}.sm\:pl-2\.5{padding-left:.625rem}.sm\:pr-2\.5{padding-right:.625rem}.sm\:text-left{text-align:left}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:24rem}}@media(min-width:768px){.md\:absolute{position:absolute}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:table-cell{display:table-cell}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[400px\]{max-width:400px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-1\.5{gap:.375rem}.md\:p-12{padding:3rem}.md\:text-left{text-align:left}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.md\:after\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset][data-state=collapsed]~.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:calc(var(--radius) + 4px)}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:table-cell{display:table-cell}.lg\:w-\[360px\]{width:360px}.lg\:w-\[400px\]{width:400px}.lg\:w-\[600px\]{width:600px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:1280px){.xl\:table-cell{display:table-cell}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.\[\&\+\[data-slot\=item-content\]\]\:flex-none+[data-slot=item-content]{flex:none}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:nth-child\(2\)\[data-selected\=true\]_button\]\:rounded-l-md:nth-child(2)[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-l-none>*:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-t-none>*:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:border-l-0>*:not(:first-child){border-left-width:0px}.\[\&\>\*\:not\(\:first-child\)\]\:border-t-0>*:not(:first-child){border-top-width:0px}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-b-none>*:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-r-none>*:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.\[\&\>\*\]\:w-full>*{width:100%}.\[\&\>\*\]\:focus-visible\:relative:focus-visible>*{position:relative}.\[\&\>\*\]\:focus-visible\:z-10:focus-visible>*{z-index:10}.\[\&\>\*\]\:data-\[slot\=field\]\:p-4[data-slot=field]>*{padding:1rem}.\[\&\>\.sr-only\]\:w-auto>.sr-only{width:auto}.\[\&\>\[data-slot\=field-group\]\]\:gap-4>[data-slot=field-group]{gap:1rem}.\[\&\>\[data-slot\=field-label\]\]\:flex-auto>[data-slot=field-label]{flex:1 1 auto}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-amber-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-emerald-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-red-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.has-\[select\[aria-hidden\=true\]\:last-child\]\:\[\&\>\[data-slot\=select-trigger\]\:last-of-type\]\:rounded-r-md>[data-slot=select-trigger]:last-of-type:has(select[aria-hidden=true]:last-child){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[data-slot\=select-trigger\]\:not\(\[class\*\=\'w-\'\]\)\]\:w-fit>[data-slot=select-trigger]:not([class*=w-]){width:-moz-fit-content;width:fit-content}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>a\:hover\]\:text-primary>a:hover{color:hsl(var(--primary))}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>input\]\:flex-1>input{flex:1 1 0%}.has-\[\>\[data-align\=block-end\]\]\:\[\&\>input\]\:pt-3>input:has(>[data-align=block-end]){padding-top:.75rem}.has-\[\>\[data-align\=block-start\]\]\:\[\&\>input\]\:pb-3>input:has(>[data-align=block-start]){padding-bottom:.75rem}.has-\[\>\[data-align\=inline-end\]\]\:\[\&\>input\]\:pr-2>input:has(>[data-align=inline-end]){padding-right:.5rem}.has-\[\>\[data-align\=inline-start\]\]\:\[\&\>input\]\:pl-2>input:has(>[data-align=inline-start]){padding-left:.5rem}.\[\&\>kbd\]\:rounded-\[calc\(var\(--radius\)-5px\)\]>kbd{border-radius:calc(var(--radius) - 5px)}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5>svg:not([class*=size-]){width:.875rem;height:.875rem}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4>svg:not([class*=size-]){width:1rem;height:1rem}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:.75rem;height:.75rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_img\]\:size-full img{width:100%;height:100%}.\[\&_img\]\:object-cover img{-o-object-fit:cover;object-fit:cover}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:.75rem;height:.75rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:1rem;height:1rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:1.5rem;height:1.5rem}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:hsl(var(--muted-foreground))}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/20{background-color:hsl(var(--background) / .2)}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:text-background{color:hsl(var(--background))}[data-slot=tooltip-content] .dark\:\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/10:is(.dark *){background-color:hsl(var(--background) / .1)}[data-variant=legend]+.\[\[data-variant\=legend\]\+\&\]\:-mt-1\.5{margin-top:-.375rem}a.\[a\&\]\:hover\:bg-accent:hover{background-color:hsl(var(--accent))}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))} diff --git a/backend/static/assets/index-D1_Nt40_.js b/backend/static/assets/index-D1_Nt40_.js new file mode 100644 index 0000000..e886a1c --- /dev/null +++ b/backend/static/assets/index-D1_Nt40_.js @@ -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}; diff --git a/backend/static/assets/index-EF2TDvxx.js b/backend/static/assets/index-LZWfu62c.js similarity index 98% rename from backend/static/assets/index-EF2TDvxx.js rename to backend/static/assets/index-LZWfu62c.js index 59da534..1900440 100644 --- a/backend/static/assets/index-EF2TDvxx.js +++ b/backend/static/assets/index-LZWfu62c.js @@ -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>>1,ie=z[F];if(0>>1;Fi(re,B))vei(Ke,re)?(z[F]=Ke,z[ve]=B,F=ve):(z[F]=re,z[Ee]=B,F=Ee);else if(vei(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()-Iz&&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||125F?(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={};var Yg;function vw(){if(Yg)return it;Yg=1;var n=ty();function r(v){var g="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),ud.exports=vw(),ud.exports}var Qg;function yw(){if(Qg)return Yo;Qg=1;var n=gw(),r=ty(),l=sy();function s(e){var t="https://react.dev/errors/"+e;if(1ie||(e.current=F[ie],F[ie]=null,ie--)}function re(e,t){ie++,F[ie]=e.current,e.current=t}var ve=Oe(null),Ke=Oe(null),Je=Oe(null),fe=Oe(null);function At(e,t){switch(re(Je,t),re(Ke,e),re(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ag(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ag(t),e=rg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(ve),re(ve,e)}function Ct(){Ee(ve),Ee(Ke),Ee(Je)}function un(e){e.memoizedState!==null&&re(fe,e);var t=ve.current,a=rg(t,e.type);t!==a&&(re(Ke,e),re(ve,a))}function dn(e){Ke.current===e&&(Ee(ve),Ee(Ke)),fe.current===e&&(Ee(fe),Po._currentValue=B)}var fn,Aa;function Ca(e){if(fn===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);fn=t&&t[1]||"",Aa=-1)":-1{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-4pfBO49u.js"),__vite__mapDeps([39,1,4,8])).then(n=>({default:n.default}))),DM=m.lazy(()=>se(()=>import("./NamespaceManagementPage-0VnYV9GN.js"),__vite__mapDeps([40,1,6,7,11,24,14,4,8])).then(n=>({default:n.default}))),kt=m.lazy(()=>se(()=>import("./NamespaceResourcePage-C3E7L6GV.js"),__vite__mapDeps([41,1,6,11,7,15,13,8,14,42,37,4,19,20,43,24,25])).then(n=>({default:n.default}))),Iv=m.lazy(()=>se(()=>import("./DeploymentDetailPage-KvjeNnqR.js"),__vite__mapDeps([44,1,6,7,4,37,42,8,15,13,19,20,11,14,24,25,32,43])).then(n=>({default:n.default}))),$v=m.lazy(()=>se(()=>import("./WorkloadViewPage-B53qfPO6.js"),__vite__mapDeps([45,1,6,7,14,4,37,42,8,15,13,19,20])).then(n=>({default:n.default}))),Jv=m.lazy(()=>se(()=>import("./TopologyView-Feyh7bIr.js"),__vite__mapDeps([46,1,6,11,24,7,15,13,8,25,4])).then(n=>({default:n.TopologyView}))),NM=m.lazy(()=>se(()=>import("./KubernetesNodes-B2jEMWTg.js"),__vite__mapDeps([47,1,6,11,7,15,13,8,14,4])).then(n=>({default:n.KubernetesNodes}))),zM=m.lazy(()=>se(()=>import("./PodMetricsPage-On_xK19V.js"),__vite__mapDeps([48,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),LM=m.lazy(()=>se(()=>import("./EventsPage-BlM0_-X4.js"),__vite__mapDeps([49,1,6,15,13,8,14,4])).then(n=>({default:n.default}))),kM=m.lazy(()=>se(()=>import("./CapacityPage-CWUpHbri.js"),__vite__mapDeps([50,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),UM=m.lazy(()=>se(()=>import("./K8sShortcutRedirect-fgkbx9Vp.js"),__vite__mapDeps([51,1,4,8])).then(n=>({default:n.default}))),Wv=m.lazy(()=>se(()=>import("./AlertManager-nv_xdloK.js"),__vite__mapDeps([52,1,6,35,53,11,7,14,8,32,13,12,54,24,25,9])).then(n=>({default:n.AlertManager}))),HM=m.lazy(()=>se(()=>import("./ApprovalFlow-D-ftjqRO.js"),__vite__mapDeps([55,1,6,7,25,56,11,8,24,15,13])).then(n=>({default:n.ApprovalFlowManager}))),BM=m.lazy(()=>se(()=>import("./ApprovalResourcePage-VT7IARzv.js"),__vite__mapDeps([57,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalResourcePage}))),PM=m.lazy(()=>se(()=>import("./ApprovalAppPage-CaEPh2Xz.js"),__vite__mapDeps([59,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalAppPage}))),VM=m.lazy(()=>se(()=>import("./ApprovalPermissionPage-0d3VJHx2.js"),__vite__mapDeps([60,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalPermissionPage}))),GM=m.lazy(()=>se(()=>import("./ApprovalWorkflowPage-Byqk0MKq.js"),__vite__mapDeps([61,1,6,56,8])).then(n=>({default:n.default}))),qM=m.lazy(()=>se(()=>import("./ScriptManager-9IW87qYN.js"),__vite__mapDeps([62,1,11,15,13,8,35,12,63,7,24,25,6])).then(n=>({default:n.ScriptManager}))),Rd=m.lazy(()=>se(()=>import("./SystemManager-BD0ukLSx.js"),__vite__mapDeps([64,1,35,7,6,11,14,15,13,8,25,24,12,32])).then(n=>({default:n.SystemManager}))),YM=m.lazy(()=>se(()=>import("./TerminalAuditTab-BzRHQUT2.js"),__vite__mapDeps([65,1,6,11,14,19,20,7,21,8,16,17,66])).then(n=>({default:n.TerminalAuditTab}))),XM=m.lazy(()=>se(()=>import("./AuditOperationsTab-DWYm9W3B.js"),__vite__mapDeps([67,1,6,11,7,14,68,16,8])).then(n=>({default:n.AuditOperationsTab}))),QM=m.lazy(()=>se(()=>import("./LoginLogsTab-q3NP-L1u.js"),__vite__mapDeps([69,1,6,11,7,14,66,8])).then(n=>({default:n.LoginLogsTab}))),KM=m.lazy(()=>se(()=>import("./CredentialManager-CSa9vb54.js"),__vite__mapDeps([70,1,11,7,15,13,8,16,17,22,24])).then(n=>({default:n.default}))),FM=m.lazy(()=>se(()=>import("./PipelineManager-DCrhFfx4.js"),__vite__mapDeps([71,1,11,72,16,17,6,7,8,25,24,15,13,73,22])).then(n=>({default:n.PipelineManager}))),ZM=m.lazy(()=>se(()=>import("./DeployCredentials-BunsdfYH.js"),__vite__mapDeps([74,1,11,7,35,24,15,13,8,73,22])).then(n=>({default:n.default}))),ey=m.lazy(()=>se(()=>import("./PipelineEditor-Cvagngmv.js"),__vite__mapDeps([75,1,6,11,7,35,15,13,8,25,32,24,72,73])).then(n=>({default:n.default}))),IM=m.lazy(()=>se(()=>import("./PipelineRunDetail-OPxhDG-Y.js"),__vite__mapDeps([76,1,7,6,72,8])).then(n=>({default:n.default}))),$M=m.lazy(()=>se(()=>import("./DeployRBAC-DCJ4MkVI.js"),__vite__mapDeps([77,1,6,11,7,15,13,8,24,72,73])).then(n=>({default:n.default}))),JM=m.lazy(()=>se(()=>import("./UserGroupsManager-UM46GMcV.js"),__vite__mapDeps([78,1,11,7,24,73,8])).then(n=>({default:n.default}))),WM=m.lazy(()=>se(()=>import("./CronJobManager-BQpVfKVA.js"),__vite__mapDeps([79,1,6,5,11,7,12,13,8,63,15,25,24,14])).then(n=>({default:n.CronJobManager}))),eD=m.lazy(()=>se(()=>import("./AIOpsAssistant-CF1D1Anl.js"),__vite__mapDeps([80,1,6,11,7,24,15,13,8,32,2,53,81,82])).then(n=>({default:n.AIOpsAssistant}))),tD=m.lazy(()=>se(()=>import("./AIAlertAnalyzer-BFwPLuXl.js"),__vite__mapDeps([83,1,6,7,53,82,8])).then(n=>({default:n.AIAlertAnalyzer}))),nD=m.lazy(()=>se(()=>import("./AIPredictiveAnalytics-BXlrnpYB.js"),__vite__mapDeps([84,1,6,5,7,35,15,13,8,2,3,53])).then(n=>({default:n.AIPredictiveAnalytics}))),aD=m.lazy(()=>se(()=>import("./AlertCenter-CaSpyOJ2.js"),__vite__mapDeps([85,1,11,7,6,5,15,13,8,35,32,53,86,16,17,81,24,54,25])).then(n=>({default:n.default}))),rD=m.lazy(()=>se(()=>import("./TraceManager-CWjCmm6P.js"),__vite__mapDeps([87,1,11,7,6,5,15,13,8,35,24,88])).then(n=>({default:n.default}))),oD=m.lazy(()=>se(()=>import("./HostMonitor-BVQwXwZu.js"),__vite__mapDeps([89,1,81,16,6,15,13,8,35,7,9])).then(n=>({default:n.HostMonitor}))),lD=m.lazy(()=>se(()=>import("./GrafanaDashboard-DwBz9b6M.js"),__vite__mapDeps([90,1,11,7,6,15,13,8,24,3,91,92,81,93,5,35,12])).then(n=>({default:n.default}))),sD=m.lazy(()=>se(()=>import("./MonitorCenter-btGjdSNo.js"),__vite__mapDeps([94,1,89,81,16,6,15,13,8,35,7,9,93,11,24,14,32,95])).then(n=>({default:n.MonitorCenter}))),iD=m.lazy(()=>se(()=>import("./MetricsExplorer-BC0aPabu.js"),__vite__mapDeps([96,1,6,15,13,8,11,93])).then(n=>({default:n.MetricsExplorer}))),cD=m.lazy(()=>se(()=>import("./DatasourcePage-5YEOUPGv.js"),__vite__mapDeps([97,1,35,7,6,16,17,92,11,24,32,13,15,8])).then(n=>({default:n.default})));function uD(){return h.jsxs("div",{"code-path":"src/App.tsx:67:5",className:"flex flex-col items-center justify-center h-[calc(100vh-14rem)] gap-4",children:[h.jsxs("div",{"code-path":"src/App.tsx:68:7",className:"relative",children:[h.jsx("div",{"code-path":"src/App.tsx:69:9",className:"h-10 w-10 border-3 border-[var(--dg-border)] border-t-[var(--dg-blue)] rounded-full animate-spin"}),h.jsx("div",{"code-path":"src/App.tsx:70:9",className:"absolute inset-0 h-10 w-10 border-3 border-transparent border-t-[var(--dg-blue)] rounded-full animate-spin opacity-30",style:{animationDirection:"reverse",animationDuration:"1s"}})]}),h.jsx("p",{"code-path":"src/App.tsx:72:7",className:"text-sm text-[var(--dg-text-muted)]",children:"加载中..."})]})}function $({children:n}){const r=wt();return h.jsx(bM,{"code-path":"src/App.tsx:81:5",children:h.jsx(fM,{"code-path":"src/App.tsx:82:7",children:h.jsx(m.Suspense,{"code-path":"src/App.tsx:83:9",fallback:h.jsx(uD,{"code-path":"src/App.tsx:83:29"}),children:n})},r.pathname)})}const dD=new jA({defaultOptions:{queries:{staleTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}});function fD(){return h.jsx(QA,{"code-path":"src/App.tsx:103:5",children:h.jsx(MA,{"code-path":"src/App.tsx:104:7",client:dD,children:h.jsx(sM,{"code-path":"src/App.tsx:105:9",children:h.jsx(KE,{"code-path":"src/App.tsx:106:11",children:h.jsxs(wE,{"code-path":"src/App.tsx:107:13",children:[h.jsx(Z,{"code-path":"src/App.tsx:108:15",path:"/login",element:h.jsx(uM,{"code-path":"src/App.tsx:108:45"})}),h.jsxs(Z,{"code-path":"src/App.tsx:109:15",path:"/",element:h.jsx(dM,{"code-path":"src/App.tsx:110:17",children:h.jsx(Oj,{"code-path":"src/App.tsx:111:19"})}),children:[h.jsx(Z,{"code-path":"src/App.tsx:114:17",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:114:39",children:h.jsx(SM,{"code-path":"src/App.tsx:114:49"})})}),h.jsx(Z,{"code-path":"src/App.tsx:115:17",path:"servers",element:h.jsx($,{"code-path":"src/App.tsx:115:48",children:h.jsx(wM,{"code-path":"src/App.tsx:115:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:116:17",path:"cloud-accounts",element:h.jsx($,{"code-path":"src/App.tsx:116:55",children:h.jsx(EM,{"code-path":"src/App.tsx:116:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:117:17",path:"domains",element:h.jsx($,{"code-path":"src/App.tsx:117:48",children:h.jsx(AM,{"code-path":"src/App.tsx:117:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:118:17",path:"regions",element:h.jsx($,{"code-path":"src/App.tsx:118:48",children:h.jsx(CM,{"code-path":"src/App.tsx:118:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:119:17",path:"platforms",element:h.jsx($,{"code-path":"src/App.tsx:119:50",children:h.jsx(RM,{"code-path":"src/App.tsx:119:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:120:17",path:"cloud-billing",element:h.jsx($,{"code-path":"src/App.tsx:120:54",children:h.jsx(TM,{"code-path":"src/App.tsx:120:64"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:123:17",path:"kubernetes",children:[h.jsx(Z,{"code-path":"src/App.tsx:124:19",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:124:41",children:h.jsx(_M,{"code-path":"src/App.tsx:124:51"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:125:19",path:":clusterCode",children:[h.jsx(Z,{"code-path":"src/App.tsx:126:21",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:126:43",children:h.jsx(OM,{"code-path":"src/App.tsx:126:53"})})}),h.jsx(Z,{"code-path":"src/App.tsx:127:21",path:"metrics/pods",element:h.jsx($,{"code-path":"src/App.tsx:127:57",children:h.jsx(zM,{"code-path":"src/App.tsx:127:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:128:21",path:"events",element:h.jsx($,{"code-path":"src/App.tsx:128:51",children:h.jsx(LM,{"code-path":"src/App.tsx:128:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:129:21",path:"capacity",element:h.jsx($,{"code-path":"src/App.tsx:129:53",children:h.jsx(kM,{"code-path":"src/App.tsx:129:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:130:21",path:"namespaces",element:h.jsx($,{"code-path":"src/App.tsx:130:55",children:h.jsx(DM,{"code-path":"src/App.tsx:130:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:131:21",path:"nodes/:nodeName",element:h.jsx($,{"code-path":"src/App.tsx:131:60",children:h.jsx(jM,{"code-path":"src/App.tsx:131:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:132:21",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:132:53",children:h.jsx(Jv,{"code-path":"src/App.tsx:132:63"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:133:21",path:"namespace/:namespace",children:[h.jsx(Z,{"code-path":"src/App.tsx:134:23",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:134:45",children:h.jsx(MM,{"code-path":"src/App.tsx:134:55"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:135:23",path:"workload",children:[h.jsx(Z,{"code-path":"src/App.tsx:136:25",path:":mode/Deployment/:name",element:h.jsx($,{"code-path":"src/App.tsx:136:71",children:h.jsx(Iv,{"code-path":"src/App.tsx:136:81"})})}),h.jsx(Z,{"code-path":"src/App.tsx:137:25",path:":mode/StatefulSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:137:72",children:h.jsx($v,{"code-path":"src/App.tsx:137:82"})})}),h.jsx(Z,{"code-path":"src/App.tsx:138:25",path:":mode/DaemonSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:138:70",children:h.jsx($v,{"code-path":"src/App.tsx:138:80"})})})]}),h.jsx(Z,{"code-path":"src/App.tsx:140:23",path:"deployments",element:h.jsx($,{"code-path":"src/App.tsx:140:58",children:h.jsx(kt,{"code-path":"src/App.tsx:140:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:141:23",path:"deployments/:name",element:h.jsx($,{"code-path":"src/App.tsx:141:64",children:h.jsx(Iv,{"code-path":"src/App.tsx:141:74"})})}),h.jsx(Z,{"code-path":"src/App.tsx:142:23",path:"pods",element:h.jsx($,{"code-path":"src/App.tsx:142:51",children:h.jsx(kt,{"code-path":"src/App.tsx:142:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:143:23",path:"services",element:h.jsx($,{"code-path":"src/App.tsx:143:55",children:h.jsx(kt,{"code-path":"src/App.tsx:143:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:144:23",path:"ingresses",element:h.jsx($,{"code-path":"src/App.tsx:144:56",children:h.jsx(kt,{"code-path":"src/App.tsx:144:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:145:23",path:"configmaps",element:h.jsx($,{"code-path":"src/App.tsx:145:57",children:h.jsx(kt,{"code-path":"src/App.tsx:145:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:146:23",path:"secrets",element:h.jsx($,{"code-path":"src/App.tsx:146:54",children:h.jsx(kt,{"code-path":"src/App.tsx:146:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:147:23",path:"hpas",element:h.jsx($,{"code-path":"src/App.tsx:147:51",children:h.jsx(kt,{"code-path":"src/App.tsx:147:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:148:23",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:148:55",children:h.jsx(kt,{"code-path":"src/App.tsx:148:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:149:23",path:"pvcs",element:h.jsx($,{"code-path":"src/App.tsx:149:51",children:h.jsx(kt,{"code-path":"src/App.tsx:149:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:150:23",path:"statefulsets",element:h.jsx($,{"code-path":"src/App.tsx:150:59",children:h.jsx(kt,{"code-path":"src/App.tsx:150:69"})})}),h.jsx(Z,{"code-path":"src/App.tsx:151:23",path:"daemonsets",element:h.jsx($,{"code-path":"src/App.tsx:151:57",children:h.jsx(kt,{"code-path":"src/App.tsx:151:67"})})})]})]})]}),h.jsx(Z,{"code-path":"src/App.tsx:157:17",path:"workloads",element:h.jsx($,{"code-path":"src/App.tsx:157:50",children:h.jsx(kt,{"code-path":"src/App.tsx:157:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:158:17",path:"workloads/events",element:h.jsx($,{"code-path":"src/App.tsx:158:57",children:h.jsx(UM,{"code-path":"src/App.tsx:158:67",target:"events"})})}),h.jsx(Z,{"code-path":"src/App.tsx:159:17",path:"workloads/:type",element:h.jsx($,{"code-path":"src/App.tsx:159:56",children:h.jsx(kt,{"code-path":"src/App.tsx:159:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:160:17",path:"nodes",element:h.jsx($,{"code-path":"src/App.tsx:160:46",children:h.jsx(NM,{"code-path":"src/App.tsx:160:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:161:17",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:161:49",children:h.jsx(Jv,{"code-path":"src/App.tsx:161:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:164:17",path:"pipelines",element:h.jsx($,{"code-path":"src/App.tsx:164:50",children:h.jsx(FM,{"code-path":"src/App.tsx:164:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:165:17",path:"pipelines/:code",element:h.jsx($,{"code-path":"src/App.tsx:165:56",children:h.jsx(ey,{"code-path":"src/App.tsx:165:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:166:17",path:"pipelines/:code/runs",element:h.jsx($,{"code-path":"src/App.tsx:166:61",children:h.jsx(IM,{"code-path":"src/App.tsx:166:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:167:17",path:"pipelines/:code/edit",element:h.jsx($,{"code-path":"src/App.tsx:167:61",children:h.jsx(ey,{"code-path":"src/App.tsx:167:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:168:17",path:"deploy/configureTools",element:h.jsx($,{"code-path":"src/App.tsx:168:62",children:h.jsx(ZM,{"code-path":"src/App.tsx:168:72"})})}),h.jsx(Z,{"code-path":"src/App.tsx:169:17",path:"deploy/groups",element:h.jsx($,{"code-path":"src/App.tsx:169:54",children:h.jsx(JM,{"code-path":"src/App.tsx:169:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:170:17",path:"deploy/rbac",element:h.jsx($,{"code-path":"src/App.tsx:170:52",children:h.jsx($M,{"code-path":"src/App.tsx:170:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:173:17",path:"metrics",element:h.jsx($,{"code-path":"src/App.tsx:173:48",children:h.jsx(iD,{"code-path":"src/App.tsx:173:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:174:17",path:"datasources",element:h.jsx($,{"code-path":"src/App.tsx:174:52",children:h.jsx(cD,{"code-path":"src/App.tsx:174:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:175:17",path:"trace",element:h.jsx($,{"code-path":"src/App.tsx:175:46",children:h.jsx(rD,{"code-path":"src/App.tsx:175:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:176:17",path:"dashboards",element:h.jsx($,{"code-path":"src/App.tsx:176:51",children:h.jsx(lD,{"code-path":"src/App.tsx:176:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:177:17",path:"host-monitor",element:h.jsx($,{"code-path":"src/App.tsx:177:53",children:h.jsx(oD,{"code-path":"src/App.tsx:177:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:178:17",path:"alerts",element:h.jsx($,{"code-path":"src/App.tsx:178:47",children:h.jsx(Wv,{"code-path":"src/App.tsx:178:57"})})}),h.jsx(Z,{"code-path":"src/App.tsx:179:17",path:"alert-center",element:h.jsx($,{"code-path":"src/App.tsx:179:53",children:h.jsx(aD,{"code-path":"src/App.tsx:179:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:180:17",path:"monitor-center",element:h.jsx($,{"code-path":"src/App.tsx:180:55",children:h.jsx(sD,{"code-path":"src/App.tsx:180:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:181:17",path:"logs",element:h.jsx($,{"code-path":"src/App.tsx:181:45",children:h.jsx(Wv,{"code-path":"src/App.tsx:181:55"})})}),h.jsx(Z,{"code-path":"src/App.tsx:184:17",path:"approval",element:h.jsx($,{"code-path":"src/App.tsx:184:49",children:h.jsx(HM,{"code-path":"src/App.tsx:184:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:185:17",path:"approval/resource",element:h.jsx($,{"code-path":"src/App.tsx:185:58",children:h.jsx(BM,{"code-path":"src/App.tsx:185:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:186:17",path:"approval/app",element:h.jsx($,{"code-path":"src/App.tsx:186:53",children:h.jsx(PM,{"code-path":"src/App.tsx:186:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:187:17",path:"approval/permission",element:h.jsx($,{"code-path":"src/App.tsx:187:60",children:h.jsx(VM,{"code-path":"src/App.tsx:187:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:188:17",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:188:49",children:h.jsx(WM,{"code-path":"src/App.tsx:188:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:189:17",path:"scripts",element:h.jsx($,{"code-path":"src/App.tsx:189:48",children:h.jsx(qM,{"code-path":"src/App.tsx:189:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:193:17",path:"ai-assistant",element:h.jsx($,{"code-path":"src/App.tsx:193:53",children:h.jsx(eD,{"code-path":"src/App.tsx:193:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:194:17",path:"ai-alert-analyzer",element:h.jsx($,{"code-path":"src/App.tsx:194:58",children:h.jsx(tD,{"code-path":"src/App.tsx:194:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:195:17",path:"ai-predictive",element:h.jsx($,{"code-path":"src/App.tsx:195:54",children:h.jsx(nD,{"code-path":"src/App.tsx:195:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:198:17",path:"audit/terminal",element:h.jsx($,{"code-path":"src/App.tsx:198:55",children:h.jsx(YM,{"code-path":"src/App.tsx:198:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:199:17",path:"audit/operations",element:h.jsx($,{"code-path":"src/App.tsx:199:57",children:h.jsx(XM,{"code-path":"src/App.tsx:199:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:200:17",path:"audit/login-logs",element:h.jsx($,{"code-path":"src/App.tsx:200:57",children:h.jsx(QM,{"code-path":"src/App.tsx:200:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:203:17",path:"users",element:h.jsx($,{"code-path":"src/App.tsx:203:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:203:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:204:17",path:"roles",element:h.jsx($,{"code-path":"src/App.tsx:204:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:204:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:205:17",path:"credentials",element:h.jsx($,{"code-path":"src/App.tsx:205:52",children:h.jsx(KM,{"code-path":"src/App.tsx:205:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:206:17",path:"settings",element:h.jsx($,{"code-path":"src/App.tsx:206:49",children:h.jsx(Rd,{"code-path":"src/App.tsx:206:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:207:17",path:"approval-workflow",element:h.jsx($,{"code-path":"src/App.tsx:207:58",children:h.jsx(GM,{"code-path":"src/App.tsx:207:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:210:17",path:"*",element:h.jsx(Sy,{"code-path":"src/App.tsx:210:42",to:"/",replace:!0})})]})]})})})})})}bw.createRoot(document.getElementById("root")).render(h.jsx(m.StrictMode,{"code-path":"src/main.tsx:7:3",children:h.jsx(fD,{"code-path":"src/main.tsx:8:5"})}));export{db as $,vD as A,St as B,Wo as C,Wj as D,TA as E,ft as F,xD as G,rn as H,yD as I,sf as J,Xa as K,ri as L,ob as M,h_ as N,wa as O,Et as P,ji as Q,f_ as R,qC as S,Hx as T,tb as U,Bx as V,Yn as W,Mi as X,nf as Y,iT as Z,ut as _,nM as a,nb as a0,Ef as a1,wf as a2,Ci as a3,Px as a4,u2 as a5,Vx as a6,ex as a7,se as a8,Js as a9,Ws as aa,ei as ab,Kd as ac,ti as ad,Fo as ae,Io as af,_j as ag,SD as ah,yA as ai,dA as aj,Nd as ak,Oy as al,cA as am,uA as an,Dd as ao,Ry as ap,AA as aq,pA as ar,gD as as,PC as at,Py as au,aM as b,oM as c,lM as d,rM as e,CD as f,mD as g,Ue as h,sl as i,AD as j,wt as k,wD as l,Ce as m,ZC as n,on as o,qT as p,C2 as q,Ea as r,ke as s,Zv as t,Wb as u,Di as v,Pe as w,oe as x,ZR as y,bi as z}; +`;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-CrqNiJMQ.js"),__vite__mapDeps([39,1,4,8])).then(n=>({default:n.default}))),DM=m.lazy(()=>se(()=>import("./NamespaceManagementPage-BuGcKQSw.js"),__vite__mapDeps([40,1,6,7,11,24,14,4,8])).then(n=>({default:n.default}))),kt=m.lazy(()=>se(()=>import("./NamespaceResourcePage-Cf6hgoD2.js"),__vite__mapDeps([41,1,6,11,7,15,13,8,14,42,37,4,19,20,43,24,25])).then(n=>({default:n.default}))),Iv=m.lazy(()=>se(()=>import("./DeploymentDetailPage-DEq3tEZd.js"),__vite__mapDeps([44,1,6,7,4,37,42,8,15,13,19,20,11,14,24,25,32,43])).then(n=>({default:n.default}))),$v=m.lazy(()=>se(()=>import("./WorkloadViewPage-DSiv67B6.js"),__vite__mapDeps([45,1,6,7,14,4,37,42,8,15,13,19,20])).then(n=>({default:n.default}))),Jv=m.lazy(()=>se(()=>import("./TopologyView-DdP6o9Mj.js"),__vite__mapDeps([46,1,6,11,24,7,15,13,8,25,4])).then(n=>({default:n.TopologyView}))),NM=m.lazy(()=>se(()=>import("./KubernetesNodes-B0frAPbY.js"),__vite__mapDeps([47,1,6,11,7,15,13,8,14,4])).then(n=>({default:n.KubernetesNodes}))),zM=m.lazy(()=>se(()=>import("./PodMetricsPage-NkW2J2Qd.js"),__vite__mapDeps([48,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),LM=m.lazy(()=>se(()=>import("./EventsPage-UFe_ZFfW.js"),__vite__mapDeps([49,1,6,15,13,8,14,4])).then(n=>({default:n.default}))),kM=m.lazy(()=>se(()=>import("./CapacityPage-BucLnYij.js"),__vite__mapDeps([50,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),UM=m.lazy(()=>se(()=>import("./K8sShortcutRedirect-fX_VMnZ-.js"),__vite__mapDeps([51,1,4,8])).then(n=>({default:n.default}))),Wv=m.lazy(()=>se(()=>import("./AlertManager-C0AXwvA2.js"),__vite__mapDeps([52,1,6,35,53,11,7,14,8,32,13,12,54,24,25,9])).then(n=>({default:n.AlertManager}))),HM=m.lazy(()=>se(()=>import("./ApprovalFlow-BziKIUh9.js"),__vite__mapDeps([55,1,6,7,25,56,11,8,24,15,13])).then(n=>({default:n.ApprovalFlowManager}))),BM=m.lazy(()=>se(()=>import("./ApprovalResourcePage-CnDxsH56.js"),__vite__mapDeps([57,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalResourcePage}))),PM=m.lazy(()=>se(()=>import("./ApprovalAppPage-BrRxxZFx.js"),__vite__mapDeps([59,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalAppPage}))),VM=m.lazy(()=>se(()=>import("./ApprovalPermissionPage-Bv3kKyby.js"),__vite__mapDeps([60,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalPermissionPage}))),GM=m.lazy(()=>se(()=>import("./ApprovalWorkflowPage-Feqoq_m6.js"),__vite__mapDeps([61,1,6,56,8])).then(n=>({default:n.default}))),qM=m.lazy(()=>se(()=>import("./ScriptManager-Dz9eHvUK.js"),__vite__mapDeps([62,1,11,15,13,8,35,12,63,7,24,25,6])).then(n=>({default:n.ScriptManager}))),Rd=m.lazy(()=>se(()=>import("./SystemManager-B9Kzdis0.js"),__vite__mapDeps([64,1,35,7,6,11,14,15,13,8,25,24,12,32])).then(n=>({default:n.SystemManager}))),YM=m.lazy(()=>se(()=>import("./TerminalAuditTab-D4-qFyPi.js"),__vite__mapDeps([65,1,6,11,14,19,20,7,21,8,16,17,66])).then(n=>({default:n.TerminalAuditTab}))),XM=m.lazy(()=>se(()=>import("./AuditOperationsTab-zpIlq3AD.js"),__vite__mapDeps([67,1,6,11,7,14,68,16,8])).then(n=>({default:n.AuditOperationsTab}))),QM=m.lazy(()=>se(()=>import("./LoginLogsTab-BZTjs1T3.js"),__vite__mapDeps([69,1,6,11,7,14,66,8])).then(n=>({default:n.LoginLogsTab}))),KM=m.lazy(()=>se(()=>import("./CredentialManager-VPjoE2mR.js"),__vite__mapDeps([70,1,11,7,15,13,8,16,17,22,24])).then(n=>({default:n.default}))),FM=m.lazy(()=>se(()=>import("./PipelineManager-C_oAjTIU.js"),__vite__mapDeps([71,1,11,72,16,17,6,7,8,25,24,15,13,73,22])).then(n=>({default:n.PipelineManager}))),ZM=m.lazy(()=>se(()=>import("./DeployCredentials-C7pbsNa2.js"),__vite__mapDeps([74,1,11,7,35,24,15,13,8,73,22])).then(n=>({default:n.default}))),ey=m.lazy(()=>se(()=>import("./PipelineEditor-BEQjb4Gp.js"),__vite__mapDeps([75,1,6,11,7,35,15,13,8,25,32,24,72,73])).then(n=>({default:n.default}))),IM=m.lazy(()=>se(()=>import("./PipelineRunDetail-C9e6xlUh.js"),__vite__mapDeps([76,1,7,6,72,8])).then(n=>({default:n.default}))),$M=m.lazy(()=>se(()=>import("./DeployRBAC-XP_74TOu.js"),__vite__mapDeps([77,1,6,11,7,15,13,8,24,72,73])).then(n=>({default:n.default}))),JM=m.lazy(()=>se(()=>import("./UserGroupsManager-CjYJT4qh.js"),__vite__mapDeps([78,1,11,7,24,73,8])).then(n=>({default:n.default}))),WM=m.lazy(()=>se(()=>import("./CronJobManager-Dow5NQrR.js"),__vite__mapDeps([79,1,6,5,11,7,12,13,8,63,15,25,24,14])).then(n=>({default:n.CronJobManager}))),eD=m.lazy(()=>se(()=>import("./AIOpsAssistant-annAjw3b.js"),__vite__mapDeps([80,1,6,11,7,24,15,13,8,32,2,53,81,82])).then(n=>({default:n.AIOpsAssistant}))),tD=m.lazy(()=>se(()=>import("./AIAlertAnalyzer-DcLlw3nl.js"),__vite__mapDeps([83,1,6,7,53,82,8])).then(n=>({default:n.AIAlertAnalyzer}))),nD=m.lazy(()=>se(()=>import("./AIPredictiveAnalytics-PqRHnPeG.js"),__vite__mapDeps([84,1,6,5,7,35,15,13,8,2,3,53])).then(n=>({default:n.AIPredictiveAnalytics}))),aD=m.lazy(()=>se(()=>import("./AlertCenter-VCEUxoOH.js"),__vite__mapDeps([85,1,11,7,6,5,15,13,8,35,32,53,86,16,17,81,24,54,25])).then(n=>({default:n.default}))),rD=m.lazy(()=>se(()=>import("./TraceManager-JbMTFm_u.js"),__vite__mapDeps([87,1,11,7,6,5,15,13,8,35,24,88])).then(n=>({default:n.default}))),oD=m.lazy(()=>se(()=>import("./HostMonitor-D4f8NRVg.js"),__vite__mapDeps([89,1,81,16,6,15,13,8,35,7,9])).then(n=>({default:n.HostMonitor}))),lD=m.lazy(()=>se(()=>import("./GrafanaDashboard-Cwk6bt47.js"),__vite__mapDeps([90,1,11,7,6,15,13,8,24,3,91,92,81,93,5,35,12])).then(n=>({default:n.default}))),sD=m.lazy(()=>se(()=>import("./MonitorCenter-DZJmSfOk.js"),__vite__mapDeps([94,1,89,81,16,6,15,13,8,35,7,9,93,11,24,14,32,95])).then(n=>({default:n.MonitorCenter}))),iD=m.lazy(()=>se(()=>import("./MetricsExplorer-CBLW7MW5.js"),__vite__mapDeps([96,1,6,15,13,8,11,93])).then(n=>({default:n.MetricsExplorer}))),cD=m.lazy(()=>se(()=>import("./DatasourcePage-7FoNVKhF.js"),__vite__mapDeps([97,1,35,7,6,16,17,92,11,24,32,13,15,8])).then(n=>({default:n.default})));function uD(){return h.jsxs("div",{"code-path":"src/App.tsx:67:5",className:"flex flex-col items-center justify-center h-[calc(100vh-14rem)] gap-4",children:[h.jsxs("div",{"code-path":"src/App.tsx:68:7",className:"relative",children:[h.jsx("div",{"code-path":"src/App.tsx:69:9",className:"h-10 w-10 border-3 border-[var(--dg-border)] border-t-[var(--dg-blue)] rounded-full animate-spin"}),h.jsx("div",{"code-path":"src/App.tsx:70:9",className:"absolute inset-0 h-10 w-10 border-3 border-transparent border-t-[var(--dg-blue)] rounded-full animate-spin opacity-30",style:{animationDirection:"reverse",animationDuration:"1s"}})]}),h.jsx("p",{"code-path":"src/App.tsx:72:7",className:"text-sm text-[var(--dg-text-muted)]",children:"加载中..."})]})}function $({children:n}){const r=wt();return h.jsx(bM,{"code-path":"src/App.tsx:81:5",children:h.jsx(fM,{"code-path":"src/App.tsx:82:7",children:h.jsx(m.Suspense,{"code-path":"src/App.tsx:83:9",fallback:h.jsx(uD,{"code-path":"src/App.tsx:83:29"}),children:n})},r.pathname)})}const dD=new jA({defaultOptions:{queries:{staleTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}});function fD(){return h.jsx(QA,{"code-path":"src/App.tsx:103:5",children:h.jsx(MA,{"code-path":"src/App.tsx:104:7",client:dD,children:h.jsx(sM,{"code-path":"src/App.tsx:105:9",children:h.jsx(KE,{"code-path":"src/App.tsx:106:11",children:h.jsxs(wE,{"code-path":"src/App.tsx:107:13",children:[h.jsx(Z,{"code-path":"src/App.tsx:108:15",path:"/login",element:h.jsx(uM,{"code-path":"src/App.tsx:108:45"})}),h.jsxs(Z,{"code-path":"src/App.tsx:109:15",path:"/",element:h.jsx(dM,{"code-path":"src/App.tsx:110:17",children:h.jsx(Oj,{"code-path":"src/App.tsx:111:19"})}),children:[h.jsx(Z,{"code-path":"src/App.tsx:114:17",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:114:39",children:h.jsx(SM,{"code-path":"src/App.tsx:114:49"})})}),h.jsx(Z,{"code-path":"src/App.tsx:115:17",path:"servers",element:h.jsx($,{"code-path":"src/App.tsx:115:48",children:h.jsx(wM,{"code-path":"src/App.tsx:115:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:116:17",path:"cloud-accounts",element:h.jsx($,{"code-path":"src/App.tsx:116:55",children:h.jsx(EM,{"code-path":"src/App.tsx:116:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:117:17",path:"domains",element:h.jsx($,{"code-path":"src/App.tsx:117:48",children:h.jsx(AM,{"code-path":"src/App.tsx:117:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:118:17",path:"regions",element:h.jsx($,{"code-path":"src/App.tsx:118:48",children:h.jsx(CM,{"code-path":"src/App.tsx:118:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:119:17",path:"platforms",element:h.jsx($,{"code-path":"src/App.tsx:119:50",children:h.jsx(RM,{"code-path":"src/App.tsx:119:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:120:17",path:"cloud-billing",element:h.jsx($,{"code-path":"src/App.tsx:120:54",children:h.jsx(TM,{"code-path":"src/App.tsx:120:64"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:123:17",path:"kubernetes",children:[h.jsx(Z,{"code-path":"src/App.tsx:124:19",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:124:41",children:h.jsx(_M,{"code-path":"src/App.tsx:124:51"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:125:19",path:":clusterCode",children:[h.jsx(Z,{"code-path":"src/App.tsx:126:21",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:126:43",children:h.jsx(OM,{"code-path":"src/App.tsx:126:53"})})}),h.jsx(Z,{"code-path":"src/App.tsx:127:21",path:"metrics/pods",element:h.jsx($,{"code-path":"src/App.tsx:127:57",children:h.jsx(zM,{"code-path":"src/App.tsx:127:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:128:21",path:"events",element:h.jsx($,{"code-path":"src/App.tsx:128:51",children:h.jsx(LM,{"code-path":"src/App.tsx:128:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:129:21",path:"capacity",element:h.jsx($,{"code-path":"src/App.tsx:129:53",children:h.jsx(kM,{"code-path":"src/App.tsx:129:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:130:21",path:"namespaces",element:h.jsx($,{"code-path":"src/App.tsx:130:55",children:h.jsx(DM,{"code-path":"src/App.tsx:130:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:131:21",path:"nodes/:nodeName",element:h.jsx($,{"code-path":"src/App.tsx:131:60",children:h.jsx(jM,{"code-path":"src/App.tsx:131:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:132:21",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:132:53",children:h.jsx(Jv,{"code-path":"src/App.tsx:132:63"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:133:21",path:"namespace/:namespace",children:[h.jsx(Z,{"code-path":"src/App.tsx:134:23",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:134:45",children:h.jsx(MM,{"code-path":"src/App.tsx:134:55"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:135:23",path:"workload",children:[h.jsx(Z,{"code-path":"src/App.tsx:136:25",path:":mode/Deployment/:name",element:h.jsx($,{"code-path":"src/App.tsx:136:71",children:h.jsx(Iv,{"code-path":"src/App.tsx:136:81"})})}),h.jsx(Z,{"code-path":"src/App.tsx:137:25",path:":mode/StatefulSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:137:72",children:h.jsx($v,{"code-path":"src/App.tsx:137:82"})})}),h.jsx(Z,{"code-path":"src/App.tsx:138:25",path:":mode/DaemonSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:138:70",children:h.jsx($v,{"code-path":"src/App.tsx:138:80"})})})]}),h.jsx(Z,{"code-path":"src/App.tsx:140:23",path:"deployments",element:h.jsx($,{"code-path":"src/App.tsx:140:58",children:h.jsx(kt,{"code-path":"src/App.tsx:140:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:141:23",path:"deployments/:name",element:h.jsx($,{"code-path":"src/App.tsx:141:64",children:h.jsx(Iv,{"code-path":"src/App.tsx:141:74"})})}),h.jsx(Z,{"code-path":"src/App.tsx:142:23",path:"pods",element:h.jsx($,{"code-path":"src/App.tsx:142:51",children:h.jsx(kt,{"code-path":"src/App.tsx:142:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:143:23",path:"services",element:h.jsx($,{"code-path":"src/App.tsx:143:55",children:h.jsx(kt,{"code-path":"src/App.tsx:143:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:144:23",path:"ingresses",element:h.jsx($,{"code-path":"src/App.tsx:144:56",children:h.jsx(kt,{"code-path":"src/App.tsx:144:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:145:23",path:"configmaps",element:h.jsx($,{"code-path":"src/App.tsx:145:57",children:h.jsx(kt,{"code-path":"src/App.tsx:145:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:146:23",path:"secrets",element:h.jsx($,{"code-path":"src/App.tsx:146:54",children:h.jsx(kt,{"code-path":"src/App.tsx:146:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:147:23",path:"hpas",element:h.jsx($,{"code-path":"src/App.tsx:147:51",children:h.jsx(kt,{"code-path":"src/App.tsx:147:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:148:23",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:148:55",children:h.jsx(kt,{"code-path":"src/App.tsx:148:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:149:23",path:"pvcs",element:h.jsx($,{"code-path":"src/App.tsx:149:51",children:h.jsx(kt,{"code-path":"src/App.tsx:149:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:150:23",path:"statefulsets",element:h.jsx($,{"code-path":"src/App.tsx:150:59",children:h.jsx(kt,{"code-path":"src/App.tsx:150:69"})})}),h.jsx(Z,{"code-path":"src/App.tsx:151:23",path:"daemonsets",element:h.jsx($,{"code-path":"src/App.tsx:151:57",children:h.jsx(kt,{"code-path":"src/App.tsx:151:67"})})})]})]})]}),h.jsx(Z,{"code-path":"src/App.tsx:157:17",path:"workloads",element:h.jsx($,{"code-path":"src/App.tsx:157:50",children:h.jsx(kt,{"code-path":"src/App.tsx:157:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:158:17",path:"workloads/events",element:h.jsx($,{"code-path":"src/App.tsx:158:57",children:h.jsx(UM,{"code-path":"src/App.tsx:158:67",target:"events"})})}),h.jsx(Z,{"code-path":"src/App.tsx:159:17",path:"workloads/:type",element:h.jsx($,{"code-path":"src/App.tsx:159:56",children:h.jsx(kt,{"code-path":"src/App.tsx:159:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:160:17",path:"nodes",element:h.jsx($,{"code-path":"src/App.tsx:160:46",children:h.jsx(NM,{"code-path":"src/App.tsx:160:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:161:17",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:161:49",children:h.jsx(Jv,{"code-path":"src/App.tsx:161:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:164:17",path:"pipelines",element:h.jsx($,{"code-path":"src/App.tsx:164:50",children:h.jsx(FM,{"code-path":"src/App.tsx:164:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:165:17",path:"pipelines/:code",element:h.jsx($,{"code-path":"src/App.tsx:165:56",children:h.jsx(ey,{"code-path":"src/App.tsx:165:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:166:17",path:"pipelines/:code/runs",element:h.jsx($,{"code-path":"src/App.tsx:166:61",children:h.jsx(IM,{"code-path":"src/App.tsx:166:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:167:17",path:"pipelines/:code/edit",element:h.jsx($,{"code-path":"src/App.tsx:167:61",children:h.jsx(ey,{"code-path":"src/App.tsx:167:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:168:17",path:"deploy/configureTools",element:h.jsx($,{"code-path":"src/App.tsx:168:62",children:h.jsx(ZM,{"code-path":"src/App.tsx:168:72"})})}),h.jsx(Z,{"code-path":"src/App.tsx:169:17",path:"deploy/groups",element:h.jsx($,{"code-path":"src/App.tsx:169:54",children:h.jsx(JM,{"code-path":"src/App.tsx:169:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:170:17",path:"deploy/rbac",element:h.jsx($,{"code-path":"src/App.tsx:170:52",children:h.jsx($M,{"code-path":"src/App.tsx:170:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:173:17",path:"metrics",element:h.jsx($,{"code-path":"src/App.tsx:173:48",children:h.jsx(iD,{"code-path":"src/App.tsx:173:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:174:17",path:"datasources",element:h.jsx($,{"code-path":"src/App.tsx:174:52",children:h.jsx(cD,{"code-path":"src/App.tsx:174:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:175:17",path:"trace",element:h.jsx($,{"code-path":"src/App.tsx:175:46",children:h.jsx(rD,{"code-path":"src/App.tsx:175:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:176:17",path:"dashboards",element:h.jsx($,{"code-path":"src/App.tsx:176:51",children:h.jsx(lD,{"code-path":"src/App.tsx:176:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:177:17",path:"host-monitor",element:h.jsx($,{"code-path":"src/App.tsx:177:53",children:h.jsx(oD,{"code-path":"src/App.tsx:177:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:178:17",path:"alerts",element:h.jsx($,{"code-path":"src/App.tsx:178:47",children:h.jsx(Wv,{"code-path":"src/App.tsx:178:57"})})}),h.jsx(Z,{"code-path":"src/App.tsx:179:17",path:"alert-center",element:h.jsx($,{"code-path":"src/App.tsx:179:53",children:h.jsx(aD,{"code-path":"src/App.tsx:179:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:180:17",path:"monitor-center",element:h.jsx($,{"code-path":"src/App.tsx:180:55",children:h.jsx(sD,{"code-path":"src/App.tsx:180:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:181:17",path:"logs",element:h.jsx($,{"code-path":"src/App.tsx:181:45",children:h.jsx(Wv,{"code-path":"src/App.tsx:181:55"})})}),h.jsx(Z,{"code-path":"src/App.tsx:184:17",path:"approval",element:h.jsx($,{"code-path":"src/App.tsx:184:49",children:h.jsx(HM,{"code-path":"src/App.tsx:184:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:185:17",path:"approval/resource",element:h.jsx($,{"code-path":"src/App.tsx:185:58",children:h.jsx(BM,{"code-path":"src/App.tsx:185:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:186:17",path:"approval/app",element:h.jsx($,{"code-path":"src/App.tsx:186:53",children:h.jsx(PM,{"code-path":"src/App.tsx:186:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:187:17",path:"approval/permission",element:h.jsx($,{"code-path":"src/App.tsx:187:60",children:h.jsx(VM,{"code-path":"src/App.tsx:187:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:188:17",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:188:49",children:h.jsx(WM,{"code-path":"src/App.tsx:188:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:189:17",path:"scripts",element:h.jsx($,{"code-path":"src/App.tsx:189:48",children:h.jsx(qM,{"code-path":"src/App.tsx:189:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:193:17",path:"ai-assistant",element:h.jsx($,{"code-path":"src/App.tsx:193:53",children:h.jsx(eD,{"code-path":"src/App.tsx:193:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:194:17",path:"ai-alert-analyzer",element:h.jsx($,{"code-path":"src/App.tsx:194:58",children:h.jsx(tD,{"code-path":"src/App.tsx:194:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:195:17",path:"ai-predictive",element:h.jsx($,{"code-path":"src/App.tsx:195:54",children:h.jsx(nD,{"code-path":"src/App.tsx:195:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:198:17",path:"audit/terminal",element:h.jsx($,{"code-path":"src/App.tsx:198:55",children:h.jsx(YM,{"code-path":"src/App.tsx:198:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:199:17",path:"audit/operations",element:h.jsx($,{"code-path":"src/App.tsx:199:57",children:h.jsx(XM,{"code-path":"src/App.tsx:199:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:200:17",path:"audit/login-logs",element:h.jsx($,{"code-path":"src/App.tsx:200:57",children:h.jsx(QM,{"code-path":"src/App.tsx:200:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:203:17",path:"users",element:h.jsx($,{"code-path":"src/App.tsx:203:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:203:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:204:17",path:"roles",element:h.jsx($,{"code-path":"src/App.tsx:204:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:204:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:205:17",path:"credentials",element:h.jsx($,{"code-path":"src/App.tsx:205:52",children:h.jsx(KM,{"code-path":"src/App.tsx:205:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:206:17",path:"settings",element:h.jsx($,{"code-path":"src/App.tsx:206:49",children:h.jsx(Rd,{"code-path":"src/App.tsx:206:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:207:17",path:"approval-workflow",element:h.jsx($,{"code-path":"src/App.tsx:207:58",children:h.jsx(GM,{"code-path":"src/App.tsx:207:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:210:17",path:"*",element:h.jsx(Sy,{"code-path":"src/App.tsx:210:42",to:"/",replace:!0})})]})]})})})})})}bw.createRoot(document.getElementById("root")).render(h.jsx(m.StrictMode,{"code-path":"src/main.tsx:7:3",children:h.jsx(fD,{"code-path":"src/main.tsx:8:5"})}));export{db as $,vD as A,St as B,Wo as C,Wj as D,TA as E,ft as F,xD as G,rn as H,yD as I,sf as J,Xa as K,ri as L,ob as M,h_ as N,wa as O,Et as P,ji as Q,f_ as R,qC as S,Hx as T,tb as U,Bx as V,Yn as W,Mi as X,nf as Y,iT as Z,ut as _,nM as a,nb as a0,Ef as a1,wf as a2,Ci as a3,Px as a4,u2 as a5,Vx as a6,ex as a7,se as a8,Js as a9,Ws as aa,ei as ab,Kd as ac,ti as ad,Fo as ae,Io as af,_j as ag,SD as ah,yA as ai,dA as aj,Nd as ak,Oy as al,cA as am,uA as an,Dd as ao,Ry as ap,AA as aq,pA as ar,gD as as,PC as at,Py as au,aM as b,oM as c,lM as d,rM as e,CD as f,mD as g,Ue as h,sl as i,AD as j,wt as k,wD as l,Ce as m,ZC as n,on as o,qT as p,C2 as q,Ea as r,ke as s,Zv as t,Wb as u,Di as v,Pe as w,oe as x,ZR as y,bi as z}; diff --git a/backend/static/assets/index-CYw3SC6I.js b/backend/static/assets/index-Z0O8nAcG.js similarity index 99% rename from backend/static/assets/index-CYw3SC6I.js rename to backend/static/assets/index-Z0O8nAcG.js index 31bd993..1ef84f2 100644 --- a/backend/static/assets/index-CYw3SC6I.js +++ b/backend/static/assets/index-Z0O8nAcG.js @@ -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(`/kubernetes/${e}/namespace/${s}/deployments/${t}`)}catch{const a=await n.get(`/kubernetes/${e}/namespace/${s}/deployments`);return(Array.isArray(a)?a:a?.list||a?.items||a?.data||[]).find(c=>c.name===t)||null}}},L={getNamespaces:async e=>n.get(`/kubernetes/${e}/namespaces`),getNamespacesDetail:async e=>n.get(`/kubernetes/${e}/namespaces/detail`),getNamespaceDetail:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/detail`),createNamespace:async(e,s,t)=>n.post(`/kubernetes/${e}/namespaces`,{name:s,labels:t||{}}),deleteNamespace:async(e,s)=>n.delete(`/kubernetes/${e}/namespaces/${s}`)},w={getNamespaceServices:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/services`),getNamespaceIngresses:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/ingresses`),getNamespaceConfigMaps:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/configmaps`),getNamespaceSecrets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/secrets`),getPVCs:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pvcs`),deletePVC:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/pvcs/${t}`),getServiceAccounts:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/serviceaccounts`),getRoles:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/roles`),getRoleBindings:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/rolebindings`),getResourceYaml:async(e,s,t,a)=>n.getRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),updateResourceYaml:async(e,s,t,a,r)=>n.putRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`,r,"application/yaml"),deleteResourceYaml:async(e,s,t,a)=>n.delete(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),getEvents:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.type=t),n.get(`/kubernetes/${e}/events`,a)},getEventsSummary:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.hours=t),n.get(`/kubernetes/${e}/events/summary`,a)},getCapacity:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/capacity`,t)},applyYAML:async(e,s)=>n.post(`/kubernetes/${e}/yaml/apply`,{yaml:s})},D={...m,...g,...h,...v,...L,...w,exportAsCSV:y,exportAsJSON:b};export{D as k}; diff --git a/backend/static/assets/input--Xdj49es.js b/backend/static/assets/input-BdDauX3U.js similarity index 92% rename from backend/static/assets/input--Xdj49es.js rename to backend/static/assets/input-BdDauX3U.js index 2b03fd2..c7c7c22 100644 --- a/backend/static/assets/input--Xdj49es.js +++ b/backend/static/assets/input-BdDauX3U.js @@ -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}; diff --git a/backend/static/assets/label-DZckFZd3.js b/backend/static/assets/label-u-lNUbKh.js similarity index 93% rename from backend/static/assets/label-DZckFZd3.js rename to backend/static/assets/label-u-lNUbKh.js index 6667a6f..787d1eb 100644 --- a/backend/static/assets/label-DZckFZd3.js +++ b/backend/static/assets/label-u-lNUbKh.js @@ -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}; diff --git a/backend/static/assets/metrics-BCZ7fIl4.js b/backend/static/assets/metrics-Dj4l07HZ.js similarity index 88% rename from backend/static/assets/metrics-BCZ7fIl4.js rename to backend/static/assets/metrics-Dj4l07HZ.js index c10a1e8..13c7933 100644 --- a/backend/static/assets/metrics-BCZ7fIl4.js +++ b/backend/static/assets/metrics-Dj4l07HZ.js @@ -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}; diff --git a/backend/static/assets/pipeline-CvSxTj00.js b/backend/static/assets/pipeline-Lgvc2XUS.js similarity index 95% rename from backend/static/assets/pipeline-CvSxTj00.js rename to backend/static/assets/pipeline-Lgvc2XUS.js index 3835edf..fb0560d 100644 --- a/backend/static/assets/pipeline-CvSxTj00.js +++ b/backend/static/assets/pipeline-Lgvc2XUS.js @@ -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}; diff --git a/backend/static/assets/platform-C7N_g8dz.js b/backend/static/assets/platform-g_u95ryi.js similarity index 71% rename from backend/static/assets/platform-C7N_g8dz.js rename to backend/static/assets/platform-g_u95ryi.js index 24887d6..f7b4b63 100644 --- a/backend/static/assets/platform-C7N_g8dz.js +++ b/backend/static/assets/platform-g_u95ryi.js @@ -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}; diff --git a/backend/static/assets/region-DScARMXs.js b/backend/static/assets/region-BZBRxF2X.js similarity index 77% rename from backend/static/assets/region-DScARMXs.js rename to backend/static/assets/region-BZBRxF2X.js index e32ecae..2d60e72 100644 --- a/backend/static/assets/region-DScARMXs.js +++ b/backend/static/assets/region-BZBRxF2X.js @@ -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}; diff --git a/backend/static/assets/select-DbRZUnPK.js b/backend/static/assets/select-4xU_9B3_.js similarity index 99% rename from backend/static/assets/select-DbRZUnPK.js rename to backend/static/assets/select-4xU_9B3_.js index 2eb137a..f794ded 100644 --- a/backend/static/assets/select-DbRZUnPK.js +++ b/backend/static/assets/select-4xU_9B3_.js @@ -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="SelectPortal",Le=t=>l.jsx(ct,{asChild:!0,...t});Le.displayName=At;var J="SelectContent",ke=n.forwardRef((t,o)=>{const e=G(J,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?Re.createPortal(l.jsx(Ve,{scope:t.__scopeSelect,children:l.jsx(ie.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),d):null}return l.jsx(Be,{...t,ref:o})});ke.displayName=J;var O=10,[Ve,Y]=oe(J),Dt="SelectContentImpl",Lt=yt("SelectContent.RemoveScroll"),Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:a,side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(J,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),R=L(o,f=>F(f)),[A,U]=n.useState(null),[Z,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return ut(v)},[v]),pt();const _=n.useCallback(f=>{const[I,...N]=V().map(b=>b.ref.current),[w]=N.slice(-1),y=document.activeElement;for(const b of f)if(b===y||(b?.scrollIntoView({block:"nearest"}),b===I&&M&&(M.scrollTop=0),b===w&&M&&(M.scrollTop=M.scrollHeight),b?.focus(),document.activeElement!==y))return},[V,M]),D=n.useCallback(()=>_([A,v]),[_,A,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},N=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",N,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",N,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,le]=et(f=>{const I=V().filter(y=>!y.disabled),N=I.find(y=>y.ref.current===document.activeElement),w=tt(I,f,N);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),ae=s==="popper"?xe:He,re=ae===xe?{side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h}:{};return l.jsx(Ve,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:A,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:Z,position:s,isPositioned:z,searchRef:pe,children:l.jsx(ft,{as:Lt,allowPinchZoom:!0,children:l.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:l.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:l.jsx(ae,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:P(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&le(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const y=f.target,b=w.indexOf(y);w=w.slice(b+1)}setTimeout(()=>_(w)),f.preventDefault()}})})})})})})});Be.displayName=Dt;var kt="SelectItemAlignedPosition",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(J,e),a=Y(J,e),[c,i]=n.useState(null),[p,g]=n.useState(null),x=L(o,R=>g(R)),E=de(e),T=n.useRef(!1),C=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=a,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&c&&p&&u&&h&&S){const R=d.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(d.dir!=="rtl"){const y=Z.left-A.left,b=U.left-y,q=R.left-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.left=ve+"px"}else{const y=A.right-Z.right,b=window.innerWidth-U.right-y,q=window.innerWidth-R.right-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.right=ve+"px"}const k=E(),V=window.innerHeight-O*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),_=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+_+z+W+D,pe=Math.min(h.offsetHeight*5,K),le=window.getComputedStyle(u),fe=parseInt(le.paddingTop,10),me=parseInt(le.paddingBottom,10),ee=R.top+R.height/2-O,ae=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+_+f,N=K-I;if(I<=ee){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const b=p.clientHeight-u.offsetTop-u.offsetHeight,q=Math.max(ae,re+(y?me:0)+b+D),X=I+q;c.style.height=X+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const q=Math.max(ee,H+u.offsetTop+(y?fe:0)+re)+N;c.style.height=q+"px",u.scrollTop=I-ee+u.offsetTop}c.style.margin=`${O}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>T.current=!0)}},[E,d.trigger,d.valueNode,c,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,m]);return l.jsx(Bt,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:T,onScrollButtonChange:ne,children:l.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:l.jsx(j.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});He.displayName=kt;var Vt="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=O,...d}=t,a=ue(e);return l.jsx(gt,{...a,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Vt;var[Bt,Te]=oe(J,{}),Se="SelectViewport",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),a=Te(Se,e),c=L(o,d.onViewportChange),i=n.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(ie.Slot,{scope:e,children:l.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=a;if(E?.current&&x){const T=Math.abs(i.current-g.scrollTop);if(T>0){const C=window.innerHeight-O*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S0?F:0,x.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});We.displayName=Se;var Fe="SelectGroup",[Ht,Wt]=oe(Fe),Ft=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return l.jsx(Ht,{scope:e,id:r,children:l.jsx(j.div,{role:"group","aria-labelledby":r,...s,ref:o})})});Ft.displayName=Fe;var Ue="SelectLabel",Ut=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Wt(Ue,e);return l.jsx(j.div,{id:r.id,...s,ref:o})});Ut.displayName=Ue;var ce="SelectItem",[zt,ze]=oe(ce),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...a}=t,c=G(ce,e),i=Y(ce,e),p=c.value===s,[g,x]=n.useState(d??""),[E,T]=n.useState(!1),C=L(o,m=>i.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(zt,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:l.jsx(ie.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:l.jsx(j.div,{role:"option","aria-labelledby":u,"data-highlighted":E?"":void 0,"aria-selected":p&&E,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:C,onFocus:P(a.onFocus,()=>T(!0)),onBlur:P(a.onBlur,()=>T(!1)),onClick:P(a.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:P(a.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:P(a.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:P(a.onPointerMove,m=>{h.current=m.pointerType,r?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(a.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:P(a.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Rt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ke.displayName=ce;var se="SelectItemText",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,a=G(se,e),c=Y(se,e),i=ze(se,e),p=Mt(se,e),[g,x]=n.useState(null),E=L(o,S=>x(S),i.onItemTextChange,S=>c.itemTextRefCallback?.(S,i.value,i.disabled)),T=g?.textContent,C=n.useMemo(()=>l.jsx("option",{value:i.value,disabled:i.disabled,children:T},i.value),[i.disabled,i.value,T]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(C),()=>h(C)),[u,h,C]),l.jsxs(l.Fragment,{children:[l.jsx(j.span,{id:i.textId,...d,ref:E}),i.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Re.createPortal(d.children,a.valueNode):null]})});$e.displayName=se;var Ge="SelectItemIndicator",Ye=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return ze(Ge,e).isSelected?l.jsx(j.span,{"aria-hidden":!0,...s,ref:o}):null});Ye.displayName=Ge;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=Te(we,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollTop>0;d(p)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",qe=n.forwardRef((t,o)=>{const e=Y(ye,t.__scopeSelect),s=Te(ye,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollHeight-i.clientHeight,g=Math.ceil(i.scrollTop)i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});qe.displayName=ye;var Xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),a=n.useRef(null),c=de(e),i=n.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return n.useEffect(()=>()=>i(),[i]),$(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),l.jsx(j.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:P(r.onPointerMove,()=>{d.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:P(r.onPointerLeave,()=>{i()})})}),Kt="SelectSeparator",$t=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return l.jsx(j.div,{"aria-hidden":!0,...s,ref:o})});$t.displayName=Kt;var Ce="SelectArrow",Gt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(Ce,e),a=Y(Ce,e);return d.open&&a.position==="popper"?l.jsx(vt,{...r,...s,ref:o}):null});Gt.displayName=Ce;var Yt="SelectBubbleInput",Qe=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),a=xt(o);return n.useEffect(()=>{const c=r.current;if(!c)return;const i=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(i,"value").set;if(a!==o&&g){const x=new Event("change",{bubbles:!0});g.call(c,o),c.dispatchEvent(x)}},[a,o]),l.jsx(j.select,{...e,style:{...it,...e.style},ref:d,defaultValue:o})});Qe.displayName=Yt;function Je(t){return t===""||t===void 0}function et(t){const o=dt(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(a=>{const c=e.current+a;o(c),(function i(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>i(""),1e3))})(c)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function tt(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let a=Zt(t,Math.max(d,0));r.length===1&&(a=a.filter(p=>p!==e));const i=a.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==e?i:void 0}function Zt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var qt=Ne,Xt=Me,Qt=Ae,Jt=De,eo=Le,to=ke,oo=We,no=Ke,ro=$e,so=Ye,lo=Ze,ao=qe;function ho({...t}){return l.jsx(qt,{"code-path":"src/components/ui/select.tsx:10:10","data-slot":"select",...t})}function go({...t}){return l.jsx(Qt,{"code-path":"src/components/ui/select.tsx:22:10","data-slot":"select-value",...t})}function vo({className:t,size:o="default",children:e,...s}){return l.jsxs(Xt,{"code-path":"src/components/ui/select.tsx:34:5","data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]: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 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,l.jsx(Jt,{"code-path":"src/components/ui/select.tsx:44:7",asChild:!0,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:45:9",className:"size-4 opacity-50"})})]})}function xo({className:t,children:o,position:e="item-aligned",align:s="center",...r}){return l.jsx(eo,{"code-path":"src/components/ui/select.tsx:59:5",children:l.jsxs(to,{"code-path":"src/components/ui/select.tsx:60:7","data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,align:s,...r,children:[l.jsx(co,{"code-path":"src/components/ui/select.tsx:72:9"}),l.jsx(oo,{"code-path":"src/components/ui/select.tsx:73:9",className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),l.jsx(io,{"code-path":"src/components/ui/select.tsx:82:9"})]})})}function So({className:t,children:o,...e}){return l.jsxs(no,{"code-path":"src/components/ui/select.tsx:107:5","data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[l.jsx("span",{"code-path":"src/components/ui/select.tsx:115:7","data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(so,{"code-path":"src/components/ui/select.tsx:119:9",children:l.jsx(St,{"code-path":"src/components/ui/select.tsx:120:11",className:"size-4"})})}),l.jsx(ro,{"code-path":"src/components/ui/select.tsx:123:7",children:o})]})}function co({className:t,...o}){return l.jsx(lo,{"code-path":"src/components/ui/select.tsx:146:5","data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(wt,{"code-path":"src/components/ui/select.tsx:154:7",className:"size-4"})})}function io({className:t,...o}){return l.jsx(ao,{"code-path":"src/components/ui/select.tsx:164:5","data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:172:7",className:"size-4"})})}export{ho as S,vo as a,go as b,xo as c,So as d}; +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="SelectPortal",Le=t=>l.jsx(ct,{asChild:!0,...t});Le.displayName=At;var J="SelectContent",ke=n.forwardRef((t,o)=>{const e=G(J,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?Re.createPortal(l.jsx(Ve,{scope:t.__scopeSelect,children:l.jsx(ie.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),d):null}return l.jsx(Be,{...t,ref:o})});ke.displayName=J;var O=10,[Ve,Y]=oe(J),Dt="SelectContentImpl",Lt=yt("SelectContent.RemoveScroll"),Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:a,side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(J,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),R=L(o,f=>F(f)),[A,U]=n.useState(null),[Z,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return ut(v)},[v]),pt();const _=n.useCallback(f=>{const[I,...N]=V().map(b=>b.ref.current),[w]=N.slice(-1),y=document.activeElement;for(const b of f)if(b===y||(b?.scrollIntoView({block:"nearest"}),b===I&&M&&(M.scrollTop=0),b===w&&M&&(M.scrollTop=M.scrollHeight),b?.focus(),document.activeElement!==y))return},[V,M]),D=n.useCallback(()=>_([A,v]),[_,A,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},N=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",N,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",N,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,le]=et(f=>{const I=V().filter(y=>!y.disabled),N=I.find(y=>y.ref.current===document.activeElement),w=tt(I,f,N);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),ae=s==="popper"?xe:He,re=ae===xe?{side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h}:{};return l.jsx(Ve,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:A,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:Z,position:s,isPositioned:z,searchRef:pe,children:l.jsx(ft,{as:Lt,allowPinchZoom:!0,children:l.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:l.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:l.jsx(ae,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:P(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&le(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const y=f.target,b=w.indexOf(y);w=w.slice(b+1)}setTimeout(()=>_(w)),f.preventDefault()}})})})})})})});Be.displayName=Dt;var kt="SelectItemAlignedPosition",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(J,e),a=Y(J,e),[c,i]=n.useState(null),[p,g]=n.useState(null),x=L(o,R=>g(R)),E=de(e),T=n.useRef(!1),C=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=a,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&c&&p&&u&&h&&S){const R=d.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(d.dir!=="rtl"){const y=Z.left-A.left,b=U.left-y,q=R.left-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.left=ve+"px"}else{const y=A.right-Z.right,b=window.innerWidth-U.right-y,q=window.innerWidth-R.right-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.right=ve+"px"}const k=E(),V=window.innerHeight-O*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),_=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+_+z+W+D,pe=Math.min(h.offsetHeight*5,K),le=window.getComputedStyle(u),fe=parseInt(le.paddingTop,10),me=parseInt(le.paddingBottom,10),ee=R.top+R.height/2-O,ae=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+_+f,N=K-I;if(I<=ee){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const b=p.clientHeight-u.offsetTop-u.offsetHeight,q=Math.max(ae,re+(y?me:0)+b+D),X=I+q;c.style.height=X+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const q=Math.max(ee,H+u.offsetTop+(y?fe:0)+re)+N;c.style.height=q+"px",u.scrollTop=I-ee+u.offsetTop}c.style.margin=`${O}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>T.current=!0)}},[E,d.trigger,d.valueNode,c,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,m]);return l.jsx(Bt,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:T,onScrollButtonChange:ne,children:l.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:l.jsx(j.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});He.displayName=kt;var Vt="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=O,...d}=t,a=ue(e);return l.jsx(gt,{...a,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Vt;var[Bt,Te]=oe(J,{}),Se="SelectViewport",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),a=Te(Se,e),c=L(o,d.onViewportChange),i=n.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(ie.Slot,{scope:e,children:l.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=a;if(E?.current&&x){const T=Math.abs(i.current-g.scrollTop);if(T>0){const C=window.innerHeight-O*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S0?F:0,x.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});We.displayName=Se;var Fe="SelectGroup",[Ht,Wt]=oe(Fe),Ft=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return l.jsx(Ht,{scope:e,id:r,children:l.jsx(j.div,{role:"group","aria-labelledby":r,...s,ref:o})})});Ft.displayName=Fe;var Ue="SelectLabel",Ut=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Wt(Ue,e);return l.jsx(j.div,{id:r.id,...s,ref:o})});Ut.displayName=Ue;var ce="SelectItem",[zt,ze]=oe(ce),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...a}=t,c=G(ce,e),i=Y(ce,e),p=c.value===s,[g,x]=n.useState(d??""),[E,T]=n.useState(!1),C=L(o,m=>i.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(zt,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:l.jsx(ie.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:l.jsx(j.div,{role:"option","aria-labelledby":u,"data-highlighted":E?"":void 0,"aria-selected":p&&E,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:C,onFocus:P(a.onFocus,()=>T(!0)),onBlur:P(a.onBlur,()=>T(!1)),onClick:P(a.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:P(a.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:P(a.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:P(a.onPointerMove,m=>{h.current=m.pointerType,r?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(a.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:P(a.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Rt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ke.displayName=ce;var se="SelectItemText",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,a=G(se,e),c=Y(se,e),i=ze(se,e),p=Mt(se,e),[g,x]=n.useState(null),E=L(o,S=>x(S),i.onItemTextChange,S=>c.itemTextRefCallback?.(S,i.value,i.disabled)),T=g?.textContent,C=n.useMemo(()=>l.jsx("option",{value:i.value,disabled:i.disabled,children:T},i.value),[i.disabled,i.value,T]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(C),()=>h(C)),[u,h,C]),l.jsxs(l.Fragment,{children:[l.jsx(j.span,{id:i.textId,...d,ref:E}),i.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Re.createPortal(d.children,a.valueNode):null]})});$e.displayName=se;var Ge="SelectItemIndicator",Ye=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return ze(Ge,e).isSelected?l.jsx(j.span,{"aria-hidden":!0,...s,ref:o}):null});Ye.displayName=Ge;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=Te(we,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollTop>0;d(p)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",qe=n.forwardRef((t,o)=>{const e=Y(ye,t.__scopeSelect),s=Te(ye,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollHeight-i.clientHeight,g=Math.ceil(i.scrollTop)i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});qe.displayName=ye;var Xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),a=n.useRef(null),c=de(e),i=n.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return n.useEffect(()=>()=>i(),[i]),$(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),l.jsx(j.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:P(r.onPointerMove,()=>{d.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:P(r.onPointerLeave,()=>{i()})})}),Kt="SelectSeparator",$t=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return l.jsx(j.div,{"aria-hidden":!0,...s,ref:o})});$t.displayName=Kt;var Ce="SelectArrow",Gt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(Ce,e),a=Y(Ce,e);return d.open&&a.position==="popper"?l.jsx(vt,{...r,...s,ref:o}):null});Gt.displayName=Ce;var Yt="SelectBubbleInput",Qe=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),a=xt(o);return n.useEffect(()=>{const c=r.current;if(!c)return;const i=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(i,"value").set;if(a!==o&&g){const x=new Event("change",{bubbles:!0});g.call(c,o),c.dispatchEvent(x)}},[a,o]),l.jsx(j.select,{...e,style:{...it,...e.style},ref:d,defaultValue:o})});Qe.displayName=Yt;function Je(t){return t===""||t===void 0}function et(t){const o=dt(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(a=>{const c=e.current+a;o(c),(function i(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>i(""),1e3))})(c)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function tt(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let a=Zt(t,Math.max(d,0));r.length===1&&(a=a.filter(p=>p!==e));const i=a.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==e?i:void 0}function Zt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var qt=Ne,Xt=Me,Qt=Ae,Jt=De,eo=Le,to=ke,oo=We,no=Ke,ro=$e,so=Ye,lo=Ze,ao=qe;function ho({...t}){return l.jsx(qt,{"code-path":"src/components/ui/select.tsx:10:10","data-slot":"select",...t})}function go({...t}){return l.jsx(Qt,{"code-path":"src/components/ui/select.tsx:22:10","data-slot":"select-value",...t})}function vo({className:t,size:o="default",children:e,...s}){return l.jsxs(Xt,{"code-path":"src/components/ui/select.tsx:34:5","data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]: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 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,l.jsx(Jt,{"code-path":"src/components/ui/select.tsx:44:7",asChild:!0,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:45:9",className:"size-4 opacity-50"})})]})}function xo({className:t,children:o,position:e="item-aligned",align:s="center",...r}){return l.jsx(eo,{"code-path":"src/components/ui/select.tsx:59:5",children:l.jsxs(to,{"code-path":"src/components/ui/select.tsx:60:7","data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,align:s,...r,children:[l.jsx(co,{"code-path":"src/components/ui/select.tsx:72:9"}),l.jsx(oo,{"code-path":"src/components/ui/select.tsx:73:9",className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),l.jsx(io,{"code-path":"src/components/ui/select.tsx:82:9"})]})})}function So({className:t,children:o,...e}){return l.jsxs(no,{"code-path":"src/components/ui/select.tsx:107:5","data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[l.jsx("span",{"code-path":"src/components/ui/select.tsx:115:7","data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(so,{"code-path":"src/components/ui/select.tsx:119:9",children:l.jsx(St,{"code-path":"src/components/ui/select.tsx:120:11",className:"size-4"})})}),l.jsx(ro,{"code-path":"src/components/ui/select.tsx:123:7",children:o})]})}function co({className:t,...o}){return l.jsx(lo,{"code-path":"src/components/ui/select.tsx:146:5","data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(wt,{"code-path":"src/components/ui/select.tsx:154:7",className:"size-4"})})}function io({className:t,...o}){return l.jsx(ao,{"code-path":"src/components/ui/select.tsx:164:5","data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:172:7",className:"size-4"})})}export{ho as S,vo as a,go as b,xo as c,So as d}; diff --git a/backend/static/assets/server-rQ-8Frwb.js b/backend/static/assets/server-BUAZv7ZV.js similarity index 94% rename from backend/static/assets/server-rQ-8Frwb.js rename to backend/static/assets/server-BUAZv7ZV.js index 1e0103b..382bdb7 100644 --- a/backend/static/assets/server-rQ-8Frwb.js +++ b/backend/static/assets/server-BUAZv7ZV.js @@ -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}; diff --git a/backend/static/assets/site-Cjg78WIa.js b/backend/static/assets/site-B-pRndoi.js similarity index 78% rename from backend/static/assets/site-Cjg78WIa.js rename to backend/static/assets/site-B-pRndoi.js index a856112..a6447ff 100644 --- a/backend/static/assets/site-Cjg78WIa.js +++ b/backend/static/assets/site-B-pRndoi.js @@ -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}; diff --git a/backend/static/assets/stat-strip-TlkYcldq.js b/backend/static/assets/stat-strip-BPzU38xY.js similarity index 95% rename from backend/static/assets/stat-strip-TlkYcldq.js rename to backend/static/assets/stat-strip-BPzU38xY.js index f155078..3e00015 100644 --- a/backend/static/assets/stat-strip-TlkYcldq.js +++ b/backend/static/assets/stat-strip-BPzU38xY.js @@ -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}; diff --git a/backend/static/assets/switch-DYISEUSP.js b/backend/static/assets/switch-C4PJnJ9I.js similarity index 97% rename from backend/static/assets/switch-DYISEUSP.js rename to backend/static/assets/switch-C4PJnJ9I.js index 951f63d..d77052c 100644 --- a/backend/static/assets/switch-DYISEUSP.js +++ b/backend/static/assets/switch-C4PJnJ9I.js @@ -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}; diff --git a/backend/static/assets/table-CUnn2-lp.js b/backend/static/assets/table-BPFYQwjr.js similarity index 95% rename from backend/static/assets/table-CUnn2-lp.js rename to backend/static/assets/table-BPFYQwjr.js index 515b280..0c05dc3 100644 --- a/backend/static/assets/table-CUnn2-lp.js +++ b/backend/static/assets/table-BPFYQwjr.js @@ -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}; diff --git a/backend/static/assets/tabs-dobHN7aQ.js b/backend/static/assets/tabs-kmtfM2I-.js similarity index 98% rename from backend/static/assets/tabs-dobHN7aQ.js rename to backend/static/assets/tabs-kmtfM2I-.js index a403788..178391a 100644 --- a/backend/static/assets/tabs-dobHN7aQ.js +++ b/backend/static/assets/tabs-kmtfM2I-.js @@ -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}; diff --git a/backend/static/assets/terminal-CLsFzYYz.js b/backend/static/assets/terminal-BchqP-zB.js similarity index 88% rename from backend/static/assets/terminal-CLsFzYYz.js rename to backend/static/assets/terminal-BchqP-zB.js index 0a87788..3116eb0 100644 --- a/backend/static/assets/terminal-CLsFzYYz.js +++ b/backend/static/assets/terminal-BchqP-zB.js @@ -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}; diff --git a/backend/static/assets/textarea-JgdELMPr.js b/backend/static/assets/textarea-BdtIagjy.js similarity index 91% rename from backend/static/assets/textarea-JgdELMPr.js rename to backend/static/assets/textarea-BdtIagjy.js index 3cd1415..c641956 100644 --- a/backend/static/assets/textarea-JgdELMPr.js +++ b/backend/static/assets/textarea-BdtIagjy.js @@ -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}; diff --git a/backend/static/assets/unwrap-oA0ekUAt.js b/backend/static/assets/unwrap-BmWy-KM2.js similarity index 99% rename from backend/static/assets/unwrap-oA0ekUAt.js rename to backend/static/assets/unwrap-BmWy-KM2.js index abacb00..a46aec7 100644 --- a/backend/static/assets/unwrap-oA0ekUAt.js +++ b/backend/static/assets/unwrap-BmWy-KM2.js @@ -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,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,R=p.status==="error"&&!c,S=E=>{R?E.reject(p.error):c&&E.resolve(p.data)},A=()=>{const E=this.#r=p.promise=L();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(R||p.data!==O.value)&&A();break;case"rejected":(!R||p.error!==O.reason)&&A();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#f=this.#t),M(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#d.size)return!0;const u=new Set(i??this.#d);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(n=>{const d=n;return this.#e[d]!==t[d]&&u.has(d)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#E(t){W.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function B(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function tt(t,e){return!M(t.getCurrentResult(),e)}var K=f.createContext(!1),et=()=>f.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=f.createContext(st()),it=()=>f.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{f.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,z=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),n=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const d=u.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",ht(n),nt(n,i,d),at(i);const b=!u.getQueryCache().get(n.queryHash),[h]=f.useState(()=>new e(u,n)),a=h.getOptimisticResult(n),v=!r&&t.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(o=>{const g=v?h.subscribe(W.batchCalls(o)):Q;return h.updateResult(),g},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),f.useEffect(()=>{h.setOptions(n)},[n,h]),ut(n,a))throw z(n,h,i);if(ot({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:d,suspense:n.suspense}))throw a.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!x.isServer()&&ct(a,r)&&(b?z(n,h,i):d?.promise)?.catch(Q).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?a:h.trackResult(a)}function bt(t,e){return lt(t,$)}const vt={terminalSessions:t=>["terminal-sessions",t],hostMonitor:{hosts:()=>["host-monitor","hosts"],history:(t,e)=>["host-monitor","history",t,e],probes:t=>["host-monitor","probes",t],portPolicy:t=>["host-monitor","port-policy",t]},servers:t=>["servers",t],pipelines:t=>["pipelines",t],pipelineRuns:t=>["pipeline-runs",t],alerts:t=>["alerts",t],alertRules:()=>["alert-rules"],agentAlertRules:()=>["agent-alert-rules"],auditLogs:t=>["audit-logs",t],sessionCommands:t=>["session-commands",t],k8sClusters:()=>["k8s-clusters"],credentials:t=>["credentials",t],credentialDetail:t=>["credential-detail",t],promDatasources:()=>["prom-datasources"]};function ft(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const e=t;if(Array.isArray(e.list))return e.list;if(Array.isArray(e.data))return e.data}return[]}function Rt(t){return t&&typeof t=="object"&&"total"in t?Number(t.total)||0:ft(t).length}export{Rt as a,ft as b,vt as q,bt as u}; +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,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,R=p.status==="error"&&!c,S=E=>{R?E.reject(p.error):c&&E.resolve(p.data)},A=()=>{const E=this.#r=p.promise=L();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(R||p.data!==O.value)&&A();break;case"rejected":(!R||p.error!==O.reason)&&A();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#f=this.#t),M(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#d.size)return!0;const u=new Set(i??this.#d);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(n=>{const d=n;return this.#e[d]!==t[d]&&u.has(d)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#E(t){W.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function B(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function tt(t,e){return!M(t.getCurrentResult(),e)}var K=f.createContext(!1),et=()=>f.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=f.createContext(st()),it=()=>f.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{f.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,z=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),n=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const d=u.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",ht(n),nt(n,i,d),at(i);const b=!u.getQueryCache().get(n.queryHash),[h]=f.useState(()=>new e(u,n)),a=h.getOptimisticResult(n),v=!r&&t.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(o=>{const g=v?h.subscribe(W.batchCalls(o)):Q;return h.updateResult(),g},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),f.useEffect(()=>{h.setOptions(n)},[n,h]),ut(n,a))throw z(n,h,i);if(ot({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:d,suspense:n.suspense}))throw a.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!x.isServer()&&ct(a,r)&&(b?z(n,h,i):d?.promise)?.catch(Q).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?a:h.trackResult(a)}function bt(t,e){return lt(t,$)}const vt={terminalSessions:t=>["terminal-sessions",t],hostMonitor:{hosts:()=>["host-monitor","hosts"],history:(t,e)=>["host-monitor","history",t,e],probes:t=>["host-monitor","probes",t],portPolicy:t=>["host-monitor","port-policy",t]},servers:t=>["servers",t],pipelines:t=>["pipelines",t],pipelineRuns:t=>["pipeline-runs",t],alerts:t=>["alerts",t],alertRules:()=>["alert-rules"],agentAlertRules:()=>["agent-alert-rules"],auditLogs:t=>["audit-logs",t],sessionCommands:t=>["session-commands",t],k8sClusters:()=>["k8s-clusters"],credentials:t=>["credentials",t],credentialDetail:t=>["credential-detail",t],promDatasources:()=>["prom-datasources"]};function ft(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const e=t;if(Array.isArray(e.list))return e.list;if(Array.isArray(e.data))return e.data}return[]}function Rt(t){return t&&typeof t=="object"&&"total"in t?Number(t.total)||0:ft(t).length}export{Rt as a,ft as b,vt as q,bt as u}; diff --git a/backend/static/assets/useMutation-BLuCS56f.js b/backend/static/assets/useMutation-Bp3lz5hm.js similarity index 97% rename from backend/static/assets/useMutation-BLuCS56f.js rename to backend/static/assets/useMutation-Bp3lz5hm.js index 1c4c560..4326211 100644 --- a/backend/static/assets/useMutation-BLuCS56f.js +++ b/backend/static/assets/useMutation-Bp3lz5hm.js @@ -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}; diff --git a/backend/static/index.html b/backend/static/index.html index 5922bd7..0334400 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -7,10 +7,10 @@ AIOps智能运维平台 - + - +
diff --git a/frontend/src/components/kubernetes/DeploymentEditStorage.tsx b/frontend/src/components/kubernetes/DeploymentEditStorage.tsx index 607d0a6..b587a33 100644 --- a/frontend/src/components/kubernetes/DeploymentEditStorage.tsx +++ b/frontend/src/components/kubernetes/DeploymentEditStorage.tsx @@ -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) => void }) { + if (vol.type === 'persistentVolumeClaim') { + return ( +
+ PVC 名称 + 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" /> + +
+ ); + } + if (vol.type === 'emptyDir') { + return ( +
+ 介质 + + 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" /> +
+ ); + } + if (vol.type === 'hostPath') { + return ( +
+ 主机路径 + 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" /> + +
+ ); + } + if (vol.type === 'nfs') { + return ( +
+ NFS + 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" /> + 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" /> +
+ ); + } + if (vol.type === 'configMap') { + return ( +
+ ConfigMap + 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" /> + 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" /> +
+ ); + } + if (vol.type === 'secret') { + return ( +
+ Secret + 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" /> + 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" /> +
+ ); + } + 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(manifest || {}); - const [volumes, setVolumes] = useState([]); - const [mounts, setMounts] = useState([]); + const [entries, setEntries] = useState([]); const [containers, setContainers] = useState([]); const [passthroughVolumes, setPassthroughVolumes] = useState[]>([]); 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) => - 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) => - setMounts(prev => prev.map((m, idx) => (idx === i ? { ...m, ...patch } : m))); + const updateEntry = (i: number, patch: Partial) => + setEntries((prev) => prev.map((e, idx) => (idx === i ? { ...e, ...patch } : e))); + + const updateVolume = (i: number, patch: Partial) => + 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 ( - - 未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。 - + 未获取到 manifest 数据,请使用 YAML 编辑模式。 ); } - const volumeNames = volumes.map(v => v.name).filter(Boolean); - return (
- {/* ══════════ 定义数据卷 ══════════ */} -
- - 定义数据卷 - {volumes.length} - -
- - {volumes.length === 0 ? ( -
+ + {entries.length === 0 ? ( +
- 未配置数据卷 + 未配置数据卷,点击「添加数据卷」开始
- ) : 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 ( -
- {/* 卷名 + 类型 */} -
- - 数据卷名称 - 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" /> - - +
+ {/* 卷定义 */} +
+
+ + 数据卷名称 + { + const name = e.target.value; + const patch: Partial = { 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" + /> + + +
+ updateVolume(i, p)} />
- {/* 类型指定字段 */} - {vol.type === 'persistentVolumeClaim' && ( -
- 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" /> - -
- )} - - {vol.type === 'emptyDir' && ( -
- 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 && } + {containers.map((cn) => )} - 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" /> +
+ + +
+ 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" + />
- )} - - {vol.type === 'hostPath' && ( -
- 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" /> - +
+ 子路径 subPath + 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" + />
- )} - - {vol.type === 'nfs' && ( -
- 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" /> - : - 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" /> - -
- )} - - {vol.type === 'configMap' && ( -
- ConfigMap - 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" /> - 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" /> -
- )} - - {vol.type === 'secret' && ( -
- 密文 - 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" /> - 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" /> -
- )} +
); })} - {/* ══════════ 挂载到容器 ══════════ */} - - -
- - 将数据卷挂载到容器 - {mounts.length} - - -
-
- - {mounts.length === 0 ? ( -
- - {volumeNames.length === 0 ? '请先定义数据卷' : '未配置挂载点'} -
- ) : mounts.map((m, i) => ( -
- {/* 容器选择 */} - 容器: - - {/* 数据卷选择 */} - - {/* 挂载路径 */} - 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" /> - 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" /> - {/* 只读/读写 */} -
- - -
- -
- ))} -
-
- - {/* 操作栏 */}
); -} +} \ No newline at end of file diff --git a/frontend/src/components/kubernetes/deployment-volume-utils.ts b/frontend/src/components/kubernetes/deployment-volume-utils.ts index 26f183b..b47f308 100644 --- a/frontend/src/components/kubernetes/deployment-volume-utils.ts +++ b/frontend/src/components/kubernetes/deployment-volume-utils.ts @@ -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): { }; } +/** 解析为 Kuboard 一卷一卡条目 // Logan.Li */ +export function parseVolumeEntries(manifest: Record): { + entries: VolumeEntry[]; + containers: string[]; + passthroughVolumes: Record[]; +} { + 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,