import{d as y,eA as _,o as b,N as w,J as I,b as h,c as v,u as x,x as D}from"./outputWidgets.d94fff8c.js";import{a as B}from"./asyncComputed.6da48dd7.js";import{P as C}from"./project.ee914ec2.js";import{B as k}from"./build.8c3823c3.js";import{r as P}from"./router.4a188c48.js";import"./index.a5166b6d.js";import{c as A}from"./string.5dafdc8d.js";import{N as j,P as L}from"./icons.fec42461.js";import{C as M}from"./CrudView.e6c5592c.js";import{f as N}from"./index.b048d0fb.js";import"./gateway.8dd534ee.js";import"./activeRecord.4bb9e983.js";import"./pubsub.39314a92.js";import"./Title.c70c7e79.js";import"./index.3dad0da1.js";import"./index.7d7e00b1.js";import"./Form.57801503.js";import"./url.596d80c9.js";import"./index.e7f021ad.js";import"./index.3709b59d.js";import"./index.0f14f01f.js";import"./index.209f6c1c.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[a]="581adcc5-9b27-4cda-af29-8b6d19ba9e83",s._sentryDebugIdIdentifier="sentry-dbid-581adcc5-9b27-4cda-af29-8b6d19ba9e83")}catch{}})();const V=y({__name:"Builds",setup(s){const o=_().params.projectId;async function u(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:c,result:p,refetch:d}=B(()=>Promise.all([k.list(o),C.get(o).then(u)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let n;b(()=>{n=setInterval(d,5e3)}),w(()=>{clearInterval(n)});function i(e,t){return e.id===t}function f(e,t,r){return i(e,r)?"Live":t===0&&e.status==="success"?"Transitioning":e.status==="aborted-by-user"||e.status==="aborted"?"Aborted":e.status==="failure"?"Failed":e.status==="in-progress"?"In progress":e.status==="pending"?"Pending":e.status==="success"?"Past":A(e.status)}function m(e,t,r){return i(e,r)?"green":t===0&&e.status==="success"?"blue":e.status==="aborted"||e.status==="aborted-by-user"?"orange":e.status==="failure"?"red":e.status==="in-progress"||e.status==="pending"?"yellow":"lightgray"}const g=I(()=>{const e=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],t=p.value;return t?{columns:e,rows:t.builds.map((r,l)=>({key:r.id,cells:[{text:r.id.slice(0,8)},{text:N(r.createdAt,Date.now(),{addSuffix:!0})},{text:f(r,l,t.lastDeploymentId),tagColor:m(r,l,t.lastDeploymentId)},{text:"",actions:[{icon:j,label:"View application logs",onClick:()=>P.push({name:"logs",params:{projectId:o},query:{buildId:r.id}})},{icon:L,label:"Download files",onClick:()=>r.download()}]}]}))}:{columns:e,rows:[]}});return(e,t)=>(h(),v(M,{"entity-name":"build",loading:x(c),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:g.value,live:""},null,8,["loading","table"]))}});const se=D(V,[["__scopeId","data-v-8f23bc14"]]);export{se as default};
//# sourceMappingURL=Builds.42be9857.js.map
