refactor(q1): src/api 全量清零 any + types/monitor 扩展输入 DTO

ROADMAP Q1 推进(前端类型安全治理 in_progress):

- src/api/ 整个目录 any 清零(含 monitor/ deploy/ 子目录 12+ 文件)
  create/update 入参 any -> Record<string, unknown> / object
  mock 桩 trace/grafana 对接 types/ 标准类型(Trace/GrafanaDashboard)
  典型接口 LdapFormData/ProbeForm 等强类型表单用 object 接收
- types/monitor.ts 扩展 ~150 行接口:
  ZabbixDatasource / AlertSilence / 7 个输入 DTO
  Trace / TraceSpan / TraceServiceMetrics / GrafanaDashboard / DashboardPanel
  HealthProbeInput

验证:
- 整个 src/api/ 目录 any=0
- ESLint no-explicit-any: 995 -> 937 (本项目此轮贡献 -58)
- tsc -b 零错误, npm run build ✓ (17.06s)
- API 回归 8/8 核心端点通过, Docker 部署 healthy
This commit is contained in:
attacker committed 2026-06-26 03:37:56 +08:00
1 parent 480e677042
commit b553c7956d
436 files changed
+410 -1198

No files matched your search

@@ -1,4 +1,4 @@
import{j as s,a5 as b,aP as f,L as v,a6 as w,Q as g,H as C,B as A,r as l,D as M,a as U,b as B,c as J,d as E,O as L,T as R,S as G,C as H}from"./index-HuRw9UhJ.js";import{C as z,b as $,c as D,a as F}from"./card-B2Wqa0sK.js";import{B as y}from"./badge-CeS-g-Od.js";import{a as K}from"./alert-Bnyn6ibM.js";import{a as Q}from"./ai-CnRvgCA9.js";import{S}from"./sparkles-DEwze8TU.js";import{T as P}from"./trending-up-C97I6AeO.js";import{F as X}from"./file-text-BqORyhNh.js";import{P as _}from"./play-BXdOitsb.js";import{C as q}from"./copy-Ci4WwJkK.js";import{C as W}from"./circle-x-BVvXVx7p.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,a2 as b,aN as f,L as v,a3 as w,Q as g,H as C,B as A,r as l,D as M,a as U,b as B,c as J,d as E,O as L,T as R,S as G,C as H}from"./index-o4rKtKfJ.js";import{C as z,b as $,c as D,a as F}from"./card-6Ae5ROGi.js";import{B as y}from"./badge-CDGsL4jH.js";import{a as K}from"./alert-BV-5lkdi.js";import{a as Q}from"./ai-BITs9FMs.js";import{S}from"./sparkles-B5z94t3h.js";import{T as P}from"./trending-up-BBigl0ol.js";import{F as X}from"./file-text-KcpAjpkr.js";import{P as _}from"./play-BOUTOTLk.js";import{C as q}from"./copy-NHEH4ztb.js";import{C as W}from"./circle-x-DCq7zPbk.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash
# CPU 高负载诊断脚本 - ${t}
echo "===== CPU TOP 10 进程 ====="
ps aux --sort=-%cpu | head -11
@@ -1,57 +0,0 @@
import{j as s,a5 as b,aG as f,L as v,a6 as w,P as g,E as C,B as A,r as l,D as O,a as U,b as B,c as E,d as J,K as L,T as R,S as G,C as K}from"./index-CwVkcMR-.js";import{C as z,b as $,c as D,a as F}from"./card-C5qBu7CR.js";import{B as y}from"./badge-DgJ0w7jf.js";import{a as H}from"./monitor-UHR7OKRa.js";import{a as X}from"./ai-ClyhMOu4.js";import{S}from"./sparkles-BA2sXk5-.js";import{T as P}from"./trending-up-CIEQtqqc.js";import{F as q}from"./file-text-DGoBtmAr.js";import{P as _}from"./play-_cqG4jyc.js";import{C as Q}from"./copy-CKzeWvtb.js";import{C as W}from"./circle-x-DBoylLde.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
echo ""
echo "===== 系统负载 ====="
uptime
echo ""
echo "===== 高 CPU 进程详情 ====="
PID=$(ps aux --sort=-%cpu | sed -n '2p' | awk '{print $2}')
if [ -n "$PID" ]; then
echo "最高 CPU 进程: PID=$PID"
cat /proc/$PID/cmdline | tr '\\0' ' '
echo ""
fi
`,similarCases:0,confidence:0}:c.includes("mem")||c.includes("ram")?{rootCause:`检测到 ${t} 内存使用率达到 ${e.currentValue},接近或超过阈值 ${e.threshold}。常见原因:1) 应用内存泄漏,对象未被正确释放;2) 缓存配置过大;3) 数据库连接池未及时释放。`,impact:a?"内存即将耗尽可能触发 OOM Killer,导致关键进程被强制终止,服务中断风险极高。":"内存持续增长,长期可能导致 OOM,建议尽快排查内存使用情况。",recommendations:[`检查 ${t} 上的内存占用最高的进程`,"如果是 Java 应用,检查 JVM 堆内存配置和 GC 日志","排查是否存在内存泄漏,必要时生成堆转储分析","调整缓存大小限制或增加交换分区"],similarCases:0,confidence:0}:c.includes("disk")||c.includes("space")?{rootCause:`检测到 ${t} 磁盘使用率达到 ${e.currentValue},超过阈值 ${e.threshold}。最常见原因:1) 日志文件未配置轮转/清理;2) 临时文件堆积;3) 数据库数据文件膨胀。`,impact:a?"磁盘空间不足可能导致服务无法写入数据/日志,数据库可能崩溃,文件系统变只读,影响范围极大。":"磁盘空间告警,如不及时清理可能导致服务异常。",recommendations:[`清理 ${t} 上 30 天前的日志文件`,"检查并清理临时目录 /tmp、/var/tmp","配置 logrotate 日志轮转策略","考虑扩容磁盘或将数据迁移到对象存储"],autoFixScript:`#!/bin/bash
# 磁盘清理脚本 - ${t}
echo "===== 清理前磁盘使用 ====="
df -h /
echo ""
echo "===== 清理 30 天前日志 ====="
find /var/log -name "*.log" -mtime +30 -delete 2>/dev/null
find /var/log -name "*.gz" -mtime +30 -delete 2>/dev/null
echo ""
echo "===== 清理系统缓存 ====="
journalctl --vacuum-time=7d 2>/dev/null
echo ""
echo "===== 清理后磁盘使用 ====="
df -h /
`,similarCases:0,confidence:0}:c.includes("net")||c.includes("latency")||c.includes("bandwidth")?{rootCause:`检测到 ${t} 网络指标异常(当前值 ${e.currentValue}),可能原因:1) 上游依赖服务响应变慢;2) 网络带宽打满;3) DNS 解析延迟;4) 连接数达到上限。`,impact:a?"网络异常将导致所有经过该节点的请求超时,影响所有上游业务的可用性。":"网络延迟偏高,可能影响用户体验,建议排查网络链路。",recommendations:[`检查 ${t} 的网络连接和带宽使用情况`,"排查上游依赖服务的健康状态和响应时间","检查防火墙规则是否有限速或异常丢弃","考虑启用熔断/降级机制保障核心链路"],similarCases:0,confidence:0}:c.includes("service")||c.includes("up")||c.includes("avail")?{rootCause:`检测到 ${t} 服务不可用(指标 ${e.metric} = ${e.currentValue})。可能原因:1) 进程崩溃或被 OOM Killer 终止;2) 端口被占用或监听异常;3) 健康检查端点返回错误;4) 配置文件错误导致启动失败。`,impact:a?"服务完全不可用,所有依赖该服务的业务功能将中断,需要立即处理。":"服务可用性下降,部分功能可能受影响。",recommendations:[`立即检查 ${t} 的服务状态: systemctl status <service>`,"查看服务日志排查崩溃原因","检查端口占用和监听状态: ss -tlnp","必要时重启服务并监控恢复情况"],autoFixScript:`#!/bin/bash
# 服务恢复脚本 - ${t}
echo "===== 检查服务状态 ====="
systemctl list-units --state=failed
echo ""
echo "===== 检查端口监听 ====="
ss -tlnp | grep -E ':(80|443|8080|3306|6379|9090)'
echo ""
echo "===== 重启失败服务 ====="
systemctl reset-failed
`,similarCases:0,confidence:0}:{rootCause:`检测到 ${t} 触发告警「${e.name}」,当前指标值 ${e.currentValue} 超过阈值 ${e.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,impact:a?"该告警级别为严重,可能影响业务正常运行,建议优先处理。":"该告警需要关注,持续恶化可能影响系统稳定性。",recommendations:[`查看 ${t} 的监控仪表盘,确认指标趋势`,"检查对应时间段的系统日志和应用日志","关联同时间段的其他告警,排查是否有连锁反应","若确认误报,调整告警规则阈值或持续时间"],similarCases:0,confidence:0}}function Z(e){const c=e.rule?.expression||"",t=c.match(/([\w_]+)\s*[><=!]+\s*([\d.]+)/),a=t?t[1]:c||"unknown",n=t?t[2]+"%":"-",r=e.value??0,d=a.includes("usage")||a.includes("cpu")||a.includes("disk")||a.includes("mem")?r.toFixed(1)+"%":r.toFixed(2),x=e.resolved_at?new Date(e.resolved_at):new Date,i=new Date(e.started_at),p=Math.max(1,Math.round((x.getTime()-i.getTime())/6e4)),h=p>=60?`${Math.floor(p/60)}小时${p%60}分钟`:`${p}分钟`,u=i.toLocaleString("zh-CN",{hour12:!1});return{id:String(e.id),name:e.rule_name||e.rule?.name||"未知告警",severity:e.severity==="critical"?"critical":e.severity==="warning"?"warning":"info",status:e.status==="firing"?"active":"resolved",source:e.target||"未知目标",metric:a,threshold:n,currentValue:d,duration:h,startedAt:u,description:e.message&&e.message!==`告警事件 ${e.id}`?e.message:e.rule?.description||`${e.rule_name||"告警"}: ${e.target} 当前值 ${d}`}}function ss(e){switch(e){case"critical":return"bg-red-500/10 text-red-400 border-red-500/30";case"warning":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-blue-500/10 text-blue-400 border-blue-500/30"}}function es({selectedAlert:e,isAnalyzing:c,analysis:t,onAutoFix:a}){return s.jsxs(z,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:18:5",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:19:7",className:"border-b border-slate-700 pb-3",children:s.jsxs(D,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:20:9",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:21:11",className:"h-5 w-5 text-purple-400"}),"AI 分析结果"]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:25:7",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:26:9",className:"p-4",children:e?c?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:33:13",className:"flex flex-col items-center justify-center h-64",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:34:15",className:"h-8 w-8 animate-spin text-purple-400 mb-4"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:35:15",className:"text-slate-400",children:"AI正在分析告警根因..."}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:36:15",className:"text-xs text-slate-500 mt-2",children:"正在关联日志、指标和历史案例"})]}):t?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:39:13",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:41:15",className:"flex items-center justify-between p-3 bg-purple-500/10 rounded-lg border border-purple-500/30",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:42:17",className:"flex items-center gap-2",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:43:19",className:"h-5 w-5 text-purple-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:44:19",className:"text-slate-300",children:"分析置信度"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:46:17",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:47:19",className:"w-32 h-2 bg-slate-700 rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:48:21",className:"h-full bg-gradient-to-r from-purple-500 to-pink-500",style:{width:`${t.confidence}%`}})}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:53:19",className:"text-purple-400 font-bold",children:[t.confidence,"%"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:58:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:59:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(w,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:60:19",className:"h-4 w-4 text-red-400"}),"根因分析"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:63:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",childre Line truncated
告警名称:${o.name}
严重程度:${o.severity}
目标:${o.source}
指标:${o.metric} = ${o.currentValue}(阈值 ${o.threshold})
持续:${o.duration}
描述:${o.description}
返回 JSON 格式(字段名用 snake_case):
{
"root_cause": "根因分析(2-3句)",
"impact": "影响评估(1-2句)",
"recommendations": ["建议1", "建议2", "建议3"],
"auto_fix_script": "#!/bin/bash\\n...\\n(可选的自动修复脚本,无则 null)",
"similar_cases": 数字(类似案例数预估),
"confidence": 数字(0-100 置信度)
}`,N=await X.chat([{role:"user",content:M}]),I=N?.content||N?.message?.content||"";i(I?as(I,m):m)}catch{i(m)}finally{d(!1)}},k=()=>{h(!0)},V=o=>{switch(o){case"critical":return s.jsx(W,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:127:16",className:"h-4 w-4 text-red-400"});case"warning":return s.jsx(w,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:129:16",className:"h-4 w-4 text-amber-400"});default:return s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:131:16",className:"h-4 w-4 text-blue-400"})}};return s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:136:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:138:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:139:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:140:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center",children:s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:141:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:143:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:144:13",className:"text-2xl font-bold text-slate-100",children:"AI 告警智能分析"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:145:13",className:"text-sm text-slate-500",children:"基于大模型的告警根因分析和自动修复建议"})]})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:148:9",className:"flex items-center gap-2",children:s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:149:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:150:13",className:"h-3 w-3 mr-1"}),"AI 引擎运行中"]})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:156:7",className:"grid grid-cols-2 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs(z,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:158:9",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:159:11",className:"border-b border-slate-700 pb-3",children:s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:160:13",className:"flex items-center justify-between",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:161:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:162:17",className:"h-5 w-5 text-amber-400"}),"活跃告警"]}),s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:165:15",className:"bg-red-500/10 text-red-400 border-red-500/30",children:[e.filter(o=>o.status==="active").length," 个活跃"]})]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:170:11",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:171:13",className:"p-4 space-y-3",children:t?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:173:17",className:"flex flex-col items-center justify-center h-32",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:174:19",className:"h-6 w-6 animate-spin text-slate-500 mb-2"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:175:19",className:"text-sm text-slate-500",children:"加载告警数据..."})]}):e.length===0?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:178:17",className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:179:19",className:"h-8 w-8 mb-2 opacity-50"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:180:19",className:"text-sm",children:"暂无告警事件"})]}):e.map(o=>s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:184:17",className:`p-4 rounded-lg border cursor-pointer transition-all ${n?.id===o.id?"border-purple-500 bg-purple-500/10":"border-slate-700 bg-slate-800/50 hover:border-slate-600"}`,onClick:()=>T(o),children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:193:19",className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:194:21",className:"flex items-center gap-2",children:[V(o.severity),s.jsx("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:196:23",className:"font-medium text-slate-100",children:o.name})]}),s.jsx(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:198:21",variant:"outline",className:ss(o.severity),children:o.severity==="critical"?"严重":o.severity==="warning"?"警告":"提示"})]}),s.jsx("div",{"code-path":"src Line truncated
@@ -1,57 +0,0 @@
import{j as s,a5 as b,aI as f,L as v,a6 as w,P as g,E as C,B as A,r as l,D as O,a as U,b as B,c as E,d as J,K as L,T as R,S as G,C as K}from"./index-Dmami9WE.js";import{C as z,b as $,c as D,a as F}from"./card-CIfC-8Rh.js";import{B as y}from"./badge-3UzCvU7L.js";import{a as H}from"./monitor-CicbJUrQ.js";import{a as X}from"./ai-2t1T1OeI.js";import{S}from"./sparkles-rPZivnlW.js";import{T as P}from"./trending-up-d1DKmRom.js";import{F as q}from"./file-text-CebshSV-.js";import{P as _}from"./play-0EwQQJX_.js";import{C as Q}from"./copy-CE_T92Lk.js";import{C as W}from"./circle-x-BBQeW1R3.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
echo ""
echo "===== 系统负载 ====="
uptime
echo ""
echo "===== 高 CPU 进程详情 ====="
PID=$(ps aux --sort=-%cpu | sed -n '2p' | awk '{print $2}')
if [ -n "$PID" ]; then
echo "最高 CPU 进程: PID=$PID"
cat /proc/$PID/cmdline | tr '\\0' ' '
echo ""
fi
`,similarCases:0,confidence:0}:c.includes("mem")||c.includes("ram")?{rootCause:`检测到 ${t} 内存使用率达到 ${e.currentValue},接近或超过阈值 ${e.threshold}。常见原因:1) 应用内存泄漏,对象未被正确释放;2) 缓存配置过大;3) 数据库连接池未及时释放。`,impact:a?"内存即将耗尽可能触发 OOM Killer,导致关键进程被强制终止,服务中断风险极高。":"内存持续增长,长期可能导致 OOM,建议尽快排查内存使用情况。",recommendations:[`检查 ${t} 上的内存占用最高的进程`,"如果是 Java 应用,检查 JVM 堆内存配置和 GC 日志","排查是否存在内存泄漏,必要时生成堆转储分析","调整缓存大小限制或增加交换分区"],similarCases:0,confidence:0}:c.includes("disk")||c.includes("space")?{rootCause:`检测到 ${t} 磁盘使用率达到 ${e.currentValue},超过阈值 ${e.threshold}。最常见原因:1) 日志文件未配置轮转/清理;2) 临时文件堆积;3) 数据库数据文件膨胀。`,impact:a?"磁盘空间不足可能导致服务无法写入数据/日志,数据库可能崩溃,文件系统变只读,影响范围极大。":"磁盘空间告警,如不及时清理可能导致服务异常。",recommendations:[`清理 ${t} 上 30 天前的日志文件`,"检查并清理临时目录 /tmp、/var/tmp","配置 logrotate 日志轮转策略","考虑扩容磁盘或将数据迁移到对象存储"],autoFixScript:`#!/bin/bash
# 磁盘清理脚本 - ${t}
echo "===== 清理前磁盘使用 ====="
df -h /
echo ""
echo "===== 清理 30 天前日志 ====="
find /var/log -name "*.log" -mtime +30 -delete 2>/dev/null
find /var/log -name "*.gz" -mtime +30 -delete 2>/dev/null
echo ""
echo "===== 清理系统缓存 ====="
journalctl --vacuum-time=7d 2>/dev/null
echo ""
echo "===== 清理后磁盘使用 ====="
df -h /
`,similarCases:0,confidence:0}:c.includes("net")||c.includes("latency")||c.includes("bandwidth")?{rootCause:`检测到 ${t} 网络指标异常(当前值 ${e.currentValue}),可能原因:1) 上游依赖服务响应变慢;2) 网络带宽打满;3) DNS 解析延迟;4) 连接数达到上限。`,impact:a?"网络异常将导致所有经过该节点的请求超时,影响所有上游业务的可用性。":"网络延迟偏高,可能影响用户体验,建议排查网络链路。",recommendations:[`检查 ${t} 的网络连接和带宽使用情况`,"排查上游依赖服务的健康状态和响应时间","检查防火墙规则是否有限速或异常丢弃","考虑启用熔断/降级机制保障核心链路"],similarCases:0,confidence:0}:c.includes("service")||c.includes("up")||c.includes("avail")?{rootCause:`检测到 ${t} 服务不可用(指标 ${e.metric} = ${e.currentValue})。可能原因:1) 进程崩溃或被 OOM Killer 终止;2) 端口被占用或监听异常;3) 健康检查端点返回错误;4) 配置文件错误导致启动失败。`,impact:a?"服务完全不可用,所有依赖该服务的业务功能将中断,需要立即处理。":"服务可用性下降,部分功能可能受影响。",recommendations:[`立即检查 ${t} 的服务状态: systemctl status <service>`,"查看服务日志排查崩溃原因","检查端口占用和监听状态: ss -tlnp","必要时重启服务并监控恢复情况"],autoFixScript:`#!/bin/bash
# 服务恢复脚本 - ${t}
echo "===== 检查服务状态 ====="
systemctl list-units --state=failed
echo ""
echo "===== 检查端口监听 ====="
ss -tlnp | grep -E ':(80|443|8080|3306|6379|9090)'
echo ""
echo "===== 重启失败服务 ====="
systemctl reset-failed
`,similarCases:0,confidence:0}:{rootCause:`检测到 ${t} 触发告警「${e.name}」,当前指标值 ${e.currentValue} 超过阈值 ${e.threshold}。建议进一步排查具体指标数据和相关日志以确定根因。`,impact:a?"该告警级别为严重,可能影响业务正常运行,建议优先处理。":"该告警需要关注,持续恶化可能影响系统稳定性。",recommendations:[`查看 ${t} 的监控仪表盘,确认指标趋势`,"检查对应时间段的系统日志和应用日志","关联同时间段的其他告警,排查是否有连锁反应","若确认误报,调整告警规则阈值或持续时间"],similarCases:0,confidence:0}}function Z(e){const c=e.rule?.expression||"",t=c.match(/([\w_]+)\s*[><=!]+\s*([\d.]+)/),a=t?t[1]:c||"unknown",n=t?t[2]+"%":"-",r=e.value??0,d=a.includes("usage")||a.includes("cpu")||a.includes("disk")||a.includes("mem")?r.toFixed(1)+"%":r.toFixed(2),x=e.resolved_at?new Date(e.resolved_at):new Date,i=new Date(e.started_at),p=Math.max(1,Math.round((x.getTime()-i.getTime())/6e4)),h=p>=60?`${Math.floor(p/60)}小时${p%60}分钟`:`${p}分钟`,u=i.toLocaleString("zh-CN",{hour12:!1});return{id:String(e.id),name:e.rule_name||e.rule?.name||"未知告警",severity:e.severity==="critical"?"critical":e.severity==="warning"?"warning":"info",status:e.status==="firing"?"active":"resolved",source:e.target||"未知目标",metric:a,threshold:n,currentValue:d,duration:h,startedAt:u,description:e.message&&e.message!==`告警事件 ${e.id}`?e.message:e.rule?.description||`${e.rule_name||"告警"}: ${e.target} 当前值 ${d}`}}function ss(e){switch(e){case"critical":return"bg-red-500/10 text-red-400 border-red-500/30";case"warning":return"bg-amber-500/10 text-amber-400 border-amber-500/30";default:return"bg-blue-500/10 text-blue-400 border-blue-500/30"}}function es({selectedAlert:e,isAnalyzing:c,analysis:t,onAutoFix:a}){return s.jsxs(z,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:18:5",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:19:7",className:"border-b border-slate-700 pb-3",children:s.jsxs(D,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:20:9",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:21:11",className:"h-5 w-5 text-purple-400"}),"AI 分析结果"]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:25:7",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:26:9",className:"p-4",children:e?c?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:33:13",className:"flex flex-col items-center justify-center h-64",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:34:15",className:"h-8 w-8 animate-spin text-purple-400 mb-4"}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:35:15",className:"text-slate-400",children:"AI正在分析告警根因..."}),s.jsx("p",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:36:15",className:"text-xs text-slate-500 mt-2",children:"正在关联日志、指标和历史案例"})]}):t?s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:39:13",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:41:15",className:"flex items-center justify-between p-3 bg-purple-500/10 rounded-lg border border-purple-500/30",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:42:17",className:"flex items-center gap-2",children:[s.jsx(f,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:43:19",className:"h-5 w-5 text-purple-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:44:19",className:"text-slate-300",children:"分析置信度"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:46:17",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:47:19",className:"w-32 h-2 bg-slate-700 rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:48:21",className:"h-full bg-gradient-to-r from-purple-500 to-pink-500",style:{width:`${t.confidence}%`}})}),s.jsxs("span",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:53:19",className:"text-purple-400 font-bold",children:[t.confidence,"%"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:58:15",className:"space-y-2",children:[s.jsxs("h4",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:59:17",className:"text-sm font-medium text-slate-300 flex items-center gap-2",children:[s.jsx(w,{"code-path":"src/components/aiops/AIAnalysisResult.tsx:60:19",className:"h-4 w-4 text-red-400"}),"根因分析"]}),s.jsx("div",{"code-path":"src/components/aiops/AIAnalysisResult.tsx:63:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",childre Line truncated
告警名称:${o.name}
严重程度:${o.severity}
目标:${o.source}
指标:${o.metric} = ${o.currentValue}(阈值 ${o.threshold})
持续:${o.duration}
描述:${o.description}
返回 JSON 格式(字段名用 snake_case):
{
"root_cause": "根因分析(2-3句)",
"impact": "影响评估(1-2句)",
"recommendations": ["建议1", "建议2", "建议3"],
"auto_fix_script": "#!/bin/bash\\n...\\n(可选的自动修复脚本,无则 null)",
"similar_cases": 数字(类似案例数预估),
"confidence": 数字(0-100 置信度)
}`,N=await X.chat([{role:"user",content:M}]),I=N?.content||N?.message?.content||"";i(I?as(I,m):m)}catch{i(m)}finally{d(!1)}},k=()=>{h(!0)},V=o=>{switch(o){case"critical":return s.jsx(W,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:127:16",className:"h-4 w-4 text-red-400"});case"warning":return s.jsx(w,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:129:16",className:"h-4 w-4 text-amber-400"});default:return s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:131:16",className:"h-4 w-4 text-blue-400"})}};return s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:136:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:138:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:139:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:140:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-amber-500 to-orange-500 flex items-center justify-center",children:s.jsx(f,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:141:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:143:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:144:13",className:"text-2xl font-bold text-slate-100",children:"AI 告警智能分析"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:145:13",className:"text-sm text-slate-500",children:"基于大模型的告警根因分析和自动修复建议"})]})]}),s.jsx("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:148:9",className:"flex items-center gap-2",children:s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:149:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(S,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:150:13",className:"h-3 w-3 mr-1"}),"AI 引擎运行中"]})})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:156:7",className:"grid grid-cols-2 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs(z,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:158:9",className:"bg-slate-800 border-slate-700 flex flex-col",children:[s.jsx($,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:159:11",className:"border-b border-slate-700 pb-3",children:s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:160:13",className:"flex items-center justify-between",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:161:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(R,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:162:17",className:"h-5 w-5 text-amber-400"}),"活跃告警"]}),s.jsxs(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:165:15",className:"bg-red-500/10 text-red-400 border-red-500/30",children:[e.filter(o=>o.status==="active").length," 个活跃"]})]})}),s.jsx(b,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:170:11",className:"flex-1",children:s.jsx(F,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:171:13",className:"p-4 space-y-3",children:t?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:173:17",className:"flex flex-col items-center justify-center h-32",children:[s.jsx(v,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:174:19",className:"h-6 w-6 animate-spin text-slate-500 mb-2"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:175:19",className:"text-sm text-slate-500",children:"加载告警数据..."})]}):e.length===0?s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:178:17",className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[s.jsx(g,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:179:19",className:"h-8 w-8 mb-2 opacity-50"}),s.jsx("p",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:180:19",className:"text-sm",children:"暂无告警事件"})]}):e.map(o=>s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:184:17",className:`p-4 rounded-lg border cursor-pointer transition-all ${n?.id===o.id?"border-purple-500 bg-purple-500/10":"border-slate-700 bg-slate-800/50 hover:border-slate-600"}`,onClick:()=>T(o),children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:193:19",className:"flex items-start justify-between mb-2",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:194:21",className:"flex items-center gap-2",children:[V(o.severity),s.jsx("span",{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:196:23",className:"font-medium text-slate-100",children:o.name})]}),s.jsx(y,{"code-path":"src/components/aiops/AIAlertAnalyzer.tsx:198:21",variant:"outline",className:ss(o.severity),children:o.severity==="critical"?"严重":o.severity==="warning"?"警告":"提示"})]}),s.jsx("div",{"code-path":"src Line truncated
@@ -1,19 +0,0 @@
import{i as _s,r as x,j as s,aF as ks,aR as Es,aw as Ls,as as H,a0 as ds,aI as Rs,B as N,y as Z,T as ms,A as xs,L as k,E as Ms,aS as ss,a5 as Ps,U as Ds,D as Ts,a as qs,b as Us,c as Bs,d as Fs,e as zs}from"./index-Dmami9WE.js";import{C as D,b as T,c as ts,a as q}from"./card-CIfC-8Rh.js";import{I as w}from"./input-NsU9nXZF.js";import{B as E}from"./badge-3UzCvU7L.js";import{L as y}from"./label-Ap_-SPYI.js";import{S as es,a as as,b as ns,c as os,d as cs}from"./select-DUbxjT0z.js";import{S as Hs}from"./switch-TqjD2x0W.js";import{t as C}from"./index-BuEnLCjT.js";import{d as U}from"./dashboard-BHNKEvkq.js";import{a as Vs}from"./monitor-CicbJUrQ.js";import{a as Ks}from"./agent-B3ElXCx8.js";import{a as $}from"./ai-2t1T1OeI.js";import{C as Gs}from"./circle-check-CVbTTFQ0.js";import{F as hs}from"./file-text-CebshSV-.js";import{T as Ws}from"./trending-up-d1DKmRom.js";import{R as Qs}from"./rotate-cw-CKCO6IKE.js";import{M as Js}from"./message-square-BNbub2_o.js";import{S as Xs}from"./square-NjJOra_E.js";import{W as Ys}from"./wifi-CtC3YBV7.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Zs=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],st=_s("send",Zs);function tt(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 v(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,v]}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,et(o,...n)]}function et(...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 at=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=at.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 nt(){if(rs)return F;rs=1;var e=Es();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 v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,F}var is;function ot(){return is||(is=1,B.exports=nt()),B.exports}var ct=ot();function rt(){return ct.useSyncExternalStore(it,()=>!0,()=>!1)}function it(){return()=>{}}var K="Avatar",[pt]=tt(K),[lt,us]=pt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(lt,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",dt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=mt(r,a),l=Ls(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});dt.displayName=fs;var gs="AvatarFallback",Is=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});Is.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 mt(e,{referrerPolicy:n,crossOrigin:i}){const r=rt(),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"),v=l("error");return a.addEventListener("load",g),a.addEventListener("error",v),n&&(a.referrerPolicy=n),Line truncated
${i.join(`
`)}`}async function ls(){const e=await Ks.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} 台主机实时指标:
${i.join(`
`)}${o}`}async function It(){const[e,n,i]=await Promise.all([U.getStats().catch(()=>null),U.getAlerts(10).catch(()=>null),U.getReleases(10).catch(()=>null)]),r=e||{},o=r.server_stats||{},a=r.kubernetes_stats||{},d=r.alert_stats||{},m=r.pipeline_stats||{},l=r.cost_stats||{},g=`服务器:${o.total??0}(运行${o.running??0}) | Kubernetes集群:${a.total??0} 节点:${a.total_nodes??0} Pod:${a.total_pods??0} | 告警:${d.total??0}(firing ${d.firing??0}) | 流水线:${m.total??0}(成功率${m.success_rate??0}%) | 本月成本:¥${l.month_cost??0}`,v=Array.isArray(n)?n:n?.list||[],h=Array.isArray(i)?i:i?.list||[],u=v.slice(0,10).map((p,A)=>`${A+1}.[${p.severity||"?"}|${p.status||"?"}] ${p.rule_name||"-"} → ${p.target||"-"}`),c=h.slice(0,10).map((p,A)=>`${A+1}.${p.app_name||"-"} ${p.version||""} [${p.environment||"-"}/${p.status||"-"}] by ${p.author||"-"}`);return`平台概览:${g}
最近告警:
${u.join(`
`)||"(无)"}
最近发布:
${c.join(`
`)||"(无)"}`}const vt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:gt},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:It},{id:"optimize",name:"资源优化建议",icon:Ws,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function jt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function zt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,v]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ft),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const I=Math.random()*16|0;return(t==="x"?I:I&3|8).toString(16)})},[Q,vs]=x.useState(()=>W()),J=x.useRef(null),js=()=>J.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const I=(await $.getHistory(Q))?.list||[];n(I.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const I=z.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:I?.defaultEndpoint||f.endpoint,model:I?.models[0]||f.model}))},Ss=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){C.error("请填写 API Key");return}v(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),C.success("配置已保存"),l(!1)}catch(t){C.error(t instanceof Error?t.message:"保存失败")}finally{v(!1)}},ys=async()=>{u(!0);try{await $.testConnection(),C.success("LLM 服务连接成功")}catch(t){C.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},X=async t=>{const I={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,I,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const M=new AbortController;d.current=M;let P=!1;try{const _=[...e,I].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(S=>S.map(b=>b.id===f?{...b,content:b.content+O}:b))},M.signal,Q)}catch(_){if(M.signal.aborted)n(O=>O.map(S=>S.id===f?{...S,content:S.content||"(已停止生成)",isStopped:!0}:S));else{const O=_ instanceof Error?_.message:"对话失败";n(S=>S.map(b=>b.id===f?{...b,content:P?b.content+`
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},Y=async()=>{const t=i.trim();!t||o||(r(""),await X(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let I="";try{I=await t.contextLoader()}catch{I="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
【平台实时数据】
${I}`;await X(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();vs(t),n([]),r(""),C.success("已开始新对话")},R=z.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(Rs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Gs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:vt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx(" Line truncated
@@ -1,19 +0,0 @@
import{i as _s,r as x,j as s,aF as ks,aT as Es,aw as Ls,as as H,$ as ds,aG as Rs,B as N,y as Z,T as ms,A as xs,L as k,E as Ms,aU as ss,a5 as Ps,U as Ds,D as Ts,a as Us,b as qs,c as Bs,d as Fs,e as zs}from"./index-CwVkcMR-.js";import{C as D,b as T,c as ts,a as U}from"./card-C5qBu7CR.js";import{I as w}from"./input-B5ad6Rfz.js";import{B as E}from"./badge-DgJ0w7jf.js";import{L as S}from"./label-mg-tHjNc.js";import{S as es,a as as,b as ns,c as os,d as cs}from"./select-CGtvCG8I.js";import{S as Hs}from"./switch-DYr_nGop.js";import{t as C}from"./index-Dxvx0mlR.js";import{d as q}from"./dashboard-bavYfUo7.js";import{a as Vs}from"./monitor-UHR7OKRa.js";import{a as Ks}from"./agent-CJbfK8cW.js";import{a as $}from"./ai-ClyhMOu4.js";import{C as Gs}from"./circle-check-DTBW_8Wd.js";import{F as hs}from"./file-text-DGoBtmAr.js";import{T as Ws}from"./trending-up-CIEQtqqc.js";import{R as Qs}from"./rotate-cw-BWMnGC9F.js";import{M as Js}from"./message-square-DZm6jFHB.js";import{S as Xs}from"./square-mxcxvBKV.js";import{W as Ys}from"./wifi-CVkack1B.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const Zs=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],st=_s("send",Zs);function tt(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 v(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,v]}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,et(o,...n)]}function et(...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 at=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=at.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 nt(){if(rs)return F;rs=1;var e=Es();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 v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,F}var is;function ot(){return is||(is=1,B.exports=nt()),B.exports}var ct=ot();function rt(){return ct.useSyncExternalStore(it,()=>!0,()=>!1)}function it(){return()=>{}}var K="Avatar",[pt]=tt(K),[lt,us]=pt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(lt,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",dt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=mt(r,a),l=Ls(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});dt.displayName=fs;var gs="AvatarFallback",Is=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});Is.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 mt(e,{referrerPolicy:n,crossOrigin:i}){const r=rt(),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"),v=l("error");return a.addEventListener("load",g),a.addEventListener("error",v),n&&(a.referrerPolicy=n),tLine truncated
${i.join(`
`)}`}async function ls(){const e=await Ks.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} 台主机实时指标:
${i.join(`
`)}${o}`}async function It(){const[e,n,i]=await Promise.all([q.getStats().catch(()=>null),q.getAlerts(10).catch(()=>null),q.getReleases(10).catch(()=>null)]),r=e||{},o=r.server_stats||{},a=r.kubernetes_stats||{},d=r.alert_stats||{},m=r.pipeline_stats||{},l=r.cost_stats||{},g=`服务器:${o.total??0}(运行${o.running??0}) | Kubernetes集群:${a.total??0} 节点:${a.total_nodes??0} Pod:${a.total_pods??0} | 告警:${d.total??0}(firing ${d.firing??0}) | 流水线:${m.total??0}(成功率${m.success_rate??0}%) | 本月成本:¥${l.month_cost??0}`,v=Array.isArray(n)?n:n?.list||[],h=Array.isArray(i)?i:i?.list||[],u=v.slice(0,10).map((p,A)=>`${A+1}.[${p.severity||"?"}|${p.status||"?"}] ${p.rule_name||"-"} → ${p.target||"-"}`),c=h.slice(0,10).map((p,A)=>`${A+1}.${p.app_name||"-"} ${p.version||""} [${p.environment||"-"}/${p.status||"-"}] by ${p.author||"-"}`);return`平台概览:${g}
最近告警:
${u.join(`
`)||"(无)"}
最近发布:
${c.join(`
`)||"(无)"}`}const vt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:gt},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:It},{id:"optimize",name:"资源优化建议",icon:Ws,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function jt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function zt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,v]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ft),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const I=Math.random()*16|0;return(t==="x"?I:I&3|8).toString(16)})},[Q,vs]=x.useState(()=>W()),J=x.useRef(null),js=()=>J.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const I=(await $.getHistory(Q))?.list||[];n(I.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const I=z.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:I?.defaultEndpoint||f.endpoint,model:I?.models[0]||f.model}))},ys=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){C.error("请填写 API Key");return}v(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),C.success("配置已保存"),l(!1)}catch(t){C.error(t instanceof Error?t.message:"保存失败")}finally{v(!1)}},Ss=async()=>{u(!0);try{await $.testConnection(),C.success("LLM 服务连接成功")}catch(t){C.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},X=async t=>{const I={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,I,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const M=new AbortController;d.current=M;let P=!1;try{const _=[...e,I].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(y=>y.map(b=>b.id===f?{...b,content:b.content+O}:b))},M.signal,Q)}catch(_){if(M.signal.aborted)n(O=>O.map(y=>y.id===f?{...y,content:y.content||"(已停止生成)",isStopped:!0}:y));else{const O=_ instanceof Error?_.message:"对话失败";n(y=>y.map(b=>b.id===f?{...b,content:P?b.content+`
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},Y=async()=>{const t=i.trim();!t||o||(r(""),await X(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let I="";try{I=await t.contextLoader()}catch{I="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
【平台实时数据】
${I}`;await X(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();vs(t),n([]),r(""),C.success("已开始新对话")},R=z.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(Rs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Gs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(U,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:vt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(U,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx(" Line truncated
@@ -1,4 +1,4 @@
import{i as _s,r as x,j as s,aO as ks,b9 as Es,aF as Ls,aB as H,a0 as ds,aP as Rs,B as N,z as Z,T as ms,A as xs,L as k,H as Ms,ba as ss,a5 as Ps,U as Ds,D as Ts,a as qs,b as Us,c as Bs,d as zs,e as Fs,t as w}from"./index-HuRw9UhJ.js";import{C as D,b as T,c as ts,a as q}from"./card-B2Wqa0sK.js";import{I as C}from"./input-C9Xfv8um.js";import{B as E}from"./badge-CeS-g-Od.js";import{L as y}from"./label-DvRDtaMA.js";import{S as es,a as as,b as ns,c as os,d as cs}from"./select-KDzbUQs3.js";import{S as Hs}from"./switch--ZaqVsRJ.js";import{d as U}from"./dashboard-H9WVvG1k.js";import{a as Vs}from"./alert-Bnyn6ibM.js";import{a as Ks}from"./agent-CTqsAA8l.js";import{a as $}from"./ai-CnRvgCA9.js";import{C as Gs}from"./circle-check-C5nUiTvE.js";import{F as hs}from"./file-text-BqORyhNh.js";import{T as Ws}from"./trending-up-C97I6AeO.js";import{R as Qs}from"./rotate-cw-Dt34Qj6N.js";import{M as Js}from"./message-square-D6FQV-gp.js";import{S as Xs}from"./square-DC6JUotK.js";import{W as Ys}from"./wifi-DF9mrE-Q.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const Zs=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],st=_s("send",Zs);function tt(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 v(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,v]}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,et(o,...n)]}function et(...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 at=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=at.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:{}},z={};var rs;function nt(){if(rs)return z;rs=1;var e=Es();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 v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return z.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,z}var is;function ot(){return is||(is=1,B.exports=nt()),B.exports}var ct=ot();function rt(){return ct.useSyncExternalStore(it,()=>!0,()=>!1)}function it(){return()=>{}}var K="Avatar",[pt]=tt(K),[lt,us]=pt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(lt,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",dt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=mt(r,a),l=Ls(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});dt.displayName=fs;var gs="AvatarFallback",Is=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});Is.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 mt(e,{referrerPolicy:n,crossOrigin:i}){const r=rt(),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"),v=l("error");return a.addEventListener("load",g),a.addEventListener("error",v),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=Line truncated
import{i as _s,r as x,j as s,aM as ks,b9 as Es,aD as Ls,az as H,Z as ds,aN as Ms,B as N,z as Y,T as ms,A as xs,L as k,H as Rs,ba as ss,a2 as Ps,U as Ds,D as Ts,a as qs,b as Us,c as zs,d as Bs,e as Fs,t as w}from"./index-o4rKtKfJ.js";import{C as D,b as T,c as ts,a as q}from"./card-6Ae5ROGi.js";import{I as C}from"./input-BfBi0wR2.js";import{B as E}from"./badge-CDGsL4jH.js";import{L as y}from"./label-DrX9VaVC.js";import{S as es,a as as,b as ns,c as os,d as cs}from"./select-DuV0kIrj.js";import{S as Hs}from"./switch-Dqj5wqUV.js";import{d as U}from"./dashboard-Z5J6ei7x.js";import{a as Vs}from"./alert-BV-5lkdi.js";import{a as Ks}from"./agent-BmcTPQds.js";import{a as $}from"./ai-BITs9FMs.js";import{C as Gs}from"./circle-check-Bp6gonk8.js";import{F as hs}from"./file-text-KcpAjpkr.js";import{T as Ws}from"./trending-up-BBigl0ol.js";import{R as Qs}from"./rotate-cw-DBn4I-55.js";import{M as Zs}from"./message-square-CE152duc.js";import{S as Js}from"./square-CsUOcMPf.js";import{W as Xs}from"./wifi-DJeyLXcG.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Ys=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],st=_s("send",Ys);function tt(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 v(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,v]}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,et(o,...n)]}function et(...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 at=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=at.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}},{}),z={exports:{}},B={};var rs;function nt(){if(rs)return B;rs=1;var e=Es();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 v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return B.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,B}var is;function ot(){return is||(is=1,z.exports=nt()),z.exports}var ct=ot();function rt(){return ct.useSyncExternalStore(it,()=>!0,()=>!1)}function it(){return()=>{}}var K="Avatar",[pt]=tt(K),[lt,us]=pt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(lt,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",dt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=mt(r,a),l=Ls(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});dt.displayName=fs;var gs="AvatarFallback",Is=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});Is.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 mt(e,{referrerPolicy:n,crossOrigin:i}){const r=rt(),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"),v=l("error");return a.addEventListener("load",g),a.addEventListener("error",v),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=iLine truncated
${i.join(`
`)}`}async function ls(){const e=await Ks.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} 台主机实时指标:
@@ -11,9 +11,9 @@ ${u.join(`
最近发布:
${c.join(`
`)||"(无)"}`}const vt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:gt},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:It},{id:"optimize",name:"资源优化建议",icon:Ws,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function jt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function zt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,v]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ft),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const I=Math.random()*16|0;return(t==="x"?I:I&3|8).toString(16)})},[Q,vs]=x.useState(()=>W()),J=x.useRef(null),js=()=>J.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const I=(await $.getHistory(Q))?.list||[];n(I.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const I=F.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:I?.defaultEndpoint||f.endpoint,model:I?.models[0]||f.model}))},Ss=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){w.error("请填写 API Key");return}v(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),w.success("配置已保存"),l(!1)}catch(t){w.error(t instanceof Error?t.message:"保存失败")}finally{v(!1)}},ys=async()=>{u(!0);try{await $.testConnection(),w.success("LLM 服务连接成功")}catch(t){w.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},X=async t=>{const I={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,I,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const M=new AbortController;d.current=M;let P=!1;try{const _=[...e,I].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(S=>S.map(b=>b.id===f?{...b,content:b.content+O}:b))},M.signal,Q)}catch(_){if(M.signal.aborted)n(O=>O.map(S=>S.id===f?{...S,content:S.content||"(已停止生成)",isStopped:!0}:S));else{const O=_ instanceof Error?_.message:"对话失败";n(S=>S.map(b=>b.id===f?{...b,content:P?b.content+`
`)||"(无)"}`}const vt=[{id:"alerts",name:"分析今日告警",icon:ms,prompt:"帮我分析以下最近的告警事件,给出根因分析和处置建议(按严重程度排序,给出具体处置步骤)",contextLoader:gt},{id:"performance",name:"性能瓶颈分析",icon:xs,prompt:"分析以下主机实时指标,找出 CPU/内存使用率最高的主机并给出性能优化建议",contextLoader:ls},{id:"report",name:"生成运维报告",icon:hs,prompt:"基于以下平台实时数据,生成一份简洁的今日运维报告,包括资源概览、告警情况和发布状态,用 Markdown 格式输出",contextLoader:It},{id:"optimize",name:"资源优化建议",icon:Ws,prompt:"根据以下主机资源使用数据,提供成本优化和容量规划建议(识别闲置/过载主机,给出缩容/扩容建议)",contextLoader:ls}];function jt(e){return new Date(e).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}function Bt(){const[e,n]=x.useState([]),[i,r]=x.useState(""),[o,a]=x.useState(!1),d=x.useRef(null);x.useEffect(()=>()=>d.current?.abort(),[]);const[m,l]=x.useState(!1),[g,v]=x.useState(!1),[h,u]=x.useState(!1),[c,p]=x.useState(ft),[A,j]=x.useState(!1),[L,G]=x.useState(null),W=()=>{try{return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const I=Math.random()*16|0;return(t==="x"?I:I&3|8).toString(16)})},[Q,vs]=x.useState(()=>W()),Z=x.useRef(null),js=()=>Z.current?.scrollIntoView({behavior:"smooth"});x.useEffect(()=>{js()},[e]);const Os=async()=>{try{const t=await $.getConfig();p(t),j(!!(t.enabled&&t.configured))}catch{j(!1)}},bs=async()=>{try{const I=(await $.getHistory(Q))?.list||[];n(I.map(f=>({id:String(f.id),role:f.role,content:f.content,timestamp:f.created_at})))}catch{}};x.useEffect(()=>{Os(),bs()},[]);const Ns=t=>{const I=F.find(f=>f.id===t);p(f=>({...f,provider:t,endpoint:I?.defaultEndpoint||f.endpoint,model:I?.models[0]||f.model}))},Ss=async()=>{if(c.enabled&&!c.api_key&&c.provider!=="ollama"){w.error("请填写 API Key");return}v(!0);try{const t=await $.saveConfig(c);p(t),j(!!(t.enabled&&t.configured)),w.success("配置已保存"),l(!1)}catch(t){w.error(t instanceof Error?t.message:"保存失败")}finally{v(!1)}},ys=async()=>{u(!0);try{await $.testConnection(),w.success("LLM 服务连接成功")}catch(t){w.error(t instanceof Error?t.message:"连接失败")}finally{u(!1)}},J=async t=>{const I={id:Date.now().toString(),role:"user",content:t,timestamp:new Date().toISOString()},f=(Date.now()+1).toString(),$s=[...e,I,{id:f,role:"assistant",content:"",timestamp:new Date().toISOString()}];n($s),a(!0);const R=new AbortController;d.current=R;let P=!1;try{const _=[...e,I].slice(-10).map(O=>({role:O.role,content:O.content}));await $.chatStream(_,O=>{P=!0,n(S=>S.map(b=>b.id===f?{...b,content:b.content+O}:b))},R.signal,Q)}catch(_){if(R.signal.aborted)n(O=>O.map(S=>S.id===f?{...S,content:S.content||"(已停止生成)",isStopped:!0}:S));else{const O=_ instanceof Error?_.message:"对话失败";n(S=>S.map(b=>b.id===f?{...b,content:P?b.content+`
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},Y=async()=>{const t=i.trim();!t||o||(r(""),await X(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let I="";try{I=await t.contextLoader()}catch{I="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
⚠️ ${O}`:`⚠️ ${O}`,isError:!P}:b))}}finally{a(!1),d.current=null}},X=async()=>{const t=i.trim();!t||o||(r(""),await J(t))},ws=async t=>{if(o||L)return;if(!A||!t.contextLoader){r(t.prompt);return}G(t.id);let I="";try{I=await t.contextLoader()}catch{I="(平台数据加载失败,请稍后重试或检查后端服务)"}finally{G(null)}const f=`${t.prompt}
【平台实时数据】
${I}`;await X(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();vs(t),n([]),r(""),w.success("已开始新对话")},R=F.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(Rs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Gs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(Z,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:vt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx(" Line truncated
${I}`;await J(f)},Cs=async()=>{try{await $.clearHistory()}catch{}const t=W();vs(t),n([]),r(""),w.success("已开始新对话")},M=F.find(t=>t.id===c.provider);return s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:370:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:372:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:373:9",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:374:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center",children:s.jsx(Ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:375:13",className:"h-5 w-5 text-white"})}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:377:11",children:[s.jsx("h1",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:378:13",className:"text-2xl font-bold text-slate-100",children:"AIOps 智能助手"}),s.jsx("p",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:379:13",className:"text-sm text-slate-500",children:"AI 驱动的智能运维助手"})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:382:9",className:"flex items-center gap-3",children:[A?s.jsxs(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:384:13",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Gs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:385:15",className:"h-3 w-3 mr-1"}),c.model]}):s.jsx(E,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:389:13",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"未配置"}),s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:393:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>l(!0),children:[s.jsx(Y,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:394:13",className:"h-4 w-4 mr-2"}),"模型配置"]})]})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:400:7",className:"grid grid-cols-4 gap-6 h-[calc(100vh-200px)]",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:402:9",className:"col-span-1 space-y-4",children:[s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:403:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:404:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:405:15",className:"text-sm text-slate-300",children:"快速操作"})}),s.jsx(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:407:13",className:"space-y-2",children:vt.map(t=>s.jsxs(N,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:409:17",variant:"ghost",className:"w-full justify-start text-slate-300 hover:text-slate-100 hover:bg-slate-700",disabled:o||L!==null,onClick:()=>ws(t),children:[L===t.id?s.jsx(k,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:417:21",className:"h-4 w-4 mr-2 shrink-0 animate-spin"}):s.jsx(t.icon,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:419:21",className:"h-4 w-4 mr-2 shrink-0"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:421:19",className:"text-sm",children:t.name}),A&&t.contextLoader&&s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:423:21",className:"ml-auto text-[10px] text-emerald-400/60 shrink-0",children:"实时"})]},t.id))})]}),s.jsxs(D,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:430:11",className:"bg-slate-800 border-slate-700",children:[s.jsx(T,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:431:13",className:"pb-3",children:s.jsx(ts,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:432:15",className:"text-sm text-slate-300",children:"能力展示"})}),s.jsxs(q,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:434:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:435:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(ms,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:436:17",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:437:17",children:"智能告警分析"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:439:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(xs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:440:17",className:"h-4 w-4 text-blue-400"}),s.jsx("span",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:441:17",children:"性能瓶颈识别"})]}),s.jsxs("div",{"code-path":"src/components/aiops/AIOpsAssistant.tsx:443:15",className:"flex items-center gap-2 text-sm text-slate-400",children:[s.jsx(hs,{"code-path":"src/components/aiops/AIOpsAssistant.tsx:444:17",className:"h-4 w-4 text-emerald-400"}),s.jsx(" Line truncated
@@ -1 +0,0 @@
import{i as V,j as e,L as U,z as Y,r as g,aG as q,B as Q,A as ee,J as se,T as $,p as te,N as ce}from"./index-CwVkcMR-.js";import{C as F,b as B,c as K,a as z}from"./card-C5qBu7CR.js";import{S as ae}from"./stat-strip-CGgDVYxa.js";import{B as Z}from"./badge-DgJ0w7jf.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-Bd_3HnQp.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-CGtvCG8I.js";import{d as pe}from"./dashboard-bavYfUo7.js";import{s as me}from"./server-CfXcTAsg.js";import{a as H}from"./monitor-UHR7OKRa.js";import{H as J}from"./hard-drive-CGq_SnM5.js";import{Z as X}from"./zap-Dr77-_Z_.js";import{C as xe}from"./calendar-DODmhz9p.js";import{T as W}from"./trending-up-CIEQtqqc.js";import{S as he}from"./sparkles-BA2sXk5-.js";import{M as ye}from"./memory-stick-Di60E52x.js";import{M as ve}from"./minus-BWHRIRGV.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=V("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=V("trending-down",be);function Pe({forecasts:a,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(J,{"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(U,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.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:a.map((c,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(Y,{"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:c.resource})]}),e.jsx(Z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.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:c.daysUntilThreshold<=7?"紧急":c.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:c.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:[c.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:`${c.currentUsage}%`}Line truncated
@@ -1 +0,0 @@
import{i as G,j as e,L as U,z as Y,r as g,aI as q,B as Q,A as ee,J as se,T as $,p as te,N as ce}from"./index-Dmami9WE.js";import{C as F,b as B,c as K,a as z}from"./card-CIfC-8Rh.js";import{S as ae}from"./stat-strip-BteRU1Iu.js";import{B as Z}from"./badge-3UzCvU7L.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-lV44z_UR.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-DUbxjT0z.js";import{d as pe}from"./dashboard-BHNKEvkq.js";import{s as me}from"./server-3HmnhxQB.js";import{a as H}from"./monitor-CicbJUrQ.js";import{H as J}from"./hard-drive-DmC04Y5r.js";import{Z as X}from"./zap-CocSkPPl.js";import{C as xe}from"./calendar-CxZxrJ2o.js";import{T as W}from"./trending-up-d1DKmRom.js";import{S as he}from"./sparkles-rPZivnlW.js";import{M as ye}from"./memory-stick-DvAvWvue.js";import{M as ve}from"./minus-DRP_TSA-.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=G("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=G("trending-down",be);function Pe({forecasts:a,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(J,{"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(U,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.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:a.map((c,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(Y,{"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:c.resource})]}),e.jsx(Z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.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:c.daysUntilThreshold<=7?"紧急":c.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:c.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:[c.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:`${c.currentUsage}%`}Line truncated
@@ -1 +1 @@
import{i as G,j as e,L as U,E as q,r as g,aP as J,B as Q,A as ee,K as se,T as $,p as te,N as ce}from"./index-HuRw9UhJ.js";import{C as F,b as K,c as B,a as H}from"./card-B2Wqa0sK.js";import{S as ae}from"./stat-strip-CVviXwc6.js";import{B as Z}from"./badge-CeS-g-Od.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-XYsjnHzX.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-KDzbUQs3.js";import{d as pe}from"./dashboard-H9WVvG1k.js";import{s as me}from"./server-BQNr9a-x.js";import{a as z}from"./alert-Bnyn6ibM.js";import{H as X}from"./hard-drive-laLCm9TI.js";import{Z as Y}from"./zap-CS68N0Jd.js";import{C as xe}from"./calendar-DY9lnH9R.js";import{T as W}from"./trending-up-C97I6AeO.js";import{S as he}from"./sparkles-DEwze8TU.js";import{M as ye}from"./memory-stick-CLkdveMl.js";import{M as ve}from"./minus-BLAorVC4.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=G("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=G("trending-down",be);function Pe({forecasts:a,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(K,{"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(B,{"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(H,{"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(U,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.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:a.map((c,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(q,{"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:c.resource})]}),e.jsx(Z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.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:c.daysUntilThreshold<=7?"紧急":c.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:c.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:[c.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:`${c.currentUsage}%`}})Line truncated
import{i as G,j as e,L as U,E as q,r as g,aN as J,B as Q,A as ee,K as se,T as $,p as te,N as ce}from"./index-o4rKtKfJ.js";import{C as F,b as K,c as B,a as H}from"./card-6Ae5ROGi.js";import{S as ae}from"./stat-strip-DYcHo9Kj.js";import{B as Z}from"./badge-CDGsL4jH.js";import{T as ie,a as ne,b as L,c as D}from"./tabs-CoTqT5ed.js";import{S as re,a as oe,b as le,c as de,d as S}from"./select-DuV0kIrj.js";import{d as pe}from"./dashboard-Z5J6ei7x.js";import{s as me}from"./server-Cnj_Y0tD.js";import{a as z}from"./alert-BV-5lkdi.js";import{H as X}from"./hard-drive-P-ztZBRa.js";import{Z as Y}from"./zap-BPZOchcR.js";import{C as xe}from"./calendar-DgwL_Rib.js";import{T as W}from"./trending-up-BBigl0ol.js";import{S as he}from"./sparkles-B5z94t3h.js";import{M as ye}from"./memory-stick-BZFgFF9q.js";import{M as ve}from"./minus-CqgIaHif.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Ae=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ue=G("chart-line",Ae);const be=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],je=G("trending-down",be);function Pe({forecasts:a,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(K,{"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(B,{"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(H,{"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(U,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):a.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:a.map((c,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(q,{"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:c.resource})]}),e.jsx(Z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:c.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":c.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:c.daysUntilThreshold<=7?"紧急":c.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:c.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:[c.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:`${c.currentUsage}%`}})Line truncated
@@ -1 +0,0 @@
import{i as Oe,j as e,I as st,T as Le,a6 as ot,P as ze,U as ct,D as V,a as H,b as U,c as Q,d as Y,e as ie,B as d,K as Ge,o as at,r as s,f as $e,C as lt,O as it,al as mt}from"./index-CwVkcMR-.js";import{I as E}from"./input-B5ad6Rfz.js";import{B as v}from"./badge-DgJ0w7jf.js";import{C as F,a as J,b as Te,c as _e}from"./card-C5qBu7CR.js";import{S as dt}from"./stat-strip-CGgDVYxa.js";import{S as se,a as oe,b as ce,c as ae,d as _}from"./select-CGtvCG8I.js";import{T as pt,a as xt,b as P,c as W}from"./tabs-Bd_3HnQp.js";import{S as Ie}from"./switch-DYr_nGop.js";import{t as l}from"./index-Dxvx0mlR.js";import{a as O,b as R}from"./monitor-UHR7OKRa.js";import{a as ge}from"./agent-CJbfK8cW.js";import{Z as ht}from"./zap-Dr77-_Z_.js";import{L as j}from"./label-mg-tHjNc.js";import{A as ut}from"./AlertRuleDialog-D5v2nZpn.js";import{T as gt}from"./textarea-BZOXMpxW.js";import{R as re}from"./refresh-cw-DM6JPbZg.js";import{P as ne}from"./plus-CaJ-dB4A.js";import{C as jt}from"./calendar-DODmhz9p.js";import{S as Ct}from"./square-pen-C8Ol72WC.js";import{T as ft}from"./trash-2-BPpnm3Sz.js";import{S as vt}from"./search-1PdnG-g5.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";import"./message-square-DZm6jFHB.js";import"./phone-EXSHn3tX.js";const At=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Nt=Oe("repeat",At);const yt=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],le=Oe("volume-x",yt);function wt(r){return{id:String(r.id),title:r.rule_name||r.title||`告警 #${r.id}`,description:r.message||r.description||"",severity:r.severity||"info",status:r.status||"firing",source:r.target||r.source||"",service:r.service||"",metric:r.metric||"",value:r.value||0,threshold:r.threshold||0,startedAt:r.started_at||r.startedAt||r.created_at||new Date().toISOString(),resolvedAt:r.resolved_at||r.resolvedAt,labels:typeof r.labels=="string"?(()=>{try{return JSON.parse(r.labels||"{}")}catch{return{}}})():r.labels||{},annotations:typeof r.annotations=="string"?(()=>{try{return JSON.parse(r.annotations||"{}")}catch{return{}}})():r.annotations||{}}}function je(r){switch(r){case"critical":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(ot,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(st,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function bt(r){switch(r){case"firing":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(ct,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ze,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function St(r){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信"Line truncated
@@ -1 +1 @@
import{i as Oe,j as e,I as st,T as Le,a6 as ot,Q as ze,U as ct,D as V,a as H,b as U,c as Q,d as Y,e as ie,B as d,O as Ge,o as at,r as s,t as l,f as $e,C as lt,P as it,au as mt}from"./index-HuRw9UhJ.js";import{I as E}from"./input-C9Xfv8um.js";import{B as v}from"./badge-CeS-g-Od.js";import{C as F,a as J,b as Te,c as _e}from"./card-B2Wqa0sK.js";import{S as dt}from"./stat-strip-CVviXwc6.js";import{S as se,a as oe,b as ce,c as ae,d as _}from"./select-KDzbUQs3.js";import{T as pt,a as xt,b as P,c as W}from"./tabs-XYsjnHzX.js";import{S as Ie}from"./switch--ZaqVsRJ.js";import{a as O}from"./alert-Bnyn6ibM.js";import{a as R}from"./alert-center-BbLaFZ2d.js";import{a as ge}from"./agent-CTqsAA8l.js";import{Z as ht}from"./zap-CS68N0Jd.js";import{L as j}from"./label-DvRDtaMA.js";import{A as ut}from"./AlertRuleDialog-prj74zKK.js";import{T as gt}from"./textarea-Bzol9o6k.js";import{R as re}from"./refresh-cw-CSycAyA2.js";import{P as ne}from"./plus-BVwIGPvl.js";import{C as jt}from"./calendar-DY9lnH9R.js";import{S as Ct}from"./square-pen-DoCLytAo.js";import{T as ft}from"./trash-2-Cf9-88KL.js";import{S as vt}from"./search-CcKEpJIn.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";import"./message-square-D6FQV-gp.js";import"./phone-xS_7A3bu.js";const At=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Nt=Oe("repeat",At);const yt=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],le=Oe("volume-x",yt);function wt(r){return{id:String(r.id),title:r.rule_name||r.title||`告警 #${r.id}`,description:r.message||r.description||"",severity:r.severity||"info",status:r.status||"firing",source:r.target||r.source||"",service:r.service||"",metric:r.metric||"",value:r.value||0,threshold:r.threshold||0,startedAt:r.started_at||r.startedAt||r.created_at||new Date().toISOString(),resolvedAt:r.resolved_at||r.resolvedAt,labels:typeof r.labels=="string"?(()=>{try{return JSON.parse(r.labels||"{}")}catch{return{}}})():r.labels||{},annotations:typeof r.annotations=="string"?(()=>{try{return JSON.parse(r.annotations||"{}")}catch{return{}}})():r.annotations||{}}}function je(r){switch(r){case"critical":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(ot,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(st,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function bt(r){switch(r){case"firing":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(ct,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ze,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function St(r){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"Line truncated
import{i as Oe,j as e,I as st,T as Le,a3 as ot,Q as ze,U as ct,D as V,a as H,b as U,c as Q,d as Y,e as ie,B as d,O as Ge,o as at,r as s,t as l,f as $e,C as lt,P as it,as as mt}from"./index-o4rKtKfJ.js";import{I as E}from"./input-BfBi0wR2.js";import{B as v}from"./badge-CDGsL4jH.js";import{C as F,a as J,b as Te,c as _e}from"./card-6Ae5ROGi.js";import{S as dt}from"./stat-strip-DYcHo9Kj.js";import{S as se,a as oe,b as ce,c as ae,d as _}from"./select-DuV0kIrj.js";import{T as pt,a as xt,b as P,c as W}from"./tabs-CoTqT5ed.js";import{S as Ie}from"./switch-Dqj5wqUV.js";import{a as O}from"./alert-BV-5lkdi.js";import{a as R}from"./alert-center-d1Xoi8Bo.js";import{a as ge}from"./agent-BmcTPQds.js";import{Z as ht}from"./zap-BPZOchcR.js";import{L as j}from"./label-DrX9VaVC.js";import{A as ut}from"./AlertRuleDialog-IbIdg7El.js";import{T as gt}from"./textarea-9Podrtqd.js";import{R as re}from"./refresh-cw-eQ6GkWW0.js";import{P as ne}from"./plus-BXcAPnTg.js";import{C as jt}from"./calendar-DgwL_Rib.js";import{S as Ct}from"./square-pen-y4Af_nu2.js";import{T as ft}from"./trash-2-C2Niwqae.js";import{S as vt}from"./search-C_UCkHB_.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";import"./message-square-CE152duc.js";import"./phone-C90KJWhC.js";const At=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Nt=Oe("repeat",At);const yt=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],le=Oe("volume-x",yt);function wt(r){return{id:String(r.id),title:r.rule_name||r.title||`告警 #${r.id}`,description:r.message||r.description||"",severity:r.severity||"info",status:r.status||"firing",source:r.target||r.source||"",service:r.service||"",metric:r.metric||"",value:r.value||0,threshold:r.threshold||0,startedAt:r.started_at||r.startedAt||r.created_at||new Date().toISOString(),resolvedAt:r.resolved_at||r.resolvedAt,labels:typeof r.labels=="string"?(()=>{try{return JSON.parse(r.labels||"{}")}catch{return{}}})():r.labels||{},annotations:typeof r.annotations=="string"?(()=>{try{return JSON.parse(r.annotations||"{}")}catch{return{}}})():r.annotations||{}}}function je(r){switch(r){case"critical":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(ot,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(st,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function bt(r){switch(r){case"firing":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(ct,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ze,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function St(r){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"Line truncated
@@ -1 +0,0 @@
import{i as Oe,j as e,I as st,T as Le,a6 as ot,P as ze,U as ct,D as V,a as H,b as U,c as Q,d as Y,e as ie,B as d,K as Ge,o as at,r as s,f as $e,C as lt,O as it,al as mt}from"./index-Dmami9WE.js";import{I as E}from"./input-NsU9nXZF.js";import{B as v}from"./badge-3UzCvU7L.js";import{C as F,a as J,b as Te,c as _e}from"./card-CIfC-8Rh.js";import{S as dt}from"./stat-strip-BteRU1Iu.js";import{S as se,a as oe,b as ce,c as ae,d as _}from"./select-DUbxjT0z.js";import{T as pt,a as xt,b as P,c as W}from"./tabs-lV44z_UR.js";import{S as Ie}from"./switch-TqjD2x0W.js";import{t as l}from"./index-BuEnLCjT.js";import{a as O,b as R}from"./monitor-CicbJUrQ.js";import{a as ge}from"./agent-B3ElXCx8.js";import{Z as ht}from"./zap-CocSkPPl.js";import{L as j}from"./label-Ap_-SPYI.js";import{A as ut}from"./AlertRuleDialog-CpPLZsky.js";import{T as gt}from"./textarea-DHUZ6N85.js";import{R as re}from"./refresh-cw-CTBERyFc.js";import{P as ne}from"./plus-O65gX7Qz.js";import{C as jt}from"./calendar-CxZxrJ2o.js";import{S as Ct}from"./square-pen-B3dPIBrm.js";import{T as ft}from"./trash-2-DWVnIU6o.js";import{S as vt}from"./search-Dd-PeBfg.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";import"./message-square-BNbub2_o.js";import"./phone-Cn_wSobp.js";const At=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Nt=Oe("repeat",At);const yt=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],le=Oe("volume-x",yt);function wt(r){return{id:String(r.id),title:r.rule_name||r.title||`告警 #${r.id}`,description:r.message||r.description||"",severity:r.severity||"info",status:r.status||"firing",source:r.target||r.source||"",service:r.service||"",metric:r.metric||"",value:r.value||0,threshold:r.threshold||0,startedAt:r.started_at||r.startedAt||r.created_at||new Date().toISOString(),resolvedAt:r.resolved_at||r.resolvedAt,labels:typeof r.labels=="string"?(()=>{try{return JSON.parse(r.labels||"{}")}catch{return{}}})():r.labels||{},annotations:typeof r.annotations=="string"?(()=>{try{return JSON.parse(r.annotations||"{}")}catch{return{}}})():r.annotations||{}}}function je(r){switch(r){case"critical":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(ot,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(st,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function bt(r){switch(r){case"firing":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(ct,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(ze,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(v,{"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(v,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function St(r){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信"Line truncated
@@ -1 +0,0 @@
import{f as H,r as l,j as e,L as O,B as A,P as Y,H as $,T as z,y as Q,D as ee,a as te,b as se,c as oe,d as ae,e as ne,C as re}from"./index-Dmami9WE.js";import{C as w,a as M,b as ce,c as le,d as ie}from"./card-CIfC-8Rh.js";import{T as me,a as de,b as _,c as I}from"./tabs-lV44z_UR.js";import{a as g}from"./monitor-CicbJUrQ.js";import{I as X}from"./input-NsU9nXZF.js";import{B as f}from"./badge-3UzCvU7L.js";import{T as J,a as V,b as R,c as i,d as q,e as c}from"./table-CG4mjNfb.js";import{S as xe}from"./search-Dd-PeBfg.js";import{S as B}from"./switch-TqjD2x0W.js";import{C as G}from"./checkbox-DoAtRzQj.js";import{t as E}from"./index-BuEnLCjT.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-CpPLZsky.js";import{T as P}from"./trash-2-DWVnIU6o.js";import{L as D}from"./label-Ap_-SPYI.js";import{T as be}from"./textarea-DHUZ6N85.js";import{P as U}from"./plus-O65gX7Qz.js";import{R as Ae,C as je,X as ue,Y as Ne,T as ve}from"./generateCategoricalChart-ZqCvxO-S.js";import{A as fe,a as W}from"./AreaChart-CrvX3B0s.js";import"./index-CtCQcvyh.js";import"./message-square-BNbub2_o.js";import"./phone-Cn_wSobp.js";function Te({alerts:m,loading:T,onReload:d}){H();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($,{"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(xe,{"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(X,{"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/componentLine truncated
@@ -1 +0,0 @@
import{f as H,r as l,j as e,L as O,B as A,P as Y,H as $,T as z,y as Q,D as ee,a as te,b as se,c as oe,d as ae,e as ne,C as re}from"./index-CwVkcMR-.js";import{C as w,a as M,b as ce,c as le,d as ie}from"./card-C5qBu7CR.js";import{T as me,a as de,b as _,c as I}from"./tabs-Bd_3HnQp.js";import{a as g}from"./monitor-UHR7OKRa.js";import{I as X}from"./input-B5ad6Rfz.js";import{B as f}from"./badge-DgJ0w7jf.js";import{T as J,a as V,b as R,c as i,d as q,e as c}from"./table-X8m9Cp5H.js";import{S as xe}from"./search-1PdnG-g5.js";import{S as B}from"./switch-DYr_nGop.js";import{C as G}from"./checkbox-CbtT7pld.js";import{t as E}from"./index-Dxvx0mlR.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-D5v2nZpn.js";import{T as P}from"./trash-2-BPpnm3Sz.js";import{L as D}from"./label-mg-tHjNc.js";import{T as be}from"./textarea-BZOXMpxW.js";import{P as U}from"./plus-CaJ-dB4A.js";import{R as Ae,C as je,X as ue,Y as Ne,T as ve}from"./generateCategoricalChart-B9iVh1fX.js";import{A as fe,a as W}from"./AreaChart-ZFR7lw9c.js";import"./index-CBIZnJrN.js";import"./message-square-DZm6jFHB.js";import"./phone-EXSHn3tX.js";function Te({alerts:m,loading:T,onReload:d}){H();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($,{"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(xe,{"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(X,{"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/componentLine truncated
@@ -1 +1 @@
import{f as _,r as l,j as e,L as O,B as A,Q as W,J as Y,T as z,z as $,t as E,D as ee,a as te,b as se,c as oe,d as ae,e as ne,C as re}from"./index-HuRw9UhJ.js";import{C as w,a as M,b as ce,c as le,d as ie}from"./card-B2Wqa0sK.js";import{T as me,a as de,b as H,c as I}from"./tabs-XYsjnHzX.js";import{a as g}from"./alert-Bnyn6ibM.js";import{I as J}from"./input-C9Xfv8um.js";import{B as f}from"./badge-CeS-g-Od.js";import{T as X,a as V,b as R,c as i,d as q,e as c}from"./table-Du1vU-OM.js";import{S as xe}from"./search-CcKEpJIn.js";import{S as B}from"./switch--ZaqVsRJ.js";import{C as G}from"./checkbox-B7nWBaO4.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-prj74zKK.js";import{T as P}from"./trash-2-Cf9-88KL.js";import{L as D}from"./label-DvRDtaMA.js";import{T as be}from"./textarea-Bzol9o6k.js";import{P as U}from"./plus-BVwIGPvl.js";import{R as Ae,C as je,X as ue,Y as Ne,T as ve}from"./generateCategoricalChart-DrSMejeS.js";import{A as fe,a as Q}from"./AreaChart-CTVvt9LZ.js";import"./index-DwvHXNyF.js";import"./message-square-D6FQV-gp.js";import"./phone-xS_7A3bu.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(Y,{"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(xe,{"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(J,{"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"Line truncated
import{f as _,r as l,j as e,L as O,B as A,Q as W,J as Y,T as z,z as $,t as E,D as ee,a as te,b as se,c as oe,d as ae,e as ne,C as re}from"./index-o4rKtKfJ.js";import{C as w,a as M,b as ce,c as le,d as ie}from"./card-6Ae5ROGi.js";import{T as me,a as de,b as H,c as I}from"./tabs-CoTqT5ed.js";import{a as g}from"./alert-BV-5lkdi.js";import{I as J}from"./input-BfBi0wR2.js";import{B as f}from"./badge-CDGsL4jH.js";import{T as X,a as V,b as R,c as i,d as q,e as c}from"./table-FZ6-yFwR.js";import{S as xe}from"./search-C_UCkHB_.js";import{S as B}from"./switch-Dqj5wqUV.js";import{C as G}from"./checkbox-zTZ6SyDQ.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-IbIdg7El.js";import{T as P}from"./trash-2-C2Niwqae.js";import{L as D}from"./label-DrX9VaVC.js";import{T as be}from"./textarea-9Podrtqd.js";import{P as U}from"./plus-BXcAPnTg.js";import{R as Ae,C as je,X as ue,Y as Ne,T as ve}from"./generateCategoricalChart-BeO9rjxr.js";import{A as fe,a as Q}from"./AreaChart-CIzu6WTF.js";import"./index-BeCACrpC.js";import"./message-square-CE152duc.js";import"./phone-C90KJWhC.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(Y,{"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(xe,{"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(J,{"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"Line truncated
@@ -1,14 +0,0 @@
import{j as e,H as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}from"./index-Dmami9WE.js";import{I as x}from"./input-NsU9nXZF.js";import{L as n}from"./label-Ap_-SPYI.js";import{T as E}from"./textarea-DHUZ6N85.js";import{S as P}from"./switch-TqjD2x0W.js";import{a as A}from"./monitor-CicbJUrQ.js";import{M as T}from"./message-square-BNbub2_o.js";import{P as I,M as B}from"./phone-Cn_wSobp.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"],H={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function q(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:H[o]||o,isLegacy:!0}:null}const M=[{key:"dingtalk",label:"钉钉",placeholder:`{
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=***",
"secret": "SECxxx"
}`},{key:"wechat",label:"企业微信",placeholder:`{
"webhook": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=***"
}`},{key:"email",label:"邮件",placeholder:`{
"to": "ops@ezops.io",
"subject": "告警通知"
}`},{key:"sms",label:"短信",placeholder:`{
"phones": "13800138000",
"sign": "AIOps"
}`},{key:"webhook",label:"Webhook",placeholder:`{
"url": "https://example.com/alert"
}`}];function y(o){return M.find(r=>r.key===o)?.label||o}function j(o){switch(o){case"email":return B;case"sms":return I;case"dingtalk":case"wechat":return T;default:return R}}function U(o,r){const a=D(o.notify_channels);return a.length===0?e.jsx("span",{"code-path":"src/components/monitor/alertShared.tsx:76:33",className:"text-xs text-slate-600",children:"--"}):e.jsx("div",{"code-path":"src/components/monitor/alertShared.tsx:78:5",className:"flex flex-wrap gap-1",children:a.map(c=>{const i=q(c,r);if(!i)return null;const t=j(i.type);return e.jsxs("span",{"code-path":"src/components/monitor/alertShared.tsx:84:11",title:`${i.name} (${y(i.type)})`,className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:[e.jsx(t,{"code-path":"src/components/monitor/alertShared.tsx:89:13",className:"h-3 w-3 text-slate-400"}),i.name]},c)})})}const b={name:"",description:"",type:"metric",source:"prometheus",expression:"",severity:"warning",duration:300,notify_channels:[]};function Z({open:o,onOpenChange:r,editingRule:a,notifyChannels:c,onSaved:i}){const[t,l]=d.useState({...b}),[h,u]=d.useState(!1);d.useEffect(()=>{o&&l(a?{name:a.name||"",description:a.description||"",type:a.type||"metric",source:a.source||"prometheus",expression:a.expression||"",severity:a.severity||"warning",duration:a.duration||300,notify_channels:D(a.notify_channels)}:{...b})},[o,a]);const f=s=>{l(m=>({...m,notify_channels:m.notify_channels.includes(s)?m.notify_channels.filter(p=>p!==s):[...m.notify_channels,s]}))},N=async()=>{if(!(!t.name.trim()||!t.expression.trim())){u(!0);try{const s={name:t.name.trim(),description:t.description.trim(),type:t.type,source:t.source,expression:t.expression.trim(),severity:t.severity,duration:Number(t.duration)||0,notify_channels:t.notify_channels};a?await A.updateRule(a.id,s):await A.createRule(s),r(!1),i()}catch(s){console.error("Failed to save rule:",s)}finally{u(!1)}}};return e.jsx(v,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:103:5",open:o,onOpenChange:r,children:e.jsxs(w,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:104:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(k,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:105:9",children:[e.jsx(S,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:106:11",className:"text-slate-100",children:a?"编辑告警规则":"新建告警规则"}),e.jsx(_,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:109:11",className:"text-slate-500",children:a?"修改告警规则的触发条件和通知方式":"配置监控指标的告警触发条件"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:114:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:115:11",className:"space-y-1.5",children:[e.jsxs(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:13",className:"text-slate-300",children:["规则名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:52",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:117:13",value:t.name,onChange:s=>l({...t,name:s.target.value}),placeholder:"如:CPU 使用率告警",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:125:11",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:126:13",className:"text-slate-300",children:"描述"}),e.jsx(E,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:127:13",value:t.description,onChange:s=>l({...t,description:s.target.value}),placeholder:"规则说明",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 resize-none"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:136:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:137:13",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:138:15",className:"text-slate-300",children:"规则类型"}),e.jsxs("select",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:139:15",value:t.type,onChange:s=>l({...t,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:[e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:144:17",value:"metric",children:"指标监控"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:145:17",value:"log",children:"日志告警"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:146:17",value:"event",children:"事件告警"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:149:13",className:"space-y-1.5",chi Line truncated
@@ -1,14 +0,0 @@
import{j as e,H as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}from"./index-CwVkcMR-.js";import{I as x}from"./input-B5ad6Rfz.js";import{L as n}from"./label-mg-tHjNc.js";import{T as E}from"./textarea-BZOXMpxW.js";import{S as P}from"./switch-DYr_nGop.js";import{a as A}from"./monitor-UHR7OKRa.js";import{M as T}from"./message-square-DZm6jFHB.js";import{P as I,M as B}from"./phone-EXSHn3tX.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"],H={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function q(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:H[o]||o,isLegacy:!0}:null}const M=[{key:"dingtalk",label:"钉钉",placeholder:`{
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=***",
"secret": "SECxxx"
}`},{key:"wechat",label:"企业微信",placeholder:`{
"webhook": "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=***"
}`},{key:"email",label:"邮件",placeholder:`{
"to": "ops@ezops.io",
"subject": "告警通知"
}`},{key:"sms",label:"短信",placeholder:`{
"phones": "13800138000",
"sign": "AIOps"
}`},{key:"webhook",label:"Webhook",placeholder:`{
"url": "https://example.com/alert"
}`}];function y(o){return M.find(r=>r.key===o)?.label||o}function j(o){switch(o){case"email":return B;case"sms":return I;case"dingtalk":case"wechat":return T;default:return R}}function U(o,r){const a=D(o.notify_channels);return a.length===0?e.jsx("span",{"code-path":"src/components/monitor/alertShared.tsx:76:33",className:"text-xs text-slate-600",children:"--"}):e.jsx("div",{"code-path":"src/components/monitor/alertShared.tsx:78:5",className:"flex flex-wrap gap-1",children:a.map(c=>{const i=q(c,r);if(!i)return null;const t=j(i.type);return e.jsxs("span",{"code-path":"src/components/monitor/alertShared.tsx:84:11",title:`${i.name} (${y(i.type)})`,className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-slate-800 text-slate-300",children:[e.jsx(t,{"code-path":"src/components/monitor/alertShared.tsx:89:13",className:"h-3 w-3 text-slate-400"}),i.name]},c)})})}const b={name:"",description:"",type:"metric",source:"prometheus",expression:"",severity:"warning",duration:300,notify_channels:[]};function Z({open:o,onOpenChange:r,editingRule:a,notifyChannels:c,onSaved:i}){const[t,l]=d.useState({...b}),[h,u]=d.useState(!1);d.useEffect(()=>{o&&l(a?{name:a.name||"",description:a.description||"",type:a.type||"metric",source:a.source||"prometheus",expression:a.expression||"",severity:a.severity||"warning",duration:a.duration||300,notify_channels:D(a.notify_channels)}:{...b})},[o,a]);const f=s=>{l(m=>({...m,notify_channels:m.notify_channels.includes(s)?m.notify_channels.filter(p=>p!==s):[...m.notify_channels,s]}))},N=async()=>{if(!(!t.name.trim()||!t.expression.trim())){u(!0);try{const s={name:t.name.trim(),description:t.description.trim(),type:t.type,source:t.source,expression:t.expression.trim(),severity:t.severity,duration:Number(t.duration)||0,notify_channels:t.notify_channels};a?await A.updateRule(a.id,s):await A.createRule(s),r(!1),i()}catch(s){console.error("Failed to save rule:",s)}finally{u(!1)}}};return e.jsx(v,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:103:5",open:o,onOpenChange:r,children:e.jsxs(w,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:104:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(k,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:105:9",children:[e.jsx(S,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:106:11",className:"text-slate-100",children:a?"编辑告警规则":"新建告警规则"}),e.jsx(_,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:109:11",className:"text-slate-500",children:a?"修改告警规则的触发条件和通知方式":"配置监控指标的告警触发条件"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:114:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:115:11",className:"space-y-1.5",children:[e.jsxs(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:13",className:"text-slate-300",children:["规则名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:116:52",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:117:13",value:t.name,onChange:s=>l({...t,name:s.target.value}),placeholder:"如:CPU 使用率告警",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:125:11",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:126:13",className:"text-slate-300",children:"描述"}),e.jsx(E,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:127:13",value:t.description,onChange:s=>l({...t,description:s.target.value}),placeholder:"规则说明",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 resize-none"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:136:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:137:13",className:"space-y-1.5",children:[e.jsx(n,{"code-path":"src/components/monitor/AlertRuleDialog.tsx:138:15",className:"text-slate-300",children:"规则类型"}),e.jsxs("select",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:139:15",value:t.type,onChange:s=>l({...t,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:[e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:144:17",value:"metric",children:"指标监控"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:145:17",value:"log",children:"日志告警"}),e.jsx("option",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:146:17",value:"event",children:"事件告警"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertRuleDialog.tsx:149:13",className:"space-y-1.5",chi Line truncated
@@ -1,4 +1,4 @@
import{j as e,J as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}from"./index-HuRw9UhJ.js";import{I as x}from"./input-C9Xfv8um.js";import{L as n}from"./label-DvRDtaMA.js";import{T as E}from"./textarea-Bzol9o6k.js";import{S as P}from"./switch--ZaqVsRJ.js";import{a as A}from"./alert-Bnyn6ibM.js";import{M as T}from"./message-square-D6FQV-gp.js";import{P as I,M as B}from"./phone-xS_7A3bu.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 M=[{key:"dingtalk",label:"钉钉",placeholder:`{
import{j as e,J as R,r as d,D as v,a as w,b as k,c as S,d as _,e as C,B as g,L}from"./index-o4rKtKfJ.js";import{I as x}from"./input-BfBi0wR2.js";import{L as n}from"./label-DrX9VaVC.js";import{T as E}from"./textarea-9Podrtqd.js";import{S as P}from"./switch-Dqj5wqUV.js";import{a as A}from"./alert-BV-5lkdi.js";import{M as T}from"./message-square-CE152duc.js";import{P as I,M as B}from"./phone-C90KJWhC.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 M=[{key:"dingtalk",label:"钉钉",placeholder:`{
"webhook": "https://oapi.dingtalk.com/robot/send?access_token=***",
"secret": "SECxxx"
}`},{key:"wechat",label:"企业微信",placeholder:`{
@@ -1 +0,0 @@
import{j as e}from"./index-CwVkcMR-.js";import{A as t}from"./ApprovalCategoryPage-ffOu-p7w.js";import"./card-C5qBu7CR.js";import"./input-B5ad6Rfz.js";import"./badge-DgJ0w7jf.js";import"./label-mg-tHjNc.js";import"./table-X8m9Cp5H.js";import"./select-CGtvCG8I.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";import"./approval-DOWuQTU9.js";import"./index-Dxvx0mlR.js";import"./plus-CaJ-dB4A.js";import"./search-1PdnG-g5.js";import"./refresh-cw-DM6JPbZg.js";import"./file-text-DGoBtmAr.js";import"./circle-x-DBoylLde.js";import"./play-_cqG4jyc.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 A(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{A as ApprovalAppPage};
@@ -1 +0,0 @@
import{j as e}from"./index-Dmami9WE.js";import{A as t}from"./ApprovalCategoryPage-CIXhWQ3k.js";import"./card-CIfC-8Rh.js";import"./input-NsU9nXZF.js";import"./badge-3UzCvU7L.js";import"./label-Ap_-SPYI.js";import"./table-CG4mjNfb.js";import"./select-DUbxjT0z.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";import"./system-C3cYTuQH.js";import"./index-BuEnLCjT.js";import"./plus-O65gX7Qz.js";import"./search-Dd-PeBfg.js";import"./refresh-cw-CTBERyFc.js";import"./file-text-CebshSV-.js";import"./circle-x-BBQeW1R3.js";import"./play-0EwQQJX_.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 A(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{A as ApprovalAppPage};
@@ -1 +1 @@
import{j as e}from"./index-HuRw9UhJ.js";import{A as t}from"./ApprovalCategoryPage-DAN5ugD6.js";import"./card-B2Wqa0sK.js";import"./input-C9Xfv8um.js";import"./badge-CeS-g-Od.js";import"./label-DvRDtaMA.js";import"./table-Du1vU-OM.js";import"./select-KDzbUQs3.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";import"./approval-BpnRjDXJ.js";import"./plus-BVwIGPvl.js";import"./search-CcKEpJIn.js";import"./refresh-cw-CSycAyA2.js";import"./file-text-BqORyhNh.js";import"./circle-x-BVvXVx7p.js";import"./play-BXdOitsb.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 v(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{v as ApprovalAppPage};
import{j as e}from"./index-o4rKtKfJ.js";import{A as t}from"./ApprovalCategoryPage-Cn1wMnBZ.js";import"./card-6Ae5ROGi.js";import"./input-BfBi0wR2.js";import"./badge-CDGsL4jH.js";import"./label-DrX9VaVC.js";import"./table-FZ6-yFwR.js";import"./select-DuV0kIrj.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";import"./approval-CXJJf5q6.js";import"./plus-BXcAPnTg.js";import"./search-C_UCkHB_.js";import"./refresh-cw-eQ6GkWW0.js";import"./file-text-KcpAjpkr.js";import"./circle-x-DCq7zPbk.js";import"./play-BOUTOTLk.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 v(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{v as ApprovalAppPage};
@@ -1 +0,0 @@
import{r as c,j as e,B as x,L as H,X as I,K as B,O as de,D as Q,a as W,b as Y,c as Z,d as ee,C as xe,P as ne,U as ie,o as he}from"./index-Dmami9WE.js";import{C as ve,a as me}from"./card-CIfC-8Rh.js";import{I as q}from"./input-NsU9nXZF.js";import{B as z}from"./badge-3UzCvU7L.js";import{L as ye}from"./label-Ap_-SPYI.js";import{T as ue,a as Ce,b as J,c as N,d as je,e as f}from"./table-CG4mjNfb.js";import{S as K,a as U,b as X,c as G,d as w}from"./select-DUbxjT0z.js";import{b as i}from"./system-C3cYTuQH.js";import{t as l}from"./index-BuEnLCjT.js";import{P as Pe}from"./plus-O65gX7Qz.js";import{S as Ae}from"./search-Dd-PeBfg.js";import{R as be}from"./refresh-cw-CTBERyFc.js";import{F as Ne}from"./file-text-CebshSV-.js";import{C as fe}from"./circle-x-BBQeW1R3.js";import{P as we}from"./play-0EwQQJX_.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(ne,{"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(fe,{"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(xe,{"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 Je({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[h,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),h&&(a.status=h);const r=await i.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,h]),O=c.useCallback(async()=>{try{const a=await i.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{O()},[O]);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 i.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)}},R=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await i.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await i.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await i.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:R,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(Pe,{"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(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"Line truncated
@@ -1 +1 @@
import{r as c,j as e,B as x,L as H,X as I,O as B,P as de,D as M,a as W,b as Y,c as Z,d as ee,C as xe,Q as ne,t as l,U as he,o as ie}from"./index-HuRw9UhJ.js";import{C as ve,a as me}from"./card-B2Wqa0sK.js";import{I as q}from"./input-C9Xfv8um.js";import{B as z}from"./badge-CeS-g-Od.js";import{L as ye}from"./label-DvRDtaMA.js";import{T as ue,a as Ce,b as J,c as N,d as je,e as f}from"./table-Du1vU-OM.js";import{S as U,a as X,b as K,c as Q,d as w}from"./select-KDzbUQs3.js";import{b as h}from"./approval-BpnRjDXJ.js";import{P as Pe}from"./plus-BVwIGPvl.js";import{S as Ae}from"./search-CcKEpJIn.js";import{R as be}from"./refresh-cw-CSycAyA2.js";import{F as Ne}from"./file-text-BqORyhNh.js";import{C as fe}from"./circle-x-BVvXVx7p.js";import{P as we}from"./play-BXdOitsb.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(ne,{"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(fe,{"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(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function G(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 qe({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]),O=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(()=>{O()},[O]);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)}},R=()=>{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:R,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(Pe,{"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(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translLine truncated
import{r as c,j as e,B as x,L as H,X as I,O as B,P as de,D as M,a as W,b as Y,c as Z,d as ee,C as xe,Q as ne,t as l,U as he,o as ie}from"./index-o4rKtKfJ.js";import{C as ve,a as me}from"./card-6Ae5ROGi.js";import{I as q}from"./input-BfBi0wR2.js";import{B as z}from"./badge-CDGsL4jH.js";import{L as ye}from"./label-DrX9VaVC.js";import{T as ue,a as Ce,b as J,c as N,d as je,e as f}from"./table-FZ6-yFwR.js";import{S as U,a as X,b as K,c as Q,d as w}from"./select-DuV0kIrj.js";import{b as h}from"./approval-CXJJf5q6.js";import{P as Pe}from"./plus-BXcAPnTg.js";import{S as Ae}from"./search-C_UCkHB_.js";import{R as be}from"./refresh-cw-eQ6GkWW0.js";import{F as Ne}from"./file-text-KcpAjpkr.js";import{C as fe}from"./circle-x-DCq7zPbk.js";import{P as we}from"./play-BOUTOTLk.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(ne,{"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(fe,{"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(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function G(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 qe({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]),O=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(()=>{O()},[O]);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)}},R=()=>{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:R,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(Pe,{"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(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translLine truncated
@@ -1 +0,0 @@
import{r as c,j as e,B as x,L as H,X as I,K as B,O as de,D as Q,a as W,b as Y,c as Z,d as ee,C as xe,P as ne,U as ie,o as he}from"./index-CwVkcMR-.js";import{C as ve,a as me}from"./card-C5qBu7CR.js";import{I as q}from"./input-B5ad6Rfz.js";import{B as z}from"./badge-DgJ0w7jf.js";import{L as ye}from"./label-mg-tHjNc.js";import{T as ue,a as Ce,b as J,c as N,d as je,e as f}from"./table-X8m9Cp5H.js";import{S as K,a as U,b as X,c as G,d as w}from"./select-CGtvCG8I.js";import{b as i}from"./approval-DOWuQTU9.js";import{t as l}from"./index-Dxvx0mlR.js";import{P as Pe}from"./plus-CaJ-dB4A.js";import{S as Ae}from"./search-1PdnG-g5.js";import{R as be}from"./refresh-cw-DM6JPbZg.js";import{F as Ne}from"./file-text-DGoBtmAr.js";import{C as fe}from"./circle-x-DBoylLde.js";import{P as we}from"./play-_cqG4jyc.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(ne,{"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(fe,{"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(xe,{"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 Je({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[h,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),h&&(a.status=h);const r=await i.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,h]),O=c.useCallback(async()=>{try{const a=await i.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{O()},[O]);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 i.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)}},R=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await i.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await i.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await i.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:R,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(Pe,{"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(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",classNameLine truncated
@@ -1 +0,0 @@
import{i as ye,S as Ne,j as e,a0 as b,L as $,B as i,O as we,Q as oe,D as V,a as J,b as q,c as H,d as Q,C as pe,e as G,r as v}from"./index-Dmami9WE.js";import{C as u,a as j,b as fe,c as Te,d as De}from"./card-CIfC-8Rh.js";import{B as C}from"./badge-3UzCvU7L.js";import{T as le}from"./textarea-DHUZ6N85.js";import{t as T}from"./index-BuEnLCjT.js";import{b as k}from"./system-C3cYTuQH.js";import{I as ce}from"./input-NsU9nXZF.js";import{F as _}from"./file-text-CebshSV-.js";import{C as D}from"./circle-check-CVbTTFQ0.js";import{C as F}from"./circle-x-BBQeW1R3.js";import{S as Fe}from"./search-Dd-PeBfg.js";import{F as Ce}from"./funnel-DngS63SK.js";import{S as Pe}from"./square-pen-B3dPIBrm.js";import{A as Se}from"./arrow-right-CkKR0P0R.js";import{L as ke}from"./label-Ap_-SPYI.js";import{S as _e,a as Le,b as Oe,c as Ie,d as $e}from"./select-DUbxjT0z.js";import{P as ze}from"./plus-O65gX7Qz.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Re=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Be=ye("git-commit-horizontal",Re);function Ee(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}return[]}function I(a){if(!a)return[];const s=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return s?Array.isArray(s.fields)?s.fields:[]:[]}function Me(a,s){if(!a)return null;let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!r||typeof r!="object")return null;const o=I(s?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(r).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 z=[{value:"server_apply",label:"云服务器申请",icon:Ne,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Be,color:"var(--dg-blue)"}],Y=a=>z.find(s=>s.value===a)?.label||a||"通用审批",L=a=>z.find(s=>s.value===a)?.color||"var(--dg-text-secondary)",Ve=a=>z.find(s=>s.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const s=Ee(a.steps),r=a.current_step??0,o=s.length,n=s.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:s,currentIndex:r,total:o,completed:n,percentage:m}}function X(a){const{steps:s,currentIndex:r}=U(a);return s.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:s.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===r,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<s.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function qe(a){const s={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 Line truncated
@@ -1 +0,0 @@
import{i as ye,S as Ne,j as e,a0 as b,L as $,B as i,P as we,V as oe,D as M,a as J,b as q,c as H,d as G,C as pe,e as Q,r as v,t as T}from"./index-HuRw9UhJ.js";import{C as u,a as j,b as fe,c as Te,d as De}from"./card-B2Wqa0sK.js";import{B as C}from"./badge-CeS-g-Od.js";import{T as le}from"./textarea-Bzol9o6k.js";import{b as k}from"./approval-BpnRjDXJ.js";import{I as ce}from"./input-C9Xfv8um.js";import{F as _}from"./file-text-BqORyhNh.js";import{C as D}from"./circle-check-C5nUiTvE.js";import{C as F}from"./circle-x-BVvXVx7p.js";import{S as Fe}from"./search-CcKEpJIn.js";import{F as Ce}from"./funnel-D7YDgUpE.js";import{S as Pe}from"./square-pen-DoCLytAo.js";import{A as Se}from"./arrow-right-C1YbOgFu.js";import{L as ke}from"./label-DvRDtaMA.js";import{S as _e,a as Le,b as Oe,c as Ie,d as $e}from"./select-KDzbUQs3.js";import{P as ze}from"./plus-BVwIGPvl.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const Re=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Be=ye("git-commit-horizontal",Re);function Ee(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}return[]}function I(a){if(!a)return[];const s=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return s?Array.isArray(s.fields)?s.fields:[]:[]}function Ve(a,s){if(!a)return null;let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!r||typeof r!="object")return null;const o=I(s?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(r).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 z=[{value:"server_apply",label:"云服务器申请",icon:Ne,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Be,color:"var(--dg-blue)"}],Y=a=>z.find(s=>s.value===a)?.label||a||"通用审批",L=a=>z.find(s=>s.value===a)?.color||"var(--dg-text-secondary)",Me=a=>z.find(s=>s.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const s=Ee(a.steps),r=a.current_step??0,o=s.length,n=s.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:s,currentIndex:r,total:o,completed:n,percentage:m}}function X(a){const{steps:s,currentIndex:r}=U(a);return s.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:s.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===r,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<s.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function qe(a){const s={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(-Line truncated
@@ -0,0 +1 @@
import{i as ye,S as Ne,j as e,Z as b,L as $,B as i,P as we,V as oe,D as M,a as J,b as q,c as H,d as G,C as pe,e as Q,r as v,t as T}from"./index-o4rKtKfJ.js";import{C as u,a as j,b as fe,c as Te,d as De}from"./card-6Ae5ROGi.js";import{B as C}from"./badge-CDGsL4jH.js";import{T as le}from"./textarea-9Podrtqd.js";import{b as k}from"./approval-CXJJf5q6.js";import{I as ce}from"./input-BfBi0wR2.js";import{F as _}from"./file-text-KcpAjpkr.js";import{C as D}from"./circle-check-Bp6gonk8.js";import{C as F}from"./circle-x-DCq7zPbk.js";import{S as Fe}from"./search-C_UCkHB_.js";import{F as Ce}from"./funnel-UXxSn3Yh.js";import{S as Pe}from"./square-pen-y4Af_nu2.js";import{A as Se}from"./arrow-right-DT1TwHJ4.js";import{L as ke}from"./label-DrX9VaVC.js";import{S as _e,a as Le,b as Oe,c as Ie,d as $e}from"./select-DuV0kIrj.js";import{P as ze}from"./plus-BXcAPnTg.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Re=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Be=ye("git-commit-horizontal",Re);function Ee(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}return[]}function I(a){if(!a)return[];const s=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return s?Array.isArray(s.fields)?s.fields:[]:[]}function Ve(a,s){if(!a)return null;let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!r||typeof r!="object")return null;const o=I(s?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(r).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 z=[{value:"server_apply",label:"云服务器申请",icon:Ne,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Be,color:"var(--dg-blue)"}],Y=a=>z.find(s=>s.value===a)?.label||a||"通用审批",L=a=>z.find(s=>s.value===a)?.color||"var(--dg-text-secondary)",Me=a=>z.find(s=>s.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const s=Ee(a.steps),r=a.current_step??0,o=s.length,n=s.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:s,currentIndex:r,total:o,completed:n,percentage:m}}function X(a){const{steps:s,currentIndex:r}=U(a);return s.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:s.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===r,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<s.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function qe(a){const s={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30 text-[var(--dg-blue)] bg-[var(--Line truncated
@@ -1 +0,0 @@
import{i as ye,S as Ne,j as e,$ as b,L as $,B as i,O as we,Q as oe,D as V,a as J,b as q,c as H,d as Q,C as pe,e as G,r as v}from"./index-CwVkcMR-.js";import{C as u,a as j,b as fe,c as Te,d as De}from"./card-C5qBu7CR.js";import{B as C}from"./badge-DgJ0w7jf.js";import{T as le}from"./textarea-BZOXMpxW.js";import{t as T}from"./index-Dxvx0mlR.js";import{b as k}from"./approval-DOWuQTU9.js";import{I as ce}from"./input-B5ad6Rfz.js";import{F as _}from"./file-text-DGoBtmAr.js";import{C as D}from"./circle-check-DTBW_8Wd.js";import{C as F}from"./circle-x-DBoylLde.js";import{S as Fe}from"./search-1PdnG-g5.js";import{F as Ce}from"./funnel-BPxvRUWy.js";import{S as Pe}from"./square-pen-C8Ol72WC.js";import{A as Se}from"./arrow-right-aZAKUdlE.js";import{L as ke}from"./label-mg-tHjNc.js";import{S as _e,a as Le,b as Oe,c as Ie,d as $e}from"./select-CGtvCG8I.js";import{P as ze}from"./plus-CaJ-dB4A.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const Re=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Be=ye("git-commit-horizontal",Re);function Ee(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const s=JSON.parse(a);return Array.isArray(s)?s:[]}catch{return[]}return[]}function I(a){if(!a)return[];const s=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return s?Array.isArray(s.fields)?s.fields:[]:[]}function Me(a,s){if(!a)return null;let r;try{r=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!r||typeof r!="object")return null;const o=I(s?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(r).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 z=[{value:"server_apply",label:"云服务器申请",icon:Ne,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Be,color:"var(--dg-blue)"}],Y=a=>z.find(s=>s.value===a)?.label||a||"通用审批",L=a=>z.find(s=>s.value===a)?.color||"var(--dg-text-secondary)",Ve=a=>z.find(s=>s.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const s=Ee(a.steps),r=a.current_step??0,o=s.length,n=s.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:s,currentIndex:r,total:o,completed:n,percentage:m}}function X(a){const{steps:s,currentIndex:r}=U(a);return s.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:s.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===r,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),n<s.length-1&&e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:121:15",className:b("w-4 h-px",m?"bg-emerald-500/30":"bg-[var(--dg-border)]")})]},o.id||n)})})}const Je=[{key:"all",label:"全部",value:""},{key:"pending",label:"待审批",value:"pending"},{key:"approved",label:"已通过",value:"approved"},{key:"rejected",label:"已拒绝",value:"rejected"},{key:"processing",label:"进行中",value:"processing"},{key:"completed",label:"已完成",value:"completed"}];function qe(a){const s={pending:{label:"待审批",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",dot:"bg-amber-400"},approved:{label:"已通过",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",dot:"bg-emerald-400"},rejected:{label:"已拒绝",className:"border-red-500/30 text-red-400 bg-red-500/10",dot:"bg-red-400"},processing:{label:"进行中",className:"border-[var(--dg-blue)]/30Line truncated
@@ -1 +0,0 @@
import{j as e}from"./index-CwVkcMR-.js";import{A as r}from"./ApprovalCategoryPage-ffOu-p7w.js";import"./card-C5qBu7CR.js";import"./input-B5ad6Rfz.js";import"./badge-DgJ0w7jf.js";import"./label-mg-tHjNc.js";import"./table-X8m9Cp5H.js";import"./select-CGtvCG8I.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";import"./approval-DOWuQTU9.js";import"./index-Dxvx0mlR.js";import"./plus-CaJ-dB4A.js";import"./search-1PdnG-g5.js";import"./refresh-cw-DM6JPbZg.js";import"./file-text-DGoBtmAr.js";import"./circle-x-DBoylLde.js";import"./play-_cqG4jyc.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 f(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{f as ApprovalPermissionPage};
@@ -1 +1 @@
import{j as e}from"./index-HuRw9UhJ.js";import{A as r}from"./ApprovalCategoryPage-DAN5ugD6.js";import"./card-B2Wqa0sK.js";import"./input-C9Xfv8um.js";import"./badge-CeS-g-Od.js";import"./label-DvRDtaMA.js";import"./table-Du1vU-OM.js";import"./select-KDzbUQs3.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";import"./approval-BpnRjDXJ.js";import"./plus-BVwIGPvl.js";import"./search-CcKEpJIn.js";import"./refresh-cw-CSycAyA2.js";import"./file-text-BqORyhNh.js";import"./circle-x-BVvXVx7p.js";import"./play-BXdOitsb.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 b(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{b as ApprovalPermissionPage};
import{j as e}from"./index-o4rKtKfJ.js";import{A as r}from"./ApprovalCategoryPage-Cn1wMnBZ.js";import"./card-6Ae5ROGi.js";import"./input-BfBi0wR2.js";import"./badge-CDGsL4jH.js";import"./label-DrX9VaVC.js";import"./table-FZ6-yFwR.js";import"./select-DuV0kIrj.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";import"./approval-CXJJf5q6.js";import"./plus-BXcAPnTg.js";import"./search-C_UCkHB_.js";import"./refresh-cw-eQ6GkWW0.js";import"./file-text-KcpAjpkr.js";import"./circle-x-DCq7zPbk.js";import"./play-BOUTOTLk.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 b(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{b as ApprovalPermissionPage};
@@ -1 +0,0 @@
import{j as e}from"./index-Dmami9WE.js";import{A as r}from"./ApprovalCategoryPage-CIXhWQ3k.js";import"./card-CIfC-8Rh.js";import"./input-NsU9nXZF.js";import"./badge-3UzCvU7L.js";import"./label-Ap_-SPYI.js";import"./table-CG4mjNfb.js";import"./select-DUbxjT0z.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";import"./system-C3cYTuQH.js";import"./index-BuEnLCjT.js";import"./plus-O65gX7Qz.js";import"./search-Dd-PeBfg.js";import"./refresh-cw-CTBERyFc.js";import"./file-text-CebshSV-.js";import"./circle-x-BBQeW1R3.js";import"./play-0EwQQJX_.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 f(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{f as ApprovalPermissionPage};
@@ -1 +1 @@
import{j as e}from"./index-HuRw9UhJ.js";import{A as r}from"./ApprovalCategoryPage-DAN5ugD6.js";import"./card-B2Wqa0sK.js";import"./input-C9Xfv8um.js";import"./badge-CeS-g-Od.js";import"./label-DvRDtaMA.js";import"./table-Du1vU-OM.js";import"./select-KDzbUQs3.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";import"./approval-BpnRjDXJ.js";import"./plus-BVwIGPvl.js";import"./search-CcKEpJIn.js";import"./refresh-cw-CSycAyA2.js";import"./file-text-BqORyhNh.js";import"./circle-x-BVvXVx7p.js";import"./play-BXdOitsb.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 x(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{x as ApprovalResourcePage};
import{j as e}from"./index-o4rKtKfJ.js";import{A as r}from"./ApprovalCategoryPage-Cn1wMnBZ.js";import"./card-6Ae5ROGi.js";import"./input-BfBi0wR2.js";import"./badge-CDGsL4jH.js";import"./label-DrX9VaVC.js";import"./table-FZ6-yFwR.js";import"./select-DuV0kIrj.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";import"./approval-CXJJf5q6.js";import"./plus-BXcAPnTg.js";import"./search-C_UCkHB_.js";import"./refresh-cw-eQ6GkWW0.js";import"./file-text-KcpAjpkr.js";import"./circle-x-DCq7zPbk.js";import"./play-BOUTOTLk.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 x(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{x as ApprovalResourcePage};
@@ -1 +0,0 @@
import{j as e}from"./index-CwVkcMR-.js";import{A as r}from"./ApprovalCategoryPage-ffOu-p7w.js";import"./card-C5qBu7CR.js";import"./input-B5ad6Rfz.js";import"./badge-DgJ0w7jf.js";import"./label-mg-tHjNc.js";import"./table-X8m9Cp5H.js";import"./select-CGtvCG8I.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";import"./approval-DOWuQTU9.js";import"./index-Dxvx0mlR.js";import"./plus-CaJ-dB4A.js";import"./search-1PdnG-g5.js";import"./refresh-cw-DM6JPbZg.js";import"./file-text-DGoBtmAr.js";import"./circle-x-DBoylLde.js";import"./play-_cqG4jyc.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 f(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{f as ApprovalResourcePage};
@@ -1 +0,0 @@
import{j as e}from"./index-Dmami9WE.js";import{A as r}from"./ApprovalCategoryPage-CIXhWQ3k.js";import"./card-CIfC-8Rh.js";import"./input-NsU9nXZF.js";import"./badge-3UzCvU7L.js";import"./label-Ap_-SPYI.js";import"./table-CG4mjNfb.js";import"./select-DUbxjT0z.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";import"./system-C3cYTuQH.js";import"./index-BuEnLCjT.js";import"./plus-O65gX7Qz.js";import"./search-Dd-PeBfg.js";import"./refresh-cw-CTBERyFc.js";import"./file-text-CebshSV-.js";import"./circle-x-BBQeW1R3.js";import"./play-0EwQQJX_.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 f(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{f as ApprovalResourcePage};
@@ -1 +0,0 @@
import{r as l,u as Q,j as e,L as D,B as $,Q as V,V as R,X as z,t as Y,W as X,P as H}from"./index-CwVkcMR-.js";import{C as K,a as Z}from"./card-C5qBu7CR.js";import{t as _}from"./index-Dxvx0mlR.js";import{a as C}from"./approval-DOWuQTU9.js";import{P as J}from"./plus-CaJ-dB4A.js";import{S as B}from"./star-BY-sYfNe.js";import{C as ee}from"./chevron-up-DM77dvsL.js";import{P as F}from"./play-_cqG4jyc.js";import{P as se}from"./pen-BT_2xx_Z.js";import{T as G}from"./trash-2-BPpnm3Sz.js";import{A as ae,a as te}from"./arrow-up-Tz6HpGg2.js";const re={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},O={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"},oe={submit:X,audit:Y,execute:F},pe=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function le({users:i,selectedIds:x,label:v,onToggle:j,onToggleAll:y,onClear:f,getUserName:W}){const[m,N]=l.useState(!1),b=l.useRef(null),[k,p]=l.useState({top:0,left:0,width:0}),h=()=>{if(b.current){const c=b.current.getBoundingClientRect();p({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:112:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:7",ref:b,type:"button",onClick:()=>{m||h(),N(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${x.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:123:9",className:"truncate",children:x.length===0?`${v} * 请选择`:`${v} (${x.length}人)`}),e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:126:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),x.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:130:9",className:"flex flex-wrap gap-1 mt-1.5",children:x.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:132: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:[W(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:134:15",onClick:()=>j(c),className:"hover:text-red-400",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:134:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:142:11",className:"fixed inset-0 z-40",onClick:()=>N(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143: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:k.top,left:k.left,width:k.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:145: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:146:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:x.length===i.length&&i.length>0?"取消全选":"全选"}),x.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:150:17",onClick:f,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const w=x.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:156:17",onClick:()=>j(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:158:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${w?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:w&&e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:161:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:163:19",className:`text-sm flex-1 ${w?"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:166: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 ce({workflow:i,users:x,onClose:v,onSaved:j}){const y=!!i,[f,W]=l.useState(i?.name||""),[m,N]=l.useState(i?.description||""),[b,k]=l.useState(i?.category||"resource"),[p,h]=l.useState([]),[c,w]=l.useState(!1),[E,P]=l.useState("");l.useEffect(()=>{i?.steps?.leLine truncated
@@ -1 +1 @@
import{f as Q,r as p,u as V,t as C,j as e,L as R,B as $,V as X,W as Y,X as z,v as J,Y as H,Q as K}from"./index-HuRw9UhJ.js";import{C as Z,a as ee}from"./card-B2Wqa0sK.js";import{a as S}from"./approval-BpnRjDXJ.js";import{P as F}from"./plus-BVwIGPvl.js";import{S as D}from"./star-CJEUXmIA.js";import{C as se}from"./chevron-up-GXrRy2ul.js";import{P as G}from"./play-BXdOitsb.js";import{P as ae}from"./pen-C8XHRV1-.js";import{T as q}from"./trash-2-Cf9-88KL.js";import{A as te,a as re}from"./arrow-up-CmLz9pAr.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},O={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:H,audit:J,execute:G},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:A,onClear:y,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(z,{"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:A,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:y,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(K,{"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 A=!!i,[y,_]=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=>({nLine truncated
import{f as Q,r as p,u as V,t as C,j as e,L as R,B as $,V as X,W as Y,X as z,v as J,Y as H,Q as K}from"./index-o4rKtKfJ.js";import{C as Z,a as ee}from"./card-6Ae5ROGi.js";import{a as S}from"./approval-CXJJf5q6.js";import{P as F}from"./plus-BXcAPnTg.js";import{S as D}from"./star-nuqYbwAt.js";import{C as se}from"./chevron-up-CZcf1jNw.js";import{P as G}from"./play-BOUTOTLk.js";import{P as ae}from"./pen-Bq7bEvmf.js";import{T as q}from"./trash-2-C2Niwqae.js";import{A as te,a as re}from"./arrow-up-jL4nMkK9.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},O={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:H,audit:J,execute:G},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:A,onClear:y,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(z,{"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:A,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:y,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(K,{"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 A=!!i,[y,_]=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=>({nLine truncated
@@ -1 +0,0 @@
import{r as c,h as j,j as e,L as R,B as T,Q as V,V as z,X as Y,t as J,W as X,P as H}from"./index-Dmami9WE.js";import{C as K,a as Z}from"./card-CIfC-8Rh.js";import{t as C}from"./index-BuEnLCjT.js";import{P as F}from"./plus-O65gX7Qz.js";import{S as D}from"./star-DRCV7Fx2.js";import{C as ee}from"./chevron-up-Cq4GPopa.js";import{P as G}from"./play-0EwQQJX_.js";import{P as se}from"./pen-0lfnZsyH.js";import{T as q}from"./trash-2-DWVnIU6o.js";import{A as ae,a as te}from"./arrow-up-DMuDiHn6.js";const re={resource:"资源申请",app:"应用申请",permission:"权限审批"},O={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"},oe={submit:X,audit:J,execute:G},pe=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}],S={list:p=>j.get("/approval-workflows",p),get:p=>j.get(`/approval-workflows/${p}`),create:p=>j.post("/approval-workflows",p),update:(p,i)=>j.put(`/approval-workflows/${p}`,i),delete:p=>j.delete(`/approval-workflows/${p}`),setDefault:p=>j.put(`/approval-workflows/${p}/default`)},le=()=>j.get("/admin/users");function ce({users:p,selectedIds:i,label:v,onToggle:W,onToggleAll:y,onClear:f,getUserName:N}){const[m,_]=c.useState(!1),b=c.useRef(null),[k,l]=c.useState({top:0,left:0,width:0}),h=()=>{if(b.current){const d=b.current.getBoundingClientRect();l({top:d.bottom+4,left:d.left,width:d.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:121:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:122:7",ref:b,type:"button",onClick:()=>{m||h(),_(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${i.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:132:9",className:"truncate",children:i.length===0?`${v} * 请选择`:`${v} (${i.length}人)`}),e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),i.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:139:9",className:"flex flex-wrap gap-1 mt-1.5",children:i.map(d=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:141: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:[N(d),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:15",onClick:()=>W(d),className:"hover:text-red-400",children:e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:84",className:"w-3 h-3"})})]},d))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:11",className:"fixed inset-0 z-40",onClick:()=>_(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:152: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:k.top,left:k.left,width:k.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:154: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:155:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:i.length===p.length&&p.length>0?"取消全选":"全选"}),i.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:17",onClick:f,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),p.map(d=>{const w=i.includes(d.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:165:17",onClick:()=>W(d.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:167:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${w?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:w&&e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:170:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:172:19",className:`text-sm flex-1 ${w?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:d.display_name||d.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:175:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:d.role})]},d.id)})]})]})]})}fuLine truncated
@@ -1 +1 @@
import{b as R,L as W,m as T,i as C,c as F,A as ie,d as B,e as G,h as oe,j as q,k as se,l as le,u as ue,n as K,G as ce,o as J,p as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-DrSMejeS.js";import{af as p,ag as ee,r as ve}from"./index-HuRw9UhJ.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=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},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=(function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),CLine truncated
import{b as R,L as W,m as T,i as C,c as F,A as ie,d as B,e as G,h as oe,j as q,k as se,l as le,u as ue,n as K,G as ce,o as J,p as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-BeO9rjxr.js";import{a5 as p,a6 as ee,r as ve}from"./index-o4rKtKfJ.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=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},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=(function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),CLine truncated
@@ -1 +0,0 @@
import{b as R,L as W,m as T,i as C,c as F,A as ie,d as B,e as G,h as oe,j as q,k as se,l as le,u as ue,n as K,G as ce,o as J,p as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-ZqCvxO-S.js";import{a3 as p,a7 as ee,r as ve}from"./index-Dmami9WE.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=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},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=(function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),CLine truncated
@@ -1 +0,0 @@
import{b as R,L as W,m as T,i as C,c as F,A as ie,d as B,e as G,h as oe,j as q,k as se,l as le,u as ue,n as K,G as ce,o as J,p as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-B9iVh1fX.js";import{a2 as p,a7 as ee,r as ve}from"./index-CwVkcMR-.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=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},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=(function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),CLine truncated
@@ -1,3 +0,0 @@
import{i as ce,r as a,j as e,D as xe,a as he,b as _e,c as me,d as ue,L as ge,a3 as De,$ as be,aN as Y,X as ie,f as Te,A as je,B as y,O as fe,aO as Re,G as Me,x as ze}from"./index-CwVkcMR-.js";import{C as W,a as U}from"./card-C5qBu7CR.js";import{I as H}from"./input-B5ad6Rfz.js";import{B as _}from"./badge-DgJ0w7jf.js";import{T as q,a as J,b as E,c as l,d as X,e as o}from"./table-X8m9Cp5H.js";import{t as K,s as Ie,a as V,l as Ee}from"./terminal-CUhviP7m.js";import{x as Ae,a as ve}from"./xterm-DSqgeKvr.js";import{m as $e,a as Be}from"./xterm-utils-slbfdUHf.js";import{M as Fe,a as Pe}from"./minimize-2-Dk2LAAKi.js";import{S as F}from"./search-1PdnG-g5.js";import{R as G}from"./refresh-cw-DM6JPbZg.js";import{P as He}from"./play-_cqG4jyc.js";import{D as Ne}from"./download-BgEJ-n5L.js";const Ke=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],We=ce("octagon-x",Ke);const Ue=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],qe=ce("timer-off",Ue);const Je=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Xe=ce("timer",Je);function Ge({open:s,onOpenChange:i,sessionId:d}){const n=a.useRef(null),p=a.useRef(null),g=a.useRef(null),[x,w]=a.useState(!1),[T,L]=a.useState(""),[j,A]=a.useState(0);return a.useEffect(()=>{if(!s||!d)return;const r=new Ae.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)"}}),h=new ve.FitAddon;r.loadAddon(h),p.current=r;let b=!1;return w(!0),L(""),A(0),K.getRecord(d).then(O=>{if(b)return;const z=typeof O=="string"?O:O?.data||O?.record_data||"";if(!z||z.trim()===""){L("No recording data available for this session"),w(!1);return}if(n.current){r.open(n.current);try{h.fit()}catch{}}const m=z.split(`
`).filter(f=>f.trim()),v=[];for(const f of m)try{const S=JSON.parse(f);Array.isArray(S)&&S.length>=3&&v.push({time:S[0],eventType:S[1],data:S[2]})}catch{}if(v.length===0){r.write(z),A(100),w(!1);return}w(!1);const $=v[v.length-1].time;let D=0,I=0;const u=()=>{if(b||D>=v.length){A(100);return}const f=v[D],S=(f.time-I)*1e3;I=f.time,D++;const k=Math.min(S,2e3);g.current=setTimeout(()=>{b||(r.write(f.data),A(Math.round(f.time/$*100)),u())},k)};u()}).catch(O=>{b||(console.error("[Replay] Load failed:",O),L("Failed to load recording data"),w(!1))}),()=>{b=!0,g.current&&clearTimeout(g.current);try{r.dispose()}catch{}p.current=null}},[s,d]),e.jsx(xe,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:i,children:e.jsxs(he,{"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(_e,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",d??"",j>0&&j<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[j,"%"]})]}),e.jsx(ue,{"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:[x&&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(ge,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),T&&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:T})}),j>0&&j<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:`${j}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:n,className:"absolute inset-0 p-1"})]})]})})}function Ve({open:s,onOpenChange:i,sessionId:d,sessionInfo:n}){const p=a.useRef(null),g=a.useRef(null),x=a.useRef(null),w=a.useRef(null),[T,L]=a.useState(!1),[j,A]=a.useState(""),[r,h]=a.useState(n||null),[b,O]=a.useState(!1);a.useEffect(()=>{s||(L(!1),A(""),O(!1))},[s]),a.useEffect(()=>{if(!s||!d)return;L(!1),A("");const m=new Ae.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)"}}),v=new ve.FitAddon;m.loadAddon(v),g.current=m,x.current=v;const $=De.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),I=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${d}?token=${encodeURIComponent($)}`,u=new WebSocket(I);w.current=u;let f=!1;u.onopen=()=>{f=!0,L(!0),A(""),$e(m,v,()=>p.current),m.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},u.onmessage=k=>{try{const C=JSON.parse(k.data);switch(C.type){case"session_info":h(C.payload),m.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&m.write(C.data);break;case"output":C.data&&m.write(C.data);break}}catch{}},u.onerror=()=>A("WebSocket 连接失败"),u.onclose=k=>{f||A(`连接失败 (code=${k.code}): ${k.reason||"认证失败或网络问题"}`),L(!1),m.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const S=setTimeout(()=>{f||(A("连接超时 — 请确认已登录且有活跃会话"),u.close())},5e3);return()=>{clearTimeout(S),u.close(),m.dispose(),g.current=null,x.current=null,w.current=null,L(!1)}},[s,d]),a.useEffect(()=>{if(!s)return;let m,v=0;const $=()=>{const D=p.current,I=x.current,u=g.current;if(!D||!I||!u){v++<30&&requestAnimationFrame($);return}m=Be(D,I,u)};return $(),()=>m?.()},[s,d,b]);const z=m=>m?new Date(m).toLocaleString():"--";return e.jsx(xe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:i,children:e.jsxs(he,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:be("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",b?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:b?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(me,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(ue,{"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(Y,{"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:"终端实时监控"}),r&&e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:206:15",className:"text-[var(--dg-text-muted)] truncate",children:[r.username," · ",r.server_name," (",r.server_ip,") · ",z(r.start_time)]}),T&&e.jsx(_,{"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:"● 在线"}),!T&&!j&&e.jsxs(_,{"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(ge,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),j&&e.jsx(_,{"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:()=>O(!b),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:b?"退出全屏":"全屏",children:b?e.jsx(Fe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(Pe,{"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:()=>i(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(ie,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),j&&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:j}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:p,className:"xterm-terminal-host",style:{height:b?"calc(100vh - 49px)":"520px"}})]})})}function ye(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const i=Math.floor(s/60),d=s%60;if(i<60)return`${i}分${d>0?`${d}秒`:""}`;const n=Math.floor(i/60),p=i%60;return`${n}时${p>0?`${p}分`:""}`}function Qe(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function Le(s){return s==="active"?e.jsxs(_,{"code-path":"src/pages/TerminalAuditTab.tsx:86:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/TerminalAuditTab.tsx:87:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(_,{"code-path":"src/pages/TerminalAuditTab.tsx:94:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(_,{"code-path":"src/pages/TerminalAuditTab.tsx:100:5",variant:"outline",className:"border-sl Line truncated
@@ -1,3 +1,3 @@
import{i as V,r as a,a3 as ve,j as e,D as ae,a as re,a0 as ie,c as ne,d as oe,aW as Q,L as ce,X as Y,ac as fe,f as le,B as N,A as de,P as pe,b as ye,be as Ne,G as Se,y as Ae}from"./index-HuRw9UhJ.js";import{C as $,a as B}from"./card-B2Wqa0sK.js";import{I as F}from"./input-C9Xfv8um.js";import{T as E,a as q,b as _,c as d,d as K,e as p}from"./table-Du1vU-OM.js";import{x as xe,a as me}from"./xterm-DSqgeKvr.js";import{B as w}from"./badge-CeS-g-Od.js";import{m as Te,a as Le}from"./xterm-utils-slbfdUHf.js";import{M as we,a as Pe}from"./minimize-2-UErWMOt6.js";import{u as Z,q as ee,a as se,b as Oe}from"./unwrap-s5xDIyKq.js";import{u as X}from"./useMutation-ChnF9A9K.js";import{t as I,a as J,s as Ce,l as ke}from"./terminal-DvxWm4UP.js";import{S as z}from"./search-CcKEpJIn.js";import{R as W}from"./refresh-cw-CSycAyA2.js";import{P as _e}from"./play-BXdOitsb.js";import{D as he}from"./download-CjFatm64.js";const De=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],He=V("octagon-x",De);const Me=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],Re=V("timer-off",Me);const ze=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ie=V("timer",ze);function Fe({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const n=a.useRef(null),x=a.useRef(null),g=a.useRef(null),j=a.useRef(null),[v,l]=a.useState(!1),[u,f]=a.useState(""),[t,h]=a.useState(c||null),[y,T]=a.useState(!1);a.useEffect(()=>{s||(l(!1),f(""),T(!1))},[s]),a.useEffect(()=>{if(!s||!i)return;l(!1),f("");const b=new xe.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)"}}),m=new me.FitAddon;b.loadAddon(m),x.current=b,g.current=m;const S=ve.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),H=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(S)}`,L=new WebSocket(H);j.current=L;let A=!1;L.onopen=()=>{A=!0,l(!0),f(""),Te(b,m,()=>n.current),b.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},L.onmessage=M=>{try{const C=JSON.parse(M.data);switch(C.type){case"session_info":h(C.payload),b.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&b.write(C.data);break;case"output":C.data&&b.write(C.data);break}}catch{}},L.onerror=()=>f("WebSocket 连接失败"),L.onclose=M=>{A||f(`连接失败 (code=${M.code}): ${M.reason||"认证失败或网络问题"}`),l(!1),b.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const P=setTimeout(()=>{A||(f("连接超时 — 请确认已登录且有活跃会话"),L.close())},5e3);return()=>{clearTimeout(P),L.close(),b.dispose(),x.current=null,g.current=null,j.current=null,l(!1)}},[s,i]),a.useEffect(()=>{if(!s)return;let b,m=0;const S=()=>{const D=n.current,H=g.current,L=x.current;if(!D||!H||!L){m++<30&&requestAnimationFrame(S);return}b=Le(D,H,L)};return S(),()=>b?.()},[s,i,y]);const O=b=>b?new Date(b).toLocaleString():"--";return e.jsx(ae,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(re,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:ie("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",y?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:y?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(ne,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(oe,{"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(Q,{"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,") · ",O(t.start_time)]}),v&&e.jsx(w,{"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:"● 在线"}),!v&&!u&&e.jsxs(w,{"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(ce,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),u&&e.jsx(w,{"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:()=>T(!y),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:y?"退出全屏":"全屏",children:y?e.jsx(we,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(Pe,{"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(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),u&&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:u}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:n,className:"xterm-terminal-host",style:{height:y?"calc(100vh - 49px)":"520px"}})]})})}function ue(s={page:1,page_size:100}){return Z({queryKey:ee.terminalSessions(s),queryFn:async()=>{const r=await I.list(s);return se(r)}})}function $e(){const s=fe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=X({mutationFn:x=>I.kill(x),onSuccess:r}),c=X({mutationFn:x=>I.delete(x),onSuccess:r}),n=X({mutationFn:x=>I.batchDelete(x),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:n,invalidate:r}}function Be(s={page:1,page_size:50}){return Z({queryKey:ee.auditLogs(s),queryFn:async()=>{const r=await J.getLogs(s);return{list:se(r),total:Oe(r)}},staleTime:2e4})}function Ee(s={page:1,page_size:200}){return Z({queryKey:ee.sessionCommands(s),queryFn:async()=>{const r=await Ce.list(s);return se(r)}})}function ge(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),n=r%60;return`${c}时${n>0?`${n}分`:""}`}fun Line truncated
`).filter(A=>A.trim()),m=[];for(const A of b)try{const P=JSON.parse(A);Array.isArray(P)&&P.length>=3&&m.push({time:P[0],eventType:P[1],data:P[2]})}catch{}if(m.length===0){t.write(O),f(100),j(!1);return}j(!1);const S=m[m.length-1].time;let D=0,H=0;const L=()=>{if(y||D>=m.length){f(100);return}const A=m[D],P=(A.time-H)*1e3;H=A.time,D++;const M=Math.min(P,2e3);x.current=setTimeout(()=>{y||(t.write(A.data),f(Math.round(A.time/S*100)),L())},M)};L()}).catch(T=>{y||(console.error("[Replay] Load failed:",T),l("Failed to load recording data"),j(!1))}),()=>{y=!0,x.current&&clearTimeout(x.current);try{t.dispose()}catch{}n.current=null}},[s,i]),e.jsx(ae,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(re,{"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(ye,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(ne,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",u>0&&u<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[u,"%"]})]}),e.jsx(oe,{"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:[g&&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(ce,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),v&&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:v})}),u>0&&u<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:`${u}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function Qe(){const{data:s=[],isLoading:r,refetch:i}=ue({page:1,page_size:100,status:"closed"}),[c,n]=a.useState(""),[x,g]=a.useState(null),[j,v]=a.useState(!1),l=s.filter(t=>{const h=c.toLowerCase();return!h||(t.username||"").toLowerCase().includes(h)||(t.server_name||"").toLowerCase().includes(h)||(t.server_ip||"").toLowerCase().includes(h)}),u=t=>{g(t),v(!0)},f=async t=>{try{await I.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(z,{"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(F,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>n(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(N,{"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($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(B,{"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"})}):l.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",chil Line truncated
import{i as V,aj as ve,r as a,a0 as fe,j as e,D as ae,a as re,Z as ie,c as ne,d as oe,aW as Q,L as ce,X as Z,f as le,B as N,A as de,P as pe,b as ye,be as Ne,G as Se,y as Ae}from"./index-o4rKtKfJ.js";import{C as $,a as B}from"./card-6Ae5ROGi.js";import{I as F}from"./input-BfBi0wR2.js";import{T as E,a as q,b as _,c as d,d as K,e as p}from"./table-FZ6-yFwR.js";import{x as xe,a as me}from"./xterm-DSqgeKvr.js";import{B as w}from"./badge-CDGsL4jH.js";import{m as Te,a as Le}from"./xterm-utils-slbfdUHf.js";import{M as we,a as Pe}from"./minimize-2-FJos9g1e.js";import{u as Y,q as ee,a as se,b as Oe}from"./unwrap-D0DvYxvf.js";import{u as X}from"./useMutation-B7xoUHzt.js";import{t as I,a as J,s as Ce,l as ke}from"./terminal-B4dme9rT.js";import{S as z}from"./search-C_UCkHB_.js";import{R as W}from"./refresh-cw-eQ6GkWW0.js";import{P as _e}from"./play-BOUTOTLk.js";import{D as he}from"./download-Gr2Xr683.js";const De=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],He=V("octagon-x",De);const Me=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],Re=V("timer-off",Me);const ze=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ie=V("timer",ze);function ue(s={page:1,page_size:100}){return Y({queryKey:ee.terminalSessions(s),queryFn:async()=>{const r=await I.list(s);return se(r)}})}function Fe(){const s=ve(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=X({mutationFn:x=>I.kill(x),onSuccess:r}),c=X({mutationFn:x=>I.delete(x),onSuccess:r}),n=X({mutationFn:x=>I.batchDelete(x),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:n,invalidate:r}}function $e(s={page:1,page_size:50}){return Y({queryKey:ee.auditLogs(s),queryFn:async()=>{const r=await J.getLogs(s);return{list:se(r),total:Oe(r)}},staleTime:2e4})}function Be(s={page:1,page_size:200}){return Y({queryKey:ee.sessionCommands(s),queryFn:async()=>{const r=await Ce.list(s);return se(r)}})}function Ee({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const n=a.useRef(null),x=a.useRef(null),g=a.useRef(null),j=a.useRef(null),[v,l]=a.useState(!1),[u,f]=a.useState(""),[t,h]=a.useState(c||null),[y,T]=a.useState(!1);a.useEffect(()=>{s||(l(!1),f(""),T(!1))},[s]),a.useEffect(()=>{if(!s||!i)return;l(!1),f("");const b=new xe.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)"}}),m=new me.FitAddon;b.loadAddon(m),x.current=b,g.current=m;const S=fe.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),H=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(S)}`,L=new WebSocket(H);j.current=L;let A=!1;L.onopen=()=>{A=!0,l(!0),f(""),Te(b,m,()=>n.current),b.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},L.onmessage=M=>{try{const C=JSON.parse(M.data);switch(C.type){case"session_info":h(C.payload),b.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&b.write(C.data);break;case"output":C.data&&b.write(C.data);break}}catch{}},L.onerror=()=>f("WebSocket 连接失败"),L.onclose=M=>{A||f(`连接失败 (code=${M.code}): ${M.reason||"认证失败或网络问题"}`),l(!1),b.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const P=setTimeout(()=>{A||(f("连接超时 — 请确认已登录且有活跃会话"),L.close())},5e3);return()=>{clearTimeout(P),L.close(),b.dispose(),x.current=null,g.current=null,j.current=null,l(!1)}},[s,i]),a.useEffect(()=>{if(!s)return;let b,m=0;const S=()=>{const D=n.current,H=g.current,L=x.current;if(!D||!H||!L){m++<30&&requestAnimationFrame(S);return}b=Le(D,H,L)};return S(),()=>b?.()},[s,i,y]);const O=b=>b?new Date(b).toLocaleString():"--";return e.jsx(ae,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(re,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:ie("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",y?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:y?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(ne,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(oe,{"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(Q,{"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,") · ",O(t.start_time)]}),v&&e.jsx(w,{"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:"● 在线"}),!v&&!u&&e.jsxs(w,{"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(ce,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),u&&e.jsx(w,{"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:()=>T(!y),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:y?"退出全屏":"全屏",children:y?e.jsx(we,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(Pe,{"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(Z,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),u&&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:u}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:n,className:"xterm-terminal-host",style:{height:y?"calc(100vh - 49px)":"520px"}})]})})}function ge(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),n=r%60;return`${c}时${n>0?`${n}分`:""}`}function qe(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function be(s){return s==="active"?e.jsxs(w,{"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(w,{"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(w,{"code-path":"src/pages/terminal-audit/helpers.tsx:40:5",variant:"outline Line truncated
`).filter(A=>A.trim()),m=[];for(const A of b)try{const P=JSON.parse(A);Array.isArray(P)&&P.length>=3&&m.push({time:P[0],eventType:P[1],data:P[2]})}catch{}if(m.length===0){t.write(O),f(100),j(!1);return}j(!1);const S=m[m.length-1].time;let D=0,H=0;const L=()=>{if(y||D>=m.length){f(100);return}const A=m[D],P=(A.time-H)*1e3;H=A.time,D++;const M=Math.min(P,2e3);x.current=setTimeout(()=>{y||(t.write(A.data),f(Math.round(A.time/S*100)),L())},M)};L()}).catch(T=>{y||(console.error("[Replay] Load failed:",T),l("Failed to load recording data"),j(!1))}),()=>{y=!0,x.current&&clearTimeout(x.current);try{t.dispose()}catch{}n.current=null}},[s,i]),e.jsx(ae,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(re,{"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(ye,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(ne,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",u>0&&u<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[u,"%"]})]}),e.jsx(oe,{"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:[g&&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(ce,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),v&&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:v})}),u>0&&u<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:`${u}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function Qe(){const{data:s=[],isLoading:r,refetch:i}=ue({page:1,page_size:100,status:"closed"}),[c,n]=a.useState(""),[x,g]=a.useState(null),[j,v]=a.useState(!1),l=s.filter(t=>{const h=c.toLowerCase();return!h||(t.username||"").toLowerCase().includes(h)||(t.server_name||"").toLowerCase().includes(h)||(t.server_ip||"").toLowerCase().includes(h)}),u=t=>{g(t),v(!0)},f=async t=>{try{await I.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(z,{"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(F,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>n(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(N,{"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($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(B,{"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"})}):l.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",chil Line truncated
@@ -1,3 +0,0 @@
import{i as ce,r as a,j as e,D as pe,a as xe,b as he,c as me,d as ue,L as ge,$ as _e,aH as Y,U as De,S as Re,C as Me,f as be,A as Te,a0 as ze,B as v,O as je,X as fe,aP as Ee,G as Ie,x as Be}from"./index-Dmami9WE.js";import{C as K,a as U}from"./card-CIfC-8Rh.js";import{I as F}from"./input-NsU9nXZF.js";import{B as _}from"./badge-3UzCvU7L.js";import{T as W,a as q,b as E,c as l,d as G,e as o}from"./table-CG4mjNfb.js";import{t as H,s as $e,a as X,l as Fe}from"./system-C3cYTuQH.js";import{x as Ae,a as ve}from"./xterm-DSqgeKvr.js";import{S as B}from"./search-Dd-PeBfg.js";import{R as J}from"./refresh-cw-CTBERyFc.js";import{P as Pe}from"./play-0EwQQJX_.js";import{D as Ne}from"./download-Vuij9wGr.js";const He=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Ke=ce("octagon-x",He);const Ue=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],We=ce("timer-off",Ue);const qe=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Ge=ce("timer",qe);function Je({open:s,onOpenChange:i,sessionId:d}){const n=a.useRef(null),p=a.useRef(null),g=a.useRef(null),[m,w]=a.useState(!1),[b,N]=a.useState(""),[T,j]=a.useState(0);return a.useEffect(()=>{if(!s||!d)return;const r=new Ae.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)"}}),u=new ve.FitAddon;r.loadAddon(u),p.current=r;let O=!1;return w(!0),N(""),j(0),H.getRecord(d).then(x=>{if(O)return;const y=typeof x=="string"?x:x?.data||x?.record_data||"";if(!y||y.trim()===""){N("No recording data available for this session"),w(!1);return}if(n.current){r.open(n.current);try{u.fit()}catch{}}const D=y.split(`
`).filter(L=>L.trim()),S=[];for(const L of D)try{const h=JSON.parse(L);Array.isArray(h)&&h.length>=3&&S.push({time:h[0],eventType:h[1],data:h[2]})}catch{}if(S.length===0){r.write(y),j(100),w(!1);return}w(!1);const P=S[S.length-1].time;let R=0,k=0;const C=()=>{if(O||R>=S.length){j(100);return}const L=S[R],h=(L.time-k)*1e3;k=L.time,R++;const f=Math.min(h,2e3);g.current=setTimeout(()=>{O||(r.write(L.data),j(Math.round(L.time/P*100)),C())},f)};C()}).catch(x=>{O||(console.error("[Replay] Load failed:",x),N("Failed to load recording data"),w(!1))}),()=>{O=!0,g.current&&clearTimeout(g.current);try{r.dispose()}catch{}p.current=null}},[s,d]),e.jsx(pe,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:i,children:e.jsxs(xe,{"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(he,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",d??"",T>0&&T<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[T,"%"]})]}),e.jsx(ue,{"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:[m&&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(ge,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),b&&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:b})}),T>0&&T<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:`${T}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:n,className:"absolute inset-0 p-1"})]})]})})}function Xe({open:s,onOpenChange:i,sessionId:d,sessionInfo:n}){const p=a.useRef(null),g=a.useRef(null),m=a.useRef(null),w=a.useRef(null),[b,N]=a.useState(!1),[T,j]=a.useState(""),[r,u]=a.useState(n||null);a.useEffect(()=>{s||(N(!1),j(""))},[s]),a.useEffect(()=>{if(!s||!d)return;N(!1),j("");const x=new Ae.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"#264f78",black:"#1a1a2e",red:"#ff6b6b",green:"#69db7c",yellow:"#ffd43b",blue:"#4dabf7",magenta:"#da77f2",cyan:"#63e6be",white:"#d6d6d6",brightBlack:"#4a4a4a",brightRed:"#ff8787",brightGreen:"#8ce99a",brightYellow:"#ffe066",brightBlue:"#74c0fc",brightMagenta:"#e599f7",brightCyan:"#7ae5d5",brightWhite:"#f8f9fa"}}),y=new ve.FitAddon;x.loadAddon(y),g.current=x,m.current=y;const D=()=>{const h=p.current;if(!h){requestAnimationFrame(D);return}x.open(h);try{y.fit()}catch{}},S=_e.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),R=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${d}?token=${encodeURIComponent(S)}`;console.log("[LiveMonitor] Connecting to:",R.replace(/token=[^&]+/,"token=***"));const k=new WebSocket(R);w.current=k;let C=!1;k.onopen=()=>{console.log("[LiveMonitor] WS connected for session:",d),C=!0,N(!0),j(""),D(),x.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},k.onmessage=h=>{try{const f=JSON.parse(h.data);switch(f.type){case"session_info":u(f.payload),x.writeln(`\x1B[36m用户: ${f.payload.username} 服务器: ${f.payload.server_name}\x1B[0m`);break;case"history":f.data&&x.write(f.data);break;case"output":f.data&&x.write(f.data);break}}catch{}},k.onerror=h=>{console.log("[LiveMonitor] WS error:",h),j("WebSocket 连接失败")},k.onclose=h=>{console.log("[LiveMonitor] WS closed code:",h.code,"reason:",h.reason),C||j(`连接失败 (code=${h.code}): ${h.reason||"认证失败或网络问题"}`),N(!1),x.writeln(`\r
\x1B[33m[审计监控] 连接已断开\x1B[0m`)};const L=setTimeout(()=>{C||(j("连接超时 — 请确认已登录且有活跃会话"),k.close())},5e3);return()=>{clearTimeout(L),k.close(),x.dispose(),g.current=null,m.current=null,w.current=null,N(!1)}},[s,d]),a.useEffect(()=>{if(!s)return;const x=p.current;if(!x)return;let y;const D=new ResizeObserver(()=>{clearTimeout(y),y=setTimeout(()=>{try{m.current?.fit()}catch{}},60)});return D.observe(x),()=>{clearTimeout(y),D.disconnect()}},[s,d]);const O=x=>x?new Date(x).toLocaleString():"--";return e.jsx(pe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:223:5",open:s,onOpenChange:i,children:e.jsxs(xe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:224:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-[95vw] max-h-[90vh] w-[1200px]",children:[e.jsxs(he,{"code-path":"src/components/system/LiveMonitorDialog.tsx:225:9",children:[e.jsxs(me,{"code-path":"src/components/system/LiveMonitorDialog.tsx:226:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:227:13",className:"h-5 w-5 text-emerald-400"}),"终端实时监控",b&&e.jsx(_,{"code-path":"src/components/system/LiveMonitorDialog.tsx:230:15",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10 ml-2 text-xs",children:"● 在线"}),!b&&!T&&e.jsxs(_,{"code-path":"src/components/system/LiveMonitorDialog.tsx:235:15",variant:"outline",className:"border-yellow-500/30 text-yellow-400 bg-yellow-500/10 ml-2 text-xs",children:[e.jsx(ge,{"code-path":"src/components/system/LiveMonitorDialog.tsx:236:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),T&&e.jsx(_,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 ml-2 text-xs",children:"连接失败"})]}),e.jsx(ue,{"code-path":"src/components/system/LiveMonitorDialog.tsx:246:11",className:"text-[var(--dg-text-secondary)]",children:r&&e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:248:15",className:"flex items-center gap-4 text-xs mt-1 flex-wrap",children:[e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:249:17",className:"flex items-center gap-1",children:[e.jsx(De,{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:19",className:"h-3 w-3"}),r.username]}),e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:253:17",className:"flex items-center gap-1",children:[e.jsx(Re,{"code-path":"src/components/system/LiveMonitorDialog.tsx:254:19",className:"h-3 w-3"}),r.server_name," (",r.server_ip,")"]}),e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:257:17",className:"flex items-center gap-1",children:[e.jsx(Me,{"code-path":"src/components/system/LiveMonitorDialog.tsx:258:19",className:"h-3 w-3"}),O(r.start_time)]})]})})]}),T&&e.jsx("p",{"code-path":"src/components/system/LiveMonitorDialog.tsx:267:11",className:"text-sm text-red-400 px-1",children:T}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:270:9",ref:p,className:"w-full rounded-md overflow-hidden border border-[var(--dg-border)]",style:{height:"55vh"}})]})})}function ye(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const i=Math.floor(s/60),d=s%60;if(i<60)return`${i}分${d>0?`${d}秒`:""}`;const n=Math.floor(i/60),p=i%60;return`${n}时${p>0?`${p}分`:""}`}function Ve(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function Le(s){return s==="active"?e.jsxs(_,{"code-path":"src/pages/TerminalAuditTab.tsx:86:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/TerminalAuditTab.tsx:87:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(_,{"code-path":"src/pages/TerminalAuditTab.tsx:94:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(_,{"code-path":"src/pages/TerminalAuditTab.tsx:100:5",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:"已关闭"})}function Ye(s){const[i,d]=a.useState(0);return a.useEffect(()=>{if(!s)return;const n=new Date(s).getTime(),p=()=>d(Math.floor((Date.now()-n)/1e3));p();const g=setInterval(p,1e3);return()=>clearInterval(g)},[s]),i}const Qe=[{id:"active",name:"在线会话",icon:Te},{id:"history",name:"历史会话",icon:Y},{id:"commands",name:"会话命令",icon:B}];function de(){const s=be(),[i,d]=a.useState("active"),[n,p]=a.useState([]),[g,m]=a.useState(!0),[w,b]=a.useState(""),[N,T]=a.useState([]),[j,r]=a.useState(!0),[u,O]=a.useState(""),[x,y]=a.useState(null),[D,S]=a.useState(!1),[P,R]=a.useState([]),[k,C]=a.useState(!0),[L,h]=a.useState(""),[f,Q]=a.useState(""),[Z,c]=a.useState(!1),[M,ee]=a.useSta Line truncated
@@ -1 +1 @@
import{g as a,B as i,X as s,Y as t,f as e}from"./generateCategoricalChart-ZqCvxO-S.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
import{g as a,B as i,X as s,Y as t,f as e}from"./generateCategoricalChart-BeO9rjxr.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
@@ -1 +0,0 @@
import{g as a,B as i,X as s,Y as t,f as e}from"./generateCategoricalChart-B9iVh1fX.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
@@ -1 +0,0 @@
import{g as a,B as i,X as s,Y as t,f as e}from"./generateCategoricalChart-DrSMejeS.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
@@ -1 +0,0 @@
import{k as E,m as D,r as c,j as e,n as k,o as j,J as H,B as P,p as N}from"./index-Dmami9WE.js";import{C as L,a as M}from"./card-CIfC-8Rh.js";import{B as z}from"./badge-3UzCvU7L.js";import{S as f,a as v,b as S,c as w,d as x}from"./select-DUbxjT0z.js";import{T as U,a as F,b as d,c as r,d as I,e as n}from"./table-CG4mjNfb.js";import{k as p}from"./kubernetes-D2-GnE0t.js";import{R as J}from"./refresh-cw-CTBERyFc.js";import{D as G}from"./download-Vuij9wGr.js";import{H as _}from"./hard-drive-DmC04Y5r.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";function ce(){const{clusterCode:$}=E(),h=D(),[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(j,{"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(j,{"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(H,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(w,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(w,{"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(P,{"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(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(P,{"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(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CLine truncated
@@ -1 +0,0 @@
import{k as E,m as D,r as c,j as e,n as k,o as j,J as H,B as P,p as N}from"./index-CwVkcMR-.js";import{C as L,a as M}from"./card-C5qBu7CR.js";import{B as z}from"./badge-DgJ0w7jf.js";import{S as f,a as v,b as S,c as w,d as x}from"./select-CGtvCG8I.js";import{T as U,a as F,b as d,c as r,d as I,e as n}from"./table-X8m9Cp5H.js";import{k as p}from"./index-DK2BjZ0M.js";import{R as J}from"./refresh-cw-DM6JPbZg.js";import{D as G}from"./download-BgEJ-n5L.js";import{H as _}from"./hard-drive-CGq_SnM5.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";function ce(){const{clusterCode:$}=E(),h=D(),[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(j,{"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(j,{"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(H,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(w,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(w,{"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(P,{"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(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(P,{"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(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]}Line truncated
@@ -1 +1 @@
import{k as E,m as D,r as c,j as e,n as k,o as j,K as H,B as P,p as N}from"./index-HuRw9UhJ.js";import{C as L,a as M}from"./card-B2Wqa0sK.js";import{B as z}from"./badge-CeS-g-Od.js";import{S as f,a as v,b as S,c as w,d as x}from"./select-KDzbUQs3.js";import{T as U,a as F,b as d,c as r,d as I,e as n}from"./table-Du1vU-OM.js";import{k as p}from"./index-GZwpRmKU.js";import{R as K}from"./refresh-cw-CSycAyA2.js";import{D as G}from"./download-CjFatm64.js";import{H as _}from"./hard-drive-laLCm9TI.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";function ce(){const{clusterCode:$}=E(),h=D(),[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(j,{"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(j,{"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(H,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(w,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(w,{"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(P,{"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(K,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(P,{"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(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]}Line truncated
import{k as E,m as D,r as c,j as e,n as k,o as j,K as H,B as P,p as N}from"./index-o4rKtKfJ.js";import{C as L,a as M}from"./card-6Ae5ROGi.js";import{B as z}from"./badge-CDGsL4jH.js";import{S as f,a as v,b as S,c as w,d as x}from"./select-DuV0kIrj.js";import{T as U,a as F,b as d,c as r,d as I,e as n}from"./table-FZ6-yFwR.js";import{k as p}from"./index-BZgsOVD1.js";import{R as K}from"./refresh-cw-eQ6GkWW0.js";import{D as G}from"./download-Gr2Xr683.js";import{H as _}from"./hard-drive-P-ztZBRa.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";function ce(){const{clusterCode:$}=E(),h=D(),[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(j,{"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(j,{"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(H,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(w,{"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(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(v,{"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(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(w,{"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(P,{"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(K,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(P,{"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(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]}Line truncated
@@ -0,0 +1 @@
import{j as e,r as a,B as d,a4 as _,D as R,a as W,b as Q,c as V,s as $,d as G,e as X,L as Z}from"./index-o4rKtKfJ.js";import{I as h}from"./input-BfBi0wR2.js";import{L as u}from"./label-DrX9VaVC.js";import{C as N,a as y}from"./card-6Ae5ROGi.js";import{B as A}from"./badge-CDGsL4jH.js";import{c as v}from"./account-BE9llC-P.js";import{R as F}from"./refresh-cw-eQ6GkWW0.js";import{P as S}from"./plus-BXcAPnTg.js";import{S as q}from"./search-C_UCkHB_.js";import{C as J}from"./circle-check-Bp6gonk8.js";import{C as U}from"./circle-x-DCq7zPbk.js";import{P as k}from"./pencil-DNq-pnlG.js";import{T as Y}from"./trash-2-C2Niwqae.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",colorLine truncated
@@ -1 +0,0 @@
import{j as e,r as a,B as d,Z as _,D as R,a as W,b as Q,c as V,s as Z,d as $,e as G,L as X}from"./index-HuRw9UhJ.js";import{I as h}from"./input-C9Xfv8um.js";import{L as u}from"./label-DvRDtaMA.js";import{C as N,a as y}from"./card-B2Wqa0sK.js";import{B as A}from"./badge-CeS-g-Od.js";import{c as v}from"./cloud-sEaHmpLm.js";import{R as F}from"./refresh-cw-CSycAyA2.js";import{P as S}from"./plus-BVwIGPvl.js";import{S as q}from"./search-CcKEpJIn.js";import{C as J}from"./circle-check-C5nUiTvE.js";import{C as U}from"./circle-x-BVvXVx7p.js";import{P as k}from"./pencil-BZ7zX3m0.js";import{T as Y}from"./trash-2-Cf9-88KL.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:"#Line truncated
@@ -1 +0,0 @@
import{j as e,r as a,B as d,Y as _,D as R,a as W,b as Q,c as V,s as $,d as G,e as X,L as Y}from"./index-CwVkcMR-.js";import{I as h}from"./input-B5ad6Rfz.js";import{L as u}from"./label-mg-tHjNc.js";import{C as N,a as y}from"./card-C5qBu7CR.js";import{B as A}from"./badge-DgJ0w7jf.js";import{c as v}from"./cloud--X6XAPv_.js";import{R as F}from"./refresh-cw-DM6JPbZg.js";import{P as S}from"./plus-CaJ-dB4A.js";import{S as Z}from"./search-1PdnG-g5.js";import{C as q}from"./circle-check-DTBW_8Wd.js";import{C as J}from"./circle-x-DBoylLde.js";import{P as k}from"./pencil-OnUdgX3e.js";import{T as U}from"./trash-2-BPpnm3Sz.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:"#Line truncated
@@ -1 +0,0 @@
import{j as e,r as a,B as d,Y as _,D as R,a as W,b as Q,c as V,s as $,d as G,e as X,L as Y}from"./index-Dmami9WE.js";import{I as h}from"./input-NsU9nXZF.js";import{L as u}from"./label-Ap_-SPYI.js";import{C as N,a as y}from"./card-CIfC-8Rh.js";import{B as A}from"./badge-3UzCvU7L.js";import{c as v}from"./cloud-Dq4kl-JO.js";import{R as F}from"./refresh-cw-CTBERyFc.js";import{P as S}from"./plus-O65gX7Qz.js";import{S as Z}from"./search-Dd-PeBfg.js";import{C as q}from"./circle-check-CVbTTFQ0.js";import{C as J}from"./circle-x-BBQeW1R3.js";import{P as k}from"./pencil-BYahlvYT.js";import{T as U}from"./trash-2-DWVnIU6o.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:"#Line truncated
@@ -1 +0,0 @@
import{i as ve,j as e,r as c,D as X,a as Y,b as Z,c as ee,d as se,e as le,B as u,L as R,f as Ne,H as A}from"./index-Dmami9WE.js";import{I as j}from"./input-NsU9nXZF.js";import{L as r}from"./label-Ap_-SPYI.js";import{C as T,a as V}from"./card-CIfC-8Rh.js";import{B as fe}from"./badge-3UzCvU7L.js";import{S as oe}from"./switch-TqjD2x0W.js";import{S as w,a as S,b as k,c as _,d as x}from"./select-DUbxjT0z.js";import{t as p}from"./index-BuEnLCjT.js";import{b as h}from"./cloud-Dq4kl-JO.js";import{S as be}from"./stat-strip-BteRU1Iu.js";import{R as q}from"./refresh-cw-CTBERyFc.js";import{P as G}from"./plus-O65gX7Qz.js";import{P as J}from"./pencil-BYahlvYT.js";import{T as K}from"./trash-2-DWVnIU6o.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const De=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ye=ve("wallet",De),v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},O={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 Re({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 we({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(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDiaLine truncated
@@ -1 +0,0 @@
import{i as ve,j as e,r as c,D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,L as R,t as p,f as Ne,J as H}from"./index-HuRw9UhJ.js";import{I as j}from"./input-C9Xfv8um.js";import{L as r}from"./label-DvRDtaMA.js";import{C as T,a as V}from"./card-B2Wqa0sK.js";import{B as fe}from"./badge-CeS-g-Od.js";import{S as oe}from"./switch--ZaqVsRJ.js";import{S as w,a as S,b as k,c as _,d as x}from"./select-KDzbUQs3.js";import{b as h}from"./cloud-sEaHmpLm.js";import{S as be}from"./stat-strip-CVviXwc6.js";import{R as q}from"./refresh-cw-CSycAyA2.js";import{P as J}from"./plus-BVwIGPvl.js";import{P as G}from"./pencil-BZ7zX3m0.js";import{T as K}from"./trash-2-Cf9-88KL.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const De=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ye=ve("wallet",De),v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},O={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 Re({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 we({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(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(_,{"codLine truncated
@@ -1 +0,0 @@
import{i as ve,j as e,r as c,D as X,a as Y,b as Z,c as ee,d as se,e as le,B as u,L as R,f as Ne,H as A}from"./index-CwVkcMR-.js";import{I as j}from"./input-B5ad6Rfz.js";import{L as r}from"./label-mg-tHjNc.js";import{C as T,a as V}from"./card-C5qBu7CR.js";import{B as fe}from"./badge-DgJ0w7jf.js";import{S as oe}from"./switch-DYr_nGop.js";import{S as w,a as S,b as k,c as _,d as x}from"./select-CGtvCG8I.js";import{t as p}from"./index-Dxvx0mlR.js";import{b as h}from"./cloud--X6XAPv_.js";import{S as be}from"./stat-strip-CGgDVYxa.js";import{R as q}from"./refresh-cw-DM6JPbZg.js";import{P as G}from"./plus-CaJ-dB4A.js";import{P as J}from"./pencil-OnUdgX3e.js";import{T as K}from"./trash-2-BPpnm3Sz.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const De=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ye=ve("wallet",De),v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},O={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 Re({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 we({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(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDiaLine truncated
@@ -0,0 +1 @@
import{i as ve,j as e,r as c,D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,L as R,t as p,f as Ne,J as H}from"./index-o4rKtKfJ.js";import{I as j}from"./input-BfBi0wR2.js";import{L as r}from"./label-DrX9VaVC.js";import{C as T,a as V}from"./card-6Ae5ROGi.js";import{B as fe}from"./badge-CDGsL4jH.js";import{S as oe}from"./switch-Dqj5wqUV.js";import{S as w,a as S,b as k,c as _,d as x}from"./select-DuV0kIrj.js";import{b as h}from"./billing-BAdZ35V9.js";import{S as be}from"./stat-strip-DYcHo9Kj.js";import{R as q}from"./refresh-cw-eQ6GkWW0.js";import{P as J}from"./plus-BXcAPnTg.js";import{P as G}from"./pencil-DNq-pnlG.js";import{T as K}from"./trash-2-C2Niwqae.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const De=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ye=ve("wallet",De),v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},O={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 Re({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 we({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(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(_,{"cLine truncated
@@ -1 +0,0 @@
import{k as F,m as K,r as c,j as e,n as w,o as C,B as G,L as A,p as k,q as R,S as T,s as H,A as q,t as z,v as D}from"./index-Dmami9WE.js";import{C as i,a as u}from"./card-CIfC-8Rh.js";import{B as M}from"./badge-3UzCvU7L.js";import{T as J,a as Q,b as x,c as n,d as V,e as a}from"./table-CG4mjNfb.js";import{k as j}from"./kubernetes-D2-GnE0t.js";import{u as W}from"./use-toast-jvSbBx20.js";import{R as X}from"./refresh-cw-CTBERyFc.js";const Y={"kube-system":T,"kube-public":z,"kube-node-lease":q,default:H};function ne(){const{clusterCode:r}=F(),B=K(),{toast:E}=W(),[,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 j.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([j.getNodes(r).catch(()=>[]),j.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(C,{"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(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(X,{"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(k,{"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.Line truncated
@@ -1 +0,0 @@
import{k as F,m as K,r as c,j as e,n as w,o as C,B as G,L as A,p as k,q as R,S as T,s as H,A as q,v as z,w as D}from"./index-HuRw9UhJ.js";import{C as i,a as u}from"./card-B2Wqa0sK.js";import{B as M}from"./badge-CeS-g-Od.js";import{T as J,a as Q,b as x,c as n,d as V,e as a}from"./table-Du1vU-OM.js";import{k as j}from"./index-GZwpRmKU.js";import{u as W}from"./use-toast-B25j_Fg3.js";import{R as X}from"./refresh-cw-CSycAyA2.js";const Y={"kube-system":T,"kube-public":z,"kube-node-lease":q,default:H};function ne(){const{clusterCode:r}=F(),B=K(),{toast:E}=W(),[,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 j.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([j.getNodes(r).catch(()=>[]),j.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(C,{"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(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(X,{"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(k,{"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(RLine truncated
@@ -1 +1 @@
import{k as F,m as K,r as c,j as e,n as w,o as C,B as G,L as A,p as k,q as R,S as T,s as H,A as q,t as z,v as D}from"./index-CwVkcMR-.js";import{C as i,a as u}from"./card-C5qBu7CR.js";import{B as M}from"./badge-DgJ0w7jf.js";import{T as J,a as Q,b as x,c as n,d as V,e as a}from"./table-X8m9Cp5H.js";import{k as j}from"./index-DK2BjZ0M.js";import{u as W}from"./use-toast-C8N6561m.js";import{R as X}from"./refresh-cw-DM6JPbZg.js";const Y={"kube-system":T,"kube-public":z,"kube-node-lease":q,default:H};function ne(){const{clusterCode:r}=F(),B=K(),{toast:E}=W(),[,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 j.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([j.getNodes(r).catch(()=>[]),j.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(C,{"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(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(X,{"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(k,{"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(RLine truncated
import{k as F,m as K,r as c,j as e,n as w,o as C,B as G,L as A,p as k,q as R,S as T,s as H,A as q,v as z,w as D}from"./index-o4rKtKfJ.js";import{C as i,a as u}from"./card-6Ae5ROGi.js";import{B as M}from"./badge-CDGsL4jH.js";import{T as J,a as Q,b as x,c as n,d as V,e as a}from"./table-FZ6-yFwR.js";import{k as j}from"./index-BZgsOVD1.js";import{u as W}from"./use-toast-A4ENhXFA.js";import{R as X}from"./refresh-cw-eQ6GkWW0.js";const Y={"kube-system":T,"kube-public":z,"kube-node-lease":q,default:H};function ne(){const{clusterCode:r}=F(),B=K(),{toast:E}=W(),[,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 j.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([j.getNodes(r).catch(()=>[]),j.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(C,{"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(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(X,{"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(k,{"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(RLine truncated
@@ -1 +0,0 @@
import{f as st,r as a,t as h,j as e,B as b,v as qe,G as rt,E as nt,s as ot,w as ct,S as dt,Z as V,C as lt,D as ze,a as Be,b as Ge,c as Ue,d as pt,e as $e,T as it,_ as Ye,P as Qe,$ as xt}from"./index-HuRw9UhJ.js";import{I as p}from"./input-C9Xfv8um.js";import{L as l}from"./label-DvRDtaMA.js";import{B as S}from"./badge-CeS-g-Od.js";import{S as Ke,a as Ae,b as De,c as Pe,d as _}from"./select-KDzbUQs3.js";import{c as I}from"./credential-snjgV65G.js";import{R as mt}from"./refresh-cw-CSycAyA2.js";import{P as Re}from"./plus-BVwIGPvl.js";import{S as gt}from"./search-CcKEpJIn.js";import{Z as ht}from"./zap-CS68N0Jd.js";import{F as yt}from"./file-text-BqORyhNh.js";import{P as vt}from"./pencil-BZ7zX3m0.js";import{C as Ze}from"./circle-x-BVvXVx7p.js";import{C as We}from"./circle-check-C5nUiTvE.js";import{T as Ct}from"./trash-2-Cf9-88KL.js";import{C as Ve}from"./copy-Ci4WwJkK.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const O={ssh:{label:"SSH 密钥",icon:dt,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ct,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:qe,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:ot,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:nt,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:rt,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:yt,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},Xe={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 ut({open:j,onClose:M,credId:k}){const[n,g]=a.useState(null),[T,y]=a.useState(!1),[E,w]=a.useState({});if(a.useEffect(()=>{!k||!j||(y(!0),I.get(k).then(d=>{g(d)}).catch(()=>h.error("加载详情失败")).finally(()=>y(!1)))},[k,j]),!j||!k)return null;const c=d=>w(i=>({...i,[d]:!i[d]})),K=d=>{navigator.clipboard.writeText(d),h.success("已复制")},x=n?.secret_type,v=O[x],r=n?.content||{},o=({label:d,value:i,sensitive:m,fieldKey:A})=>{if(i==null||i==="")return null;const L=typeof i=="string"&&i.length>80,D=A?E[A]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:107:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:108:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(xt,{"code-path":"src/components/deploy/CredentialManager.tsx:109:11",className:"h-3 w-3"}),d]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"flex gap-1",children:[L?e.jsx("textarea",{"code-path":"src/components/deploy/CredentialManager.tsx:113:13",readOnly:!0,value:m&&!D?"••••••••":i,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/CredentialManager.tsx:117:13",readOnly:!0,value:m&&!D?"••••••••":String(i),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/CredentialManager.tsx:120:11",className:"flex flex-col gap-0.5 shrink-0",children:[m&&e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:122:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c(A),children:D?e.jsx(Ye,{"code-path":"src/components/deploy/CredentialManager.tsx:123:25",className:"h-3 w-3"}):e.jsx(Qe,{"code-path":"src/components/deploy/CredentialManager.tsx:123:58",className:"h-3 w-3"})}),e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>K(String(i)),children:e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",className:"h-3 w-3"})})]})]})]})};return e.jsx(ze,{"code-path":"src/components/deploy/CredentialManager.tsx:136:5",open:j,onOpenChange:M,children:e.jsxs(Be,{"code-path":"src/components/deploy/CredentialManager.tsx:137: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/CredentialManager.tsx:138:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/CredentialManager.tsx:139:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[v?e.jsx(v.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:140:20",className:`h-5 w-5 ${v.color}`}):e.jsx(VLine truncated
@@ -1 +0,0 @@
import{f as st,r as a,h as I,j as e,B as b,t as $e,G as rt,z as nt,s as ot,v as ct,S as dt,Y as V,C as lt,D as qe,a as ze,b as Be,c as Ue,d as pt,e as Ge,T as it,Z as Ye,O as Qe,_ as xt}from"./index-Dmami9WE.js";import{I as p}from"./input-NsU9nXZF.js";import{L as l}from"./label-Ap_-SPYI.js";import{B as S}from"./badge-3UzCvU7L.js";import{S as Ke,a as De,b as Ae,c as Pe,d as _}from"./select-DUbxjT0z.js";import{t as y}from"./index-BuEnLCjT.js";import{R as mt}from"./refresh-cw-CTBERyFc.js";import{P as Re}from"./plus-O65gX7Qz.js";import{S as gt}from"./search-Dd-PeBfg.js";import{Z as ht}from"./zap-CocSkPPl.js";import{F as yt}from"./file-text-CebshSV-.js";import{P as vt}from"./pencil-BYahlvYT.js";import{C as Ze}from"./circle-x-BBQeW1R3.js";import{C as We}from"./circle-check-CVbTTFQ0.js";import{T as Ct}from"./trash-2-DWVnIU6o.js";import{C as Ve}from"./copy-CE_T92Lk.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const O={ssh:{label:"SSH 密钥",icon:dt,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ct,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:$e,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:ot,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:nt,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:rt,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:yt,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},Xe={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 ut({open:j,onClose:M,credId:k}){const[n,h]=a.useState(null),[T,v]=a.useState(!1),[E,w]=a.useState({});if(a.useEffect(()=>{!k||!j||(v(!0),I.get(`/credentials/${k}`).then(d=>{h(d)}).catch(()=>y.error("加载详情失败")).finally(()=>v(!1)))},[k,j]),!j||!k)return null;const c=d=>w(i=>({...i,[d]:!i[d]})),K=d=>{navigator.clipboard.writeText(d),y.success("已复制")},x=n?.secret_type,C=O[x],r=n?.content||{},o=({label:d,value:i,sensitive:m,fieldKey:D})=>{if(i==null||i==="")return null;const L=typeof i=="string"&&i.length>80,A=D?E[D]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:107:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:108:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(xt,{"code-path":"src/components/deploy/CredentialManager.tsx:109:11",className:"h-3 w-3"}),d]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"flex gap-1",children:[L?e.jsx("textarea",{"code-path":"src/components/deploy/CredentialManager.tsx:113:13",readOnly:!0,value:m&&!A?"••••••••":i,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/CredentialManager.tsx:117:13",readOnly:!0,value:m&&!A?"••••••••":String(i),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/CredentialManager.tsx:120:11",className:"flex flex-col gap-0.5 shrink-0",children:[m&&e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:122:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c(D),children:A?e.jsx(Ye,{"code-path":"src/components/deploy/CredentialManager.tsx:123:25",className:"h-3 w-3"}):e.jsx(Qe,{"code-path":"src/components/deploy/CredentialManager.tsx:123:58",className:"h-3 w-3"})}),e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>K(String(i)),children:e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",className:"h-3 w-3"})})]})]})]})};return e.jsx(qe,{"code-path":"src/components/deploy/CredentialManager.tsx:136:5",open:j,onOpenChange:M,children:e.jsxs(ze,{"code-path":"src/components/deploy/CredentialManager.tsx:137:7",className:"sm:max-w-[680px] max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/CredentialManager.tsx:138:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/CredentialManager.tsx:139:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[C?e.jsx(C.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:140:20",className:`h-5 w-5 ${C.coloLine truncated
@@ -1 +0,0 @@
import{f as st,r as a,j as e,B as b,t as qe,G as rt,z as nt,s as ot,v as ct,S as dt,Y as V,C as lt,D as ze,a as Be,b as Ge,c as Ue,d as pt,e as $e,T as it,Z as Ye,O as Qe,_ as xt}from"./index-CwVkcMR-.js";import{I as p}from"./input-B5ad6Rfz.js";import{L as l}from"./label-mg-tHjNc.js";import{B as S}from"./badge-DgJ0w7jf.js";import{S as Ke,a as Ae,b as De,c as Pe,d as _}from"./select-CGtvCG8I.js";import{t as h}from"./index-Dxvx0mlR.js";import{c as I}from"./deploy-C6PfjuUR.js";import{R as mt}from"./refresh-cw-DM6JPbZg.js";import{P as Re}from"./plus-CaJ-dB4A.js";import{S as gt}from"./search-1PdnG-g5.js";import{Z as ht}from"./zap-Dr77-_Z_.js";import{F as yt}from"./file-text-DGoBtmAr.js";import{P as vt}from"./pencil-OnUdgX3e.js";import{C as Ze}from"./circle-x-DBoylLde.js";import{C as We}from"./circle-check-DTBW_8Wd.js";import{T as Ct}from"./trash-2-BPpnm3Sz.js";import{C as Ve}from"./copy-CKzeWvtb.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const O={ssh:{label:"SSH 密钥",icon:dt,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ct,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:qe,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:ot,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:nt,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:rt,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:yt,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},Xe={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 ut({open:j,onClose:M,credId:k}){const[n,g]=a.useState(null),[T,y]=a.useState(!1),[E,w]=a.useState({});if(a.useEffect(()=>{!k||!j||(y(!0),I.get(k).then(d=>{g(d)}).catch(()=>h.error("加载详情失败")).finally(()=>y(!1)))},[k,j]),!j||!k)return null;const c=d=>w(i=>({...i,[d]:!i[d]})),K=d=>{navigator.clipboard.writeText(d),h.success("已复制")},x=n?.secret_type,v=O[x],r=n?.content||{},o=({label:d,value:i,sensitive:m,fieldKey:A})=>{if(i==null||i==="")return null;const L=typeof i=="string"&&i.length>80,D=A?E[A]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:107:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:108:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(xt,{"code-path":"src/components/deploy/CredentialManager.tsx:109:11",className:"h-3 w-3"}),d]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"flex gap-1",children:[L?e.jsx("textarea",{"code-path":"src/components/deploy/CredentialManager.tsx:113:13",readOnly:!0,value:m&&!D?"••••••••":i,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/CredentialManager.tsx:117:13",readOnly:!0,value:m&&!D?"••••••••":String(i),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/CredentialManager.tsx:120:11",className:"flex flex-col gap-0.5 shrink-0",children:[m&&e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:122:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>c(A),children:D?e.jsx(Ye,{"code-path":"src/components/deploy/CredentialManager.tsx:123:25",className:"h-3 w-3"}):e.jsx(Qe,{"code-path":"src/components/deploy/CredentialManager.tsx:123:58",className:"h-3 w-3"})}),e.jsx(b,{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>K(String(i)),children:e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",className:"h-3 w-3"})})]})]})]})};return e.jsx(ze,{"code-path":"src/components/deploy/CredentialManager.tsx:136:5",open:j,onOpenChange:M,children:e.jsxs(Be,{"code-path":"src/components/deploy/CredentialManager.tsx:137: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/CredentialManager.tsx:138:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/CredentialManager.tsx:139:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[v?e.jsx(v.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:140:20",className:`Line truncated
@@ -0,0 +1 @@
import{aj as na,G as ca,E as da,s as la,v as ze,w as ia,S as pa,r as t,j as e,D as Be,a as Ge,b as Ue,c as Qe,a4 as z,T as ma,e as $e,B as N,t as S,aO as xa,aP as Ye,P as Ze,d as ga,f as ha,C as ya}from"./index-o4rKtKfJ.js";import{I as p}from"./input-BfBi0wR2.js";import{B as w}from"./badge-CDGsL4jH.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-DuV0kIrj.js";import{u as We,q as Xe,a as va}from"./unwrap-D0DvYxvf.js";import{u as V}from"./useMutation-B7xoUHzt.js";import{c as P}from"./credential-Cg1BP64k.js";import{F as Ca}from"./file-text-KcpAjpkr.js";import{C as Je}from"./circle-check-Bp6gonk8.js";import{C as ea}from"./circle-x-DCq7zPbk.js";import{C as Re}from"./copy-NHEH4ztb.js";import{L as i}from"./label-DrX9VaVC.js";import{R as ua}from"./refresh-cw-eQ6GkWW0.js";import{P as Ve}from"./plus-BXcAPnTg.js";import{S as Da}from"./search-C_UCkHB_.js";import{Z as ba}from"./zap-BPZOchcR.js";import{P as ja}from"./pencil-DNq-pnlG.js";import{T as Na}from"./trash-2-C2Niwqae.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";function fa(c={page_size:100}){return We({queryKey:Xe.credentials(c),queryFn:async()=>{const d=await P.list(c);return va(d)},staleTime:3e4})}function Fa(c,d=!0){return We({queryKey:Xe.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:pa,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ia,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:la,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:da,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:ca,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:Ca,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(xa,{"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(Ye,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(Ze,{"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",clasLine truncated
@@ -1,2 +0,0 @@
import{j as t,L as k,P as lt,r as n,D as X,a as G,b as K,c as U,d as W,e as mt,B as p,E as Y,f as dt,C as xt,F as pt}from"./index-CwVkcMR-.js";import{C as ht,a as gt}from"./card-C5qBu7CR.js";import{S as ut}from"./stat-strip-CGgDVYxa.js";import{I as L}from"./input-B5ad6Rfz.js";import{B as C}from"./badge-DgJ0w7jf.js";import{C as I}from"./checkbox-CbtT7pld.js";import{t as l}from"./index-Dxvx0mlR.js";import{s as $,c as y,t as bt}from"./automation-CscX6ZsM.js";import{C as vt}from"./circle-x-DBoylLde.js";import{S as B,a as z,b as O,c as R,d as J}from"./select-CGtvCG8I.js";import{T as A}from"./textarea-BZOXMpxW.js";import{L as N}from"./label-mg-tHjNc.js";import{T as yt,a as Ct,b as P,c as w,d as jt,e as f}from"./table-X8m9Cp5H.js";import{H as Z}from"./history-DUPeIzQi.js";import{R as Jt}from"./refresh-cw-DM6JPbZg.js";import{P as Nt}from"./plus-CaJ-dB4A.js";import{S as ft}from"./search-1PdnG-g5.js";import{T as V}from"./trash-2-BPpnm3Sz.js";import{P as Dt}from"./package-open-DHWz2zZW.js";import{P as Q}from"./play-_cqG4jyc.js";import{P as Ft}from"./pause-CoEPLyJU.js";import{S as Mt}from"./square-pen-C8Ol72WC.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.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(lt,{"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(vt,{"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,m]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,d]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(m({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=>{d(e)}).catch(()=>d(null)):d(null)):(m({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),d(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&&(d(x),m(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{m(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),d(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:Line truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>m({...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(mt,{"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,m]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{m(!0);const d=await bt.getExecutions({task_type:"cron",page_size:50});D(d.list||[])}catch(d){console.error("Failed to load executions:",d)}finally{m(!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(Z,{"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(yt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ct,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(P,{"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(jt,{"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(P,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
@@ -1,2 +1,2 @@
import{j as t,L as k,Q as lt,r as n,D as X,a as G,b as K,c as U,d as W,e as mt,B as p,t as l,H as Y,f as dt,C as xt,F as pt}from"./index-HuRw9UhJ.js";import{C as ht,a as gt}from"./card-B2Wqa0sK.js";import{S as ut}from"./stat-strip-CVviXwc6.js";import{I as P}from"./input-C9Xfv8um.js";import{B as C}from"./badge-CeS-g-Od.js";import{C as I}from"./checkbox-B7nWBaO4.js";import{s as $,c as y,t as bt}from"./automation-B8G9u7Xj.js";import{C as vt}from"./circle-x-BVvXVx7p.js";import{S as B,a as z,b as O,c as R,d as J}from"./select-KDzbUQs3.js";import{T as A}from"./textarea-Bzol9o6k.js";import{L as N}from"./label-DvRDtaMA.js";import{T as yt,a as Ct,b as L,c as w,d as jt,e as f}from"./table-Du1vU-OM.js";import{H as Z}from"./history-CLAzTAyT.js";import{R as Jt}from"./refresh-cw-CSycAyA2.js";import{P as Nt}from"./plus-BVwIGPvl.js";import{S as ft}from"./search-CcKEpJIn.js";import{T as Q}from"./trash-2-Cf9-88KL.js";import{P as Dt}from"./package-open-DtPFmjqV.js";import{P as V}from"./play-BXdOitsb.js";import{P as Ft}from"./pause-R-v_3hMV.js";import{S as Mt}from"./square-pen-DoCLytAo.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.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(lt,{"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(vt,{"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,m]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,d]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(m({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=>{d(e)}).catch(()=>d(null)):d(null)):(m({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),d(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&&(d(x),m(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{m(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),d(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-Line truncated
import{j as t,L as k,Q as lt,r as n,D as X,a as G,b as K,c as U,d as W,e as mt,B as p,t as l,H as Y,f as dt,C as xt,F as pt}from"./index-o4rKtKfJ.js";import{C as ht,a as gt}from"./card-6Ae5ROGi.js";import{S as ut}from"./stat-strip-DYcHo9Kj.js";import{I as P}from"./input-BfBi0wR2.js";import{B as C}from"./badge-CDGsL4jH.js";import{C as I}from"./checkbox-zTZ6SyDQ.js";import{s as $,c as y,t as bt}from"./automation-Dzbn9u0H.js";import{C as vt}from"./circle-x-DCq7zPbk.js";import{S as B,a as z,b as O,c as R,d as J}from"./select-DuV0kIrj.js";import{T as A}from"./textarea-9Podrtqd.js";import{L as N}from"./label-DrX9VaVC.js";import{T as yt,a as Ct,b as L,c as w,d as jt,e as f}from"./table-FZ6-yFwR.js";import{H as Z}from"./history-DdSYxjMs.js";import{R as Jt}from"./refresh-cw-eQ6GkWW0.js";import{P as Nt}from"./plus-BXcAPnTg.js";import{S as ft}from"./search-C_UCkHB_.js";import{T as Q}from"./trash-2-C2Niwqae.js";import{P as Dt}from"./package-open-DHkNep1U.js";import{P as V}from"./play-BOUTOTLk.js";import{P as Ft}from"./pause-BVx-OrUs.js";import{S as Mt}from"./square-pen-y4Af_nu2.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.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(lt,{"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(vt,{"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,m]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,d]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(m({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=>{d(e)}).catch(()=>d(null)):d(null)):(m({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),d(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&&(d(x),m(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{m(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),d(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-Line truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>m({...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(mt,{"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,m]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{m(!0);const d=await bt.getExecutions({task_type:"cron",page_size:50});D(d.list||[])}catch(d){console.error("Failed to load executions:",d)}finally{m(!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(Z,{"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(yt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ct,{"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(jt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:78:15",children:s.map(r=>t.jsxs(n.Fragment,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:80:19",children:[t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
@@ -1,2 +0,0 @@
import{j as t,L as k,P as lt,r as n,D as X,a as G,b as K,c as U,d as W,e as mt,B as p,E as Y,f as dt,C as xt,F as pt}from"./index-Dmami9WE.js";import{C as ht,a as gt}from"./card-CIfC-8Rh.js";import{S as ut}from"./stat-strip-BteRU1Iu.js";import{I as L}from"./input-NsU9nXZF.js";import{B as C}from"./badge-3UzCvU7L.js";import{C as I}from"./checkbox-DoAtRzQj.js";import{t as l}from"./index-BuEnLCjT.js";import{s as $,c as y,t as bt}from"./automation-WG-s4QEv.js";import{C as vt}from"./circle-x-BBQeW1R3.js";import{S as B,a as z,b as O,c as R,d as J}from"./select-DUbxjT0z.js";import{T as A}from"./textarea-DHUZ6N85.js";import{L as N}from"./label-Ap_-SPYI.js";import{T as yt,a as Ct,b as P,c as w,d as jt,e as f}from"./table-CG4mjNfb.js";import{H as Z}from"./history-CbX6uocL.js";import{R as Jt}from"./refresh-cw-CTBERyFc.js";import{P as Nt}from"./plus-O65gX7Qz.js";import{S as ft}from"./search-Dd-PeBfg.js";import{T as V}from"./trash-2-DWVnIU6o.js";import{P as Dt}from"./package-open-Bj2Cp1LK.js";import{P as Q}from"./play-0EwQQJX_.js";import{P as Ft}from"./pause-DOhduDQ5.js";import{S as Mt}from"./square-pen-B3dPIBrm.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.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(lt,{"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(vt,{"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,m]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,d]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(m({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=>{d(e)}).catch(()=>d(null)):d(null)):(m({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),d(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&&(d(x),m(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{m(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),d(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:Line truncated
`).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>m({...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(mt,{"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,m]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{m(!0);const d=await bt.getExecutions({task_type:"cron",page_size:50});D(d.list||[])}catch(d){console.error("Failed to load executions:",d)}finally{m(!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(Z,{"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(yt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ct,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(P,{"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(jt,{"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(P,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83: Line truncated
@@ -1,4 +0,0 @@
import{a7 as B,a3 as m,aT as tt,r as A,j as s,p as at,A as Dt,a0 as u,z as Nt,m as ie,B as se,a5 as st,T as rt,t as $e,al as Fe,S as ot,s as Me,C as Ct}from"./index-Dmami9WE.js";import{d as he}from"./dashboard-BHNKEvkq.js";import{s as kt}from"./server-3HmnhxQB.js";import{k as Rt}from"./kubernetes-D2-GnE0t.js";import{S as At}from"./stat-strip-BteRU1Iu.js";import{C as K,b as U,c as z,d as V,a as W}from"./card-CIfC-8Rh.js";import{B as L}from"./badge-3UzCvU7L.js";import{H as wt}from"./hard-drive-DmC04Y5r.js";import{b as C,r as nt,s as St,t as ct,v as Ot,n as X,w as Ee,x as I,L as T,y as dt,z as Te,E as it,D as Pt,c as _t,e as ae,o as J,S as Et,A as Tt,F as Lt,d as Be,j as It,i as Q,l as $t,u as Ft,G as Mt,H as me,I as Bt,a as lt,J as Kt,K as pe,M as Ke,g as Ut,N as zt,R as Re,C as ht,X as pt,Y as mt,T as Ae,B as Vt}from"./generateCategoricalChart-ZqCvxO-S.js";import{A as Wt,a as Ne}from"./AreaChart-CrvX3B0s.js";import{B as qt}from"./BarChart-CLIO1OEu.js";import{M as Ht}from"./memory-stick-DvAvWvue.js";import{A as le}from"./arrow-right-CkKR0P0R.js";import{C as Gt}from"./circle-CGbaa1m0.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ue(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var ze=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){ze(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),ze(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(Ue(n),Ue(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=B("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,Ve;function oa(){if(Ve)return Ce;Ve=1;var t=nt(),a=St(),r=ct();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=tt(na);var ke,We;function da(){if(We)return ke;We=1;var t=nt(),a=ct(),r=Ot();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=tt(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function qe(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function G(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?qe(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function He(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Ge(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,xt(e.key),e)}}function xa(t,a,r){return a&&Ge(t.prototype,a),r&&Ge(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,ut()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(Ke(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),q=J(D,p,M),H=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var R=E+me(h)*((O!==0?N:0)+H*S),Le=(E+R)/2,Ie=(f.innerRadius+f.outerRadius)/2,yt=[{name:q,value:O,payload:D,dataKey:y,type:b}],jt=I(f.cx,f.cy,Ie,Le);return F=g(g(g({percent:H,cornerRadius:n,name:q,tooltipPayload:yt,midAngle:Le,middleRadius:Ie,tooltipPosition:jt},D),f),{},{value:J(D,y),startAngle:E,endAngle:R,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=Ut({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:zt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const $a={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},et=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Fa(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 Ma(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 Ka({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:$a[d.cloud]||et[l%et.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Fa(r);return s.jsxs(K,{"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 Line truncated
@@ -1,4 +0,0 @@
import{a7 as B,a2 as m,aV as tt,r as A,j as s,p as at,A as Dt,$ as u,z as Nt,m as ie,B as se,a5 as st,T as rt,t as $e,al as Fe,S as ot,s as Me,C as Ct}from"./index-CwVkcMR-.js";import{d as he}from"./dashboard-bavYfUo7.js";import{s as kt}from"./server-CfXcTAsg.js";import{k as Rt}from"./index-DK2BjZ0M.js";import{S as At}from"./stat-strip-CGgDVYxa.js";import{C as K,b as U,c as z,d as V,a as q}from"./card-C5qBu7CR.js";import{B as L}from"./badge-DgJ0w7jf.js";import{H as wt}from"./hard-drive-CGq_SnM5.js";import{b as C,r as nt,q as St,s as ct,t as Ot,n as X,v as Ee,w as I,L as T,x as dt,y as Te,z as it,D as Pt,c as _t,e as ae,o as J,S as Et,A as Tt,E as Lt,d as Be,j as It,i as Q,l as $t,u as Ft,G as Mt,F as me,H as Bt,a as lt,I as Kt,J as pe,K as Ke,g as Ut,M as zt,R as Re,C as ht,X as pt,Y as mt,T as Ae,B as Vt}from"./generateCategoricalChart-B9iVh1fX.js";import{A as qt,a as Ne}from"./AreaChart-ZFR7lw9c.js";import{B as Wt}from"./BarChart-CMbRSb9K.js";import{M as Ht}from"./memory-stick-Di60E52x.js";import{A as le}from"./arrow-right-aZAKUdlE.js";import{C as Gt}from"./circle-1_c_IHWJ.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ue(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var ze=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){ze(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),ze(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(Ue(n),Ue(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=B("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,Ve;function oa(){if(Ve)return Ce;Ve=1;var t=nt(),a=St(),r=ct();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=tt(na);var ke,qe;function da(){if(qe)return ke;qe=1;var t=nt(),a=ct(),r=Ot();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=tt(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function We(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function G(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?We(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):We(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function He(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Ge(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,xt(e.key),e)}}function xa(t,a,r){return a&&Ge(t.prototype,a),r&&Ge(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,ut()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(Ke(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),W=J(D,p,M),H=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var R=E+me(h)*((O!==0?N:0)+H*S),Le=(E+R)/2,Ie=(f.innerRadius+f.outerRadius)/2,yt=[{name:W,value:O,payload:D,dataKey:y,type:b}],jt=I(f.cx,f.cy,Ie,Le);return F=g(g(g({percent:H,cornerRadius:n,name:W,tooltipPayload:yt,midAngle:Le,middleRadius:Ie,tooltipPosition:jt},D),f),{},{value:J(D,y),startAngle:E,endAngle:R,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=Ut({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:zt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const $a={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},et=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Fa(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 Ma(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 Ka({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:$a[d.cloud]||et[l%et.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Fa(r);return s.jsxs(K,{"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 Line truncated
@@ -1,4 +1,4 @@
import{ag as B,af as m,bc as tt,r as A,j as s,p as at,A as Dt,a0 as u,E as Nt,m as ie,B as se,a5 as st,T as rt,v as $e,au as Fe,S as ot,s as Me,C as Ct}from"./index-HuRw9UhJ.js";import{d as he}from"./dashboard-H9WVvG1k.js";import{s as kt}from"./server-BQNr9a-x.js";import{k as Rt}from"./index-GZwpRmKU.js";import{S as At}from"./stat-strip-CVviXwc6.js";import{C as K,b as U,c as z,d as V,a as W}from"./card-B2Wqa0sK.js";import{B as L}from"./badge-CeS-g-Od.js";import{H as wt}from"./hard-drive-laLCm9TI.js";import{b as C,r as nt,s as St,t as ct,v as Ot,n as X,w as Ee,x as I,L as T,y as dt,z as Te,E as it,D as Pt,c as _t,e as ae,o as J,S as Et,A as Tt,F as Lt,d as Be,j as It,i as Q,l as $t,u as Ft,G as Mt,H as me,I as Bt,a as lt,J as Kt,K as pe,M as Ke,g as Ut,N as zt,R as Re,C as ht,X as pt,Y as mt,T as Ae,B as Vt}from"./generateCategoricalChart-DrSMejeS.js";import{A as Wt,a as Ne}from"./AreaChart-CTVvt9LZ.js";import{B as qt}from"./BarChart-DrZfTE9F.js";import{M as Ht}from"./memory-stick-CLkdveMl.js";import{A as le}from"./arrow-right-C1YbOgFu.js";import{C as Gt}from"./circle-DV2nF4ie.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ue(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
import{a6 as B,a5 as m,bc as tt,r as A,j as s,p as at,A as Dt,Z as u,E as Nt,m as ie,B as se,a2 as st,T as rt,v as $e,as as Fe,S as ot,s as Me,C as Ct}from"./index-o4rKtKfJ.js";import{d as he}from"./dashboard-Z5J6ei7x.js";import{s as kt}from"./server-Cnj_Y0tD.js";import{k as Rt}from"./index-BZgsOVD1.js";import{S as At}from"./stat-strip-DYcHo9Kj.js";import{C as K,b as U,c as z,d as V,a as W}from"./card-6Ae5ROGi.js";import{B as L}from"./badge-CDGsL4jH.js";import{H as wt}from"./hard-drive-P-ztZBRa.js";import{b as C,r as nt,s as St,t as ct,v as Ot,n as X,w as Ee,x as I,L as T,y as dt,z as Te,E as it,D as Pt,c as _t,e as ae,o as J,S as Et,A as Tt,F as Lt,d as Be,j as It,i as Q,l as $t,u as Ft,G as Mt,H as me,I as Bt,a as lt,J as Kt,K as pe,M as Ke,g as Ut,N as zt,R as Re,C as ht,X as pt,Y as mt,T as Ae,B as Vt}from"./generateCategoricalChart-BeO9rjxr.js";import{A as Wt,a as Ne}from"./AreaChart-CIzu6WTF.js";import{B as qt}from"./BarChart-BR8PowaA.js";import{M as Ht}from"./memory-stick-BZFgFF9q.js";import{A as le}from"./arrow-right-DT1TwHJ4.js";import{C as Gt}from"./circle-Dh5ZrES5.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},ee.apply(this,arguments)}function Xt(t,a){if(t==null)return{};var r=Yt(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ue(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r<a;r++)e[r]=t[r];return e}var ze=function(a){return a&&a.x===+a.x&&a.y===+a.y},aa=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){ze(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),ze(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(Ue(n),Ue(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=B("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,Ve;function oa(){if(Ve)return Ce;Ve=1;var t=nt(),a=St(),r=ct();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=tt(na);var ke,We;function da(){if(We)return ke;We=1;var t=nt(),a=ct(),r=Ot();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=tt(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t},de.apply(this,arguments)}function qe(t,a){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);a&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),r.push.apply(r,e)}return r}function G(t){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?qe(Object(r),!0).forEach(function(e){ve(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function He(t,a){if(t==null)return{};var r=ma(t,a),e,o;if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(o=0;o<n.length;o++)e=n[o],!(a.indexOf(e)>=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Ge(t,a){for(var r=0;r<a.length;r++){var e=a[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,xt(e.key),e)}}function xa(t,a,r){return a&&Ge(t.prototype,a),r&&Ge(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ba(t,a,r){return a=be(a),fa(t,ut()?Reflect.construct(a,r||[],be(t).constructor):a.apply(t,r))}function fa(t,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ga(t)}function ga(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ut(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ut=function(){return!!t})()}function be(t){return be=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},be(t)}function va(t,a){if(typeof a!="function"&&a!==null)throw new TypeError("Supe Line truncated
the props "valueKey" will be deprecated in 1.1.0`),y="value"):ae(i)&&(Ke(!1,`Use "dataKey" to specify the value of pie,
the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),q=J(D,p,M),H=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var R=E+me(h)*((O!==0?N:0)+H*S),Le=(E+R)/2,Ie=(f.innerRadius+f.outerRadius)/2,yt=[{name:q,value:O,payload:D,dataKey:y,type:b}],jt=I(f.cx,f.cy,Ie,Le);return F=g(g(g({percent:H,cornerRadius:n,name:q,tooltipPayload:yt,midAngle:Le,middleRadius:Ie,tooltipPosition:jt},D),f),{},{value:J(D,y),startAngle:E,endAngle:R,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=Ut({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:zt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const $a={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},et=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Fa(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 Ma(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 Ka({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:$a[d.cloud]||et[l%et.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Fa(r);return s.jsxs(K,{"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 Line truncated
@@ -1 +0,0 @@
import{i as Ze,f as he,r,j as e,B as i,z as L,Y as Ce,D as le,a as xe,b as pe,c as ge,d as be,G as De,t as je,V as F,X as ke,T as Se,C as te,y as ve,P as Te,e as Me}from"./index-CwVkcMR-.js";import{T as Ae,a as ze,b as de,c as me}from"./tabs-Bd_3HnQp.js";import{I as u}from"./input-B5ad6Rfz.js";import{B as v}from"./badge-DgJ0w7jf.js";import{C as re,b as Le,c as Fe,a as oe}from"./card-C5qBu7CR.js";import{L as c}from"./label-mg-tHjNc.js";import{S as l}from"./switch-DYr_nGop.js";import{S as Y,a as ee,b as ae,c as se,d as A}from"./select-CGtvCG8I.js";import{t as o}from"./index-Dxvx0mlR.js";import{p as k,z}from"./monitor-UHR7OKRa.js";import{R as ce}from"./refresh-cw-DM6JPbZg.js";import{P as H}from"./plus-CaJ-dB4A.js";import{S as V}from"./star-BY-sYfNe.js";import{S as Ne}from"./square-pen-C8Ol72WC.js";import{T as fe}from"./trash-2-BPpnm3Sz.js";import{C as I}from"./chevron-up-DM77dvsL.js";import{W as Ie}from"./wrench-Du1mNsDu.js";import{C as _e}from"./circle-x-DBoylLde.js";import{C as qe}from"./circle-check-DTBW_8Wd.js";import"./index-CBIZnJrN.js";const Ee=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],ne=Ze("plug",Ee),ie={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 Oe(){const x=he(),[h,p]=r.useState([]),[B,$]=r.useState(!0),[U,g]=r.useState(!1),[b,q]=r.useState(null),[s,_]=r.useState({...ie}),[P,D]=r.useState([]),[y,E]=r.useState(!1),[,O]=r.useState(!1),[S,R]=r.useState(!1),[T,w]=r.useState(!1),[M,N]=r.useState(!1),[j,Z]=r.useState(null),m=r.useCallback(async()=>{try{const a=await k.list();p(a?.data||a||[])}catch{o.error("获取数据源列表失败")}finally{$(!1)}},[]);r.useEffect(()=>{m()},[m]);const G=()=>{q(null),_({...ie}),D([]),Z(null),E(!1),O(!1),R(!1),w(!1),g(!0)},W=a=>{q(a.id),_({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});try{const d=JSON.parse(a.custom_headers||"[]");D(Array.isArray(d)?d:[])}catch{D([])}Z(null),g(!0)},n=(a,d)=>{_(f=>({...f,[a]:d}))},J=()=>{D(a=>[...a,{header:"",value:""}])},t=a=>{D(d=>d.filter((f,X)=>X!==a))},C=(a,d,f)=>{D(X=>{const K=[...X];return K[a]={...K[a],[d]:f},K})},Q=async()=>{if(!s.name.trim()){o.error("请输入数据源名称");return}if(!s.url.trim()){o.error("请输入 Prometheus URL");return}const a={name:s.name.trim(),url:s.url.trim(),access:s.access,http_method:s.http_method,basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,with_credentials:s.with_credentials,tls_client_auth:s.tls_client_auth,with_ca_cert:s.with_ca_cert,ca_cert:s.ca_cert,skip_tls_verify:s.skip_tls_verify,custom_headers:JSON.stringify(P),enable_alerting:s.enable_alerting,alertmanager_ds:s.alertmanager_ds,scrape_interval:s.scrape_interval,query_timeout:s.query_timeout,disable_metrics_lookup:s.disable_metrics_lookup,custom_query_params:s.custom_query_params,is_default:s.is_default};try{b?(await k.update(b,a),o.success("数据源更新成功")):(await k.create(a),o.success("数据源创建成功")),g(!1),m()}catch(d){o.error(d?.message||"操作失败")}},Pe=async a=>{if(await x({title:"删除数据源",description:`确定删除数据源「${a.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await k.delete(a.id),o.success("已删除"),m()}catch{o.error("删除失败")}},ye=async a=>{try{await k.setDefault(a.id),o.success(`已将「${a.name}」设为默认数据源`),m()}catch{o.error("设置失败")}},we=async()=>{if(!s.url.trim()){o.error("请先输入 URL");return}N(!0),Z(null);try{const a=await k.testConnection({url:s.url.trim(),basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,skip_tls_verify:s.skip_tls_verify}),d=a?.data||a;Z(d)}catch(a){Z({success:!1,message:a?.message||"测试失败"})}finally{N(!1)}};return B?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:298:7",className:"flex items-center justify-center h-96",children:e.jsx(ce,{"code-path":"src/components/monitor/dataLine truncated
@@ -1 +0,0 @@
import{i as Ze,f as he,r,t as o,j as e,B as i,E as L,Z as Ce,D as le,a as xe,b as pe,c as ge,d as be,G as De,v as je,W as F,X as ke,T as Se,C as te,z as ve,Q as Te,e as Me}from"./index-HuRw9UhJ.js";import{T as Ae,a as ze,b as de,c as me}from"./tabs-XYsjnHzX.js";import{I as u}from"./input-C9Xfv8um.js";import{B as v}from"./badge-CeS-g-Od.js";import{C as re,b as Le,c as Fe,a as oe}from"./card-B2Wqa0sK.js";import{L as c}from"./label-DvRDtaMA.js";import{S as l}from"./switch--ZaqVsRJ.js";import{S as Y,a as ee,b as ae,c as se,d as A}from"./select-KDzbUQs3.js";import{p as k,z}from"./datasource-CLdSbgtw.js";import{R as ce}from"./refresh-cw-CSycAyA2.js";import{P as H}from"./plus-BVwIGPvl.js";import{S as B}from"./star-CJEUXmIA.js";import{S as Ne}from"./square-pen-DoCLytAo.js";import{T as fe}from"./trash-2-Cf9-88KL.js";import{C as I}from"./chevron-up-GXrRy2ul.js";import{W as Ie}from"./wrench-BNS3BrjG.js";import{C as _e}from"./circle-x-BVvXVx7p.js";import{C as qe}from"./circle-check-C5nUiTvE.js";import"./index-DwvHXNyF.js";const Ee=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],ne=Ze("plug",Ee),ie={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 Oe(){const x=he(),[h,p]=r.useState([]),[V,$]=r.useState(!0),[U,g]=r.useState(!1),[b,q]=r.useState(null),[s,_]=r.useState({...ie}),[P,D]=r.useState([]),[y,E]=r.useState(!1),[,O]=r.useState(!1),[S,R]=r.useState(!1),[T,w]=r.useState(!1),[M,N]=r.useState(!1),[j,Z]=r.useState(null),m=r.useCallback(async()=>{try{const a=await k.list();p(a?.data||a||[])}catch{o.error("获取数据源列表失败")}finally{$(!1)}},[]);r.useEffect(()=>{m()},[m]);const G=()=>{q(null),_({...ie}),D([]),Z(null),E(!1),O(!1),R(!1),w(!1),g(!0)},W=a=>{q(a.id),_({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});try{const d=JSON.parse(a.custom_headers||"[]");D(Array.isArray(d)?d:[])}catch{D([])}Z(null),g(!0)},n=(a,d)=>{_(f=>({...f,[a]:d}))},Q=()=>{D(a=>[...a,{header:"",value:""}])},t=a=>{D(d=>d.filter((f,X)=>X!==a))},C=(a,d,f)=>{D(X=>{const K=[...X];return K[a]={...K[a],[d]:f},K})},J=async()=>{if(!s.name.trim()){o.error("请输入数据源名称");return}if(!s.url.trim()){o.error("请输入 Prometheus URL");return}const a={name:s.name.trim(),url:s.url.trim(),access:s.access,http_method:s.http_method,basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,with_credentials:s.with_credentials,tls_client_auth:s.tls_client_auth,with_ca_cert:s.with_ca_cert,ca_cert:s.ca_cert,skip_tls_verify:s.skip_tls_verify,custom_headers:JSON.stringify(P),enable_alerting:s.enable_alerting,alertmanager_ds:s.alertmanager_ds,scrape_interval:s.scrape_interval,query_timeout:s.query_timeout,disable_metrics_lookup:s.disable_metrics_lookup,custom_query_params:s.custom_query_params,is_default:s.is_default};try{b?(await k.update(b,a),o.success("数据源更新成功")):(await k.create(a),o.success("数据源创建成功")),g(!1),m()}catch(d){o.error(d?.message||"操作失败")}},Pe=async a=>{if(await x({title:"删除数据源",description:`确定删除数据源「${a.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await k.delete(a.id),o.success("已删除"),m()}catch{o.error("删除失败")}},ye=async a=>{try{await k.setDefault(a.id),o.success(`已将「${a.name}」设为默认数据源`),m()}catch{o.error("设置失败")}},we=async()=>{if(!s.url.trim()){o.error("请先输入 URL");return}N(!0),Z(null);try{const a=await k.testConnection({url:s.url.trim(),basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,skip_tls_verify:s.skip_tls_verify}),d=a?.data||a;Z(d)}catch(a){Z({success:!1,message:a?.message||"测试失败"})}finally{N(!1)}};return V?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:298:7",className:"flex items-center justify-center h-96",children:e.jsx(ce,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManLine truncated
@@ -0,0 +1 @@
import{i as ye,aj as Me,t as n,r as d,j as e,D as ie,a as le,b as ue,c as pe,E as L,d as he,G as xe,v as ge,W as q,B as h,X as we,T as Fe,C as se,z as be,Q as Ze,e as De,f as je,a4 as Ce}from"./index-o4rKtKfJ.js";import{T as ke,a as Se,b as ce,c as ne}from"./tabs-CoTqT5ed.js";import{B as P}from"./badge-CDGsL4jH.js";import{C as ae,b as Te,c as Ae,a as te}from"./card-6Ae5ROGi.js";import{u as ze,q as qe,a as Ee}from"./unwrap-D0DvYxvf.js";import{u as O}from"./useMutation-B7xoUHzt.js";import{p as z,z as T}from"./datasource-PlnPrptP.js";import{I as x}from"./input-BfBi0wR2.js";import{L as m}from"./label-DrX9VaVC.js";import{S as j}from"./switch-Dqj5wqUV.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-DuV0kIrj.js";import{C as E}from"./chevron-up-CZcf1jNw.js";import{W as Le}from"./wrench-Bv79GtB7.js";import{P as B}from"./plus-BXcAPnTg.js";import{C as ve}from"./circle-x-DCq7zPbk.js";import{R as oe}from"./refresh-cw-eQ6GkWW0.js";import{S as V}from"./star-nuqYbwAt.js";import{S as _e}from"./square-pen-y4Af_nu2.js";import{T as Ne}from"./trash-2-C2Niwqae.js";import{C as Ie}from"./circle-check-Bp6gonk8.js";import"./index-BeCACrpC.js";const Re=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],re=ye("plug",Re);function He(){return ze({queryKey:qe.promDatasources(),queryFn:async()=>{const a=await z.list();return Ee(a)},staleTime:3e4})}function fe(){const a=Me(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>z.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>z.update(l,t),onSuccess:o}),M=O({mutationFn:l=>z.delete(l),onSuccess:o}),w=O({mutationFn:l=>z.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Oe(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 Be(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Ve(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 z.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 $e(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 Ue({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(Oe(p)),v(Be(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}))},$=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,W)=>W!==s))},H=(s,u,D)=>{v(W=>{const K=[...W];return K[s]={...K[s],[u]:D},K})},U=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Ve(t,r);try{l?(await w.mutateAsLine truncated
@@ -1 +0,0 @@
import{i as Ze,f as he,r,j as e,B as i,z as L,Y as Ce,D as le,a as xe,b as pe,c as ge,d as be,G as De,t as je,V as F,X as ke,T as Se,C as te,y as ve,P as Te,e as Me}from"./index-Dmami9WE.js";import{T as Ae,a as ze,b as de,c as me}from"./tabs-lV44z_UR.js";import{I as u}from"./input-NsU9nXZF.js";import{B as v}from"./badge-3UzCvU7L.js";import{C as re,b as Le,c as Fe,a as oe}from"./card-CIfC-8Rh.js";import{L as c}from"./label-Ap_-SPYI.js";import{S as l}from"./switch-TqjD2x0W.js";import{S as Y,a as ee,b as ae,c as se,d as A}from"./select-DUbxjT0z.js";import{t as o}from"./index-BuEnLCjT.js";import{p as k,z}from"./monitor-CicbJUrQ.js";import{R as ce}from"./refresh-cw-CTBERyFc.js";import{P as H}from"./plus-O65gX7Qz.js";import{S as V}from"./star-DRCV7Fx2.js";import{S as Ne}from"./square-pen-B3dPIBrm.js";import{T as fe}from"./trash-2-DWVnIU6o.js";import{C as I}from"./chevron-up-Cq4GPopa.js";import{W as Ie}from"./wrench-DMCGQEzN.js";import{C as _e}from"./circle-x-BBQeW1R3.js";import{C as qe}from"./circle-check-CVbTTFQ0.js";import"./index-CtCQcvyh.js";const Ee=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],ne=Ze("plug",Ee),ie={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 Oe(){const x=he(),[h,p]=r.useState([]),[B,$]=r.useState(!0),[U,g]=r.useState(!1),[b,q]=r.useState(null),[s,_]=r.useState({...ie}),[P,D]=r.useState([]),[y,E]=r.useState(!1),[,O]=r.useState(!1),[S,R]=r.useState(!1),[T,w]=r.useState(!1),[M,N]=r.useState(!1),[j,Z]=r.useState(null),m=r.useCallback(async()=>{try{const a=await k.list();p(a?.data||a||[])}catch{o.error("获取数据源列表失败")}finally{$(!1)}},[]);r.useEffect(()=>{m()},[m]);const G=()=>{q(null),_({...ie}),D([]),Z(null),E(!1),O(!1),R(!1),w(!1),g(!0)},W=a=>{q(a.id),_({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});try{const d=JSON.parse(a.custom_headers||"[]");D(Array.isArray(d)?d:[])}catch{D([])}Z(null),g(!0)},n=(a,d)=>{_(f=>({...f,[a]:d}))},J=()=>{D(a=>[...a,{header:"",value:""}])},t=a=>{D(d=>d.filter((f,X)=>X!==a))},C=(a,d,f)=>{D(X=>{const K=[...X];return K[a]={...K[a],[d]:f},K})},Q=async()=>{if(!s.name.trim()){o.error("请输入数据源名称");return}if(!s.url.trim()){o.error("请输入 Prometheus URL");return}const a={name:s.name.trim(),url:s.url.trim(),access:s.access,http_method:s.http_method,basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,with_credentials:s.with_credentials,tls_client_auth:s.tls_client_auth,with_ca_cert:s.with_ca_cert,ca_cert:s.ca_cert,skip_tls_verify:s.skip_tls_verify,custom_headers:JSON.stringify(P),enable_alerting:s.enable_alerting,alertmanager_ds:s.alertmanager_ds,scrape_interval:s.scrape_interval,query_timeout:s.query_timeout,disable_metrics_lookup:s.disable_metrics_lookup,custom_query_params:s.custom_query_params,is_default:s.is_default};try{b?(await k.update(b,a),o.success("数据源更新成功")):(await k.create(a),o.success("数据源创建成功")),g(!1),m()}catch(d){o.error(d?.message||"操作失败")}},Pe=async a=>{if(await x({title:"删除数据源",description:`确定删除数据源「${a.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await k.delete(a.id),o.success("已删除"),m()}catch{o.error("删除失败")}},ye=async a=>{try{await k.setDefault(a.id),o.success(`已将「${a.name}」设为默认数据源`),m()}catch{o.error("设置失败")}},we=async()=>{if(!s.url.trim()){o.error("请先输入 URL");return}N(!0),Z(null);try{const a=await k.testConnection({url:s.url.trim(),basic_auth:s.basic_auth,basic_auth_user:s.basic_auth_user,basic_auth_pass:s.basic_auth_pass,skip_tls_verify:s.skip_tls_verify}),d=a?.data||a;Z(d)}catch(a){Z({success:!1,message:a?.message||"测试失败"})}finally{N(!1)}};return B?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:298:7",className:"flex items-center justify-center h-96",children:e.jsx(ce,{"code-path":"src/components/monitor/dataLine truncated
@@ -0,0 +1 @@
import{i as te,r as o,j as e,D as A,a as H,b as M,c as W,G as Y,w as Z,a4 as oe,e as ae,B as d,t as r,L as F,Q as ne,C as le,W as ce,d as de,f as re,V as pe}from"./index-o4rKtKfJ.js";import{I as z}from"./input-BfBi0wR2.js";import{B as w}from"./badge-CDGsL4jH.js";import{T as ie,a as xe,b as O,c as B}from"./tabs-CoTqT5ed.js";import{L as _}from"./label-DrX9VaVC.js";import{S as K,a as Q,b as X,c as q,d as E}from"./select-DuV0kIrj.js";import{d as i}from"./config-CDJQFc9v.js";import{c as me}from"./credential-Cg1BP64k.js";import{P as G}from"./plus-BXcAPnTg.js";import{R as ee}from"./refresh-cw-eQ6GkWW0.js";import{C as ye}from"./circle-x-DCq7zPbk.js";import{D as I}from"./download-Gr2Xr683.js";import{W as he}from"./wrench-Bv79GtB7.js";import{P}from"./pencil-DNq-pnlG.js";import{T as U}from"./trash-2-C2Niwqae.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const ge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ce=te("settings-2",ge);function be({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"),k=async()=>{try{const a=await me.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(k(),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(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(W,{"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(K,{"code-path":"src/components/deploy/CredentiaLine truncated
@@ -1 +0,0 @@
import{i as te,r as o,j as e,D as A,a as H,b as M,c as W,G as J,v as Z,Y as oe,e as ae,B as d,L as F,P as ne,C as le,V as ce,d as de,f as re,Q as pe}from"./index-CwVkcMR-.js";import{I as z}from"./input-B5ad6Rfz.js";import{B as w}from"./badge-DgJ0w7jf.js";import{T as ie,a as xe,b as O,c as B}from"./tabs-Bd_3HnQp.js";import{L as _}from"./label-mg-tHjNc.js";import{S as K,a as Q,b as X,c as Y,d as E}from"./select-CGtvCG8I.js";import{t as r}from"./index-Dxvx0mlR.js";import{c as me,d as i}from"./deploy-C6PfjuUR.js";import{P as G}from"./plus-CaJ-dB4A.js";import{R as ee}from"./refresh-cw-DM6JPbZg.js";import{C as ye}from"./circle-x-DBoylLde.js";import{D as I}from"./download-BgEJ-n5L.js";import{W as he}from"./wrench-Du1mNsDu.js";import{P}from"./pencil-OnUdgX3e.js";import{T as U}from"./trash-2-BPpnm3Sz.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const ge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ce=te("settings-2",ge);function be({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"),k=async()=>{try{const a=await me.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(k(),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?J: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(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(W,{"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(K,{"code-path":"src/components/deploy/CredentialFormDLine truncated
@@ -1 +0,0 @@
import{i as te,r as o,j as e,D as A,a as H,b as M,c as W,G as J,w as Y,Z as oe,e as ae,B as d,t as r,L as F,Q as ne,C as le,W as ce,d as de,f as re,V as pe}from"./index-HuRw9UhJ.js";import{I as z}from"./input-C9Xfv8um.js";import{B as w}from"./badge-CeS-g-Od.js";import{T as ie,a as xe,b as O,c as B}from"./tabs-XYsjnHzX.js";import{L as _}from"./label-DvRDtaMA.js";import{S as K,a as Q,b as X,c as Z,d as E}from"./select-KDzbUQs3.js";import{d as i}from"./config-J-uY34Cv.js";import{c as me}from"./credential-snjgV65G.js";import{P as G}from"./plus-BVwIGPvl.js";import{R as ee}from"./refresh-cw-CSycAyA2.js";import{C as ye}from"./circle-x-BVvXVx7p.js";import{D as I}from"./download-CjFatm64.js";import{W as he}from"./wrench-BNS3BrjG.js";import{P}from"./pencil-BZ7zX3m0.js";import{T as U}from"./trash-2-Cf9-88KL.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const ge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ce=te("settings-2",ge);function be({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"),k=async()=>{try{const a=await me.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(k(),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?J:Y;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(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(W,{"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(K,{"code-path":"src/components/deploy/CredentialLine truncated
@@ -1 +0,0 @@
import{i as te,r as o,j as e,D as A,a as H,b as M,c as W,G as J,v as Z,Y as oe,e as ae,B as d,h as ne,L as F,P as le,C as ce,V as de,d as re,f as pe,Q as ie}from"./index-Dmami9WE.js";import{I as z}from"./input-NsU9nXZF.js";import{B as w}from"./badge-3UzCvU7L.js";import{T as xe,a as me,b as O,c as B}from"./tabs-lV44z_UR.js";import{L as _}from"./label-Ap_-SPYI.js";import{S as K,a as Q,b as X,c as Y,d as E}from"./select-DUbxjT0z.js";import{t as r}from"./index-BuEnLCjT.js";import{d as i}from"./deploy-CD5bEXt-.js";import{P as G}from"./plus-O65gX7Qz.js";import{R as ee}from"./refresh-cw-CTBERyFc.js";import{C as ye}from"./circle-x-BBQeW1R3.js";import{D as I}from"./download-Vuij9wGr.js";import{W as he}from"./wrench-DMCGQEzN.js";import{P}from"./pencil-BYahlvYT.js";import{T as U}from"./trash-2-DWVnIU6o.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const ge=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Ce=te("settings-2",ge);function be({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"),k=async()=>{try{const a=await ne.get("/credentials?page_size=100");l(a?.list||[])}catch{}};o.useEffect(()=>{if(k(),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?J:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:9",children:e.jsxs(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:101:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107: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:108:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109: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:110:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:111: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:114:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(K,{"code-path":"src/components/deploy/CrLine truncated
@@ -1 +0,0 @@
import{i as Ne,r as o,f as ve,j as e,L as M,t as ae,B as a,Q as D,K as fe,X as pe,W as we,u as be}from"./index-Dmami9WE.js";import{C as g,a as N}from"./card-CIfC-8Rh.js";import{I as h}from"./input-NsU9nXZF.js";import{B as x}from"./badge-3UzCvU7L.js";import{S as v,a as f,b as w,c as b,d as r}from"./select-DUbxjT0z.js";import{L as i}from"./label-Ap_-SPYI.js";import{t as c}from"./index-BuEnLCjT.js";import{d as m,p as Se}from"./deploy-CD5bEXt-.js";import{P as le}from"./plus-O65gX7Qz.js";import{S as ne}from"./save-YtnrpTd8.js";import{T as ke}from"./trash-2-DWVnIU6o.js";import{U as de}from"./user-plus-DKeca2Dx.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Ie=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],re=Ne("regex",Ie);function Ke(){const[l,me]=o.useState([]),[xe,T]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[F,ye]=o.useState([]),[I,_]=o.useState([]),[p,he]=o.useState(""),[j,q]=o.useState(""),[G,H]=o.useState(!1),[J,z]=o.useState(!1),[P,K]=o.useState(""),[E,Q]=o.useState(""),[C,W]=o.useState(""),[X,O]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[L,ee]=o.useState(""),[se,te]=o.useState(""),Re=ve(),R=async()=>{T(!0);try{const[s,t,d]=await Promise.all([m.getItemRoles(),Se.getPipelines({page_size:200}),be.getUsers({page_size:500})]);me(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{T(!1)}};o.useEffect(()=>{R()},[]);const $=async()=>{if(!p){_([]);return}try{const s=await m.getUserItemRoles(Number(p));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{$()},[p]);const B=o.useMemo(()=>{const s={};return l.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},[l,y]),oe=(n?l.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await m.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:X,description:Y}),c.success("已创建"),z(!1),K(""),Q(""),W(""),O("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!L.trim()){c.error("正则不能为空");return}A(!0);try{await m.updateItemRole(s,{pattern:L,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 m.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await m.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!p||!j){c.error("请选择用户和角色");return}H(!0);try{await m.assignItemRole(Number(p),{user_id:Number(p),item_role_id:Number(j)}),c.success("已分配"),q(""),$()}catch(s){c.error(s?.message||"分配失败")}finally{H(!1)}},ge=async s=>{try{await m.removeItemRole(Number(p),s),c.success("已撤销"),$()}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=F.find(s=>String(s.id)===p);return xe?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(M,{"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:J,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dgLine truncated
@@ -1 +0,0 @@
import{i as Ne,r as o,f as ve,j as e,L as M,t as ae,B as a,Q as D,K as fe,X as pe,W as we,u as be}from"./index-CwVkcMR-.js";import{C as g,a as N}from"./card-C5qBu7CR.js";import{I as h}from"./input-B5ad6Rfz.js";import{B as x}from"./badge-DgJ0w7jf.js";import{S as v,a as f,b as w,c as b,d as r}from"./select-CGtvCG8I.js";import{L as i}from"./label-mg-tHjNc.js";import{t as c}from"./index-Dxvx0mlR.js";import{d as m,p as Se}from"./deploy-C6PfjuUR.js";import{P as le}from"./plus-CaJ-dB4A.js";import{S as ne}from"./save-CdpyeGoy.js";import{T as ke}from"./trash-2-BPpnm3Sz.js";import{U as de}from"./user-plus-H8JkRJOU.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const Ie=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],re=Ne("regex",Ie);function Ke(){const[l,me]=o.useState([]),[xe,T]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[F,ye]=o.useState([]),[I,_]=o.useState([]),[p,he]=o.useState(""),[j,q]=o.useState(""),[G,H]=o.useState(!1),[J,z]=o.useState(!1),[P,K]=o.useState(""),[E,Q]=o.useState(""),[C,W]=o.useState(""),[X,O]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[L,ee]=o.useState(""),[se,te]=o.useState(""),Re=ve(),R=async()=>{T(!0);try{const[s,t,d]=await Promise.all([m.getItemRoles(),Se.getPipelines({page_size:200}),be.getUsers({page_size:500})]);me(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{T(!1)}};o.useEffect(()=>{R()},[]);const $=async()=>{if(!p){_([]);return}try{const s=await m.getUserItemRoles(Number(p));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{$()},[p]);const B=o.useMemo(()=>{const s={};return l.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},[l,y]),oe=(n?l.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await m.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:X,description:Y}),c.success("已创建"),z(!1),K(""),Q(""),W(""),O("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!L.trim()){c.error("正则不能为空");return}A(!0);try{await m.updateItemRole(s,{pattern:L,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 m.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await m.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!p||!j){c.error("请选择用户和角色");return}H(!0);try{await m.assignItemRole(Number(p),{user_id:Number(p),item_role_id:Number(j)}),c.success("已分配"),q(""),$()}catch(s){c.error(s?.message||"分配失败")}finally{H(!1)}},ge=async s=>{try{await m.removeItemRole(Number(p),s),c.success("已撤销"),$()}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=F.find(s=>String(s.id)===p);return xe?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(M,{"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:J,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dgLine truncated
@@ -1 +1 @@
import{i as Ne,r as o,f as ve,j as e,L as M,v as ae,B as a,V as D,O as fe,X as pe,Y as we,u as be,t as c}from"./index-HuRw9UhJ.js";import{C as g,a as N}from"./card-B2Wqa0sK.js";import{I as h}from"./input-C9Xfv8um.js";import{B as x}from"./badge-CeS-g-Od.js";import{S as v,a as f,b as w,c as b,d as r}from"./select-KDzbUQs3.js";import{L as i}from"./label-DvRDtaMA.js";import{p as Se}from"./pipeline-CRmSOJEC.js";import{d as m}from"./config-J-uY34Cv.js";import{P as le}from"./plus-BVwIGPvl.js";import{S as ne}from"./save-PutEGGnz.js";import{T as ke}from"./trash-2-Cf9-88KL.js";import{U as de}from"./user-plus-DK2M0PwG.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const Ie=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],re=Ne("regex",Ie);function Oe(){const[l,me]=o.useState([]),[xe,T]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[F,ye]=o.useState([]),[I,_]=o.useState([]),[p,he]=o.useState(""),[j,q]=o.useState(""),[G,H]=o.useState(!1),[J,z]=o.useState(!1),[P,O]=o.useState(""),[E,X]=o.useState(""),[C,Y]=o.useState(""),[K,Q]=o.useState("editor"),[W,Z]=o.useState(""),[Ce,U]=o.useState(null),[L,ee]=o.useState(""),[se,te]=o.useState(""),Re=ve(),R=async()=>{T(!0);try{const[s,t,d]=await Promise.all([m.getItemRoles(),Se.getPipelines({page_size:200}),be.getUsers({page_size:500})]);me(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{T(!1)}};o.useEffect(()=>{R()},[]);const $=async()=>{if(!p){_([]);return}try{const s=await m.getUserItemRoles(Number(p));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{$()},[p]);const B=o.useMemo(()=>{const s={};return l.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},[l,y]),oe=(n?l.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await m.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:K,description:W}),c.success("已创建"),z(!1),O(""),X(""),Y(""),Q("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!L.trim()){c.error("正则不能为空");return}A(!0);try{await m.updateItemRole(s,{pattern:L,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 m.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await m.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!p||!j){c.error("请选择用户和角色");return}H(!0);try{await m.assignItemRole(Number(p),{user_id:Number(p),item_role_id:Number(j)}),c.success("已分配"),q(""),$()}catch(s){c.error(s?.message||"分配失败")}finally{H(!1)}},ge=async s=>{try{await m.removeItemRole(Number(p),s),c.success("已撤销"),$()}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=F.find(s=>String(s.id)===p);return xe?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(M,{"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:J,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(-Line truncated
import{i as Ne,r as o,f as ve,j as e,L as M,v as ae,B as a,V as D,O as fe,X as pe,Y as we,u as be,t as c}from"./index-o4rKtKfJ.js";import{C as g,a as N}from"./card-6Ae5ROGi.js";import{I as h}from"./input-BfBi0wR2.js";import{B as x}from"./badge-CDGsL4jH.js";import{S as v,a as f,b as w,c as b,d as r}from"./select-DuV0kIrj.js";import{L as i}from"./label-DrX9VaVC.js";import{p as Se}from"./pipeline-CDjAR1sy.js";import{d as m}from"./config-CDJQFc9v.js";import{P as le}from"./plus-BXcAPnTg.js";import{S as ne}from"./save-CtHT3jpw.js";import{T as ke}from"./trash-2-C2Niwqae.js";import{U as de}from"./user-plus-DR6J1R-V.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Ie=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],re=Ne("regex",Ie);function Oe(){const[l,me]=o.useState([]),[xe,T]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[F,ye]=o.useState([]),[I,_]=o.useState([]),[p,he]=o.useState(""),[j,q]=o.useState(""),[G,H]=o.useState(!1),[J,z]=o.useState(!1),[P,O]=o.useState(""),[E,X]=o.useState(""),[C,Y]=o.useState(""),[K,Q]=o.useState("editor"),[W,Z]=o.useState(""),[Ce,U]=o.useState(null),[L,ee]=o.useState(""),[se,te]=o.useState(""),Re=ve(),R=async()=>{T(!0);try{const[s,t,d]=await Promise.all([m.getItemRoles(),Se.getPipelines({page_size:200}),be.getUsers({page_size:500})]);me(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{T(!1)}};o.useEffect(()=>{R()},[]);const $=async()=>{if(!p){_([]);return}try{const s=await m.getUserItemRoles(Number(p));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{$()},[p]);const B=o.useMemo(()=>{const s={};return l.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},[l,y]),oe=(n?l.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await m.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:K,description:W}),c.success("已创建"),z(!1),O(""),X(""),Y(""),Q("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!L.trim()){c.error("正则不能为空");return}A(!0);try{await m.updateItemRole(s,{pattern:L,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 m.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await m.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!p||!j){c.error("请选择用户和角色");return}H(!0);try{await m.assignItemRole(Number(p),{user_id:Number(p),item_role_id:Number(j)}),c.success("已分配"),q(""),$()}catch(s){c.error(s?.message||"分配失败")}finally{H(!1)}},ge=async s=>{try{await m.removeItemRole(Number(p),s),c.success("已撤销"),$()}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=F.find(s=>String(s.id)===p);return xe?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(M,{"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:J,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(-Line truncated
@@ -1,20 +0,0 @@
import{i as Ge,r as m,v as tt,N as Ee,A as Ut,j as e,B as h,L as pe,V as Kt,o as Xt,E as Zt,C as Qt,R as bs,p as ys,t as es,_ as ts,z as Ze,S as yt,G as ks,M as gs,y as ht,P as ut,Q as lt,m as ss,aW as vs,T as Bt,al as js,X as ns,a3 as kt,k as Ns}from"./index-CwVkcMR-.js";import{C as G,a as L,b as le,c as de}from"./card-C5qBu7CR.js";import{I as k}from"./input-B5ad6Rfz.js";import{L as A}from"./label-mg-tHjNc.js";import{B as ee}from"./badge-DgJ0w7jf.js";import{k as Q}from"./index-DK2BjZ0M.js";import{u as we}from"./use-toast-C8N6561m.js";import{S as fe,f as Le,e as Ds,b as fs,s as dt,Y as Ot,P as Ss,a as Es}from"./PodFileBrowser-Dsv7UfKm.js";import{T as Re,a as Be,b as ge,c as K,d as Oe,e as X}from"./table-X8m9Cp5H.js";import{P as oe}from"./plus-CaJ-dB4A.js";import{H as ws}from"./history-DUPeIzQi.js";import{M as gt}from"./minus-BWHRIRGV.js";import{F as vt}from"./file-text-DGoBtmAr.js";import{H as os}from"./hard-drive-CGq_SnM5.js";import{E as bt}from"./external-link-BhKmTUrK.js";import{T as Qe}from"./textarea-BZOXMpxW.js";import{S as Me,a as _e,b as et,c as $e,d as be}from"./select-CGtvCG8I.js";import{S as jt}from"./switch-DYr_nGop.js";import{T as xe}from"./trash-2-BPpnm3Sz.js";import{Z as as}from"./zap-Dr77-_Z_.js";import{F as Cs}from"./folder-open-BPEM3um6.js";import{R as cs}from"./rotate-cw-BWMnGC9F.js";import{P as rs}from"./play-_cqG4jyc.js";import{S as st}from"./save-CdpyeGoy.js";import{D as Ps}from"./disc-nz-uNCoJ.js";import{a as As,F as it}from"./folder-Jx79bRH4.js";import{R as nt}from"./refresh-cw-DM6JPbZg.js";import{C as Vs}from"./circle-x-DBoylLde.js";import{A as Ws}from"./arrow-left-B1MijWEO.js";import{P as It}from"./pause-CoEPLyJU.js";import"./copy-CKzeWvtb.js";import"./sparkles-BA2sXk5-.js";import"./xterm-DSqgeKvr.js";import"./box-D54sw_gB.js";import"./minimize-2-Dk2LAAKi.js";import"./upload-CSuL4aK-.js";import"./download-BgEJ-n5L.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const Ts=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Rs=Ge("hash",Ts);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Ge("heart",Bs);const Is=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Hs=Ge("image",Is);const zs=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Ms=Ge("key-round",zs);const _s=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],Ht=Ge("tags",_s);function ls(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(l=>(l.type||l.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function $s(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:l,onRefresh:d}=t,{toast:p}=we(),[g,x]=m.useState("pods"),[N,D]=m.useState(null),[O,v]=m.useState(null),[f,C]=m.useState(a?.replicas||0),[E,M]=m.useState(!1),[I,q]=m.useState([]),[Y,V]=m.useState([]),[Z,_]=m.useState([]),[F,ne]=m.useState(""),[te,r]=m.useState([]),[u,S]=m.useState([]),T=a?.ready_replicas??a?.readyReplicas??0,i=a?.replicas??0,P=T===i&&i>0;m.useEffect(()=>{g==="services"&&(ne("services"),Promise.all([Q.getNamespaceServices(s,o).catch(()=>[]),Q.getNamespaceIngresses(s,o).catch(()=>[])]).then(([b,J])=>{const z=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],$=z(b),he=z(J),U=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},me=$.filter(R=>{const ae=R.spec?.selector||R.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([ke,Ne])=>U[ke]===Ne)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"<none>",ports:(R.spec?.ports||R.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),je=new Set(me.map(R=>R.name)),re=he.filter(R=>(R.spec?.rules||R.rules||[]).some(ke=>(ke.http?.paths||ke.paths||[]).some(Ne=>{const j=Ne.backend?.service?.name||Ne.backendSerLine truncated
`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let l="none";return n.exec?l="exec":n.httpGet?l="httpGet":n.tcpSocket&&(l="tcpSocket"),{type:l,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(`
`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function Mt(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 pt(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function _t(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function $t(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(x=>x.name.trim()).map(x=>{const N={name:x.name};return x.value!=null&&(N.value=x.value),N})),t.ports.length>0&&(s.ports=t.ports.filter(x=>x.containerPort!=="").map(x=>{const N={containerPort:typeof x.containerPort=="number"?x.containerPort:Number(x.containerPort)};return x.name&&(N.name=x.name),x.protocol&&(N.protocol=x.protocol),N}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(x=>x&&x.trim()),l=a&&Object.values(a).some(x=>x&&x.trim());(n||l)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),l&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=pt(t.livenessProbe);d&&(s.livenessProbe=d);const p=pt(t.readinessProbe);p&&(s.readinessProbe=p);const g=pt(t.startupProbe);if(g&&(s.startupProbe=g),t.lifecycle){const x={},N=_t(t.lifecycle.postStart);N&&(x.postStart=N);const D=_t(t.lifecycle.preStop);D&&(x.preStop=D),Object.keys(x).length>0&&(s.lifecycle=x)}if(t.securityContext){const x=t.securityContext,N={};x.runAsUser!==""&&x.runAsUser!=null&&(N.runAsUser=Number(x.runAsUser)),x.runAsGroup!==""&&x.runAsGroup!=null&&(N.runAsGroup=Number(x.runAsGroup)),x.runAsNonRoot!=null&&(N.runAsNonRoot=x.runAsNonRoot),x.privileged!=null&&(N.privileged=x.privileged),x.readOnlyRootFilesystem!=null&&(N.readOnlyRootFilesystem=x.readOnlyRootFilesystem),x.allowPrivilegeEscalation!=null&&(N.allowPrivilegeEscalation=x.allowPrivilegeEscalation);const D=(x.capabilitiesAdd||[]).filter(Boolean),O=(x.capabilitiesDrop||[]).filter(Boolean);(D.length||O.length)&&(N.capabilities={},D.length&&(N.capabilities.add=D),O.length&&(N.capabilities.drop=O)),Object.keys(N).length>0&&(s.securityContext=N)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(x=>x.name.trim()&&x.mountPath.trim()).map(x=>{const N={name:x.name,mountPath:x.mountPath};return x.subPath&&(N.subPath=x.subPath),x.readOnly&&(N.readOnly=!0),N})),s}function Gt(t){return t.join(`
`)}function Lt(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function qs({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs(Me,{"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(_e,{"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(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Gt(o.command),placeholder:`/bin/sh
-c`,onChange:n=>s({command:Lt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Gt(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:n=>s({args:Lt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(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,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const p=[...o.env];p[l]={...n,name:d.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const p=[...o.env];p[l]={...n,value:d.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,p)=>p!==l)}),children:e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},l)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:a,children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(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,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const p=[...o.ports];p[l]={...n,name:d.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const p=[...o.ports];p[l]={...n,containerPort:d.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs(Me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:d=>{const p=[...o.ports];p[l]={...n,protocol:d},s({ports:p})},children:[e.jsx(_e,{"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(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:f=>a(f.target.value),placeholder:`svc.cluster.local
cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:g,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((f,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:f.name,onChange:E=>x(C,{name:E.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(k,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:f.value,onChange:E=>x(C,{value:E.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>N(C),children:e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},C))]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(le,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(de,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(gs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(L,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:D,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((f,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:f.ip,onChange:E=>O(C,{ip:E.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(k,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:f.hostnames,onChange:E=>O(C,{hostnames:E.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(C),children:e.jsx(xe,{"code-path":"src/compone Line truncated
`):""),Vt(Array.isArray(B.searches)?B.searches.join(`
`):"");const ie=Array.isArray(B.options)?B.options:[];Tt(ie.map(ce=>({name:ce.name||"",value:ce.value||""}))),N(!1)},[a]);const is=()=>P(w=>[...w,{key:"",value:""}]),ps=w=>P(W=>W.filter((se,ye)=>ye!==w)),ms=(w,W)=>P(se=>se.map((ye,Pe)=>Pe===w?{...ye,...W}:ye)),xs=async()=>{g(!0);try{const w=JSON.parse(JSON.stringify(D));w.spec=w.spec||{},w.spec.template=w.spec.template||{},w.spec.template.spec=w.spec.template.spec||{};const W=w.spec.template.spec;if(w.spec.strategy={type:v},v==="RollingUpdate"&&(w.spec.strategy.rollingUpdate={maxSurge:C,maxUnavailable:M}),q&&(w.spec.revisionHistoryLimit=Number(q)),V&&(w.spec.progressDeadlineSeconds=Number(V)),_==="nodeName"&&ne.trim())W.nodeName=ne.trim(),delete W.nodeSelector,W.affinity&&delete W.affinity.nodeAffinity;else if(_==="nodeSelector"){const B={};for(const{key:ie,value:ce}of i){const He=ie.trim();He&&(B[He]=ce)}Object.keys(B).length>0?W.nodeSelector=B:delete W.nodeSelector,W.nodeName&&delete W.nodeName,W.affinity&&delete W.affinity.nodeAffinity}else if(_==="nodeAffinity"){const B=i.filter(ie=>ie.key.trim()).map(ie=>({key:ie.key.trim(),operator:"In",values:[ie.value]}));B.length>0?(W.affinity=W.affinity||{},W.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:B}]}}):W.affinity&&delete W.affinity.nodeAffinity,delete W.nodeSelector,W.nodeName&&delete W.nodeName}const se=y.filter(B=>B.key||B.operator==="Exists").map(B=>{const ie={};return B.key&&(ie.key=B.key),B.operator&&(ie.operator=B.operator),B.value&&B.operator!=="Exists"&&(ie.value=B.value),B.effect&&(ie.effect=B.effect),B.tolerationSeconds&&B.effect==="NoExecute"&&(ie.tolerationSeconds=Number(B.tolerationSeconds)),ie});se.length>0?W.tolerations=se:delete W.tolerations,J&&(W.dnsPolicy=J),$&&(W.restartPolicy=$),U&&(W.schedulerName=U),je&&(W.terminationGracePeriodSeconds=Number(je)),R&&(W.serviceAccountName=R);const ye={};ke&&(ye.fsGroup=Number(ke)),j&&(ye.runAsUser=Number(j)),ve&&(ye.runAsGroup=Number(ve)),We&&(ye.runAsNonRoot=!0),Object.keys(ye).length>0?W.securityContext=ye:delete W.securityContext,Fe?W.hostNetwork=!0:delete W.hostNetwork,Ye?W.hostIPC=!0:delete W.hostIPC,Nt?W.hostPID=!0:delete W.hostPID,ft?W.shareProcessNamespace=!0:delete W.shareProcessNamespace;const Pe=Et.filter(B=>B.ip.trim()).map(B=>({ip:B.ip.trim(),hostnames:B.hostnames.split(/[,\s]+/).map(ie=>ie.trim()).filter(Boolean)})).filter(B=>B.hostnames.length>0);Pe.length>0?W.hostAliases=Pe:delete W.hostAliases;const Ae={},Ie=Ct.split(`
`).map(B=>B.trim()).filter(Boolean);Ie.length>0&&(Ae.nameservers=Ie);const Je=At.split(`
`).map(B=>B.trim()).filter(Boolean);Je.length>0&&(Ae.searches=Je);const De=Wt.filter(B=>B.name.trim()).map(B=>{const ie={name:B.name.trim()};return B.value.trim()&&(ie.value=B.value.trim()),ie});De.length>0&&(Ae.options=De),Object.keys(Ae).length>0?W.dnsConfig=Ae:delete W.dnsConfig;const ct=JSON.stringify(w,null,2);await Q.updateResourceYaml(t,s,"deployments",o,ct),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(w){d({title:"保存失败",description:w?.message||String(w),variant:"destructive"})}finally{g(!1)}};return x?e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(pe,{"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(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(le,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(de,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(L,{"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:v==="RollingUpdate",onChange:()=>f("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:v==="Recreate",onChange:()=>f("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),v==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(k,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:C,onChange:w=>E(w.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:15",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(k,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:M,onChange:w=>I(w.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(le,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(de,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Qt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(k,{"code-path":"src/co Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:414:23",className:"h-2.5 w-2.5"}),c.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:416:23",className:"text-slate-500 text-[9px]",children:[c.protocol," ",c.port,":",c.targetPort]})]},c.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:423:15",className:"space-y-2",children:[e.jsxs(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:425:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((c,y)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:428:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(k,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:430:21",value:c.name,onChange:b=>F(y,"name",b.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:21",value:c.protocol,onChange:b=>F(y,"protocol",b.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:437:23",value:"UDP",children:"UDP"})]}),e.jsx(k,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:c.port,onChange:b=>F(y,"port",b.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:443:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(k,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:c.targetPort,onChange:b=>F(y,"targetPort",b.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(k,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:449:23",value:c.nodePort,onChange:b=>F(y,"nodePort",b.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>ne(y),disabled:q.ports.length<=1,children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:456:23",className:"h-3 w-3"})})]},y)),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:461:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>_(),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:463:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:468:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(v).length>0?Object.entries(v).map(([c,y])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:472:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[c,"=",y]},c)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:475:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>I(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:481:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:i,children:"创建"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(le,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kube Line truncated
${N?"border-blue-500 text-blue-400":x.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(D,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:584:15",className:"h-3.5 w-3.5"}),x.label,x.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:587:17",className:`text-[9px] px-1 py-0.5 rounded ${N?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:x.badge})]},x.key)})}),d==="basic"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:598:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="containers"?e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:608:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="storage"?e.jsx(en,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:618:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="advanced"?e.jsx(on,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:628:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="service"?e.jsx(cn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:638:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):null]})}function dn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=we(),n=kt(g=>g.token)||localStorage.getItem("token")||"",l=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${l}' \\
-H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\
-H 'Content-Type: application/json' \\
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,p=g=>{navigator.clipboard.writeText(g).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:666:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:667:7",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:668:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:669:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:670:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:l}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:671:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>p(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:674:7",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:675:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:676:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:677:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:d}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:678:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>p(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:681:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:682:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Xe({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:693:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:694:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:695:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:696:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:100",className:"h-4 w-4"})})]}),s]})})}function pn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:l}=we(),[d,p]=m.useState(""),[g,x]=m.useState(200),[N,D]=m.useState(a[0]||""),[O,v]=m.useState(!1),[f,C]=m.useState(!1),E=async()=>{v(!0);try{const I=await Q.getPodLogs(t,s,o,g,N||void 0);p(I?.data?.logs||I?.logs||I||"无日志")}catch{p("获取日志失败")}finally{v(!1)}};m.useEffect(()=>{E()},[N,g]);const M=async()=>{C(!0);const I=kt.getState().token||"",q="",Y=N?`&container=${encodeURIComponent(N)}`:"",V=`${q}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${g}&stream=true${Y}`;try{const _=(await fetch(V,{headers:{Authorization:`Bearer ${I}`}})).body?.getReader();if(!_)return;const F=new TextDecoder;let ne="";for(;;){const{done:te,value:r}=await _.read();if(te)break;ne+=F.decode(r,{stream:!0}),p(ne)}}catch{l({title:"流式日志连接中断",variant:"destructive"})}finally{C(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:752:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:753:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{"code-path" Line truncated
@@ -0,0 +1,20 @@
import{i as Ge,f as st,r as x,w as nt,N as Ee,A as Ut,j as e,B as h,L as he,W as Kt,o as Xt,H as Zt,C as Qt,R as ys,aO as es,p as ks,v as ts,E as Qe,S as gt,G as gs,M as vs,z as bt,Q as yt,V as it,a0 as vt,X as ss,T as ns,m as os,bd as js,as as Ns,k as fs}from"./index-o4rKtKfJ.js";import{C as F,a as Y,b as ie,c as pe}from"./card-6Ae5ROGi.js";import{B as te}from"./badge-CDGsL4jH.js";import{k as ee}from"./index-BZgsOVD1.js";import{u as Ce}from"./use-toast-A4ENhXFA.js";import{S as De,f as Fe,e as Ds,b as Ss,s as pt,Y as Bt,P as ws,a as Es}from"./PodFileBrowser-DLXSENob.js";import{I as b}from"./input-BfBi0wR2.js";import{T as Ie,a as Be,b as ge,c as K,d as Oe,e as X}from"./table-FZ6-yFwR.js";import{P as ce}from"./plus-BXcAPnTg.js";import{H as Cs}from"./history-DdSYxjMs.js";import{M as jt}from"./minus-CqgIaHif.js";import{F as Nt}from"./file-text-KcpAjpkr.js";import{H as as}from"./hard-drive-P-ztZBRa.js";import{E as kt}from"./external-link-CsDVsN5p.js";import{L as A}from"./label-DrX9VaVC.js";import{T as be}from"./trash-2-C2Niwqae.js";import{S as ot}from"./save-CtHT3jpw.js";import{T as et}from"./textarea-9Podrtqd.js";import{S as _e,a as $e,b as tt,c as We,d as ye}from"./select-DuV0kIrj.js";import{S as ft}from"./switch-Dqj5wqUV.js";import{Z as cs}from"./zap-BPZOchcR.js";import{F as Ps}from"./folder-open-DhovDCoC.js";import{R as rs}from"./rotate-cw-DBn4I-55.js";import{P as ls}from"./play-BOUTOTLk.js";import{D as As}from"./disc-BfF4TLmN.js";import{a as Vs,F as mt}from"./folder-ChrwvSiP.js";import{R as at}from"./refresh-cw-eQ6GkWW0.js";import{C as Ms}from"./circle-x-DCq7zPbk.js";import{A as Ts}from"./arrow-left-YLjxMf9c.js";import{P as Ot}from"./pause-BVx-OrUs.js";import"./copy-NHEH4ztb.js";import"./sparkles-B5z94t3h.js";import"./xterm-DSqgeKvr.js";import"./box-_NnNRGhN.js";import"./minimize-2-FJos9g1e.js";import"./upload-DOm5bdlT.js";import"./download-Gr2Xr683.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const Rs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Is=Ge("hash",Rs);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Ge("heart",Bs);const Hs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zs=Ge("image",Hs);const Ls=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],_s=Ge("key-round",Ls);const $s=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],Ht=Ge("tags",$s);function ds(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(l=>(l.type||l.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Ws(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:l,onRefresh:d}=t,{toast:m}=Ce(),w=st(),[r,v]=x.useState("pods"),[N,M]=x.useState(null),[y,E]=x.useState(null),[D,C]=x.useState(a?.replicas||0),[H,B]=x.useState(!1),[ne,q]=x.useState([]),[z,W]=x.useState([]),[U,G]=x.useState([]),[Q,oe]=x.useState(""),[c,u]=x.useState([]),[j,I]=x.useState([]),p=a?.ready_replicas??a?.readyReplicas??0,P=a?.replicas??0,O=p===P&&P>0;x.useEffect(()=>{r==="services"&&(oe("services"),Promise.all([ee.getNamespaceServices(s,o).catch(()=>[]),ee.getNamespaceIngresses(s,o).catch(()=>[])]).then(([k,_])=>{const $=T=>Array.isArray(T)?T:T?.list||T?.items||T?.data||[],L=$(k),ue=$(_),Z=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},me=L.filter(T=>{const ae=T.spec?.selector||T.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([ve,je])=>Z[ve]===je)}).map(T=>({name:T.name||T.metadata?.name,type:T.spec?.type||T.type||"ClusterIP",clusterIP:T.spec?.clusterIP||T.cluster_ip||"<none>",ports:(T.spec?.ports||T.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:T.spec?.selector||T.selector||{},age:T.age||""})),Se=new Set(me.map(T=>T.name)),re=ue.filter(T=>(T.spec?.rules||T.rules||[]).some(ve=>(ve.http?.paths||ve.paths||[]).some(je=>{const f=je.backend?.service?.Line truncated
`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let l="none";return n.exec?l="exec":n.httpGet?l="httpGet":n.tcpSocket&&(l="tcpSocket"),{type:l,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(`
`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function Lt(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function ut(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function _t(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function $t(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(r=>r.name.trim()).map(r=>{const v={name:r.name};return r.value!=null&&(v.value=r.value),v})),t.ports.length>0&&(s.ports=t.ports.filter(r=>r.containerPort!=="").map(r=>{const v={containerPort:typeof r.containerPort=="number"?r.containerPort:Number(r.containerPort)};return r.name&&(v.name=r.name),r.protocol&&(v.protocol=r.protocol),v}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(r=>r&&r.trim()),l=a&&Object.values(a).some(r=>r&&r.trim());(n||l)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),l&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ut(t.livenessProbe);d&&(s.livenessProbe=d);const m=ut(t.readinessProbe);m&&(s.readinessProbe=m);const w=ut(t.startupProbe);if(w&&(s.startupProbe=w),t.lifecycle){const r={},v=_t(t.lifecycle.postStart);v&&(r.postStart=v);const N=_t(t.lifecycle.preStop);N&&(r.preStop=N),Object.keys(r).length>0&&(s.lifecycle=r)}if(t.securityContext){const r=t.securityContext,v={};r.runAsUser!==""&&r.runAsUser!=null&&(v.runAsUser=Number(r.runAsUser)),r.runAsGroup!==""&&r.runAsGroup!=null&&(v.runAsGroup=Number(r.runAsGroup)),r.runAsNonRoot!=null&&(v.runAsNonRoot=r.runAsNonRoot),r.privileged!=null&&(v.privileged=r.privileged),r.readOnlyRootFilesystem!=null&&(v.readOnlyRootFilesystem=r.readOnlyRootFilesystem),r.allowPrivilegeEscalation!=null&&(v.allowPrivilegeEscalation=r.allowPrivilegeEscalation);const N=(r.capabilitiesAdd||[]).filter(Boolean),M=(r.capabilitiesDrop||[]).filter(Boolean);(N.length||M.length)&&(v.capabilities={},N.length&&(v.capabilities.add=N),M.length&&(v.capabilities.drop=M)),Object.keys(v).length>0&&(s.securityContext=v)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(r=>r.name.trim()&&r.mountPath.trim()).map(r=>{const v={name:r.name,mountPath:r.mountPath};return r.subPath&&(v.subPath=r.subPath),r.readOnly&&(v.readOnly=!0),v})),s}function Wt(t){return t.join(`
`)}function Gt(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function Ks({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs(_e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:51:11",value:o.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx($e,{"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(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Wt(o.command),placeholder:`/bin/sh
-c`,onChange:n=>s({command:Gt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Wt(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:n=>s({args:Gt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:93:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:96:9",className:"space-y-1.5",children:[o.env.map((n,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const m=[...o.env];m[l]={...n,name:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const m=[...o.env];m[l]={...n,value:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,m)=>m!==l)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},l)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:a,children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:121:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:124:9",className:"space-y-1.5",children:[o.ports.map((n,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const m=[...o.ports];m[l]={...n,name:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const m=[...o.ports];m[l]={...n,containerPort:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs(_e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:d=>{const m=[...o.ports];m[l]={...n,protocol:d},s({ports:m})},children:[e.jsx($e,{"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(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:E=>a(E.target.value),placeholder:`svc.cluster.local
cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:w,children:[e.jsx(ce,{"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,D)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:C=>r(D,{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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:C=>r(D,{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(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(D),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},D))]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(vs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:N,children:[e.jsx(ce,{"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,D)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:C=>M(D,{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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:C=>M(D,{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(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>y(D),children:e.jsx(be,{"code-path":"src/compone Line truncated
`):""),Mt(Array.isArray(R.searches)?R.searches.join(`
`):"");const xe=Array.isArray(R.options)?R.options:[];Rt(xe.map(le=>({name:le.name||"",value:le.value||""}))),v(!1)},[a]);const ps=()=>P(S=>[...S,{key:"",value:""}]),ms=S=>P(V=>V.filter((se,ke)=>ke!==S)),xs=(S,V)=>P(se=>se.map((ke,Ae)=>Ae===S?{...ke,...V}:ke)),hs=async()=>{w(!0);try{const S=JSON.parse(JSON.stringify(N));S.spec=S.spec||{},S.spec.template=S.spec.template||{},S.spec.template.spec=S.spec.template.spec||{};const V=S.spec.template.spec;if(S.spec.strategy={type:y},y==="RollingUpdate"&&(S.spec.strategy.rollingUpdate={maxSurge:D,maxUnavailable:H}),ne&&(S.spec.revisionHistoryLimit=Number(ne)),z&&(S.spec.progressDeadlineSeconds=Number(z)),U==="nodeName"&&Q.trim())V.nodeName=Q.trim(),delete V.nodeSelector,V.affinity&&delete V.affinity.nodeAffinity;else if(U==="nodeSelector"){const R={};for(const{key:xe,value:le}of p){const ze=xe.trim();ze&&(R[ze]=le)}Object.keys(R).length>0?V.nodeSelector=R:delete V.nodeSelector,V.nodeName&&delete V.nodeName,V.affinity&&delete V.affinity.nodeAffinity}else if(U==="nodeAffinity"){const R=p.filter(xe=>xe.key.trim()).map(xe=>({key:xe.key.trim(),operator:"In",values:[xe.value]}));R.length>0?(V.affinity=V.affinity||{},V.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:R}]}}):V.affinity&&delete V.affinity.nodeAffinity,delete V.nodeSelector,V.nodeName&&delete V.nodeName}const se=i.filter(R=>R.key||R.operator==="Exists").map(R=>{const xe={};return R.key&&(xe.key=R.key),R.operator&&(xe.operator=R.operator),R.value&&R.operator!=="Exists"&&(xe.value=R.value),R.effect&&(xe.effect=R.effect),R.tolerationSeconds&&R.effect==="NoExecute"&&(xe.tolerationSeconds=Number(R.tolerationSeconds)),xe});se.length>0?V.tolerations=se:delete V.tolerations,k&&(V.dnsPolicy=k),$&&(V.restartPolicy=$),ue&&(V.schedulerName=ue),me&&(V.terminationGracePeriodSeconds=Number(me)),re&&(V.serviceAccountName=re);const ke={};ae&&(ke.fsGroup=Number(ae)),je&&(ke.runAsUser=Number(je)),de&&(ke.runAsGroup=Number(de)),Ne&&(ke.runAsNonRoot=!0),Object.keys(ke).length>0?V.securityContext=ke:delete V.securityContext,ct?V.hostNetwork=!0:delete V.hostNetwork,rt?V.hostIPC=!0:delete V.hostIPC,we?V.hostPID=!0:delete V.hostPID,St?V.shareProcessNamespace=!0:delete V.shareProcessNamespace;const Ae=Et.filter(R=>R.ip.trim()).map(R=>({ip:R.ip.trim(),hostnames:R.hostnames.split(/[,\s]+/).map(xe=>xe.trim()).filter(Boolean)})).filter(R=>R.hostnames.length>0);Ae.length>0?V.hostAliases=Ae:delete V.hostAliases;const Ve={},He=Pt.split(`
`).map(R=>R.trim()).filter(Boolean);He.length>0&&(Ve.nameservers=He);const qe=Vt.split(`
`).map(R=>R.trim()).filter(Boolean);qe.length>0&&(Ve.searches=qe);const fe=Tt.filter(R=>R.name.trim()).map(R=>{const xe={name:R.name.trim()};return R.value.trim()&&(xe.value=R.value.trim()),xe});fe.length>0&&(Ve.options=fe),Object.keys(Ve).length>0?V.dnsConfig=Ve:delete V.dnsConfig;const lt=JSON.stringify(S,null,2);await ee.updateResourceYaml(t,s,"deployments",o,lt),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(S){d({title:"保存失败",description:S?.message||String(S),variant:"destructive"})}finally{w(!1)}};return r?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:y==="RollingUpdate",onChange:()=>E("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:15",type:"radio",checked:y==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),y==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:D,onChange:S=>C(S.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:15",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:H,onChange:S=>B(S.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Qt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(A,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(b,{"code-path":"src/c Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:422:23",className:"h-2.5 w-2.5"}),i.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"text-slate-500 text-[9px]",children:[i.protocol," ",i.port,":",i.targetPort]})]},i.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:431:15",className:"space-y-2",children:[e.jsxs(A,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:432:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((i,g)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:21",value:i.name,onChange:k=>Q(g,"name",k.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:442:21",value:i.protocol,onChange:k=>Q(g,"protocol",k.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:445:23",value:"UDP",children:"UDP"})]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:448:21",value:i.port,onChange:k=>Q(g,"port",k.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:451:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:452:21",value:i.targetPort,onChange:k=>Q(g,"targetPort",k.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),q.type==="NodePort"&&e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:457:23",value:i.nodePort,onChange:k=>Q(g,"nodePort",k.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:462:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>oe(g),disabled:q.ports.length<=1,children:e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:23",className:"h-3 w-3"})})]},g)),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>G(),children:[e.jsx(ce,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:476:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:477:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([i,g])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[i,"=",g]},i)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:483:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:487:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:488:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ne(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:P,children:"创建"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:497:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:498:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kub Line truncated
${v?"border-blue-500 text-blue-400":r.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(N,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:15",className:"h-3.5 w-3.5"}),r.label,r.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:55:17",className:`text-[9px] px-1 py-0.5 rounded ${v?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:r.badge})]},r.key)})}),d==="basic"?e.jsx(Us,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:66:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="containers"?e.jsx(Zs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:76:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="storage"?e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:86:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="advanced"?e.jsx(an,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:96:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):d==="service"?e.jsx(rn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:106:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:l}):null]})}function dn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Ce(),n=vt(w=>w.token)||localStorage.getItem("token")||"",l=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${l}' \\
-H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\
-H 'Content-Type: application/json' \\
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,m=w=>{navigator.clipboard.writeText(w).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:28:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:29:7",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:30:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:31:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:32:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:l}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>m(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(A,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:37:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:38:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:39:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:d}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>m(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:43:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:44:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function 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(h,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function pn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:l}=Ce(),[d,m]=x.useState(""),[w,r]=x.useState(200),[v,N]=x.useState(a[0]||""),[M,y]=x.useState(!1),[E,D]=x.useState(!1),C=async()=>{y(!0);try{const B=await ee.getPodLogs(t,s,o,w,v||void 0);m(B?.data?.logs||B?.logs||B||"无日志")}catch{m("获取日志失败")}finally{y(!1)}};x.useEffect(()=>{C()},[v,w]);const H=async()=>{D(!0);const B=vt.getState().token||"",ne="",q=v?`&container=${encodeURIComponent(v)}`:"",z=`${ne}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${w}&stream=true${q}`;try{const U=(await fetch(z,{headers:{Authorization:`Bearer ${B}`}})).body?.getReader();if(!U)return;const G=new TextDecoder;let Q="";for(;;){const{done:oe,value:c}=await U.read();if(oe)break;Q+=G.decode(c,{stream:!0}),m(Q)}}catch{l({title:"流式日志连接中断",variant:"destructive"})}finally{D(!1)}};return e.jsx("div",{"code-path":"src/components/ku Line truncated
@@ -1,20 +0,0 @@
import{i as Le,f as st,r as x,w as nt,N as we,A as Kt,j as e,B as h,L as he,W as Xt,o as Zt,H as Qt,C as es,R as ys,p as ks,v as ts,$ as ss,E as Qe,S as gt,G as gs,M as vs,z as bt,Q as yt,V as it,m as ns,bd as js,T as Ot,au as Ns,X as os,a3 as vt,k as Ds}from"./index-HuRw9UhJ.js";import{C as F,a as Y,b as ie,c as pe}from"./card-B2Wqa0sK.js";import{I as b}from"./input-C9Xfv8um.js";import{L as P}from"./label-DvRDtaMA.js";import{B as te}from"./badge-CeS-g-Od.js";import{k as ee}from"./index-GZwpRmKU.js";import{u as Ce}from"./use-toast-B25j_Fg3.js";import{S as fe,f as Fe,e as fs,b as Ss,s as pt,Y as It,P as Es,a as ws}from"./PodFileBrowser-DmjH49sm.js";import{T as Be,a as Oe,b as ge,c as K,d as Ie,e as X}from"./table-Du1vU-OM.js";import{P as ce}from"./plus-BVwIGPvl.js";import{H as Cs}from"./history-CLAzTAyT.js";import{M as jt}from"./minus-BLAorVC4.js";import{F as Nt}from"./file-text-BqORyhNh.js";import{H as as}from"./hard-drive-laLCm9TI.js";import{E as kt}from"./external-link-JBfQbjOd.js";import{T as et}from"./textarea-Bzol9o6k.js";import{S as $e,a as _e,b as tt,c as Ge,d as ye}from"./select-KDzbUQs3.js";import{S as Dt}from"./switch--ZaqVsRJ.js";import{T as be}from"./trash-2-Cf9-88KL.js";import{Z as cs}from"./zap-CS68N0Jd.js";import{F as Ps}from"./folder-open-BKJ-_5eY.js";import{R as rs}from"./rotate-cw-Dt34Qj6N.js";import{P as ls}from"./play-BXdOitsb.js";import{S as ot}from"./save-PutEGGnz.js";import{D as As}from"./disc-DI2GsPrr.js";import{a as Vs,F as mt}from"./folder-CyecCkCR.js";import{R as at}from"./refresh-cw-CSycAyA2.js";import{C as Ws}from"./circle-x-BVvXVx7p.js";import{A as Ts}from"./arrow-left-J2A6V6Vq.js";import{P as Ht}from"./pause-R-v_3hMV.js";import"./copy-Ci4WwJkK.js";import"./sparkles-DEwze8TU.js";import"./xterm-DSqgeKvr.js";import"./box-DPoVh2_c.js";import"./minimize-2-UErWMOt6.js";import"./upload-oCjAhX91.js";import"./download-CjFatm64.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const Rs=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Bs=Le("hash",Rs);const Os=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Is=Le("heart",Os);const Hs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],zs=Le("image",Hs);const Ms=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],$s=Le("key-round",Ms);const _s=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],zt=Le("tags",_s);function ds(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(r=>(r.type||r.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 Gs(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:r,onRefresh:d}=t,{toast:m}=Ce(),V=st(),[i,N]=x.useState("pods"),[D,B]=x.useState(null),[g,E]=x.useState(null),[f,w]=x.useState(a?.replicas||0),[z,O]=x.useState(!1),[ne,U]=x.useState([]),[I,L]=x.useState([]),[q,M]=x.useState([]),[Q,oe]=x.useState(""),[c,u]=x.useState([]),[j,R]=x.useState([]),p=a?.ready_replicas??a?.readyReplicas??0,C=a?.replicas??0,H=p===C&&C>0;x.useEffect(()=>{i==="services"&&(oe("services"),Promise.all([ee.getNamespaceServices(s,o).catch(()=>[]),ee.getNamespaceIngresses(s,o).catch(()=>[])]).then(([y,_])=>{const G=W=>Array.isArray(W)?W:W?.list||W?.items||W?.data||[],$=G(y),ue=G(_),Z=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},me=$.filter(W=>{const ae=W.spec?.selector||W.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([ve,je])=>Z[ve]===je)}).map(W=>({name:W.name||W.metadata?.name,type:W.spec?.type||W.type||"ClusterIP",clusterIP:W.spec?.clusterIP||W.cluster_ip||"<none>",ports:(W.spec?.ports||W.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:W.spec?.selector||W.selector||{},age:W.age||""})),Se=new Set(me.map(W=>W.name)),re=ue.filter(W=>(W.spec?.rules||W.rules||[]).some(ve=>(ve.http?.paths||ve.paths||[]).some(je=>{const v=je.backend?.service?.nLine truncated
`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let r="none";return n.exec?r="exec":n.httpGet?r="httpGet":n.tcpSocket&&(r="tcpSocket"),{type:r,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 xt(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function _t(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Gt(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(i=>i.name.trim()).map(i=>{const N={name:i.name};return i.value!=null&&(N.value=i.value),N})),t.ports.length>0&&(s.ports=t.ports.filter(i=>i.containerPort!=="").map(i=>{const N={containerPort:typeof i.containerPort=="number"?i.containerPort:Number(i.containerPort)};return i.name&&(N.name=i.name),i.protocol&&(N.protocol=i.protocol),N}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(i=>i&&i.trim()),r=a&&Object.values(a).some(i=>i&&i.trim());(n||r)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),r&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=xt(t.livenessProbe);d&&(s.livenessProbe=d);const m=xt(t.readinessProbe);m&&(s.readinessProbe=m);const V=xt(t.startupProbe);if(V&&(s.startupProbe=V),t.lifecycle){const i={},N=_t(t.lifecycle.postStart);N&&(i.postStart=N);const D=_t(t.lifecycle.preStop);D&&(i.preStop=D),Object.keys(i).length>0&&(s.lifecycle=i)}if(t.securityContext){const i=t.securityContext,N={};i.runAsUser!==""&&i.runAsUser!=null&&(N.runAsUser=Number(i.runAsUser)),i.runAsGroup!==""&&i.runAsGroup!=null&&(N.runAsGroup=Number(i.runAsGroup)),i.runAsNonRoot!=null&&(N.runAsNonRoot=i.runAsNonRoot),i.privileged!=null&&(N.privileged=i.privileged),i.readOnlyRootFilesystem!=null&&(N.readOnlyRootFilesystem=i.readOnlyRootFilesystem),i.allowPrivilegeEscalation!=null&&(N.allowPrivilegeEscalation=i.allowPrivilegeEscalation);const D=(i.capabilitiesAdd||[]).filter(Boolean),B=(i.capabilitiesDrop||[]).filter(Boolean);(D.length||B.length)&&(N.capabilities={},D.length&&(N.capabilities.add=D),B.length&&(N.capabilities.drop=B)),Object.keys(N).length>0&&(s.securityContext=N)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(i=>i.name.trim()&&i.mountPath.trim()).map(i=>{const N={name:i.name,mountPath:i.mountPath};return i.subPath&&(N.subPath=i.subPath),i.readOnly&&(N.readOnly=!0),N})),s}function Lt(t){return t.join(`
`)}function Ft(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function Us({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/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(P,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(P,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(P,{"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(_e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:52:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(P,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(P,{"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:Lt(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(P,{"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:Lt(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(Qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(ce,{"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,r)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const m=[...o.env];m[r]={...n,name:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const m=[...o.env];m[r]={...n,value:d.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,m)=>m!==r)}),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},r)),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(we,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(ce,{"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,r)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const m=[...o.ports];m[r]={...n,name:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const m=[...o.ports];m[r]={...n,containerPort:d.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:d=>{const m=[...o.ports];m[r]={...n,protocol:d},s({ports:m})},children:[e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:134:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ye,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.ts Line truncated
114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(P,{"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(P,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:V,children:[e.jsx(ce,{"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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:w=>i(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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:w=>i(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(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>N(f),children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},f))]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(vs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(P,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:D,children:[e.jsx(ce,{"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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:w=>B(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(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:w=>B(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(h,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>g(f),children:e.jsx(be,{"code-path":"src/compone Line truncated
`):""),Wt(Array.isArray(T.searches)?T.searches.join(`
`):"");const xe=Array.isArray(T.options)?T.options:[];Rt(xe.map(le=>({name:le.name||"",value:le.value||""}))),N(!1)},[a]);const ps=()=>C(S=>[...S,{key:"",value:""}]),ms=S=>C(A=>A.filter((se,ke)=>ke!==S)),xs=(S,A)=>C(se=>se.map((ke,Ae)=>Ae===S?{...ke,...A}:ke)),hs=async()=>{V(!0);try{const S=JSON.parse(JSON.stringify(D));S.spec=S.spec||{},S.spec.template=S.spec.template||{},S.spec.template.spec=S.spec.template.spec||{};const A=S.spec.template.spec;if(S.spec.strategy={type:g},g==="RollingUpdate"&&(S.spec.strategy.rollingUpdate={maxSurge:f,maxUnavailable:z}),ne&&(S.spec.revisionHistoryLimit=Number(ne)),I&&(S.spec.progressDeadlineSeconds=Number(I)),q==="nodeName"&&Q.trim())A.nodeName=Q.trim(),delete A.nodeSelector,A.affinity&&delete A.affinity.nodeAffinity;else if(q==="nodeSelector"){const T={};for(const{key:xe,value:le}of p){const ze=xe.trim();ze&&(T[ze]=le)}Object.keys(T).length>0?A.nodeSelector=T:delete A.nodeSelector,A.nodeName&&delete A.nodeName,A.affinity&&delete A.affinity.nodeAffinity}else if(q==="nodeAffinity"){const T=p.filter(xe=>xe.key.trim()).map(xe=>({key:xe.key.trim(),operator:"In",values:[xe.value]}));T.length>0?(A.affinity=A.affinity||{},A.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:T}]}}):A.affinity&&delete A.affinity.nodeAffinity,delete A.nodeSelector,A.nodeName&&delete A.nodeName}const se=l.filter(T=>T.key||T.operator==="Exists").map(T=>{const xe={};return T.key&&(xe.key=T.key),T.operator&&(xe.operator=T.operator),T.value&&T.operator!=="Exists"&&(xe.value=T.value),T.effect&&(xe.effect=T.effect),T.tolerationSeconds&&T.effect==="NoExecute"&&(xe.tolerationSeconds=Number(T.tolerationSeconds)),xe});se.length>0?A.tolerations=se:delete A.tolerations,y&&(A.dnsPolicy=y),G&&(A.restartPolicy=G),ue&&(A.schedulerName=ue),me&&(A.terminationGracePeriodSeconds=Number(me)),re&&(A.serviceAccountName=re);const ke={};ae&&(ke.fsGroup=Number(ae)),je&&(ke.runAsUser=Number(je)),de&&(ke.runAsGroup=Number(de)),Ne&&(ke.runAsNonRoot=!0),Object.keys(ke).length>0?A.securityContext=ke:delete A.securityContext,ct?A.hostNetwork=!0:delete A.hostNetwork,rt?A.hostIPC=!0:delete A.hostIPC,Ee?A.hostPID=!0:delete A.hostPID,St?A.shareProcessNamespace=!0:delete A.shareProcessNamespace;const Ae=wt.filter(T=>T.ip.trim()).map(T=>({ip:T.ip.trim(),hostnames:T.hostnames.split(/[,\s]+/).map(xe=>xe.trim()).filter(Boolean)})).filter(T=>T.hostnames.length>0);Ae.length>0?A.hostAliases=Ae:delete A.hostAliases;const Ve={},He=Pt.split(`
`).map(T=>T.trim()).filter(Boolean);He.length>0&&(Ve.nameservers=He);const qe=Vt.split(`
`).map(T=>T.trim()).filter(Boolean);qe.length>0&&(Ve.searches=qe);const De=Tt.filter(T=>T.name.trim()).map(T=>{const xe={name:T.name.trim()};return T.value.trim()&&(xe.value=T.value.trim()),xe});De.length>0&&(Ve.options=De),Object.keys(Ve).length>0?A.dnsConfig=Ve:delete A.dnsConfig;const lt=JSON.stringify(S,null,2);await ee.updateResourceYaml(t,s,"deployments",o,lt),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(S){d({title:"保存失败",description:S?.message||String(S),variant:"destructive"})}finally{V(!1)}};return i?e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:g==="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:g==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),g==="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(P,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:f,onChange:S=>w(S.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(P,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:S=>O(S.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(es,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(Y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(b,{"code-path":"src/c Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:422:23",className:"h-2.5 w-2.5"}),l.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"text-slate-500 text-[9px]",children:[l.protocol," ",l.port,":",l.targetPort]})]},l.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:431:15",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:432:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:24",className:"text-slate-600",children:["(",U.ports.length," 个端口)"]})]}),U.ports.map((l,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:21",value:l.name,onChange:y=>Q(k,"name",y.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:442:21",value:l.protocol,onChange:y=>Q(k,"protocol",y.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:445:23",value:"UDP",children:"UDP"})]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:448:21",value:l.port,onChange:y=>Q(k,"port",y.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:451:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:452:21",value:l.targetPort,onChange:y=>Q(k,"targetPort",y.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),U.type==="NodePort"&&e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:457:23",value:l.nodePort,onChange:y=>Q(k,"nodePort",y.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:462:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>oe(k),disabled:U.ports.length<=1,children:e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:23",className:"h-3 w-3"})})]},k)),e.jsxs(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>M(),children:[e.jsx(ce,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:476:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:477:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([l,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[l,"=",k]},l)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:483:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:487:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:488:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>ne(null),children:"取消"}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:C,children:"创建"})]})]})]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:497:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:498:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kub Line truncated
${N?"border-blue-500 text-blue-400":i.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(D,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:596:15",className:"h-3.5 w-3.5"}),i.label,i.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:599:17",className:`text-[9px] px-1 py-0.5 rounded ${N?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:i.badge})]},i.key)})}),d==="basic"?e.jsx(Zs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:610:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:r}):d==="containers"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:620:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:r}):d==="storage"?e.jsx(tn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:630:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:r}):d==="advanced"?e.jsx(an,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:640:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:r}):d==="service"?e.jsx(rn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:650:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:r}):null]})}function pn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Ce(),n=vt(V=>V.token)||localStorage.getItem("token")||"",r=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${r}' \\
-H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\
-H 'Content-Type: application/json' \\
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,m=V=>{navigator.clipboard.writeText(V).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:678:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:679:7",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:680:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:681:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:682:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:r}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>m(r),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:686:7",children:[e.jsx(P,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:687:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:688:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:689:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:d}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:690:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>m(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:693:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:694:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:695:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:695:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:696:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:696:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Ze({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:705:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:706:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:707:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:708:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:709:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:709:100",className:"h-4 w-4"})})]}),s]})})}function mn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:r}=Ce(),[d,m]=x.useState(""),[V,i]=x.useState(200),[N,D]=x.useState(a[0]||""),[B,g]=x.useState(!1),[E,f]=x.useState(!1),w=async()=>{g(!0);try{const O=await ee.getPodLogs(t,s,o,V,N||void 0);m(O?.data?.logs||O?.logs||O||"无日志")}catch{m("获取日志失败")}finally{g(!1)}};x.useEffect(()=>{w()},[N,V]);const z=async()=>{f(!0);const O=vt.getState().token||"",ne="",U=N?`&container=${encodeURIComponent(N)}`:"",I=`${ne}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${V}&stream=true${U}`;try{const q=(await fetch(I,{headers:{Authorization:`Bearer ${O}`}})).body?.getReader();if(!q)return;const M=new TextDecoder;let Q="";for(;;){const{done:oe,value:c}=await q.read();if(oe)break;Q+=M.decode(c,{stream:!0}),m(Q)}}catch{r({title:"流式日志连接中断",variant:"destructive"})}finally{f(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:764:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:765:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:O=>O.stopPropagation(),children:[e.jsxs("div",{"code-path" Line truncated
@@ -1,20 +0,0 @@
import{i as Fe,r as m,v as ot,N as Se,A as Zt,j as e,B as u,L as xe,V as Qt,o as es,E as ts,C as ss,R as bs,p as ys,t as ns,_ as os,z as tt,S as jt,y as vt,G as ks,M as vs,P as gt,Q as xt,m as as,aU as gs,T as Mt,al as Ds,X as cs,$ as Nt,k as js}from"./index-Dmami9WE.js";import{C as L,a as G,b as ie,c as pe}from"./card-CIfC-8Rh.js";import{I as v}from"./input-NsU9nXZF.js";import{L as C}from"./label-Ap_-SPYI.js";import{B as se}from"./badge-3UzCvU7L.js";import{k as te}from"./kubernetes-D2-GnE0t.js";import{u as Pe}from"./use-toast-jvSbBx20.js";import{S as we,f as Ye,e as Ns,b as fs,s as ht,Y as zt,P as Es,a as ws}from"./PodFileBrowser-BLvOIIeH.js";import{T as Re,a as Be,b as De,c as X,d as Oe,e as Z}from"./table-CG4mjNfb.js";import{P as ae}from"./plus-O65gX7Qz.js";import{H as Cs}from"./history-CbX6uocL.js";import{M as ft}from"./minus-DRP_TSA-.js";import{F as Et}from"./file-text-CebshSV-.js";import{H as rs}from"./hard-drive-DmC04Y5r.js";import{E as Dt}from"./external-link-2hCYo_Ng.js";import{T as st}from"./textarea-DHUZ6N85.js";import{S as Le,a as Ge,b as nt,c as He,d as ve}from"./select-DUbxjT0z.js";import{S as wt}from"./switch-TqjD2x0W.js";import{T as ue}from"./trash-2-DWVnIU6o.js";import{P as ls}from"./play-0EwQQJX_.js";import{S as at}from"./save-YtnrpTd8.js";import{R as ds}from"./rotate-cw-CKCO6IKE.js";import{Z as is}from"./zap-CocSkPPl.js";import{F as Ss}from"./folder-open-CjMh_m_2.js";import{D as Ps}from"./disc-BPxL4arn.js";import{F as As,a as ut}from"./folder-B5RGB3GG.js";import{R as ct}from"./refresh-cw-CTBERyFc.js";import{C as Vs}from"./circle-x-BBQeW1R3.js";import{A as Ws}from"./arrow-left-BIbk9wFC.js";import{P as _t}from"./pause-DOhduDQ5.js";import"./copy-CE_T92Lk.js";import"./sparkles-rPZivnlW.js";import"./xterm-DSqgeKvr.js";import"./box-88Ol5qY-.js";import"./minimize-2-BHcbNmdK.js";import"./upload-CRLg7Pbj.js";import"./download-Vuij9wGr.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const Ts=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Rs=Fe("hash",Ts);const Bs=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Os=Fe("heart",Bs);const Is=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ms=Fe("image",Is);const zs=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],_s=Fe("key-round",zs);const $s=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],$t=Fe("tags",$s);function ps(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(d=>(d.type||d.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Ls(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:d,onRefresh:i}=t,{toast:p}=Pe(),[D,h]=m.useState("pods"),[N,I]=m.useState(null),[q,V]=m.useState(null),[R,M]=m.useState(a?.replicas||0),[z,F]=m.useState(!1),[B,U]=m.useState([]),[Y,S]=m.useState([]),[Q,O]=m.useState([]),[H,ne]=m.useState(""),[oe,r]=m.useState([]),[b,f]=m.useState([]),P=a?.ready_replicas??a?.readyReplicas??0,l=a?.replicas??0,w=P===l&&l>0;m.useEffect(()=>{D==="services"&&(ne("services"),Promise.all([te.getNamespaceServices(s,o).catch(()=>[]),te.getNamespaceIngresses(s,o).catch(()=>[])]).then(([y,J])=>{const _=A=>Array.isArray(A)?A:A?.list||A?.items||A?.data||[],$=_(y),be=_(J),K=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},he=$.filter(A=>{const ce=A.spec?.selector||A.selector||{};return Object.keys(ce).length===0?!1:Object.entries(ce).every(([ge,fe])=>K[ge]===fe)}).map(A=>({name:A.name||A.metadata?.name,type:A.spec?.type||A.type||"ClusterIP",clusterIP:A.spec?.clusterIP||A.cluster_ip||"<none>",ports:(A.spec?.ports||A.ports||[]).map(ce=>`${ce.port}${ce.targetPort?":"+ce.targetPort:""}/${ce.protocol||"TCP"}`),selector:A.spec?.selector||A.selector||{},age:A.age||""})),Ne=new Set(he.map(A=>A.name)),de=be.filter(A=>(A.spec?.rules||A.rules||[]).some(ge=>(ge.http?.paths||ge.paths||[]).some(fe=>{const g=fe.backend?.service?.name||fe.bacLine truncated
`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let d="none";return n.exec?d="exec":n.httpGet?d="httpGet":n.tcpSocket&&(d="tcpSocket"),{type:d,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(`
`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function Gt(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function bt(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(`
`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function Ht(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(`
`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Ft(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(h=>h.name.trim()).map(h=>{const N={name:h.name};return h.value!=null&&(N.value=h.value),N})),t.ports.length>0&&(s.ports=t.ports.filter(h=>h.containerPort!=="").map(h=>{const N={containerPort:typeof h.containerPort=="number"?h.containerPort:Number(h.containerPort)};return h.name&&(N.name=h.name),h.protocol&&(N.protocol=h.protocol),N}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(h=>h&&h.trim()),d=a&&Object.values(a).some(h=>h&&h.trim());(n||d)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),d&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const i=bt(t.livenessProbe);i&&(s.livenessProbe=i);const p=bt(t.readinessProbe);p&&(s.readinessProbe=p);const D=bt(t.startupProbe);if(D&&(s.startupProbe=D),t.lifecycle){const h={},N=Ht(t.lifecycle.postStart);N&&(h.postStart=N);const I=Ht(t.lifecycle.preStop);I&&(h.preStop=I),Object.keys(h).length>0&&(s.lifecycle=h)}if(t.securityContext){const h=t.securityContext,N={};h.runAsUser!==""&&h.runAsUser!=null&&(N.runAsUser=Number(h.runAsUser)),h.runAsGroup!==""&&h.runAsGroup!=null&&(N.runAsGroup=Number(h.runAsGroup)),h.runAsNonRoot!=null&&(N.runAsNonRoot=h.runAsNonRoot),h.privileged!=null&&(N.privileged=h.privileged),h.readOnlyRootFilesystem!=null&&(N.readOnlyRootFilesystem=h.readOnlyRootFilesystem),h.allowPrivilegeEscalation!=null&&(N.allowPrivilegeEscalation=h.allowPrivilegeEscalation);const I=(h.capabilitiesAdd||[]).filter(Boolean),q=(h.capabilitiesDrop||[]).filter(Boolean);(I.length||q.length)&&(N.capabilities={},I.length&&(N.capabilities.add=I),q.length&&(N.capabilities.drop=q)),Object.keys(N).length>0&&(s.securityContext=N)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(h=>h.name.trim()&&h.mountPath.trim()).map(h=>{const N={name:h.name,mountPath:h.mountPath};return h.subPath&&(N.subPath=h.subPath),h.readOnly&&(N.readOnly=!0),N})),s}function Yt(t){return t.join(`
`)}function Jt(t){return t.split(`
`).map(s=>s.trim()).filter(Boolean)}function qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}){const{toast:i}=Pe(),[p,D]=m.useState(!1),[h,N]=m.useState(!a),[I,q]=m.useState(a||{}),[V,R]=m.useState([]),[M,z]=m.useState([]),[F,B]=m.useState([]);m.useEffect(()=>{if(!a){N(!1);return}q(a);const r=a?.spec?.template?.spec||{};R((Array.isArray(r.containers)?r.containers:[]).map(Lt)),z((Array.isArray(r.initContainers)?r.initContainers:[]).map(Lt)),B((Array.isArray(r.imagePullSecrets)?r.imagePullSecrets:[]).map(b=>b.name||"")),N(!1)},[a]);const U=(r,b)=>{R(f=>f.map((P,l)=>l===r?{...P,...b}:P))},Y=()=>{R(r=>[...r,Gt(`container-${r.length+1}`)])},S=r=>{R(b=>b.filter((f,P)=>P!==r))},Q=r=>{R(b=>{const f=JSON.parse(JSON.stringify(b[r]));f.name=`${f.name}-copy`;const P=[...b];return P.splice(r+1,0,f),P})},O=(r,b)=>{z(f=>f.map((P,l)=>l===r?{...P,...b}:P))},H=()=>{z(r=>[...r,Gt(`init-${r.length+1}`)])},ne=r=>{z(b=>b.filter((f,P)=>P!==r))},oe=async()=>{for(const r of[...M,...V]){if(!r.name.trim()){i({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!r.image.trim()){i({title:"保存失败",description:`容器 ${r.name} 的镜像不能为空`,variant:"destructive"});return}}D(!0);try{const r=JSON.parse(JSON.stringify(I));r.spec=r.spec||{},r.spec.template=r.spec.template||{},r.spec.template.spec=r.spec.template.spec||{},r.spec.template.spec.containers=V.map(Ft),r.spec.template.spec.initContainers=M.length>0?M.map(Ft):void 0,r.spec.template.spec.imagePullSecrets=F.filter(f=>f.trim()).length>0?F.filter(f=>f.trim()).map(f=>({name:f})):void 0;const b=JSON.stringify(r,null,2);await te.updateResourceYaml(t,s,"deployments",o,b),i({title:"容器配置已保存",description:`${o} 更新已提交`}),n()}catch(r){i({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{D(!1)}};return h?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:400:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:401:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:402:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:403:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:419:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:421:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:422:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:423:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:424:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(se,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:426:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:429:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:430:11",className:"flex items-center gap-2 flex-wrap",children:[F.map((r,b)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:432:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:433:17",className:"text-xs text-slate-300 font-mono",children:r}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:434:17",onClick:()=>B(f=>f.filter((P,l)=>l!==b)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:435:68",className:"h-3 w-3"})})]},b)),F.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:438:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:440:11",className:"flex gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:441:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:r=>{if(r.key==="Enter"){const b=r.target.value.trim();b&&(B(f=>[...f,b]),r.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:448:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",on Line truncated
-c`,onChange:n=>s({command:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:639:9",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:640:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(st,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:641:11",value:Yt(o.args),placeholder:`--config=/etc/app.yaml
--debug`,onChange:n=>s({args:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:648:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:649:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:650:11",className:a,children:[e.jsx(ts,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:650:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:651:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:653:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:656:9",className:"space-y-1.5",children:[o.env.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:658:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:659:15",value:n.name,placeholder:"KEY",onChange:i=>{const p=[...o.env];p[d]={...n,name:i.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:662:15",value:n.value||"",placeholder:"value",onChange:i=>{const p=[...o.env];p[d]={...n,value:i.target.value},s({env:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:665:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((i,p)=>p!==d)}),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:667:17",className:"h-3.5 w-3.5"})})]},d)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:671:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:676:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:677:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:678:11",className:a,children:[e.jsx(Se,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:678:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:679:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:681:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:684:9",className:"space-y-1.5",children:[o.ports.map((n,d)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:686:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:687:15",value:n.name||"",placeholder:"http",onChange:i=>{const p=[...o.ports];p[d]={...n,name:i.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:690:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:i=>{const p=[...o.ports];p[d]={...n,containerPort:i.target.value},s({ports:p})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs(Le,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:693:15",value:n.protocol||"TCP",onValueChange:i=>{const p=[...o.ports];p[d]={...n,protocol:i},s({ports:p})},children:[e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:694:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(nt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:695:19"})}),e.jsxs(He,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:697:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:698:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:699:19",value:"UDP",className:"text-slate-2 Line truncated
`):""),Rt(Array.isArray(W.searches)?W.searches.join(`
`):"");const me=Array.isArray(W.options)?W.options:[];Me(me.map(le=>({name:le.name||"",value:le.value||""}))),N(!1)},[a]);const Bt=()=>w(x=>[...x,{key:"",value:""}]),Ot=x=>w(j=>j.filter((E,ee)=>ee!==x)),Ue=(x,j)=>w(E=>E.map((ee,re)=>re===x?{...ee,...j}:ee)),xs=async()=>{D(!0);try{const x=JSON.parse(JSON.stringify(I));x.spec=x.spec||{},x.spec.template=x.spec.template||{},x.spec.template.spec=x.spec.template.spec||{};const j=x.spec.template.spec;if(x.spec.strategy={type:V},V==="RollingUpdate"&&(x.spec.strategy.rollingUpdate={maxSurge:M,maxUnavailable:F}),U&&(x.spec.revisionHistoryLimit=Number(U)),S&&(x.spec.progressDeadlineSeconds=Number(S)),O==="nodeName"&&ne.trim())j.nodeName=ne.trim(),delete j.nodeSelector,j.affinity&&delete j.affinity.nodeAffinity;else if(O==="nodeSelector"){const W={};for(const{key:me,value:le}of l){const _e=me.trim();_e&&(W[_e]=le)}Object.keys(W).length>0?j.nodeSelector=W:delete j.nodeSelector,j.nodeName&&delete j.nodeName,j.affinity&&delete j.affinity.nodeAffinity}else if(O==="nodeAffinity"){const W=l.filter(me=>me.key.trim()).map(me=>({key:me.key.trim(),operator:"In",values:[me.value]}));W.length>0?(j.affinity=j.affinity||{},j.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:W}]}}):j.affinity&&delete j.affinity.nodeAffinity,delete j.nodeSelector,j.nodeName&&delete j.nodeName}const E=k.filter(W=>W.key||W.operator==="Exists").map(W=>{const me={};return W.key&&(me.key=W.key),W.operator&&(me.operator=W.operator),W.value&&W.operator!=="Exists"&&(me.value=W.value),W.effect&&(me.effect=W.effect),W.tolerationSeconds&&W.effect==="NoExecute"&&(me.tolerationSeconds=Number(W.tolerationSeconds)),me});E.length>0?j.tolerations=E:delete j.tolerations,J&&(j.dnsPolicy=J),$&&(j.restartPolicy=$),K&&(j.schedulerName=K),Ne&&(j.terminationGracePeriodSeconds=Number(Ne)),A&&(j.serviceAccountName=A);const ee={};ge&&(ee.fsGroup=Number(ge)),g&&(ee.runAsUser=Number(g)),je&&(ee.runAsGroup=Number(je)),We&&(ee.runAsNonRoot=!0),Object.keys(ee).length>0?j.securityContext=ee:delete j.securityContext,Je?j.hostNetwork=!0:delete j.hostNetwork,qe?j.hostIPC=!0:delete j.hostIPC,Ct?j.hostPID=!0:delete j.hostPID,Pt?j.shareProcessNamespace=!0:delete j.shareProcessNamespace;const re=dt.filter(W=>W.ip.trim()).map(W=>({ip:W.ip.trim(),hostnames:W.hostnames.split(/[,\s]+/).map(me=>me.trim()).filter(Boolean)})).filter(W=>W.hostnames.length>0);re.length>0?j.hostAliases=re:delete j.hostAliases;const ke={},ze=Vt.split(`
`).map(W=>W.trim()).filter(Boolean);ze.length>0&&(ke.nameservers=ze);const Ke=Tt.split(`
`).map(W=>W.trim()).filter(Boolean);Ke.length>0&&(ke.searches=Ke);const Ee=it.filter(W=>W.name.trim()).map(W=>{const me={name:W.name.trim()};return W.value.trim()&&(me.value=W.value.trim()),me});Ee.length>0&&(ke.options=Ee),Object.keys(ke).length>0?j.dnsConfig=ke:delete j.dnsConfig;const pt=JSON.stringify(x,null,2);await te.updateResourceYaml(t,s,"deployments",o,pt),i({title:"高级设置已保存",description:`${o} 更新已提交`}),n()}catch(x){i({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{D(!1)}};return h?e.jsx(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:328:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:329:9",className:"p-12 text-center",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:330:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:331:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:348:5",className:"space-y-4",children:[e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ct,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:356:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:359:15",type:"radio",checked:V==="RollingUpdate",onChange:()=>R("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:363:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:15",type:"radio",checked:V==="Recreate",onChange:()=>R("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),V==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:373:17",value:M,onChange:x=>z(x.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:376:15",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:377:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:378:17",value:F,onChange:x=>B(x.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:11",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(v,{"code-path":"src/c Line truncated
114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:667:13",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:668:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:669:15",value:Tt,onChange:x=>Rt(x.target.value),placeholder:`svc.cluster.local
cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:675:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:676:13",className:"flex items-center justify-between mb-1",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:677:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:678:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>Me(x=>[...x,{name:"",value:""}]),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:680:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),it.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:684:15",className:"text-xs text-slate-600 italic",children:"未配置"}):it.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:686:15",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:687:17",value:x.name,onChange:E=>Me(ee=>ee.map((re,ke)=>ke===j?{...re,name:E.target.value}:re)),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:689:17",className:"text-slate-600",children:":"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:690:17",value:x.value,onChange:E=>Me(ee=>ee.map((re,ke)=>ke===j?{...re,value:E.target.value}:re)),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:692:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Me(E=>E.filter((ee,re)=>re!==j)),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:694:19",className:"h-3 w-3"})})]},j))]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:703:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:704:9",className:"pb-3",children:e.jsxs(pe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:705:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(vs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:706:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:709:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:710:11",className:"flex items-center justify-between mb-1",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:711:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:712:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:()=>Ie(x=>[...x,{ip:"",hostnames:""}]),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:714:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),dt.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:718:13",className:"text-xs text-slate-600 italic",children:"未配置"}):dt.map((x,j)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:720:13",className:"flex items-center gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:721:15",value:x.ip,onChange:E=>Ie(ee=>ee.map((re,ke)=>ke===j?{...re,ip:E.target.value}:re)),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:723:15",className:"text-slate-600",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:724:15",value:x.hostnames,onChange:E=>Ie(ee=>ee.map((re,ke)=>ke===j?{...re,hostnames:E.target.value}:re)),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:726:15",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>Ie(E=>E.filter((ee,re)=>re!==j)),children:e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:728:17",className:"h-3 w-3"})})]},j))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:736:7",cl Line truncated
bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:414:23",className:"h-2.5 w-2.5"}),c.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:416:23",className:"text-slate-500 text-[9px]",children:[c.protocol," ",c.port,":",c.targetPort]})]},c.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:423:15",className:"space-y-2",children:[e.jsxs(C,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:425:24",className:"text-slate-600",children:["(",U.ports.length," 个端口)"]})]}),U.ports.map((c,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:428:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:430:21",value:c.name,onChange:y=>H(k,"name",y.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:21",value:c.protocol,onChange:y=>H(k,"protocol",y.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:436:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:437:23",value:"UDP",children:"UDP"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:c.port,onChange:y=>H(k,"port",y.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:443:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:c.targetPort,onChange:y=>H(k,"targetPort",y.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),U.type==="NodePort"&&e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:449:23",value:c.nodePort,onChange:y=>H(k,"nodePort",y.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>ne(k),disabled:U.ports.length<=1,children:e.jsx(ft,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:456:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:461:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>O(),children:[e.jsx(ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:463:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:468:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:469:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(V).length>0?Object.entries(V).map(([c,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:472:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[c,"=",k]},c)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:475:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:480:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>B(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:481:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:l,children:"创建"})]})]})]})]}),e.jsxs(L,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ie,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kube Line truncated
${N?"border-blue-500 text-blue-400":h.available?"border-transparent text-slate-400 hover:text-slate-200":"border-transparent text-slate-600 cursor-not-allowed"}`,children:[e.jsx(I,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:584:15",className:"h-3.5 w-3.5"}),h.label,h.badge&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:587:17",className:`text-[9px] px-1 py-0.5 rounded ${N?"bg-blue-500/20 text-blue-300":"bg-slate-800 text-slate-600"}`,children:h.badge})]},h.key)})}),i==="basic"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:598:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="containers"?e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:608:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="storage"?e.jsx(en,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:618:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="advanced"?e.jsx(tn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:628:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):i==="service"?e.jsx(nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:638:9",clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:d}):null]})}function cn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Pe(),n=Nt(D=>D.token)||localStorage.getItem("token")||"",d=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,i=`curl -X POST '${d}' \\
-H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\
-H 'Content-Type: application/json' \\
-d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,p=D=>{navigator.clipboard.writeText(D).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:666:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:667:7",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:668:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:669:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:670:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:d}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:671:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>p(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:674:7",children:[e.jsx(C,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:675:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:676:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:677:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:i}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:678:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>p(i),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:681:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:682:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:683:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:684:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function et({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:693:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:694:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:695:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:696:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:697:100",className:"h-4 w-4"})})]}),s]})})}function rn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:d}=Pe(),[i,p]=m.useState(""),[D,h]=m.useState(200),[N,I]=m.useState(a[0]||""),[q,V]=m.useState(!1),[R,M]=m.useState(!1),z=async()=>{V(!0);try{const B=await te.getPodLogs(t,s,o,D,N||void 0);p(B?.data?.logs||B?.logs||B||"无日志")}catch{p("获取日志失败")}finally{V(!1)}};m.useEffect(()=>{z()},[N,D]);const F=async()=>{M(!0);const B=Nt.getState().token||"",U="",Y=N?`&container=${encodeURIComponent(N)}`:"",S=`${U}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${D}&stream=true${Y}`;try{const O=(await fetch(S,{headers:{Authorization:`Bearer ${B}`}})).body?.getReader();if(!O)return;const H=new TextDecoder;let ne="";for(;;){const{done:oe,value:r}=await O.read();if(oe)break;ne+=H.decode(r,{stream:!0}),p(ne)}}catch{d({title:"流式日志连接中断",variant:"destructive"})}finally{M(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:752:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:753:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:B=>B.stopPropagation(),children:[e.jsxs("div",{"code-path Line truncated
@@ -1 +0,0 @@
import{r as n,j as e,B as m,G as E,C as U,D as A,a as H,b as X,c as q,d as J,e as K,L as V}from"./index-Dmami9WE.js";import{I as l}from"./input-NsU9nXZF.js";import{L as d}from"./label-Ap_-SPYI.js";import{C as j,a as M}from"./card-CIfC-8Rh.js";import{B as h}from"./badge-3UzCvU7L.js";import{c as u}from"./cloud-Dq4kl-JO.js";import{R as L}from"./refresh-cw-CTBERyFc.js";import{P as k}from"./plus-O65gX7Qz.js";import{S as W}from"./search-Dd-PeBfg.js";import{C as P}from"./circle-check-CVbTTFQ0.js";import{C as Y}from"./circle-x-BBQeW1R3.js";import{P as O}from"./pen-0lfnZsyH.js";import{T as Z}from"./trash-2-DWVnIU6o.js";function xe(){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 o=c=>c?c.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:o(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:o(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(o){console.error("删除域名失败:",o)}},C=i.filter(s=>{const o=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),c=D==="all"||s.status===D;return o&&c});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(L,{"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(k,{"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(W,{"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("optioLine truncated
@@ -1 +0,0 @@
import{r as n,j as e,B as m,G as E,C as U,D as A,a as H,b as X,c as q,d as J,e as K,L as V}from"./index-HuRw9UhJ.js";import{I as l}from"./input-C9Xfv8um.js";import{L as d}from"./label-DvRDtaMA.js";import{C as j,a as M}from"./card-B2Wqa0sK.js";import{B as h}from"./badge-CeS-g-Od.js";import{c as u}from"./cloud-sEaHmpLm.js";import{R as L}from"./refresh-cw-CSycAyA2.js";import{P as k}from"./plus-BVwIGPvl.js";import{S as W}from"./search-CcKEpJIn.js";import{C as P}from"./circle-check-C5nUiTvE.js";import{C as Y}from"./circle-x-BVvXVx7p.js";import{P as O}from"./pen-C8XHRV1-.js";import{T as Z}from"./trash-2-Cf9-88KL.js";function xe(){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 o=c=>c?c.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:o(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:o(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(o){console.error("删除域名失败:",o)}},C=i.filter(s=>{const o=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),c=D==="all"||s.status===D;return o&&c});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(L,{"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(k,{"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(W,{"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("optioLine truncated
@@ -0,0 +1 @@
import{r as n,j as e,B as m,G as E,C as U,D as A,a as H,b as X,c as q,d as J,e as K,L as V}from"./index-o4rKtKfJ.js";import{I as l}from"./input-BfBi0wR2.js";import{L as d}from"./label-DrX9VaVC.js";import{C as j,a as M}from"./card-6Ae5ROGi.js";import{B as h}from"./badge-CDGsL4jH.js";import{c as u}from"./account-BE9llC-P.js";import{R as L}from"./refresh-cw-eQ6GkWW0.js";import{P as k}from"./plus-BXcAPnTg.js";import{S as W}from"./search-C_UCkHB_.js";import{C as P}from"./circle-check-Bp6gonk8.js";import{C as Y}from"./circle-x-DCq7zPbk.js";import{P as O}from"./pen-Bq7bEvmf.js";import{T as Z}from"./trash-2-C2Niwqae.js";function xe(){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 o=c=>c?c.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:o(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:o(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(o){console.error("删除域名失败:",o)}},C=i.filter(s=>{const o=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),c=D==="all"||s.status===D;return o&&c});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(L,{"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(k,{"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(W,{"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("optLine truncated
@@ -1 +0,0 @@
import{r as n,j as e,B as m,G as E,C as U,D as A,a as H,b as X,c as q,d as J,e as K,L as V}from"./index-CwVkcMR-.js";import{I as l}from"./input-B5ad6Rfz.js";import{L as d}from"./label-mg-tHjNc.js";import{C as j,a as M}from"./card-C5qBu7CR.js";import{B as h}from"./badge-DgJ0w7jf.js";import{c as u}from"./cloud--X6XAPv_.js";import{R as L}from"./refresh-cw-DM6JPbZg.js";import{P as k}from"./plus-CaJ-dB4A.js";import{S as W}from"./search-1PdnG-g5.js";import{C as P}from"./circle-check-DTBW_8Wd.js";import{C as Y}from"./circle-x-DBoylLde.js";import{P as O}from"./pen-BT_2xx_Z.js";import{T as Z}from"./trash-2-BPpnm3Sz.js";function xe(){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 o=c=>c?c.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:o(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:o(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(o){console.error("删除域名失败:",o)}},C=i.filter(s=>{const o=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),c=D==="all"||s.status===D;return o&&c});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(L,{"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(k,{"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(W,{"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("optioLine truncated
@@ -1 +0,0 @@
import{k as he,m as ue,r as n,j as e,n as q,o as J,H as be,B as ge,A as ve,T as E,I as Q,S as ke}from"./index-Dmami9WE.js";import{C as x,a as p}from"./card-CIfC-8Rh.js";import{B as g}from"./badge-3UzCvU7L.js";import{S as N,a as f,b as y,c as w,d as o}from"./select-DUbxjT0z.js";import{T as Ee,a as je,b as L,c as h,d as Pe,e as d}from"./table-CG4mjNfb.js";import{k as S}from"./kubernetes-D2-GnE0t.js";import{R as Ne}from"./refresh-cw-CTBERyFc.js";import{L as Z}from"./layers-Dv4yGMGm.js";import{R as W,C as D,X as K,Y as M,T as V,B as H,a as ee}from"./generateCategoricalChart-ZqCvxO-S.js";import{B as I}from"./BarChart-CLIO1OEu.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const se=["#EF4444","#F59E0B","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16","#06B6D4"];function Fe(){const{clusterCode:te}=he(),O=ue(),[C,U]=n.useState(!1),[m,X]=n.useState([]),[ne,ae]=n.useState([]),[ce,re]=n.useState([]),[i,oe]=n.useState("all"),[j,le]=n.useState("all"),[T,xe]=n.useState("0"),[c,Y]=n.useState(te||""),[r,G]=n.useState(null),[u,B]=n.useState(""),[b,R]=n.useState(""),[pe,de]=n.useState(null);n.useEffect(()=>{S.getClusters().then(s=>{const t=s?.list||[];if(ae(t),!c&&t.length>0){const a=t[0].code||String(t[0].id);Y(a),O(`/kubernetes/${a}/events`,{replace:!0})}}).catch(()=>{})},[]),n.useEffect(()=>{c&&S.getNamespaces(c).then(s=>{re(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[c]);const _=n.useCallback(async()=>{if(c){U(!0);try{const s=i==="all"?void 0:i,t=j==="all"?void 0:j,a=await S.getEvents(c,s,t);X(Array.isArray(a)?a:a?.list||[])}catch{X([])}finally{U(!1)}}},[c,i,j]),A=n.useCallback(async()=>{if(c)try{const s=i==="all"?void 0:i,t=parseInt(T)||void 0,a=await S.getEventsSummary(c,s,t);G(a||null)}catch{G(null)}},[c,i,T]);n.useEffect(()=>{_()},[_]),n.useEffect(()=>{A()},[A]);const v=n.useMemo(()=>{let s=m;return u&&(s=s.filter(t=>t.reason===u)),b&&(s=s.filter(t=>(t.object||"").startsWith(b+"/"))),s},[m,u,b]),me=n.useMemo(()=>m.filter(s=>s.type==="Warning").length,[m]),ie=n.useMemo(()=>m.filter(s=>s.type==="Normal").length,[m]),k=n.useMemo(()=>(r?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[r]),z=n.useMemo(()=>(r?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[r]),$=n.useMemo(()=>(r?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[r]),F=s=>s?s.replace("T"," ").substring(0,19):"-",P=s=>{if(!s)return"";const t=Date.now()-new Date(s).getTime();if(t<0)return"";const a=Math.floor(t/6e4);if(a<1)return"刚刚";if(a<60)return`${a}分钟前`;const l=Math.floor(a/60);return l<24?`${l}小时前`:`${Math.floor(l/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:134:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:136:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:137:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),c&&e.jsxs(e.Fragment,{children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:29",className:"h-3 w-3"}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:65",to:`/kubernetes/${c}`,className:"hover:text-slate-300",children:c})]}),e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:139:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:139:45",className:"text-slate-300",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:143:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:144:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(be,{"code-path":"src/components/kubernetes/EventsPage.tsx:145:11",className:"h-5 w-5 text-yellow-400"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:147:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:148:11",value:c,onValueChange:s=>{Y(s),O(`/kubernetes/${s}/events`)},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:150:13",className:"bg-slate-800 border-slate-700",children:ne.map(s=>e.jsx(o,{"code-path":"src/components/kubernetes/EventsPage.tsx:151:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:154:11",value:i,onValueChange:s=>{oe(s),B(""),R("")},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:155:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-70Line truncated
@@ -1 +1 @@
import{k as he,m as ue,r as n,j as e,n as J,o as q,J as be,B as ge,A as ve,T as E,I as Q,S as ke}from"./index-HuRw9UhJ.js";import{C as x,a as p}from"./card-B2Wqa0sK.js";import{B as g}from"./badge-CeS-g-Od.js";import{S as N,a as f,b as y,c as w,d as o}from"./select-KDzbUQs3.js";import{T as Ee,a as je,b as L,c as h,d as Pe,e as d}from"./table-Du1vU-OM.js";import{k as S}from"./index-GZwpRmKU.js";import{R as Ne}from"./refresh-cw-CSycAyA2.js";import{L as Z}from"./layers-DZGQE4Gb.js";import{R as W,C as D,X as K,Y as M,T as V,B as I,a as ee}from"./generateCategoricalChart-DrSMejeS.js";import{B as O}from"./BarChart-DrZfTE9F.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const se=["#EF4444","#F59E0B","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16","#06B6D4"];function Fe(){const{clusterCode:te}=he(),H=ue(),[C,U]=n.useState(!1),[m,X]=n.useState([]),[ne,ae]=n.useState([]),[ce,re]=n.useState([]),[i,oe]=n.useState("all"),[j,le]=n.useState("all"),[T,xe]=n.useState("0"),[c,Y]=n.useState(te||""),[r,G]=n.useState(null),[u,B]=n.useState(""),[b,R]=n.useState(""),[pe,de]=n.useState(null);n.useEffect(()=>{S.getClusters().then(s=>{const t=s?.list||[];if(ae(t),!c&&t.length>0){const a=t[0].code||String(t[0].id);Y(a),H(`/kubernetes/${a}/events`,{replace:!0})}}).catch(()=>{})},[]),n.useEffect(()=>{c&&S.getNamespaces(c).then(s=>{re(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[c]);const _=n.useCallback(async()=>{if(c){U(!0);try{const s=i==="all"?void 0:i,t=j==="all"?void 0:j,a=await S.getEvents(c,s,t);X(Array.isArray(a)?a:a?.list||[])}catch{X([])}finally{U(!1)}}},[c,i,j]),A=n.useCallback(async()=>{if(c)try{const s=i==="all"?void 0:i,t=parseInt(T)||void 0,a=await S.getEventsSummary(c,s,t);G(a||null)}catch{G(null)}},[c,i,T]);n.useEffect(()=>{_()},[_]),n.useEffect(()=>{A()},[A]);const v=n.useMemo(()=>{let s=m;return u&&(s=s.filter(t=>t.reason===u)),b&&(s=s.filter(t=>(t.object||"").startsWith(b+"/"))),s},[m,u,b]),me=n.useMemo(()=>m.filter(s=>s.type==="Warning").length,[m]),ie=n.useMemo(()=>m.filter(s=>s.type==="Normal").length,[m]),k=n.useMemo(()=>(r?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[r]),z=n.useMemo(()=>(r?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[r]),$=n.useMemo(()=>(r?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[r]),F=s=>s?s.replace("T"," ").substring(0,19):"-",P=s=>{if(!s)return"";const t=Date.now()-new Date(s).getTime();if(t<0)return"";const a=Math.floor(t/6e4);if(a<1)return"刚刚";if(a<60)return`${a}分钟前`;const l=Math.floor(a/60);return l<24?`${l}小时前`:`${Math.floor(l/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:134:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:136:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:137:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),c&&e.jsxs(e.Fragment,{children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:29",className:"h-3 w-3"}),e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:65",to:`/kubernetes/${c}`,className:"hover:text-slate-300",children:c})]}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:139:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:139:45",className:"text-slate-300",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:143:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:144:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(be,{"code-path":"src/components/kubernetes/EventsPage.tsx:145:11",className:"h-5 w-5 text-yellow-400"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:147:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:148:11",value:c,onValueChange:s=>{Y(s),H(`/kubernetes/${s}/events`)},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:150:13",className:"bg-slate-800 border-slate-700",children:ne.map(s=>e.jsx(o,{"code-path":"src/components/kubernetes/EventsPage.tsx:151:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:154:11",value:i,onValueChange:s=>{oe(s),B(""),R("")},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:155:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",chLine truncated
import{k as he,m as ue,r as n,j as e,n as J,o as q,J as be,B as ge,A as ve,T as E,I as Q,S as ke}from"./index-o4rKtKfJ.js";import{C as x,a as p}from"./card-6Ae5ROGi.js";import{B as g}from"./badge-CDGsL4jH.js";import{S as N,a as f,b as y,c as w,d as o}from"./select-DuV0kIrj.js";import{T as Ee,a as je,b as L,c as h,d as Pe,e as d}from"./table-FZ6-yFwR.js";import{k as S}from"./index-BZgsOVD1.js";import{R as Ne}from"./refresh-cw-eQ6GkWW0.js";import{L as Z}from"./layers-DIMgGF2e.js";import{R as W,C as D,X as K,Y as M,T as V,B as I,a as ee}from"./generateCategoricalChart-BeO9rjxr.js";import{B as O}from"./BarChart-BR8PowaA.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const se=["#EF4444","#F59E0B","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16","#06B6D4"];function Fe(){const{clusterCode:te}=he(),H=ue(),[C,U]=n.useState(!1),[m,X]=n.useState([]),[ne,ae]=n.useState([]),[ce,re]=n.useState([]),[i,oe]=n.useState("all"),[j,le]=n.useState("all"),[T,xe]=n.useState("0"),[c,Y]=n.useState(te||""),[r,G]=n.useState(null),[u,B]=n.useState(""),[b,R]=n.useState(""),[pe,de]=n.useState(null);n.useEffect(()=>{S.getClusters().then(s=>{const t=s?.list||[];if(ae(t),!c&&t.length>0){const a=t[0].code||String(t[0].id);Y(a),H(`/kubernetes/${a}/events`,{replace:!0})}}).catch(()=>{})},[]),n.useEffect(()=>{c&&S.getNamespaces(c).then(s=>{re(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[c]);const _=n.useCallback(async()=>{if(c){U(!0);try{const s=i==="all"?void 0:i,t=j==="all"?void 0:j,a=await S.getEvents(c,s,t);X(Array.isArray(a)?a:a?.list||[])}catch{X([])}finally{U(!1)}}},[c,i,j]),A=n.useCallback(async()=>{if(c)try{const s=i==="all"?void 0:i,t=parseInt(T)||void 0,a=await S.getEventsSummary(c,s,t);G(a||null)}catch{G(null)}},[c,i,T]);n.useEffect(()=>{_()},[_]),n.useEffect(()=>{A()},[A]);const v=n.useMemo(()=>{let s=m;return u&&(s=s.filter(t=>t.reason===u)),b&&(s=s.filter(t=>(t.object||"").startsWith(b+"/"))),s},[m,u,b]),me=n.useMemo(()=>m.filter(s=>s.type==="Warning").length,[m]),ie=n.useMemo(()=>m.filter(s=>s.type==="Normal").length,[m]),k=n.useMemo(()=>(r?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[r]),z=n.useMemo(()=>(r?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[r]),$=n.useMemo(()=>(r?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[r]),F=s=>s?s.replace("T"," ").substring(0,19):"-",P=s=>{if(!s)return"";const t=Date.now()-new Date(s).getTime();if(t<0)return"";const a=Math.floor(t/6e4);if(a<1)return"刚刚";if(a<60)return`${a}分钟前`;const l=Math.floor(a/60);return l<24?`${l}小时前`:`${Math.floor(l/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:134:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:136:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:137:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),c&&e.jsxs(e.Fragment,{children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:29",className:"h-3 w-3"}),e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:65",to:`/kubernetes/${c}`,className:"hover:text-slate-300",children:c})]}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:139:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:139:45",className:"text-slate-300",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:143:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:144:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(be,{"code-path":"src/components/kubernetes/EventsPage.tsx:145:11",className:"h-5 w-5 text-yellow-400"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:147:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:148:11",value:c,onValueChange:s=>{Y(s),H(`/kubernetes/${s}/events`)},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:150:13",className:"bg-slate-800 border-slate-700",children:ne.map(s=>e.jsx(o,{"code-path":"src/components/kubernetes/EventsPage.tsx:151:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:154:11",value:i,onValueChange:s=>{oe(s),B(""),R("")},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:155:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",chLine truncated
@@ -1 +0,0 @@
import{k as he,m as ue,r as n,j as e,n as q,o as J,H as be,B as ge,A as ve,T as E,I as Q,S as ke}from"./index-CwVkcMR-.js";import{C as x,a as p}from"./card-C5qBu7CR.js";import{B as g}from"./badge-DgJ0w7jf.js";import{S as N,a as f,b as y,c as w,d as o}from"./select-CGtvCG8I.js";import{T as Ee,a as je,b as L,c as h,d as Pe,e as d}from"./table-X8m9Cp5H.js";import{k as S}from"./index-DK2BjZ0M.js";import{R as Ne}from"./refresh-cw-DM6JPbZg.js";import{L as Z}from"./layers-BulUCMo7.js";import{R as W,C as D,X as K,Y as M,T as V,B as H,a as ee}from"./generateCategoricalChart-B9iVh1fX.js";import{B as I}from"./BarChart-CMbRSb9K.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const se=["#EF4444","#F59E0B","#3B82F6","#8B5CF6","#EC4899","#14B8A6","#F97316","#6366F1","#84CC16","#06B6D4"];function Fe(){const{clusterCode:te}=he(),O=ue(),[C,U]=n.useState(!1),[m,X]=n.useState([]),[ne,ae]=n.useState([]),[ce,re]=n.useState([]),[i,oe]=n.useState("all"),[j,le]=n.useState("all"),[T,xe]=n.useState("0"),[c,Y]=n.useState(te||""),[r,G]=n.useState(null),[u,B]=n.useState(""),[b,R]=n.useState(""),[pe,de]=n.useState(null);n.useEffect(()=>{S.getClusters().then(s=>{const t=s?.list||[];if(ae(t),!c&&t.length>0){const a=t[0].code||String(t[0].id);Y(a),O(`/kubernetes/${a}/events`,{replace:!0})}}).catch(()=>{})},[]),n.useEffect(()=>{c&&S.getNamespaces(c).then(s=>{re(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[c]);const _=n.useCallback(async()=>{if(c){U(!0);try{const s=i==="all"?void 0:i,t=j==="all"?void 0:j,a=await S.getEvents(c,s,t);X(Array.isArray(a)?a:a?.list||[])}catch{X([])}finally{U(!1)}}},[c,i,j]),A=n.useCallback(async()=>{if(c)try{const s=i==="all"?void 0:i,t=parseInt(T)||void 0,a=await S.getEventsSummary(c,s,t);G(a||null)}catch{G(null)}},[c,i,T]);n.useEffect(()=>{_()},[_]),n.useEffect(()=>{A()},[A]);const v=n.useMemo(()=>{let s=m;return u&&(s=s.filter(t=>t.reason===u)),b&&(s=s.filter(t=>(t.object||"").startsWith(b+"/"))),s},[m,u,b]),me=n.useMemo(()=>m.filter(s=>s.type==="Warning").length,[m]),ie=n.useMemo(()=>m.filter(s=>s.type==="Normal").length,[m]),k=n.useMemo(()=>(r?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[r]),z=n.useMemo(()=>(r?.by_namespace||[]).map(t=>({name:t.namespace||"<cluster>",count:t.count})),[r]),$=n.useMemo(()=>(r?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[r]),F=s=>s?s.replace("T"," ").substring(0,19):"-",P=s=>{if(!s)return"";const t=Date.now()-new Date(s).getTime();if(t<0)return"";const a=Math.floor(t/6e4);if(a<1)return"刚刚";if(a<60)return`${a}分钟前`;const l=Math.floor(a/60);return l<24?`${l}小时前`:`${Math.floor(l/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:134:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:136:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:137:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),c&&e.jsxs(e.Fragment,{children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:29",className:"h-3 w-3"}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:138:65",to:`/kubernetes/${c}`,className:"hover:text-slate-300",children:c})]}),e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:139:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:139:45",className:"text-slate-300",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:143:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:144:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(be,{"code-path":"src/components/kubernetes/EventsPage.tsx:145:11",className:"h-5 w-5 text-yellow-400"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:147:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:148:11",value:c,onValueChange:s=>{Y(s),O(`/kubernetes/${s}/events`)},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/kubernetes/EventsPage.tsx:149:87"})}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:150:13",className:"bg-slate-800 border-slate-700",children:ne.map(s=>e.jsx(o,{"code-path":"src/components/kubernetes/EventsPage.tsx:151:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:154:11",value:i,onValueChange:s=>{oe(s),B(""),R("")},children:[e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:155:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",chLine truncated
@@ -1,3 +1,3 @@
import{i as Ya,j as a,r as o,A as J,B as D,L as aa,T as Na,S as Q,w as Qa,p as za,a3 as ka,D as oa,a as ra,b as na,c as da,d as Wa,H as xa,O as Xa,v as as,z as ss,t as u,aW as _a,f as es,m as ts,au as os,I as rs,e as va,K as $a,E as Za}from"./index-HuRw9UhJ.js";import{I as X}from"./input-C9Xfv8um.js";import{B}from"./badge-CeS-g-Od.js";import{C as U,b as ya,c as Ga,a as H}from"./card-B2Wqa0sK.js";import{S as pa,a as ba,b as ua,c as ga,d as I}from"./select-KDzbUQs3.js";import{L}from"./label-DvRDtaMA.js";import{s as Ta}from"./server-BQNr9a-x.js";import{d as fa}from"./grafana-DTc3taUi.js";import{z as ns,p as ds}from"./datasource-CLdSbgtw.js";import{a as ja}from"./agent-CTqsAA8l.js";import{T as cs}from"./trending-up-C97I6AeO.js";import{z as hs,p as Pa}from"./metrics-Q051aLdz.js";import{R as ca}from"./refresh-cw-CSycAyA2.js";import{W as Fa}from"./wifi-DF9mrE-Q.js";import{A as Ma}from"./arrow-up-down-C2LsDqn8.js";import{A as Ia,a as Ba}from"./arrow-up-CmLz9pAr.js";import{S as Oa}from"./stat-strip-CVviXwc6.js";import{T as Ea,a as Ua,b as R,c as K}from"./tabs-XYsjnHzX.js";import{Z as ta}from"./zap-CS68N0Jd.js";import{C as ms}from"./copy-Ci4WwJkK.js";import{D as is}from"./download-CjFatm64.js";import{P as ls}from"./play-BXdOitsb.js";import{C as Da}from"./checkbox-B7nWBaO4.js";import{M as xs,a as ps}from"./minimize-2-UErWMOt6.js";import{P as Aa}from"./package-open-DtPFmjqV.js";import{T as bs}from"./trash-2-Cf9-88KL.js";import{E as Ha}from"./external-link-JBfQbjOd.js";import{P as Sa}from"./plus-BVwIGPvl.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const us=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],gs=Ya("wifi-off",us);function fs(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 js({panel:s}){const r=fs();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(cs,{"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",{"codLine truncated
import{i as Ya,j as a,r as o,A as J,B as D,L as aa,T as Na,S as Q,w as Qa,p as za,a0 as ka,D as oa,a as ra,b as na,c as da,d as Wa,H as xa,O as Xa,v as as,z as ss,t as u,aW as _a,f as es,m as ts,as as os,I as rs,e as va,K as $a,E as Za}from"./index-o4rKtKfJ.js";import{I as X}from"./input-BfBi0wR2.js";import{B}from"./badge-CDGsL4jH.js";import{C as U,b as ya,c as Ga,a as H}from"./card-6Ae5ROGi.js";import{S as pa,a as ba,b as ua,c as ga,d as I}from"./select-DuV0kIrj.js";import{L}from"./label-DrX9VaVC.js";import{s as Ta}from"./server-Cnj_Y0tD.js";import{d as fa}from"./grafana-DTc3taUi.js";import{z as ns,p as ds}from"./datasource-PlnPrptP.js";import{a as ja}from"./agent-BmcTPQds.js";import{T as cs}from"./trending-up-BBigl0ol.js";import{z as hs,p as Pa}from"./metrics-BQNEEfbN.js";import{R as ca}from"./refresh-cw-eQ6GkWW0.js";import{W as Fa}from"./wifi-DJeyLXcG.js";import{A as Ma}from"./arrow-up-down-CQB-1SVt.js";import{A as Ia,a as Ba}from"./arrow-up-jL4nMkK9.js";import{S as Oa}from"./stat-strip-DYcHo9Kj.js";import{T as Ea,a as Ua,b as R,c as K}from"./tabs-CoTqT5ed.js";import{Z as ta}from"./zap-BPZOchcR.js";import{C as ms}from"./copy-NHEH4ztb.js";import{D as is}from"./download-Gr2Xr683.js";import{P as ls}from"./play-BOUTOTLk.js";import{C as Da}from"./checkbox-zTZ6SyDQ.js";import{M as xs,a as ps}from"./minimize-2-FJos9g1e.js";import{P as Aa}from"./package-open-DHkNep1U.js";import{T as bs}from"./trash-2-C2Niwqae.js";import{E as Ha}from"./external-link-CsDVsN5p.js";import{P as Sa}from"./plus-BXcAPnTg.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const us=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],gs=Ya("wifi-off",us);function fs(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 js({panel:s}){const r=fs();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(cs,{"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",{"codLine truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:M,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(xa,{"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 Ws=[{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(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],_s=()=>{const s=es(),r=ts(),[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,T]=o.useState(null),[F,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,M]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),M(new Set(ea));try{await ja.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),M(new Set)},3e4)}catch{u.error("提交失败"),M(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(Cs(await ja.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice( Line truncated
@@ -1,3 +0,0 @@
import{i as Ya,j as a,r as o,h as oa,A as J,B as D,L as aa,T as Na,S as Q,v as Qa,p as za,$ as ka,D as ra,a as na,b as da,c as ca,d as Wa,E as pa,K as Xa,t as as,y as ss,aH as _a,f as es,m as ts,al as os,I as rs,e as va,J as $a,z as Za}from"./index-Dmami9WE.js";import{I as X}from"./input-NsU9nXZF.js";import{B}from"./badge-3UzCvU7L.js";import{C as U,b as ya,c as Ga,a as H}from"./card-CIfC-8Rh.js";import{S as ba,a as ua,b as ga,c as fa,d as I}from"./select-DUbxjT0z.js";import{L}from"./label-Ap_-SPYI.js";import{t as u}from"./index-BuEnLCjT.js";import{s as Ta}from"./server-3HmnhxQB.js";import{z as ns,p as ds,d as ja}from"./monitor-CicbJUrQ.js";import{a as Pa}from"./agent-B3ElXCx8.js";import{T as cs}from"./trending-up-d1DKmRom.js";import{R as ha}from"./refresh-cw-CTBERyFc.js";import{W as Fa}from"./wifi-CtC3YBV7.js";import{A as Ma}from"./arrow-up-down-Cn71rsC9.js";import{A as Ia,a as Ba}from"./arrow-up-DMuDiHn6.js";import{S as Oa}from"./stat-strip-BteRU1Iu.js";import{T as Ea,a as Ua,b as R,c as K}from"./tabs-lV44z_UR.js";import{Z as ta}from"./zap-CocSkPPl.js";import{C as hs}from"./copy-CE_T92Lk.js";import{D as ms}from"./download-Vuij9wGr.js";import{P as is}from"./play-0EwQQJX_.js";import{C as Da}from"./checkbox-DoAtRzQj.js";import{M as ls,a as xs}from"./minimize-2-BHcbNmdK.js";import{P as Aa}from"./package-open-Bj2Cp1LK.js";import{T as ps}from"./trash-2-DWVnIU6o.js";import{E as Ha}from"./external-link-2hCYo_Ng.js";import{P as Sa}from"./plus-O65gX7Qz.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const bs=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],us=Ya("wifi-off",bs);function gs(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 fs(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 js({panel:s}){const r=fs();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(cs,{"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 rLine truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:M,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(pa,{"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:ma.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 ks=[{id:"agent",label:"Agent 主机",icon:a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:52:43",className:"w-3.5 h-3.5"})},{id:"zabbix",label:"Zabbix",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:53:42",className:"w-3.5 h-3.5"})},{id:"prometheus",label:"Prometheus",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:50",className:"w-3.5 h-3.5"})},{id:"dashboard",label:"自定义",icon:a.jsx(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:55:42",className:"w-3.5 h-3.5"})}],Ws=()=>{const s=es(),r=ts(),[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,T]=o.useState(null),[F,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ma,M]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),M(new Set(ea));try{await Pa.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),M(new Set)},3e4)}catch{u.error("提交失败"),M(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(gs(await oa.get("/agent/latest")))}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)) Line truncated
@@ -1,3 +0,0 @@
import{i as Ya,j as a,r as o,A as J,B as D,L as aa,T as Na,S as Q,v as Qa,p as za,a3 as ka,D as oa,a as ra,b as na,c as da,d as Wa,E as xa,K as Xa,t as as,y as ss,aN as _a,f as es,m as ts,al as os,I as rs,e as va,J as $a,z as Za}from"./index-CwVkcMR-.js";import{I as X}from"./input-B5ad6Rfz.js";import{B}from"./badge-DgJ0w7jf.js";import{C as U,b as ya,c as Ga,a as H}from"./card-C5qBu7CR.js";import{S as pa,a as ba,b as ua,c as ga,d as I}from"./select-CGtvCG8I.js";import{L}from"./label-mg-tHjNc.js";import{t as u}from"./index-Dxvx0mlR.js";import{s as Ta}from"./server-CfXcTAsg.js";import{f as ns,e as Pa,z as ds,p as cs,d as fa}from"./monitor-UHR7OKRa.js";import{a as ja}from"./agent-CJbfK8cW.js";import{T as hs}from"./trending-up-CIEQtqqc.js";import{R as ca}from"./refresh-cw-DM6JPbZg.js";import{W as Fa}from"./wifi-CVkack1B.js";import{A as Ma}from"./arrow-up-down-DDXCK55q.js";import{A as Ia,a as Ba}from"./arrow-up-Tz6HpGg2.js";import{S as Oa}from"./stat-strip-CGgDVYxa.js";import{T as Ea,a as Ua,b as R,c as K}from"./tabs-Bd_3HnQp.js";import{Z as ta}from"./zap-Dr77-_Z_.js";import{C as ms}from"./copy-CKzeWvtb.js";import{D as is}from"./download-BgEJ-n5L.js";import{P as ls}from"./play-_cqG4jyc.js";import{C as Da}from"./checkbox-CbtT7pld.js";import{M as xs,a as ps}from"./minimize-2-Dk2LAAKi.js";import{P as Aa}from"./package-open-DHWz2zZW.js";import{T as bs}from"./trash-2-BPpnm3Sz.js";import{E as Ha}from"./external-link-BhKmTUrK.js";import{P as Sa}from"./plus-CaJ-dB4A.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";const us=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],gs=Ya("wifi-off",us);function fs(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 js({panel:s}){const r=fs();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(hs,{"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/dashboarLine truncated
...
-----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:M,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(xa,{"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 Ws=[{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(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],_s=()=>{const s=es(),r=ts(),[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,T]=o.useState(null),[F,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,M]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),M(new Set(ea));try{await ja.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),M(new Set)},3e4)}catch{u.error("提交失败"),M(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(Cs(await ja.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice( Line truncated
@@ -1 +0,0 @@
import{i as os,aG as gs,r as i,j as t,L as ms,S as Y,B as A,aH as us,N as dt,I as bs,p as Ms,C as at,A as Wt,P as Hs,D as Kt,a as qt,b as Ut,c as Vt,d as Xt,e as Jt}from"./index-Dmami9WE.js";import{a as G}from"./agent-B3ElXCx8.js";import{C,a as S}from"./card-CIfC-8Rh.js";import{S as Qt,a as Yt,b as Zt,c as ts,d as rt}from"./select-DUbxjT0z.js";import{T as js,a as vs,b as fs,c as z}from"./tabs-lV44z_UR.js";import{B as Z}from"./badge-3UzCvU7L.js";import{H as W}from"./hard-drive-DmC04Y5r.js";import{D as mt}from"./disc-BPxL4arn.js";import{C as ut}from"./circle-x-BBQeW1R3.js";import{R as Mt,C as Ht,X as jt,Y as vt,T as ft,q as as}from"./generateCategoricalChart-ZqCvxO-S.js";import{A as Nt,a as it}from"./AreaChart-CrvX3B0s.js";import{R as ss}from"./refresh-cw-CTBERyFc.js";import{P as Ns}from"./plus-O65gX7Qz.js";import{S as _s}from"./square-pen-B3dPIBrm.js";import{T as ys}from"./trash-2-DWVnIU6o.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const ws=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],ks=os("heart-pulse",ws);const Cs=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],es=os("list",Cs),bt=[{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}];function u(r,T,O){if(!r||r.length===0)return[];const F=Math.max(1,Math.ceil(r.length/O)),d=[];for(let j=0;j<r.length;j+=F){const y=r.slice(j,j+F),w=T.slice(j,j+F),v=y.reduce((nt,K)=>nt+K,0)/y.length,f=Math.max(...y),R=Math.min(...y),n=w[Math.floor(w.length/2)]||0;d.push({time:new Date(n*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:n,avg:Number(v.toFixed(2)),max:Number(f.toFixed(2)),min:Number(R.toFixed(2)),count:y.length})}return d.slice(-O)}function M(r){if(!r)return{};if(typeof r=="object")return r;try{return JSON.parse(r)}catch{return{}}}function ct(r){return r>=1024*1024*1024?`${(r/1024/1024/1024).toFixed(1)} GB/s`:r>=1024*1024?`${(r/1024/1024).toFixed(1)} MB/s`:r>=1024?`${(r/1024).toFixed(1)} KB/s`:`${r.toFixed(1)} B/s`}function Us(){const[r]=gs(),T=r.get("host")||"",[O,F]=i.useState([]),[d,j]=i.useState(T),[y,w]=i.useState(!0),[P,v]=i.useState("basic"),[f,R]=i.useState(1),[n,nt]=i.useState("avg"),[K,_t]=i.useState([]),[o,yt]=i.useState(null),[b,rs]=i.useState(null),[wt,tt]=i.useState([]),[cs,q]=i.useState(!1),[U,kt]=i.useState(null),[a,N]=i.useState({name:"",hostname:"",probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""}),V=i.useCallback(()=>{d&&G.getHealthProbes({hostname:d}).then(s=>{Array.isArray(s)?tt(s):s?.list?tt(s.list):tt([])}).catch(()=>tt([]))},[d]),[k,xt]=i.useState("whitelist"),[X,Ct]=i.useState([]),[ds,st]=i.useState(!1),[St,Tt]=i.useState(!1),pt=i.useCallback(()=>{d&&G.getPortPolicy(d).then(s=>{s?.data&&(xt(s.data.port_filter_mode||"blacklist"),Ct(s.data.port_whitelist||[]))}).catch(()=>{})},[d]);i.useEffect(()=>{pt()},[pt]);const is=async()=>{if(d){Tt(!0);try{await G.savePortPolicy(d,{port_filter_mode:k,port_whitelist:X}),st(!1)}catch{}finally{Tt(!1)}}};i.useEffect(()=>{V()},[V]);const h=bt.find(s=>s.hours===f)||bt[0];i.useEffect(()=>{G.getLatest().then(s=>{const e=Array.isArray(s)?s:s?.data||s?.list||[];if(F(e),e.length>0&&!d){const l=T?e.find(E=>E.hostname===T):null;j(l?.hostname||e[0]?.hostname||"")}const c=e.find(l=>l.hostname===(d||T));c&&(yt(c),rs(c))}).catch(()=>{}).finally(()=>w(!1))},[d]),i.useEffect(()=>{d&&G.getHistory(d,f).then(s=>{const e=Array.isArray(s)?s:s?.data||s?.list||[];if(_t(e),e.length>0){const c=e[e.length-1];yt(l=>({...l,...c}))}}).catch(()=>_t([])).finally(()=>w(!1))},[d,f]);const g=i.useMemo(()=>{const s=[],e=[],c=[],l=[],E=[],et=[],B=[],$t=[],At=[],Ft=[],It=[],Dt=[],Et=[],Bt=[],Ot=[],Gt=[],Rt=[],zt=[],Lt=[],ht=[],m=[];for(const x of K){const ns=x.report_time?new Date(x.report_time).getTime()/1e3:x.created_at?new Date(x.created_at).getTime()/1e3:0;m.push(ns),s.push(x.cpu_usage||0),Bt.push(x.cpu_iowait||0),e.push(x.mem_usage||0),Ot.push(x.mem_available||0),c.push(x.load1||0),l.push(x.disk_usage||0);const ot=M(x.disk_info);if(Array.isArray(ot)&&ot.length>0){const ls=ot.find(hs=>hs.mount==="/")||ot[0];ht.push(ls?.inode_usage_pct||0)}else ht.push(0);const $=M(x.net_info);E.push($.tcp_established||0),et.push($.tcp_time_wait||0),B.push($.tcp_close_wait||0),Rt.push(($.tcp_established||0)+($.tcp_time_wait||0)Line truncated
@@ -1 +0,0 @@
import{aX as oe,aY as Ct,aZ as E,a_ as gt,a$ as tt,b0 as ut,b1 as bt,b2 as kt,b3 as re,b4 as rt,b5 as ae,b6 as ce,b7 as Dt,b8 as Bt,r as v,b9 as Qt,ba as jt,i as Ut,j as t,N as ct,B as L,P as ie,C as it,D as Kt,a as zt,b as Wt,c as Gt,d as qt,e as Vt,A as Xt,bb as ne,L as de,S as J,aN as le,I as he,p as pe}from"./index-CwVkcMR-.js";import{a as z}from"./agent-CJbfK8cW.js";import{C as I,a as F}from"./card-C5qBu7CR.js";import{S as Rt,a as Tt,b as Et,c as It,d as at}from"./select-CGtvCG8I.js";import{c as G,T as xe,a as me,b as ge}from"./tabs-Bd_3HnQp.js";import{B as Z}from"./badge-DgJ0w7jf.js";import{R as yt,C as _t,X as Nt,Y as Ht,T as St,N as Yt}from"./generateCategoricalChart-B9iVh1fX.js";import{A as Mt,a as nt}from"./AreaChart-ZFR7lw9c.js";import{R as Jt}from"./refresh-cw-DM6JPbZg.js";import{P as ue}from"./plus-CaJ-dB4A.js";import{C as ft}from"./circle-x-DBoylLde.js";import{S as be}from"./square-pen-C8Ol72WC.js";import{T as fe}from"./trash-2-BPpnm3Sz.js";import{H as Y}from"./hard-drive-CGq_SnM5.js";import{D as xt}from"./disc-nz-uNCoJ.js";import"./index-CBIZnJrN.js";import"./chevron-up-DM77dvsL.js";var ve=class extends oe{constructor(e,s){super(),this.options=s,this.#s=e,this.#r=null,this.#o=Ct(),this.bindMethods(),this.setOptions(s)}#s;#t=void 0;#m=void 0;#e=void 0;#c;#l;#o;#r;#g;#h;#p;#i;#n;#a;#x=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ft(this.#t,this.options)?this.#d():this.updateResult(),this.#v())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return vt(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return vt(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#j(),this.#y(),this.#t.removeObserver(this)}setOptions(e){const s=this.options,o=this.#t;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof E(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#t.setOptions(this.options),s._defaulted&&!gt(this.options,s)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const a=this.hasListeners();a&&Ot(this.#t,o,this.options,s)&&this.#d(),this.updateResult(),a&&(this.#t!==o||E(this.options.enabled,this.#t)!==E(s.enabled,this.#t)||tt(this.options.staleTime,this.#t)!==tt(s.staleTime,this.#t))&&this.#u();const l=this.#b();a&&(this.#t!==o||E(this.options.enabled,this.#t)!==E(s.enabled,this.#t)||l!==this.#a)&&this.#f(l)}getOptimisticResult(e){const s=this.#s.getQueryCache().build(this.#s,e),o=this.createResult(s,e);return ye(this,o)&&(this.#e=o,this.#l=this.options,this.#c=this.#t.state),o}getCurrentResult(){return this.#e}trackResult(e,s){return new Proxy(e,{get:(o,a)=>(this.trackProp(a),s?.(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(o,a))})}trackProp(e){this.#x.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const s=this.#s.defaultQueryOptions(e),o=this.#s.getQueryCache().build(this.#s,s);return o.fetch().then(()=>this.createResult(o,s))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#d(e){this.#_();let s=this.#t.fetch(this.options,e);return e?.throwOnError||(s=s.catch(ut)),s}#u(){this.#j();const e=tt(this.options.staleTime,this.#t);if(bt.isServer()||this.#e.isStale||!kt(e))return;const o=re(this.#e.dataUpdatedAt,e)+1;this.#i=rt.setTimeout(()=>{this.#e.isStale||this.updateResult()},o)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#f(e){this.#y(),this.#a=e,!(bt.isServer()||E(this.options.enabled,this.#t)===!1||!kt(this.#a)||this.#a===0)&&(this.#n=rt.setInterval(()=>{(this.options.refetchIntervalInBackground||ae.isFocused())&&this.#d()},this.#a))}#v(){this.#u(),this.#f(this.#b())}#j(){this.#i&&(rt.clearTimeout(this.#i),this.#i=void 0)}#y(){this.#n&&(rt.clearInterval(this.#n),this.#n=void 0)}createResult(e,s){const o=this.#t,a=this.options,l=this.#e,d=this.#c,i=this.#l,n=e!==o?e.state:this.#m,{state:c}=e;let x={...c},u=!1,g;if(s._optimisticResults){const w=this.hasListeners(),T=!w&&Ft(e,s),_=w&&Ot(e,o,s,a);(T||_)&&(x={...x,...ce(c.data,e.options)}),s._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:M,errorUpdatedAt:r,status:R}=x;g=x.data;let A=!1;if(s.placeholderData!==void 0&&g===void 0&&R==="pending"){let w;l?.isPlaceholderData&&s.placeholderData===i?.placeholderData?(w=l.data,A=!0):w=typeof s.placeholderData=="function"?s.placeholderData(this.#p?.state.data,this.#p):s.placeholderData,w!==void 0&Line truncated
@@ -1 +1 @@
import{i as St,j as t,N as st,f as qt,ac as wt,r as H,B as L,Q as Kt,C as ot,D as Pt,a as Ct,b as kt,c as Dt,d as Tt,e as Lt,t as Ot,A as Ft,bb as Rt,L as zt,S as Q,aW as Gt,I as Wt,p as Ut}from"./index-HuRw9UhJ.js";import{a as E}from"./agent-CTqsAA8l.js";import{u as ct,q as K,a as pt}from"./unwrap-s5xDIyKq.js";import{C,a as k}from"./card-B2Wqa0sK.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-KDzbUQs3.js";import{c as q,T as Qt,a as Vt,b as Xt}from"./tabs-XYsjnHzX.js";import{B as V}from"./badge-CeS-g-Od.js";import{R as mt,C as gt,X as ut,Y as bt,T as jt,q as $t}from"./generateCategoricalChart-DrSMejeS.js";import{A as vt,a as at}from"./AreaChart-CTVvt9LZ.js";import{R as At}from"./refresh-cw-CSycAyA2.js";import{P as Jt}from"./plus-BVwIGPvl.js";import{C as ht}from"./circle-x-BVvXVx7p.js";import{S as Yt}from"./square-pen-DoCLytAo.js";import{T as Zt}from"./trash-2-Cf9-88KL.js";import{H as G}from"./hard-drive-laLCm9TI.js";import{D as lt}from"./disc-DI2GsPrr.js";import"./index-DwvHXNyF.js";import"./chevron-up-GXrRy2ul.js";const te=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],ee=St("heart-pulse",te);const se=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_t=St("list",se);function oe(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ae(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 re(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 ce(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}],Mt=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((S,F)=>S+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 ie(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],S=[],F=[],o=[],B=[],X=[],W=[],$=[],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),W.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);S.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.Line truncated
import{i as St,j as t,N as st,f as qt,aj as wt,r as H,B as L,Q as Kt,C as ot,D as Pt,a as Ct,b as kt,c as Dt,d as Tt,e as Lt,t as Ot,A as Ft,bb as Rt,L as zt,S as Q,aW as Gt,I as Wt,p as Ut}from"./index-o4rKtKfJ.js";import{a as E}from"./agent-BmcTPQds.js";import{u as ct,q as K,a as pt}from"./unwrap-D0DvYxvf.js";import{C,a as k}from"./card-6Ae5ROGi.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-DuV0kIrj.js";import{c as q,T as Qt,a as Vt,b as Xt}from"./tabs-CoTqT5ed.js";import{B as V}from"./badge-CDGsL4jH.js";import{R as mt,C as gt,X as ut,Y as bt,T as jt,q as $t}from"./generateCategoricalChart-BeO9rjxr.js";import{A as vt,a as at}from"./AreaChart-CIzu6WTF.js";import{R as At}from"./refresh-cw-eQ6GkWW0.js";import{P as Jt}from"./plus-BXcAPnTg.js";import{C as ht}from"./circle-x-DCq7zPbk.js";import{S as Yt}from"./square-pen-y4Af_nu2.js";import{T as Zt}from"./trash-2-C2Niwqae.js";import{H as G}from"./hard-drive-P-ztZBRa.js";import{D as lt}from"./disc-BfF4TLmN.js";import"./index-BeCACrpC.js";import"./chevron-up-CZcf1jNw.js";const te=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],ee=St("heart-pulse",te);const se=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_t=St("list",se);function oe(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ae(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 re(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 ce(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}],Mt=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;n<e.length;n+=l){const c=e.slice(n,n+l),d=a.slice(n,n+l),s=c.reduce((S,F)=>S+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 ie(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],S=[],F=[],o=[],B=[],X=[],W=[],$=[],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),W.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);S.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.Line truncated
@@ -1,10 +0,0 @@
import{r as n,j as e,s as ae,B as T,aq as ce,ao as _e,ak as Re,ah as oe,ar as Pe,aj as $,al as X,as as Te,am as H,ai as Ee,an as Ae,a0 as E,D as le,a as ue,b as Me,c as de,d as ie,e as Ie,t as I,a3 as Fe,H as Ge,L as Oe,X as Be,aQ as Le,aR as Ue,aS as ze,aT as $e,aU as Z,aV as F,P as We,z as Ve,w as qe,T as He,Q as Xe}from"./index-HuRw9UhJ.js";import{C as G,b as U,c as z,d as xe,a as O}from"./card-B2Wqa0sK.js";import{I as L}from"./input-C9Xfv8um.js";import{B as y}from"./badge-CeS-g-Od.js";import{k as w}from"./index-GZwpRmKU.js";import{T as Qe,a as Ye,b as A,c as M}from"./tabs-XYsjnHzX.js";import{C as pe}from"./circle-x-BVvXVx7p.js";import{R as Je,C as Ze,X as et,Y as tt,T as st}from"./generateCategoricalChart-DrSMejeS.js";import{A as rt,a as ee}from"./AreaChart-CTVvt9LZ.js";import{T as te}from"./textarea-Bzol9o6k.js";import{L as P}from"./label-DvRDtaMA.js";import{u as nt}from"./index-DwvHXNyF.js";import{C as at}from"./circle-DV2nF4ie.js";import{x as ct,a as ot}from"./xterm-DSqgeKvr.js";import{M as lt,a as ut}from"./minimize-2-UErWMOt6.js";import{R as q}from"./refresh-cw-CSycAyA2.js";import{P as dt}from"./plus-BVwIGPvl.js";import{S as it}from"./search-CcKEpJIn.js";import{E as xt}from"./ellipsis-DJJV1WjU.js";import{D as pt}from"./download-CjFatm64.js";import{T as mt}from"./trash-2-Cf9-88KL.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(ae,{"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(xe,{"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(Qe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(Ye,{"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:Line truncated
kind: Config
clusters:
- cluster:
server: https://10.0.0.1:6443
...`,rows:10,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"}),!b&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:243:17",className:"text-xs text-[var(--dg-text-muted)]",children:"粘贴 kubeconfig 内容后将自动解析 API Server 地址"})]})]}),e.jsxs(Ie,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:250:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:251:11",variant:"outline",onClick:()=>{x(!1)},className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:"取消"}),e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:258:11",onClick:j,disabled:D,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:d?"保存中...":r?"保存":"添加"})]})]})})}function Rt({open:a,onOpenChange:x,clusterId:r,clusterName:g}){const s=n.useRef(null),u=n.useRef(null),d=n.useRef(null),K=n.useRef(null),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");return n.useEffect(()=>{a||f(!1)},[a]),n.useEffect(()=>{if(!a||!r)return;const t=new ct.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),i=new ot.FitAddon;t.loadAddon(i),u.current=t,K.current=i;const j=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,D=Fe.getState().token||"",o=`${j.replace(/^http/,"ws").replace("/api/v1","")}/ws/kubectl?token=${encodeURIComponent(D)}&id=${r}`,l=new WebSocket(o);return d.current=l,t.onData(N=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({status:0,data:N}))}),l.onmessage=N=>{try{const _=JSON.parse(N.data);_.status===0&&typeof _.data=="string"&&t.write(_.data)}catch{typeof N.data=="string"&&t.write(N.data)}},l.onopen=()=>{C(!0),p(""),s.current&&(t.open(s.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}),setTimeout(()=>{try{t.focus()}catch{}},150))},l.onclose=()=>{C(!1),t.write(`\r
\x1B[31m[连接已断开]\x1B[0m\r
`)},l.onerror=()=>{p("WebSocket 连接失败"),t.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)},()=>{try{(l.readyState===WebSocket.OPEN||l.readyState===WebSocket.CONNECTING)&&l.close(),t.dispose()}catch{}u.current=null,d.current=null,C(!1)}},[a,r]),n.useEffect(()=>{if(!a)return;const t=s.current;if(!t)return;let i;const m=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(K.current&&u.current&&d.current)try{K.current.fit(),u.current.focus();const{cols:j,rows:D}=u.current;d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({status:1,cols:j,rows:D}))}catch{}},60)});return m.observe(t),()=>{clearTimeout(i),m.disconnect()}},[a]),e.jsx(le,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:161:5",open:a,onOpenChange:x,children:e.jsxs(ue,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:162:7",showCloseButton:!1,onOpenAutoFocus:t=>t.preventDefault(),className:E("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",b?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:b?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:174:9",className:"sr-only",children:["kubectl — ",g]}),e.jsx(ie,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:175:9",className:"sr-only",children:"Kubernetes 集群命令行终端"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:178: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/kubernetes/KubectlTerminal.tsx:179:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:180:13",className:E("w-2 h-2 rounded-full",k?"bg-emerald-400":h?"bg-red-400":"bg-yellow-400")}),e.jsx(Ge,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:181:13",className:"h-4 w-4 text-blue-400"}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:182:13",className:"text-[var(--dg-text-primary)] font-medium",children:["kubectl — ",g]}),!k&&!h&&e.jsx(Oe,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:183:38",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:185:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:186:13",onClick:()=>f(!b),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:b?e.jsx(lt,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:29",className:"h-4 w-4"}):e.jsx(ut,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:192:13",onClick:()=>x(!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/kubernetes/KubectlTerminal.tsx:196:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:202:9",ref:s,className:"bg-[#0f172a]",style:{height:b?"calc(100vh - 49px)":"480px"}})]})})}function Jt(){const[a,x]=n.useState([]),[r,g]=n.useState(!0),[s,u]=n.useState(null),[d,K]=n.useState(""),[k,C]=n.useState(!1),[b,f]=n.useState(null),[h,p]=n.useState(null),[t,i]=n.useState(!1),[m,j]=n.useState(null),[D,o]=n.useState(!1),l=async()=>{try{g(!0);const c=await w.getClusters();x(c?.list||[])}catch(c){console.error("加载集群列表失败:",c),x([])}finally{g(!1)}};n.useEffect(()=>{l()},[]);const[,N]=n.useState(null),_=()=>{l().then(()=>{b||setTimeout(async()=>{const v=(await w.getClusters())?.list||[];v.length>0&&B(v[v.length-1].id,!0)},500)})},V=async c=>{try{await w.deleteCluster(c),l()}catch(v){console.error("删除集群失败:",v)}},B=async(c,v)=>{try{v||I.info("正在同步集群资源...");const R=await w.syncCluster(c);v||I.success(R?.message||"同步完成"),l()}catch(R){v||I.error(R?.message||"同步失败")}},ye=async()=>{if(!m)return;const c=m.code||String(m.id);try{o(!0),I.info(`正在导出 ${m.name} 所有命名空间的资源...`),await w.exportAllResources(c),I.success("导出完成,已开始下载"),j(null)}catch(v){I.error(v?.message||"导出失败")}finally{o(!1)}},Y=a.filter(c=>(c.name||"").toLowerCase().includes(d.toLowerCase())||(c.version||"").includes(d)),we=c=>{switch(c){case"healthy":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:138:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:139:13",className:"h-3 w-3 mr-1"}),"健康"]});case"warning":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:145:11",variant:"outline",className:"border-amber-500/30 text-amb Line truncated
@@ -0,0 +1,10 @@
import{r as n,j as e,s as ae,B as T,ao as ce,am as _e,aa as Re,a7 as oe,ap as Pe,a9 as $,ab as X,aq as Te,ac as H,a8 as Ee,ad as Ae,Z as E,D as le,a as ue,b as Me,c as de,d as ie,e as Ie,t as I,a0 as Fe,H as Ge,L as Oe,X as Be,aQ as Le,aR as Ue,aS as ze,aT as $e,aU as J,aV as F,P as We,z as Ve,w as qe,T as He,Q as Xe}from"./index-o4rKtKfJ.js";import{C as G,b as U,c as z,d as xe,a as O}from"./card-6Ae5ROGi.js";import{I as L}from"./input-BfBi0wR2.js";import{B as y}from"./badge-CDGsL4jH.js";import{k as w}from"./index-BZgsOVD1.js";import{T as Qe,a as Ye,b as A,c as M}from"./tabs-CoTqT5ed.js";import{C as pe}from"./circle-x-DCq7zPbk.js";import{R as Ze,C as Je,X as et,Y as tt,T as st}from"./generateCategoricalChart-BeO9rjxr.js";import{A as rt,a as ee}from"./AreaChart-CIzu6WTF.js";import{T as te}from"./textarea-9Podrtqd.js";import{L as P}from"./label-DrX9VaVC.js";import{u as nt}from"./index-BeCACrpC.js";import{C as at}from"./circle-Dh5ZrES5.js";import{x as ct,a as ot}from"./xterm-DSqgeKvr.js";import{M as lt,a as ut}from"./minimize-2-FJos9g1e.js";import{R as q}from"./refresh-cw-eQ6GkWW0.js";import{P as dt}from"./plus-BXcAPnTg.js";import{S as it}from"./search-C_UCkHB_.js";import{E as xt}from"./ellipsis-C5etkM9m.js";import{D as pt}from"./download-Gr2Xr683.js";import{T as mt}from"./trash-2-C2Niwqae.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(ae,{"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(xe,{"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(Qe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(Ye,{"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:[Line truncated
kind: Config
clusters:
- cluster:
server: https://10.0.0.1:6443
...`,rows:10,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"}),!b&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:243:17",className:"text-xs text-[var(--dg-text-muted)]",children:"粘贴 kubeconfig 内容后将自动解析 API Server 地址"})]})]}),e.jsxs(Ie,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:250:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:251:11",variant:"outline",onClick:()=>{x(!1)},className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] hover:bg-[var(--dg-bg-hover)]",children:"取消"}),e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:258:11",onClick:j,disabled:D,className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",children:d?"保存中...":r?"保存":"添加"})]})]})})}function Rt({open:a,onOpenChange:x,clusterId:r,clusterName:g}){const s=n.useRef(null),u=n.useRef(null),d=n.useRef(null),K=n.useRef(null),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");return n.useEffect(()=>{a||f(!1)},[a]),n.useEffect(()=>{if(!a||!r)return;const t=new ct.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),i=new ot.FitAddon;t.loadAddon(i),u.current=t,K.current=i;const j=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,D=Fe.getState().token||"",o=`${j.replace(/^http/,"ws").replace("/api/v1","")}/ws/kubectl?token=${encodeURIComponent(D)}&id=${r}`,l=new WebSocket(o);return d.current=l,t.onData(N=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({status:0,data:N}))}),l.onmessage=N=>{try{const _=JSON.parse(N.data);_.status===0&&typeof _.data=="string"&&t.write(_.data)}catch{typeof N.data=="string"&&t.write(N.data)}},l.onopen=()=>{C(!0),p(""),s.current&&(t.open(s.current),requestAnimationFrame(()=>{try{i.fit()}catch{}}),setTimeout(()=>{try{t.focus()}catch{}},150))},l.onclose=()=>{C(!1),t.write(`\r
\x1B[31m[连接已断开]\x1B[0m\r
`)},l.onerror=()=>{p("WebSocket 连接失败"),t.write(`\r
\x1B[31m[连接发生错误]\x1B[0m\r
`)},()=>{try{(l.readyState===WebSocket.OPEN||l.readyState===WebSocket.CONNECTING)&&l.close(),t.dispose()}catch{}u.current=null,d.current=null,C(!1)}},[a,r]),n.useEffect(()=>{if(!a)return;const t=s.current;if(!t)return;let i;const m=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(K.current&&u.current&&d.current)try{K.current.fit(),u.current.focus();const{cols:j,rows:D}=u.current;d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({status:1,cols:j,rows:D}))}catch{}},60)});return m.observe(t),()=>{clearTimeout(i),m.disconnect()}},[a]),e.jsx(le,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:161:5",open:a,onOpenChange:x,children:e.jsxs(ue,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:162:7",showCloseButton:!1,onOpenAutoFocus:t=>t.preventDefault(),className:E("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",b?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:b?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:174:9",className:"sr-only",children:["kubectl — ",g]}),e.jsx(ie,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:175:9",className:"sr-only",children:"Kubernetes 集群命令行终端"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:178: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/kubernetes/KubectlTerminal.tsx:179:11",className:"flex items-center gap-2 text-sm",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:180:13",className:E("w-2 h-2 rounded-full",k?"bg-emerald-400":h?"bg-red-400":"bg-yellow-400")}),e.jsx(Ge,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:181:13",className:"h-4 w-4 text-blue-400"}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:182:13",className:"text-[var(--dg-text-primary)] font-medium",children:["kubectl — ",g]}),!k&&!h&&e.jsx(Oe,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:183:38",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:185:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:186:13",onClick:()=>f(!b),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:b?e.jsx(lt,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:29",className:"h-4 w-4"}):e.jsx(ut,{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:190:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:192:13",onClick:()=>x(!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/kubernetes/KubectlTerminal.tsx:196:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/KubectlTerminal.tsx:202:9",ref:s,className:"bg-[#0f172a]",style:{height:b?"calc(100vh - 49px)":"480px"}})]})})}function Zt(){const[a,x]=n.useState([]),[r,g]=n.useState(!0),[s,u]=n.useState(null),[d,K]=n.useState(""),[k,C]=n.useState(!1),[b,f]=n.useState(null),[h,p]=n.useState(null),[t,i]=n.useState(!1),[m,j]=n.useState(null),[D,o]=n.useState(!1),l=async()=>{try{g(!0);const c=await w.getClusters();x(c?.list||[])}catch(c){console.error("加载集群列表失败:",c),x([])}finally{g(!1)}};n.useEffect(()=>{l()},[]);const[,N]=n.useState(null),_=()=>{l().then(()=>{b||setTimeout(async()=>{const v=(await w.getClusters())?.list||[];v.length>0&&B(v[v.length-1].id,!0)},500)})},V=async c=>{try{await w.deleteCluster(c),l()}catch(v){console.error("删除集群失败:",v)}},B=async(c,v)=>{try{v||I.info("正在同步集群资源...");const R=await w.syncCluster(c);v||I.success(R?.message||"同步完成"),l()}catch(R){v||I.error(R?.message||"同步失败")}},ye=async()=>{if(!m)return;const c=m.code||String(m.id);try{o(!0),I.info(`正在导出 ${m.name} 所有命名空间的资源...`),await w.exportAllResources(c),I.success("导出完成,已开始下载"),j(null)}catch(v){I.error(v?.message||"导出失败")}finally{o(!1)}},Y=a.filter(c=>(c.name||"").toLowerCase().includes(d.toLowerCase())||(c.version||"").includes(d)),we=c=>{switch(c){case"healthy":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:138:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:139:13",className:"h-3 w-3 mr-1"}),"健康"]});case"warning":return e.jsxs(y,{"code-path":"src/components/kubernetes/KubernetesClusters.tsx:145:11",variant:"outline",className:"border-amber-500/30 text-amb Line truncated
Loaded 100 of 436 files, more files were not shown because too many files have changed in this diff. Show more