import{d as _,eB as w,o as v,K as I,G as h,b,c as D,u as x,t as B}from"./outputWidgets.0ed3a637.js";import{a as C}from"./asyncComputed.054ae312.js";import{P as k}from"./project.2789fa4a.js";import{B as P}from"./build.29b20956.js";import{r as A}from"./router.d8af0f7d.js";import"./columns.15b333c9.js";import{c as j}from"./string.c66112fe.js";import{E,G as L}from"./icons.8d5441dc.js";import{C as M}from"./CrudView.931c84f7.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.678b6185.js";import"./activeRecord.e0ef2424.js";import"./pubsub.5dd4605f.js";import"./Base.69739fb7.js";import"./transButton.3ca23b61.js";import"./Text.e89a9af1.js";import"./Title.53f943d2.js";import"./index.230ffe19.js";import"./url.4f7be002.js";import"./index.0f5ee3e7.js";import"./index.feaa4503.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]="51384920-ebe9-47c0-8324-8d208210b37f",s._sentryDebugIdIdentifier="sentry-dbid-51384920-ebe9-47c0-8324-8d208210b37f")}catch{}})();const F=_({__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 a;v(()=>{a=setInterval(f,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=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:E,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)=>(b(),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(F,[["__scopeId","data-v-f82ddf5d"]]);export{se as default};
//# sourceMappingURL=Builds.42a26e90.js.map
