import{r as c}from"./router.8fbd98d9.js";import{d as b,eB as I,o as w,K as h,G as v,b as D,c as x,u as B,t as C}from"./outputWidgets.e822ff0f.js";import{a as k}from"./asyncComputed.68870ff7.js";import{c as P}from"./string.5881666a.js";import{B as A}from"./build.4c822521.js";import"./index.3b830ff3.js";import{P as j}from"./project.49fc286a.js";import{C as E}from"./CrudView.0a0ee0a6.js";import{z as L,E as M,G as V}from"./icons.0ab0d55f.js";import{f as z}from"./index.b048d0fb.js";import"./Base.775de4d5.js";import"./transButton.f06af665.js";import"./Text.4c9d53a2.js";import"./Title.5afb3003.js";import"./index.bf8163eb.js";import"./gateway.349a9491.js";import"./record.edca104e.js";import"./pubsub.ae710ef5.js";import"./url.c786ab78.js";import"./index.eb9667df.js";import"./index.1b95bbbc.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]="418722fd-bb22-42d7-86cf-4986cb787066",s._sentryDebugIdIdentifier="sentry-dbid-418722fd-bb22-42d7-86cf-4986cb787066")}catch{}})();const F=b({__name:"Builds",setup(s){const o=I().params.projectId;async function d(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:p,result:f,refetch:m}=k(()=>Promise.all([A.list(o),j.get(o).then(d).catch(()=>{})]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;w(()=>{a=setInterval(m,5e3)}),h(()=>{clearInterval(a)});function i(e,t){return e.id===t}function g(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":P(e.status)}function y(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 _=v(()=>{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:[{link:`/builds/${r.id}`,text:r.id.slice(0,8)},{text:z(r.createdAt,Date.now(),{addSuffix:!0})},{text:g(r,l,t.lastDeploymentId),tagColor:y(r,l,t.lastDeploymentId),hover:(u=r.log)!=null?u:void 0},{text:"",actions:[{icon:L,label:"Inspect build",onClick:()=>c.push({name:"build",params:{buildId:r.id}})},{icon:M,label:"View application logs",onClick:()=>c.push({name:"logs",params:{projectId:o},query:{buildId:r.id}})},{icon:V,label:"Download files",onClick:()=>r.download()}]}]}})}:{columns:e,rows:[]}});return(e,t)=>(D(),x(E,{"entity-name":"build",loading:B(p),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:_.value,live:""},null,8,["loading","table"]))}});const oe=C(F,[["__scopeId","data-v-de7679af"]]);export{oe as default};
//# sourceMappingURL=Builds.1b0b52e7.js.map
