import{r as c,j as s,b3 as h,b2 as m,b1 as k,cT as j,u as P,w as g,x as v,T as C,L as d,D as f,a as L,cO as w,ek as E,d as M}from"./index-_eM6l4Nf.js";import{K as x,a as b}from"./KubeMonitoringPods-DeTd2Qlo.js";import{b as O}from"./index-DUD8N5ck.js";const I=({execution:o,isOpenPopup:i,handleTogglePopup:n})=>{const[t,e]=c.useState("stdoutPath"),r=o[t]??"",l=c.useMemo(()=>[{title:"stdout",isActive:t==="stdoutPath",onClick:()=>e("stdoutPath")},{title:"stderr",isActive:t==="stderrPath",onClick:()=>e("stderrPath")},...o.notebookOutPath?[{title:"notebook out",isActive:t==="notebookOutPath",onClick:()=>e("notebookOutPath")}]:[]],[t,o.notebookOutPath]);return s.jsx(h,{size:"7xl",isOpen:i,onClose:n,hasCloseButton:!0,title:s.jsx(j,{title:"Logs",tabs:l,width:"90%"}),bodyProps:{pt:0,mt:"10px"},children:s.jsx(m,{file:{attributes:{path:r,name:k(r)}},errorContent:{title:"Logs not found",message:""},viewOnly:!0},t)})},y=({jobName:o,executionId:i})=>{var p,u;const{id:n}=P(),{data:t,isLoading:e,isFetching:r,refetch:l}=O({pId:n,name:o,execId:i,params:{expand:"kube_monitor"}},{selectFromResult:g({data:v(C("kubeMonitor"))}),pollingInterval:5e3,skip:!i}),a=(t==null?void 0:t.job)??(t==null?void 0:t.sparkJob)??(t==null?void 0:t.rayJob);return s.jsx(d,{mb:"20px",children:e?s.jsx(d,{sx:{py:"100px"},children:s.jsx(f,{})}):s.jsxs(L,{flexDirection:"column",gap:"20px",children:[s.jsx(d,{sx:{position:"absolute",top:"16px",right:"53px"},children:r?s.jsx(w,{}):s.jsx(E,{icon:M.refresh,onClick:l,sx:{mt:"-6px",mr:"-6px"},borderless:!0})}),a&&s.jsx(x,{title:"Job Status",...a,children:((p=a.pods)==null?void 0:p.items)&&s.jsx(b,{pods:a.pods.items})}),(t==null?void 0:t.workload)&&s.jsx(x,{title:"Workload Status",...t.workload,children:((u=t.workload.pods)==null?void 0:u.items)&&s.jsx(b,{pods:t.workload.pods.items})})]})})},K=c.memo(y);export{I as E,K as a};
