import{d as y,ez as _,o as w,L as I,H as v,b,c as h,u as D,v as x}from"./outputWidgets.4420c31f.js";import{a as B}from"./asyncComputed.937eb3b8.js";import{P as C}from"./project.79e14406.js";import{B as k}from"./build.1b01812c.js";import{r as P}from"./router.141c8be7.js";import"./columns.d0453565.js";import{c as A}from"./string.6250c5b0.js";import{N as L,P as j}from"./icons.2ee60219.js";import{C as M}from"./CrudView.4a9e50e2.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.c8298b74.js";import"./activeRecord.a89b1253.js";import"./pubsub.1ac087cf.js";import"./Title.f4c9dd29.js";import"./index.1ba1c343.js";import"./index.f4ac7424.js";import"./index.6f566923.js";import"./Form.6825d217.js";import"./url.14f2bdd6.js";import"./index.32966139.js";import"./index.f4ff3772.js";import"./index.afb0f92e.js";import"./index.f792c329.js";import"./index.adf86569.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]="17eed269-e8c8-422e-a841-f31ac0087a2c",s._sentryDebugIdIdentifier="sentry-dbid-17eed269-e8c8-422e-a841-f31ac0087a2c")}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:c,result:p,refetch:d}=B(()=>Promise.all([k.list(o),C.get(o).then(u)]).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=p.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)=>(b(),h(M,{"entity-name":"build",loading:D(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 ne=x(z,[["__scopeId","data-v-8f23bc14"]]);export{ne as default};
//# sourceMappingURL=Builds.90e3a0de.js.map
