import{r as p}from"./router.8f071dc2.js";import{d as y,eB as _,o as h,K as k,G as I,b as x,c as C,u as v,v as w}from"./outputWidgets.31ce2d5c.js";import{d as B}from"./index.0d76378d.js";import{a as D}from"./asyncComputed.7e3e21f4.js";import{B as A}from"./build.f953a592.js";import"./index.e05c62e3.js";import{P}from"./project.41cba40c.js";import{C as j}from"./CrudView.9d67f588.js";import{H as E,M as F,O as M}from"./icons.266b547d.js";import"./FormItem.5f0b61bf.js";import"./hasIn.932773c2.js";import"./gateway.3615e807.js";import"./index.cf4c23b9.js";import"./record.b2148451.js";import"./pubsub.2d9ab3f4.js";import"./Text.46c5bec2.js";import"./Base.eeda2dae.js";import"./Form.482980d3.js";import"./Modal.32a7843c.js";import"./url.94a5ee71.js";import"./index.627ab86d.js";import"./index.ef6e34b6.js";import"./Title.951eccc5.js";import"./index.5765ee72.js";import"./index.f1d2e592.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="92d6093c-4c0d-42b1-9d57-1d2b9c522c62",s._sentryDebugIdIdentifier="sentry-dbid-92d6093c-4c0d-42b1-9d57-1d2b9c522c62")}catch{}})();const R=y({__name:"Builds",setup(s){const l=_().params.projectId,{loading:m,result:d,refetch:b}=D(async()=>{const[t,e]=await Promise.all([A.list(l),P.getStatus(l)]);return{b:t.map(i=>({build:i,status:e.filter(a=>a.buildId==i.id).map(a=>a.status)})),status:e}});let u;h(()=>{u=setInterval(b,1e4)}),k(()=>{clearInterval(u)});const c=[{text:"Deploying",tagColor:"blue",check:t=>{var e,o;return(o=t.build.latest&&t.status.some(i=>i=="Running")&&((e=d.value)==null?void 0:e.status.some(i=>i.buildId!==t.build.id)))!=null?o:!1}},{text:"Deactivating",tagColor:"orange",check:t=>t.build.status==="success"&&!t.build.latest&&t.status.some(e=>e=="Running")},{text:"Failed",tagColor:"orange",check:t=>t.build.latest&&t.status.some(e=>e=="Failed")},{text:"LIVE",tagColor:"green",check:t=>t.build.latest},{text:"Inactive",tagColor:"lightgray",check:t=>t.build.status==="success"},{text:"Aborted",tagColor:"orange",check:t=>t.build.status==="aborted"||t.build.status==="aborted-by-user"},{text:"Failed",tagColor:"orange",check:t=>t.build.status==="failure"},{text:"In progress",tagColor:"red",check:t=>t.build.status==="in-progress"},{text:"Pending",tagColor:"yellow",check:t=>t.build.status==="pending"}];function g(t){var e,o,i,a;return{text:(o=(e=c.find(n=>n.check(t)))==null?void 0:e.text)!=null?o:"unknown",tagColor:(a=(i=c.find(n=>n.check(t)))==null?void 0:i.tagColor)!=null?a:"lightgray"}}const f=I(()=>{const t=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}];return d.value?{columns:t,rows:d.value.b.map(e=>{var o;return{key:e.build.id,cells:[{link:`/builds/${e.build.id}`,text:e.build.id.slice(0,8)},{text:B(e.build.createdAt)},{...g(e),hover:(o=e.build.log)!=null?o:void 0},{text:"",actions:[{icon:E,label:"Inspect build",onClick:()=>p.push({name:"build",params:{buildId:e.build.id}})},{icon:F,label:"View application logs",onClick:()=>p.push({name:"logs",params:{projectId:l},query:{buildId:e.build.id}})},{icon:M,label:"Download files",onClick:()=>e.build.download()}]}]}})}:{columns:t,rows:[]}});return(t,e)=>(x(),C(j,{"entity-name":"build",loading:v(m),title:"Builds",description:"Each build is a version of your app. You can create a new build by deploying your app from the local editor.","empty-title":"No builds here yet",table:f.value,live:""},null,8,["loading","table"]))}});const lt=w(R,[["__scopeId","data-v-808c1b1c"]]);export{lt as default};
//# sourceMappingURL=Builds.02cf0750.js.map
