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{r as n,j as a,an as ot,ao as Pe,af as nt,ab as Te,ap as rt,a8 as st,ag as Ie,aq as at,ac as L,ar as lt,aa as j,ad as E,as as $,at as ct,au as Re,av as it,aw as dt,ax as ut,ay as pt,az as ft,aA as mt,aB as ht,aC as gt,aD as Ee,aE as vt,a0 as te,V as Ne,K as xt}from"./index-Dmami9WE.js";import{u as St}from"./index-CtCQcvyh.js";import{C as wt}from"./chevron-up-Cq4GPopa.js";function Ct(t){const o=yt(t),e=n.forwardRef((s,r)=>{const{children:d,...l}=s,c=n.Children.toArray(d),i=c.find(bt);if(i){const p=i.props.children,g=c.map(x=>x===i?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return a.jsx(o,{...l,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return a.jsx(o,{...l,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function yt(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const l=Et(r),c=Tt(d,r.props);return r.type!==n.Fragment&&(c.ref=s?ot(s,l):l),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var It=Symbol("radix.slottable");function bt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===It}function Tt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...c)=>{const i=d(...c);return r(...c),i}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Et(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Pt=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],J="Select",[ie,de,Nt]=at(J),[oe]=st(J,[Nt,Pe]),ue=Pe(),[_t,G]=oe(J),[jt,At]=oe(J),_e=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:l,defaultValue:c,onValueChange:i,dir:p,name:g,autoComplete:x,disabled:P,required:b,form:y}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,A]=n.useState(!1),ne=nt(p),[R,O]=Te({prop:s,defaultProp:r??!1,onChange:d,caller:J}),[U,q]=Te({prop:l,defaultProp:c,onChange:i,caller:J}),k=n.useRef(null),V=h?y||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(N=>N.props.value).join(";");return a.jsx(rt,{...u,children:a.jsxs(_t,{required:b,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:A,contentId:Ie(),value:U,onValueChange:q,open:R,onOpenChange:O,dir:ne,triggerPointerDownPosRef:k,disabled:P,children:[a.jsx(ie.Provider,{scope:o,children:a.jsx(jt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(N=>{B(D=>new Set(D).add(N))},[]),onNativeOptionRemove:n.useCallback(N=>{B(D=>{const W=new Set(D);return W.delete(N),W})},[]),children:e})}),V?a.jsxs(Je,{"aria-hidden":!0,required:b,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:N=>q(N.target.value),disabled:P,form:y,children:[U===void 0?a.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};_e.displayName=J;var je="SelectTrigger",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),l=G(je,e),c=l.disabled||s,i=L(o,l.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,P,b]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===l.value),m=tt(h,u,S);m!==void 0&&l.onValueChange(m.value)}),y=u=>{c||(l.onOpenChange(!0),b()),u&&(l.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return a.jsx(lt,{asChild:!0,...d,children:a.jsx(j.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Qe(l.value)?"":void 0,...r,ref:i,onClick:E(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&y(u)}),onPointerDown:E(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(y(u),u.preventDefault())}),onKeyDown:E(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&P(u.key),!(h&&u.key===" ")&&Pt.includes(u.key)&&(y(),u.preventDefault())})})})});Ae.displayName=je;var Me="SelectValue",Oe=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:l="",...c}=t,i=G(Me,e),{onValueNodeHasChildrenChange:p}=i,g=d!==void 0,x=L(o,i.onValueNodeChange);return $(()=>{p(g)},[p,g]),a.jsx(j.span,{...c,ref:x,style:{pointerEvents:"none"},children:Qe(i.value)?a.jsx(a.Fragment,{children:l}):d})});Oe.displayName=Me;var Mt="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return a.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Mt;var Ot="SelectPortal",Le=t=>a.jsx(ct,{asChildLine truncated
|
||||
Reference in new issue
Block a user