import{u as o,X as c,r as u,hs as d}from"./index-C6OVXshM.js";import{a as p,b as E}from"./index-CU_u1Yy3.js";const f=({projectId:a,jobName:n,execution:t})=>{const{id:r}=o(),s={pId:a??r,name:n,execId:(t==null?void 0:t.id)??0},{currentData:l}=p.getJobExecution.useQueryState(s),e=c(t??{},l??{}),i=(e==null?void 0:e.finalStatus)==="UNDEFINED"||(e==null?void 0:e.state)==="AGGREGATING_LOGS";return E(s,{skip:!i,pollingInterval:5e3}),u.useMemo(()=>({execution:e,isStillExecuting:i}),[e,i])},h=(a,n=[])=>{const t=n.filter(r=>r.state==="RUNNING").length;if(t)return{width:"fit-content",value:`${t} ${t>1?"executions":"execution"} in progress`,variant:"light",loading:!0};switch(a){case"SUCCEEDED":return{width:"fit-content",value:"Success",variant:"success"};case"FAILED":return{width:"fit-content",value:"Fail",variant:"fail"};case"IN_PROGRESS":return{width:"fit-content",value:"In progress",variant:"light",loading:!0};case"KILLED":return{width:"fit-content",value:"Killed",variant:"label"};case"UNDEFINED":return{width:"fit-content",value:"-",variant:"label",loading:!0};default:return{width:"fit-content",value:a?d(a).replaceAll("_"," "):"-",variant:"label"}}};export{h as g,f as u};
