refactor(frontend): P1-P2 架构统一 — utils/hooks/api 模块化
P1: - utils/storage.ts、theme.ts、validate.ts + index 统一出口 - request/store/useTheme 接入 storage;清零 confirm/alert - PipelineManager、TerminalAuditTab 拆分子模块(<700行红线) P2: - api/monitor、api/deploy 子目录化 - hooks/api 扩展:servers/pipelines/alerts/audit/sessionCommands - PipelineManager、AuditOperationsTab 接入 TanStack Query
This commit is contained in:
1 parent
d19a03d427
commit
f45e203e21
196 files changed
+3228
-2018
No files matched your search
@@ -0,0 +1 @@
|
||||
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
|
||||
Reference in new issue
Block a user