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.800838e3.js";import{a as B}from"./asyncComputed.982dc1f5.js";import{P as C}from"./project.0458df14.js";import{B as k}from"./build.ed207a8c.js";import{r as P}from"./router.ba9fc25a.js";import"./index.46095ec8.js";import{c as A}from"./string.6bed8f1b.js";import{N as j,P as L}from"./icons.93f59c4e.js";import{C as M}from"./CrudView.b259bd34.js";import{f as N}from"./index.b048d0fb.js";import"./gateway.872328f1.js";import"./activeRecord.9d8d542d.js";import"./pubsub.3b460539.js";import"./Title.28613ffd.js";import"./index.cc2e9ddf.js";import"./index.e0615505.js";import"./Form.b8148ab8.js";import"./url.e7bb6b8a.js";import"./index.9edddcd4.js";import"./index.70fbd67e.js";import"./index.c4440e89.js";import"./index.960544fb.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]="85914874-7932-400a-9811-20a152079913",s._sentryDebugIdIdentifier="sentry-dbid-85914874-7932-400a-9811-20a152079913")}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: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=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:m(r,l,t.lastDeploymentId),tagColor:f(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.ef8b4562.js.map
