import{d as B,v as Y,a as j,u as H,r as x,D as S,c as I,b as d,w as t,e as y,n as o,P as g,H as U,U as q,o as a,L as C,M as D,J as r,I as v,f as l,t as n,j as N,T as c,a2 as z,a3 as F,z as J,_ as G}from"./index-FX23dEwE.js";import{S as K,a as Q}from"./SearchUtil-_PbmflM7.js";import{a as X}from"./app-VLUV72AC.js";import{f as W}from"./DateUtil-Z-8-nHP2.js";import{p as Z,q as T}from"./PromQueryUtil-fadptBha.js";import{b as ee}from"./ByteUtil-YdHlSEeW.js";import"./request-dCC5BMJA.js";const te={class:"__container_app_instance"},ae={class:"statistic-icon-big"},se=["onClick"],oe=B({__name:"instance",setup(ne){var k;Y(i=>({"78ed5cfc":o(g)+"22","2b29ec18":o(g)}));const E=j(),R=H();let O=x({info:{},report:{}}),A=(k=E.params)==null?void 0:k.pathId;S(async()=>{});const L=[{title:"instanceDomain.name",dataIndex:"name",key:"name",width:180,fixed:"left"},{title:"instanceDomain.ip",dataIndex:"ip",key:"ip",width:150},{title:"instanceDomain.deployState",dataIndex:"deployState",key:"deployState",width:150},{title:"instanceDomain.deployCluster",dataIndex:"deployClusters",key:"deployClusters",width:180},{title:"instanceDomain.registerState",dataIndex:"registerState",key:"registerState",width:150},{title:"instanceDomain.registerClusters",dataIndex:"registerCluster",key:"registerCluster",width:200},{title:"instanceDomain.cpu",dataIndex:"cpu",key:"cpu",width:120},{title:"instanceDomain.memory",dataIndex:"memory",key:"memory",width:120},{title:"instanceDomain.startTime",dataIndex:"startTime",key:"startTime",width:150}];function V(i){return X(i).then(async b=>Z(b,["cpu","memory"],async p=>{let _=p.ip.split(":")[0],u=await T(`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="${_}"}`),h=await T(`sum(container_memory_working_set_bytes{container!=""}) by (pod)
* on (pod) group_left(pod_ip)
kube_pod_info{pod_ip="${_}"}`);p.cpu=U.isNumber(u)?u.toFixed(3)+"u":u,p.memory=ee(h)}))}const f=x(new K([{label:"",param:"type",defaultValue:1,dict:[{label:"ip",value:1},{label:"name",value:2},{label:"label",value:3}],style:{width:"100px"}},{label:"",param:"search",style:{width:"300px"}},{label:"",param:"appName",defaultValue:A,dict:[],dictType:"APPLICATION_NAME"}],V,L,{pageSize:10},!0));S(()=>{f.tableStyle={scrollX:"100",scrollY:"calc(100vh - 400px)"},f.onSearch()});const P=i=>{R.push(`/resources/instances/detail/${i.name}/${i.ip}`)};return q(J.SEARCH_DOMAIN,f),(i,b)=>{const p=y("a-statistic"),_=y("a-flex"),u=y("a-card"),h=y("a-tooltip"),m=y("a-tag");return a(),I("div",te,[d(_,{wrap:"wrap",gap:"small",vertical:!1,justify:"space-around",align:"left"},{default:t(()=>[(a(!0),I(C,null,D(o(O).report,(s,e)=>(a(),r(u,{class:"statistic-card"},{default:t(()=>[d(_,{gap:"middle",vertical:!1,justify:"space-between",align:"center"},{default:t(()=>[d(p,{value:s.value,class:"statistic"},{prefix:t(()=>[d(o(v),{class:"statistic-icon",icon:"solar:target-line-duotone"})]),title:t(()=>[l(n(i.$t(e.toString())),1)]),_:2},1032,["value"]),N("div",ae,[d(o(v),{icon:s.icon},null,8,["icon"])])]),_:2},1024)]),_:2},1024))),256))]),_:1}),d(Q,{"search-domain":f},{bodyCell:t(({column:s,text:e,record:M})=>[s.dataIndex==="name"?(a(),r(h,{key:0,title:e},{default:t(()=>[N("span",{class:"app-link",onClick:w=>P(M)},n(e),9,se)]),_:2},1032,["title"])):c("",!0),s.dataIndex==="deployState"?(a(),r(m,{key:1,color:o(z)[e.toUpperCase()]},{default:t(()=>[l(n(e),1)]),_:2},1032,["color"])):c("",!0),s.dataIndex==="deployClusters"?(a(),r(m,{key:2},{default:t(()=>[l(n(e),1)]),_:2},1024)):c("",!0),s.dataIndex==="registerState"?(a(),r(m,{key:3,color:o(F)[e.toUpperCase()]},{default:t(()=>[l(n(e),1)]),_:2},1032,["color"])):c("",!0),s.dataIndex==="registerCluster"?(a(),r(m,{key:4},{default:t(()=>[l(n(e),1)]),_:2},1024)):c("",!0),s.dataIndex==="labels"?(a(!0),I(C,{key:5},D(e,(w,$)=>(a(),r(m,{color:o(g)},{default:t(()=>[l(n($)+" : "+n(w),1)]),_:2},1032,["color"]))),256)):c("",!0),s.dataIndex==="registerTime"?(a(),I(C,{key:6},[l(n(o(W)(e)),1)],64)):c("",!0)]),_:1},8,["search-domain"])])}}}),ue=G(oe,[["__scopeId","data-v-30ecf1a7"]]);export{ue as default};
