refactor(frontend): API 子模块化、大组件拆分与 TanStack Query hooks

P1: kubernetes/system API 拆为子目录模块,导出工具下沉到 lib/export-utils,
    http 统一 buildApiUrl/getWsBase;HostMonitor、DeploymentEdit* 拆至子组件。

P2: 新增 hooks/api(queryKeys、useTerminalSessions、useHostMonitor),
    TerminalSessionsTab 与 HostMonitor 接入 TanStack Query。

P3: 保留 services/api 路径,未迁移至 api/ 目录。
This commit is contained in:
Logan.Li committed 2026-06-26 00:02:29 +08:00
1 parent 7fb2236b4d
commit 0b404b4611
226 files changed
+3040 -2596

No files matched your search

@@ -0,0 +1 @@
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