import{bG as h,bH as j,bx as f,r as p,t as g,x as l,j as e,q as d,a4 as v,a5 as C,d as q,L as E,cc as s,aJ as b,bp as I,fD as w,fE as H,fF as m,fG as Q,fH as y}from"./index-DNBEEyYo.js";import{Q as L}from"./Queries-ClvtI5tK.js";import{u as M,a as S,b as G,c as T}from"./index-CBKOX8r-.js";import{T as W}from"./TrinoClusterMonitor-BOLv7Bxn.js";import"./styles-StUKLkkg.js";import"./trinoUtils-CkYt6rPZ.js";import"./QueryProgressBar-BiVo8p2D.js";import"./CardLabel-Cr6NEOPS.js";import"./types-Cay-L1a6.js";import"./AreaChart-Bl4wjFnC.js";import"./generateCategoricalChart-BC7jg59_.js";import"./isEqual-Caw4eDkN.js";import"./bump-BmRQ39WQ.js";import"./linear-C3cNlZpH.js";import"./string-cKWu9XK9.js";import"./max-DBeXZoyG.js";import"./Area-C3ynbKcG.js";const A=()=>{var n,x;h(j.queryEngine);const{data:i,error:t,isLoading:c}=M(),r=f(),u=p.useCallback(o=>{r(g(l.settings.queryEngine.queryOverview,l.settings.queryEngine.overview,{queryId:o}))},[r]),a=(x=(n=t==null?void 0:t.response)==null?void 0:n.data)==null?void 0:x.usrMsg;return e.jsxs(e.Fragment,{children:[a&&e.jsx(d,{pb:"20px",children:e.jsx(v,{content:e.jsx(d,{alignItems:"center",children:e.jsx(q,{children:a})}),type:C.warning,mb:"10px"})}),e.jsx(d,{maxHeight:"calc(100vh - 290px)",children:e.jsx(L,{queryInfo:i,isLoading:c,handleOverviewClick:u})})]})},D=()=>{var n,x;h(j.queryEngine);const{data:i,error:t,isLoading:c}=S(),r=f(),u=p.useCallback(o=>{r(g(l.settings.queryEngine.workerStatus,l.settings.queryEngine.overview,{workerId:o}))},[r]),a=(x=(n=t==null?void 0:t.response)==null?void 0:n.data)==null?void 0:x.usrMsg;return c?e.jsx(E,{}):e.jsxs(d,{flexDirection:"column",children:[a&&e.jsx(d,{pb:"20px",children:e.jsx(v,{content:e.jsx(d,{alignItems:"center",children:e.jsx(q,{children:a})}),type:C.warning,mb:"10px"})}),e.jsxs(s,{children:[e.jsxs(s.Row,{sx:{padding:"0px"},children:[e.jsx(s.HeadCell,{children:"Node ID"}),e.jsx(s.HeadCell,{children:"Node IP"}),e.jsx(s.HeadCell,{children:"Node version"}),e.jsx(s.HeadCell,{children:"Coordinator"}),e.jsx(s.HeadCell,{children:"State"})]}),i==null?void 0:i.map(o=>e.jsxs(s.Row,{children:[e.jsx(s.Cell,{children:e.jsx(b,{intent:"inline",onClick:()=>u(o.nodeId),children:o.nodeId})}),e.jsx(s.Cell,{children:o.nodeIp}),e.jsx(s.Cell,{children:o.nodeVersion}),e.jsx(s.Cell,{children:o.coordinator?"true":"false"}),e.jsx(s.Cell,{children:o.state})]},o.nodeId))]})]})},N=()=>{var n,x;h(j.queryEngine);const{data:i,isLoading:t}=G(),{data:c,error:r,isLoading:u}=T(void 0,{pollingInterval:3e3}),a=(x=(n=r==null?void 0:r.response)==null?void 0:n.data)==null?void 0:x.usrMsg;return e.jsxs(e.Fragment,{children:[a&&e.jsx(d,{pb:"20px",children:e.jsx(v,{content:e.jsx(d,{alignItems:"center",children:e.jsx(q,{children:a})}),type:C.warning,mb:"10px"})}),e.jsx(W,{stats:c,isLoadingStats:u,cluster:i,isLoadingCluster:t})]})},se=()=>{h(j.queryEngine);const i=I(),[t,c]=p.useState(0),r=f();p.useEffect(()=>{i.pathname.endsWith(l.settings.queryEngine.queryHistory)?c(1):i.pathname.endsWith(l.settings.queryEngine.workers)?c(2):c(0)},[i]);const u=a=>{let n=g(l.settings.queryEngine.overview,"");a===1?n=g(l.settings.queryEngine.queryHistory,l.settings.queryEngine.overview):a===2&&(n=g(l.settings.queryEngine.workers,l.settings.queryEngine.overview)),r(n)};return e.jsx(d,{flexDirection:"column",gap:"20px",children:e.jsxs(w,{colorScheme:"",defaultIndex:0,index:t,onChange:u,minWidth:1270,children:[e.jsx(d,{flexDirection:"row",justifyContent:"space-between",children:e.jsxs(H,{width:"100%",children:[e.jsx(m,{children:"Cluster"},"0"),e.jsx(m,{children:"Query History"},"1"),e.jsx(m,{children:"Workers"},"2")]})}),e.jsxs(Q,{mt:"30px",children:[e.jsx(y,{p:"0px",children:e.jsx(N,{})}),e.jsx(y,{p:"0px",children:e.jsx(A,{})}),e.jsx(y,{p:"0px",children:e.jsx(D,{})})]})]})})};export{se as default};
