import{d as y,ez as _,o as w,L as I,H as v,b as h,c as b,u as D,v as x}from"./outputWidgets.17e2270d.js";import{a as B}from"./asyncComputed.c8589796.js";import{P as C}from"./project.c7ab011d.js";import{B as k}from"./build.230e3df2.js";import{r as P}from"./router.845058a4.js";import"./columns.1320dbbc.js";import{c as A}from"./string.61f49d8a.js";import{N as L,P as j}from"./icons.ae606380.js";import{C as M}from"./CrudView.0a7d7224.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.deb7dadd.js";import"./activeRecord.1230459a.js";import"./pubsub.52f6192d.js";import"./Title.7b6ce571.js";import"./index.4787064b.js";import"./index.f4ac7424.js";import"./index.23cb8791.js";import"./Form.0e9953f6.js";import"./url.6c73df07.js";import"./index.29151007.js";import"./index.4b3be88e.js";import"./index.cfd05648.js";import"./index.bedec2c6.js";import"./index.34b7172c.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]="8649fd86-4b99-4773-9080-6f02d2123701",s._sentryDebugIdIdentifier="sentry-dbid-8649fd86-4b99-4773-9080-6f02d2123701")}catch{}})();const z=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:p,result:c,refetch:d}=B(()=>Promise.all([k.list(o),C.get(o).then(u).catch(()=>{})]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;w(()=>{a=setInterval(d,5e3)}),I(()=>{clearInterval(a)});function i(e,t){return e.id===t}function m(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 f(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=v(()=>{const e=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],t=c.value;return t?{columns:e,rows:t.builds.map((r,l)=>({key:r.id,cells:[{text:r.id.slice(0,8)},{text:V(r.createdAt,Date.now(),{addSuffix:!0})},{text:m(r,l,t.lastDeploymentId),tagColor:f(r,l,t.lastDeploymentId)},{text:"",actions:[{icon:L,label:"View application logs",onClick:()=>P.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(),b(M,{"entity-name":"build",loading:D(p),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 ne=x(z,[["__scopeId","data-v-2a278490"]]);export{ne as default};
//# sourceMappingURL=Builds.2370e550.js.map
