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.a8447bcb.js";import{a as B}from"./asyncComputed.6c2627ea.js";import{P as C}from"./project.f2efc77e.js";import{B as k}from"./build.fdcadc6a.js";import{r as P}from"./router.8be149da.js";import"./columns.79610386.js";import{c as A}from"./string.763f9f5d.js";import{N as L,P as j}from"./icons.6de7af10.js";import{C as M}from"./CrudView.996cd8b2.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.9d217caa.js";import"./activeRecord.52c1b6f8.js";import"./pubsub.3b516de1.js";import"./Form.a869b3cf.js";import"./Title.4127a4b4.js";import"./transButton.26020e2e.js";import"./Text.722e2789.js";import"./index.41d49230.js";import"./index.f4ac7424.js";import"./url.0a1547fb.js";import"./index.ee9a096e.js";import"./index.c058ebd2.js";import"./index.823e1eed.js";import"./index.71f713cd.js";import"./index.5fa32c06.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]="023bf010-e2ea-4952-8368-412379275f39",s._sentryDebugIdIdentifier="sentry-dbid-023bf010-e2ea-4952-8368-412379275f39")}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:p,result:c,refetch:m}=B(()=>Promise.all([k.list(o),C.get(o).then(u).catch(()=>{})]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let a;w(()=>{a=setInterval(m,5e3)}),I(()=>{clearInterval(a)});function i(e,t){return e.id===t}function d(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 f(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=c.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:d(r,l,t.lastDeploymentId),tagColor:f(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(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:g.value,live:""},null,8,["loading","table"]))}});const ae=x(z,[["__scopeId","data-v-2a278490"]]);export{ae as default};
//# sourceMappingURL=Builds.1bf57697.js.map
