import{d as y,ez as _,o as w,L as I,H as v,b as h,c as b,u as D,v as x}from"./outputWidgets.942e04a7.js";import{a as B}from"./asyncComputed.581a6d32.js";import{P as C}from"./project.78d75c60.js";import{B as k}from"./build.c8b0c97e.js";import{r as P}from"./router.88ac172f.js";import"./columns.b249ad7a.js";import{c as A}from"./string.04c89323.js";import{N as L,P as j}from"./icons.c37bd5be.js";import{C as M}from"./CrudView.ef33eac6.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.c853ac2b.js";import"./activeRecord.c49c8827.js";import"./pubsub.c4874b0f.js";import"./Title.02f374d5.js";import"./index.6d3b437a.js";import"./index.f4ac7424.js";import"./index.a0056785.js";import"./Form.fa989528.js";import"./url.c27b4b3f.js";import"./index.afbbab9c.js";import"./index.a1c695e0.js";import"./index.f7b7cb5d.js";import"./index.182b7916.js";import"./index.90e879e1.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]="edffa58e-8c02-4c0f-be9c-34e8cc361ad9",s._sentryDebugIdIdentifier="sentry-dbid-edffa58e-8c02-4c0f-be9c-34e8cc361ad9")}catch{}})();const z=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).catch(()=>{})]).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 f(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 m(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=v(()=>{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:V(r.createdAt,Date.now(),{addSuffix:!0})},{text:f(r,l,t.lastDeploymentId),tagColor:m(r,l,t.lastDeploymentId)},{text:"",actions:[{icon:L,label:"View application logs",onClick:()=>P.push({name:"logs",params:{projectId:o},query:{buildId:r.id}})},{icon:j,label:"Download files",onClick:()=>r.download()}]}]}))}:{columns:e,rows:[]}});return(e,t)=>(h(),b(M,{"entity-name":"build",loading:D(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 ne=x(z,[["__scopeId","data-v-2a278490"]]);export{ne as default};
//# sourceMappingURL=Builds.ae298993.js.map
