import{r as p}from"./router.d34810ba.js";import{d as y,eB as _,o as h,K as k,G as x,b as I,c as C,u as w,t as v}from"./outputWidgets.df68f70a.js";import{B as D}from"./build.e753c4c9.js";import"./index.5b8834fd.js";import{P as B}from"./project.7e3804c0.js";import{a as A}from"./asyncComputed.c4f3fa7a.js";import{C as E}from"./CrudView.8169c4b4.js";import{z as P,E as S,G as j}from"./icons.6f0b428b.js";import{f as F}from"./index.b048d0fb.js";import"./Base.8da1f136.js";import"./transButton.b32cb3fc.js";import"./Text.5293eafa.js";import"./Title.d7a9606c.js";import"./index.a1698b08.js";import"./gateway.104fd643.js";import"./record.493f7d84.js";import"./pubsub.26abae80.js";import"./url.e14018a7.js";import"./index.4c2136c4.js";import"./index.f12da0b9.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]="d6b471a0-6c4a-4df0-aca9-a8f769f35615",s._sentryDebugIdIdentifier="sentry-dbid-d6b471a0-6c4a-4df0-aca9-a8f769f35615")}catch{}})();const R=y({__name:"Builds",setup(s){const l=_().params.projectId,{loading:m,result:n,refetch:g}=A(async()=>{const[t,e]=await Promise.all([D.list(l),B.getStatus(l)]);return{b:t.map(a=>({build:a,status:e.filter(i=>i.buildId==a.id).map(i=>i.status)})),status:e}});let u;h(()=>{u=setInterval(g,1e4)}),k(()=>{clearInterval(u)});const c=[{text:"Deploying",tagColor:"blue",check:t=>{var e,o;return(o=t.build.latest&&t.status.some(a=>a=="Running")&&((e=n.value)==null?void 0:e.status.some(a=>a.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 b(t){var e,o,a,i;return{text:(o=(e=c.find(d=>d.check(t)))==null?void 0:e.text)!=null?o:"unknown",tagColor:(i=(a=c.find(d=>d.check(t)))==null?void 0:a.tagColor)!=null?i:"lightgray"}}const f=x(()=>{const t=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}];return n.value?{columns:t,rows:n.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:F(e.build.createdAt,Date.now(),{addSuffix:!0})},{...b(e),hover:(o=e.build.log)!=null?o:void 0},{text:"",actions:[{icon:P,label:"Inspect build",onClick:()=>p.push({name:"build",params:{buildId:e.build.id}})},{icon:S,label:"View application logs",onClick:()=>p.push({name:"logs",params:{projectId:l},query:{buildId:e.build.id}})},{icon:j,label:"Download files",onClick:()=>e.build.download()}]}]}})}:{columns:t,rows:[]}});return(t,e)=>(I(),C(E,{"entity-name":"build",loading:w(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 et=v(R,[["__scopeId","data-v-201b9738"]]);export{et as default};
//# sourceMappingURL=Builds.231f7ca4.js.map
