import{d as _,eB as w,o as v,K as I,G as h,b as D,c as b,u as x,t as B}from"./outputWidgets.04a14374.js";import{a as C}from"./asyncComputed.53598080.js";import{P as k}from"./project.e6570f82.js";import{B as P}from"./build.86268a50.js";import{r as A}from"./router.4677d467.js";import"./columns.19f4f485.js";import{c as j}from"./string.661e30e6.js";import{D as F,F as L}from"./icons.dee9dbe8.js";import{C as M}from"./CrudView.a6f509b7.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.f7d4a0c5.js";import"./record.b64a41e6.js";import"./pubsub.bb759777.js";import"./Base.0c1843db.js";import"./transButton.772cc0ed.js";import"./Text.84d5ffc7.js";import"./Title.9beb186f.js";import"./index.5d9ba614.js";import"./url.311573c2.js";import"./index.9bdc1e6b.js";import"./index.90d3343e.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]="c13e8e67-50e6-4a8f-9c9f-d8df06a922e0",s._sentryDebugIdIdentifier="sentry-dbid-c13e8e67-50e6-4a8f-9c9f-d8df06a922e0")}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:f,refetch:p}=C(()=>Promise.all([P.list(o),k.get(o).then(c).catch(()=>{})]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;v(()=>{a=setInterval(p,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":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=h(()=>{const e=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],t=f.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)=>(D(),b(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.b3334d3e.js.map
