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:
1 parent
7fb2236b4d
commit
0b404b4611
226 files changed
+3040
-2596
No files matched your search
@@ -0,0 +1 @@
|
||||
import{i as gs,j as e,L as R,P as G,r as n,f as Gs,m as Is,h as Ne,B as p,C as I,Q as E,al as V,S as ge,v as te,N as ye,am as ys,G as ue,V as Ws,o as ve,D as ls,a as ds,b as ps,c as is}from"./index-Dmami9WE.js";import{C as qs,a as Js}from"./card-CIfC-8Rh.js";import{I as g}from"./input-NsU9nXZF.js";import{B as y}from"./badge-3UzCvU7L.js";import{T as Hs}from"./textarea-DHUZ6N85.js";import{L as d}from"./label-Ap_-SPYI.js";import{S as Y,a as Z,b as ee,c as se,d as v}from"./select-DUbxjT0z.js";import{d as be,p as P}from"./deploy-CD5bEXt-.js";import{t as x}from"./index-BuEnLCjT.js";import{C as W}from"./circle-x-BBQeW1R3.js";import{P as je}from"./plus-O65gX7Qz.js";import{A as S}from"./arrow-right-CkKR0P0R.js";import{S as Qs}from"./search-Dd-PeBfg.js";import{L as Ks}from"./layers-Dv4yGMGm.js";import{C as Us}from"./code-BAhZJUYV.js";import{C as Pe}from"./circle-stop-DadQKvNg.js";import{P as Xs}from"./play-0EwQQJX_.js";import{H as Ys}from"./history-CbX6uocL.js";import{T as xs}from"./trash-2-DWVnIU6o.js";import{B as Zs}from"./box-88Ol5qY-.js";import{T as ms}from"./tag-utZ9-UQ0.js";import{F as hs}from"./file-text-CebshSV-.js";import"./index-CtCQcvyh.js";import"./chevron-up-Cq4GPopa.js";const ea=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],sa=gs("package",ea);const aa=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ta=gs("workflow",aa);function na(c){return c.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function oa(c){switch(c){case"success":return e.jsxs(y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(G,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(W,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(R,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const ae=[{key:"checkout",label:"代码检出",icon:E,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:Zs,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:G,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:te,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:V,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:ys,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((c,b)=>c.order-b.order);function Me(c){if(!c)return"-";if(c<60)return`${c}s`;const b=Math.floor(c/60),i=c%60;return i>0?`${b}分${i}秒`:`${b}分`}function ca(c){if(!c)return[];try{const b=typeof c=="string"?JSON.parse(c):c;return Array.isArray(b)?b:[]}catch{return[]}}function Ta(){const[c,b]=n.useState(""),[i,q]=n.useState([]),[J,B]=n.useState(!0),[M,w]=n.useState({}),[H,D]=n.useState({}),[N,L]=n.useState({}),[T,A]=n.useState("all"),[r,fe]=n.useState({}),[us,F]=n.useState(!1),[Q,we]=n.useState(""),[k,ke]=n.useState(""),[_e,Ce]=n.useState(""),[ne,Se]=n.useState(""),[Re,Ee]=n.useState("main"),[Be,De]=n.useState(""),[m,Le]=n.useState(["checkout","build","image","deploy"]),[,vs]=n.useState(""),[,bs]=n.useState(""),[oe,Te]=n.useState("branch"),[Ae,Fe]=n.useState("ssh"),[ce,$e]=n.useState(""),[re,ze]=n.useState(!1),[js,Ps]=n.useState([]),[Ms,Ns]=n.useState([]),[K,Oe]=n.useState(""),[_,Ve]=n.useState(""),[$,Ge]=n.useState("manual"),[Ie,We]=n.useState(""),[qe,Je]=n.useState(""),[He,le]=n.useState(""),[Qe,Ke]=n.useState(""),[j,C]=n.useState([]),[Ue,Xe]=n.useState(""),[Ye,fs]=n.useState(2),[,ws]=n.useState([]),[,ks]=n.useState([]),[_s,Cs]=n.useState([]),[,la]=n.useState([]),[,da]=n.useState([]),[Ss,Ze]=n.useState(!1),[z,Rs]=n.useState(null),[es,ss]=n.useState([]),as=Gs(),ts=Is(),Es=[{key:"all",label:"全部",icon:Ks,color:"#6B7280"},{key:"produLine truncated
|
||||
Reference in new issue
Block a user