import{d as y,ez as _,o as w,L as I,H as b,b as v,c as h,u as D,v as x}from"./outputWidgets.a4629ff8.js";import{a as B}from"./asyncComputed.fb8b9ba6.js";import{P as C}from"./project.b861b2fe.js";import{B as k}from"./build.d1be9cdb.js";import{r as P}from"./router.ab2ac3ba.js";import"./columns.464a3bb5.js";import{c as A}from"./string.0031a572.js";import{N as L,P as j}from"./icons.73bff2ab.js";import{C as M}from"./CrudView.a5b1a4eb.js";import{f as V}from"./index.b048d0fb.js";import"./gateway.68939de7.js";import"./activeRecord.a2b7d343.js";import"./pubsub.25dc8c41.js";import"./Title.cf2a531e.js";import"./index.339c7421.js";import"./index.f4ac7424.js";import"./Text.eb216708.js";import"./Form.ab59726f.js";import"./url.d6a620b9.js";import"./index.874565bb.js";import"./index.48817ebe.js";import"./index.0f6dde5f.js";import"./index.46db6cb2.js";import"./index.56cfba6d.js";import"./index.fda4c602.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[a]="311ba3da-161b-43af-a71e-c6219dad50cd",s._sentryDebugIdIdentifier="sentry-dbid-311ba3da-161b-43af-a71e-c6219dad50cd")}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 n;w(()=>{n=setInterval(d,5e3)}),I(()=>{clearInterval(n)});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":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=b(()=>{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:m(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)=>(v(),h(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.5c212a15.js.map
