import{d as y,ez as _,o as b,L as w,H as I,b as v,c as h,u as D,v as x}from"./outputWidgets.d6334d0e.js";import{a as B}from"./asyncComputed.95fd0999.js";import{P as C}from"./project.2aec9e3e.js";import{B as k}from"./build.f4cbbc17.js";import{r as P}from"./router.c9839d0e.js";import"./columns.6b92da60.js";import{c as A}from"./string.cb6de819.js";import{N as L,P as j}from"./icons.09e1f108.js";import{C as M}from"./CrudView.a040df87.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.78108c4a.js";import"./activeRecord.aa738a85.js";import"./pubsub.9d7d329e.js";import"./Form.afe8a620.js";import"./Title.132c3f7f.js";import"./transButton.97ae4a5a.js";import"./Text.2f6a30da.js";import"./index.85dd1fea.js";import"./index.f4ac7424.js";import"./url.dce42ecb.js";import"./index.9476b093.js";import"./index.e0fb68fa.js";import"./index.98d66b02.js";import"./index.2221e01c.js";import"./index.6da051f8.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]="1e53abbc-5b15-4b74-9133-395ebdf99eaf",s._sentryDebugIdIdentifier="sentry-dbid-1e53abbc-5b15-4b74-9133-395ebdf99eaf")}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;b(()=>{a=setInterval(d,5e3)}),w(()=>{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=I(()=>{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)=>(v(),h(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 ae=x(z,[["__scopeId","data-v-2a278490"]]);export{ae as default};
//# sourceMappingURL=Builds.4fa804b2.js.map
