import{d as _,eB as w,o as b,K as v,G as I,b as h,c as D,u as x,t as B}from"./outputWidgets.c4f3de67.js";import{a as C}from"./asyncComputed.c75b06d6.js";import{P as k}from"./project.fda53dcc.js";import{B as P}from"./build.21942a20.js";import{r as A}from"./router.88734ca5.js";import"./columns.aa61756c.js";import{c as j}from"./string.f2726d1b.js";import{D as F,F as L}from"./icons.49e74e71.js";import{C as M}from"./CrudView.4072ea68.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.5578a098.js";import"./record.685c8ba7.js";import"./pubsub.1842fa2d.js";import"./Base.9ed9c296.js";import"./transButton.ebe60b80.js";import"./Text.fcf8f28f.js";import"./Title.345a4775.js";import"./index.db3809d7.js";import"./url.d2782274.js";import"./index.c4339fad.js";import"./index.b168b141.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[a]="6f3acccc-b4ad-4aab-b0f0-0e49a053373d",s._sentryDebugIdIdentifier="sentry-dbid-6f3acccc-b4ad-4aab-b0f0-0e49a053373d")}catch{}})();const E=_({__name:"Builds",setup(s){const o=w().params.projectId;async function c(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:d,result:p,refetch:f}=C(()=>Promise.all([P.list(o),k.get(o).then(c).catch(()=>{})]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let n;b(()=>{n=setInterval(f,5e3)}),v(()=>{clearInterval(n)});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":j(e.status)}function g(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 y=I(()=>{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)=>{var u;return{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:g(r,l,t.lastDeploymentId),hover:(u=r.log)!=null?u:void 0},{text:"",actions:[{icon:F,label:"View application logs",onClick:()=>A.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(),D(M,{"entity-name":"build",loading:x(d),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:y.value,live:""},null,8,["loading","table"]))}});const se=B(E,[["__scopeId","data-v-f82ddf5d"]]);export{se as default};
//# sourceMappingURL=Builds.e6883e61.js.map
