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.f120b477.js";import{a as B}from"./asyncComputed.5ccd4614.js";import{P as C}from"./project.594dcbc1.js";import{B as k}from"./build.41e77770.js";import{r as P}from"./router.e3ecb487.js";import"./index.81859a03.js";import{c as A}from"./string.c4e71dd1.js";import{N as j,P as L}from"./icons.c367c256.js";import{C as M}from"./CrudView.87b341af.js";import{f as N}from"./index.b048d0fb.js";import"./gateway.a36b7b3a.js";import"./activeRecord.d87d7ef2.js";import"./pubsub.4681462f.js";import"./Title.3dc4e32d.js";import"./index.5818bfb2.js";import"./index.3ab4f365.js";import"./Form.ec892c10.js";import"./url.8af07297.js";import"./index.b96fbbd8.js";import"./index.3801d49d.js";import"./index.de46e6db.js";import"./index.54e8798a.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]="4529407e-f7e8-4914-aea7-da9c5f45c67c",s._sentryDebugIdIdentifier="sentry-dbid-4529407e-f7e8-4914-aea7-da9c5f45c67c")}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:f}=B(()=>Promise.all([k.list(o),C.get(o).then(u)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;w(()=>{a=setInterval(f,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":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=b(()=>{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:d(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.240128d4.js.map
