import{d as y,eA as _,o as w,N as I,J as b,b as h,c as v,u as x,x as D}from"./outputWidgets.cf5b7366.js";import{a as C}from"./asyncComputed.2caa7fe6.js";import{P as B}from"./project.030c5d86.js";import{B as k}from"./build.106fcbc3.js";import{r as A}from"./router.565b4739.js";import"./index.2fa55c7c.js";import{N as P,P as j}from"./icons.c510a141.js";import{C as L}from"./CrudView.ca1846b4.js";import{f as M}from"./index.b048d0fb.js";import"./gateway.409ff644.js";import"./activeRecord.f30e02c2.js";import"./pubsub.664a70af.js";import"./Title.adce1298.js";import"./index.3d2fbf9e.js";import"./index.7622dd54.js";import"./Form.c8affe88.js";import"./url.fb40e08c.js";import"./index.47f17eed.js";import"./index.aee8b5d5.js";import"./index.9583d9e9.js";import"./index.10cdfb2c.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[n]="c7ef4497-7f68-4ff7-a78f-b81232f9056a",s._sentryDebugIdIdentifier="sentry-dbid-c7ef4497-7f68-4ff7-a78f-b81232f9056a")}catch{}})();function N(s){return s.charAt(0).toUpperCase()+s.slice(1)}const V=y({__name:"Builds",setup(s){const o=_().params.projectId;async function l(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:c,result:f,refetch:p}=C(()=>Promise.all([k.list(o),B.get(o).then(l)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;w(()=>{a=setInterval(p,5e3)}),I(()=>{clearInterval(a)});function i(e,t){return e.id===t}function d(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":N(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=b(()=>{const e=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],t=f.value;return t?{columns:e,rows:t.builds.map((r,u)=>({key:r.id,cells:[{text:r.id.slice(0,8)},{text:M(r.createdAt,Date.now(),{addSuffix:!0})},{text:d(r,u,t.lastDeploymentId),tagColor:m(r,u,t.lastDeploymentId)},{text:"",actions:[{icon:P,label:"View application logs",onClick:()=>A.push({name:"logs",params:{projectId:o},query:{buildId:r.id}})},{icon:j,label:"Download files",onClick:()=>r.download()}]}]}))}:{columns:e,rows:[]}});return(e,t)=>(h(),v(L,{"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 re=D(V,[["__scopeId","data-v-8f23bc14"]]);export{re as default};
//# sourceMappingURL=Builds.7ba332dd.js.map
