import{s as b}from"./instance-WW5TU1a7.js";import{S as D,a as N}from"./SearchUtil-_PbmflM7.js";import{d as E,a as T,r as q,D as O,F as R,c as y,b as k,w as n,H as v,U as L,e as f,o as t,J as c,j as C,n as _,I as P,f as p,t as r,Y as V,T as i,a2 as $,a3 as A,L as B,M as F,z as M,_ as U}from"./index-FX23dEwE.js";import{p as Y,q as g}from"./PromQueryUtil-fadptBha.js";import{b as H}from"./ByteUtil-YdHlSEeW.js";import"./request-dCC5BMJA.js";const J={class:"instances-container"},j=["onClick"],z={key:1},G=E({__name:"index",setup(K){let I=T(),x=I.query.query,w=[{title:"instanceDomain.instanceName",key:"name",dataIndex:"name",width:140},{title:"instanceDomain.instanceIP",key:"ip",dataIndex:"ip",width:200},{title:"instanceDomain.deployState",key:"deployState",dataIndex:"deployState",width:120},{title:"instanceDomain.deployCluster",key:"deployCluster",dataIndex:"deployCluster",width:120},{title:"instanceDomain.registerState",key:"registerState",dataIndex:"registerState",width:120},{title:"instanceDomain.registerCluster",key:"registerClusters",dataIndex:"registerClusters",width:140},{title:"instanceDomain.CPU",key:"cpu",dataIndex:"cpu",width:140},{title:"instanceDomain.memory",key:"memory",dataIndex:"memory",width:100},{title:"instanceDomain.startTime_k8s",key:"startTime_k8s",dataIndex:"startTime",width:200}];function S(d){return b(d).then(async u=>Y(u,["cpu","memory"],async l=>{let a=l.ip.split(":")[0],e=await g(`sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{container!=""}) by (pod) * on (pod) group_left(pod_ip)
        kube_pod_info{pod_ip="${a}"}`),m=await g(`sum(container_memory_working_set_bytes{container!=""}) by (pod)
* on (pod) group_left(pod_ip)
kube_pod_info{pod_ip="${a}"}`);l.cpu=v.isNumber(e)?e.toFixed(3)+"u":e,l.memory=H(m)}))}const o=q(new D([{label:"instanceDomain.instanceIP",param:"keywords",defaultValue:x,placeholder:"typeInstanceIP",style:{width:"200px"}}],S,w));return O(()=>{o.tableStyle={scrollX:"100",scrollY:"367px"},o.onSearch()}),L(M.SEARCH_DOMAIN,o),R(I,(d,u)=>{o.queryForm.keywords=d.query.query,o.onSearch(),console.log(d)}),(d,u)=>{const l=f("a-tooltip"),a=f("a-tag");return t(),y("div",J,[k(N,{"search-domain":o},{bodyCell:n(({text:e,record:m,index:Q,column:s})=>[s.dataIndex==="name"?(t(),c(l,{key:0,title:e},{default:n(()=>[C("span",{class:"app-link",onClick:h=>_(V).push(`/resources/instances/detail/${m.name}/${m.ip}`)},[C("b",null,[k(_(P),{style:{"margin-bottom":"-2px"},icon:"material-symbols:attach-file-rounded"}),p(" "+r(e),1)])],8,j)]),_:2},1032,["title"])):i("",!0),s.dataIndex==="ip"?(t(),y("span",z,r(e),1)):i("",!0),s.dataIndex==="deployState"?(t(),c(a,{key:2,color:_($)[e.toUpperCase()]},{default:n(()=>[p(r(e),1)]),_:2},1032,["color"])):i("",!0),s.dataIndex==="deployCluster"?(t(),c(a,{key:3,color:"grey"},{default:n(()=>[p(r(e),1)]),_:2},1024)):i("",!0),s.dataIndex==="registerState"?(t(),c(a,{key:4,color:_(A)[e.toUpperCase()]},{default:n(()=>[p(r(e),1)]),_:2},1032,["color"])):i("",!0),s.dataIndex==="registerClusters"?(t(!0),y(B,{key:5},F(e,h=>(t(),c(a,{color:"grey"},{default:n(()=>[p(r(h),1)]),_:2},1024))),256)):i("",!0)]),_:1},8,["search-domain"])])}}}),oe=U(G,[["__scopeId","data-v-31fb50af"]]);export{oe as default};
