import{d as b,ey as v,o as I,L as w,H as h,b as D,c as x,u as B,v as C}from"./registerWidgets.9fce82a0.js";import{a as k}from"./asyncComputed.a4b709a3.js";import{P}from"./project.621d9b91.js";import{B as A}from"./build.7950fa09.js";import"./gateway.6deb8468.js";import"./index.75e03e08.js";import{N as L,P as j}from"./icons.1992e13b.js";import{r as M}from"./console.cb717b80.js";import{_ as E}from"./CrudView.vue_vue_type_script_setup_true_lang.ac5a77d6.js";import{f as F}from"./index.b048d0fb.js";import"./activeRecord.872f4269.js";import"./pubsub.025cc397.js";import"./passwordlessManager.eda842b8.js";import"./storage.ae287dfa.js";import"./index.9df32b45.js";import"./Form.413853c0.js";import"./Title.26974edb.js";import"./index.b9dfa5e6.js";import"./index.e8158c16.js";import"./index.0067889e.js";import"./dayjs.89aecc81.js";import"./index.eed9c711.js";import"./index.e3cd80f7.js";import"./TabPane.439993c1.js";import"./index.02615dca.js";import"./index.30c35b37.js";import"./index.3995bfa0.js";import"./index.db5cf0e6.js";import"./index.dcb944c7.js";import"./index.0afce1eb.js";import"./index.c9f7f8f0.js";import"./index.2c964e80.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[n]="3f8dd7c5-8670-4b1c-b236-10cc14b91cf3",o._sentryDebugIdIdentifier="sentry-dbid-3f8dd7c5-8670-4b1c-b236-10cc14b91cf3")}catch{}})();function N(o){return o.charAt(0).toUpperCase()+o.slice(1)}const S=b({__name:"Builds",setup(o){const s=v().params.projectId;async function m(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:d,result:a,refetch:f}=k(()=>Promise.all([A.list(s),P.get(s).then(m)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;I(()=>{i=setInterval(f,5e3)}),w(()=>{clearInterval(i)});function c(e,t){return e.id===t}function g(e,t,r){return c(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":N(e.status)}function y(e,t,r){return c(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 _=h(()=>{var e,t;return{columns:[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],rows:(t=(e=a.value)==null?void 0:e.builds.map((r,l)=>{var u,p;return{key:r.id,cells:[{text:r.id.slice(0,8)},{text:F(r.createdAt,Date.now(),{addSuffix:!0})},{text:g(r,l,(u=a.value)==null?void 0:u.lastDeploymentId),tagColor:y(r,l,(p=a.value)==null?void 0:p.lastDeploymentId)},{text:"",actions:[{icon:L,label:"View application logs",onClick:()=>M.push({name:"logs",params:{projectId:s},query:{buildId:r.id}})},{icon:j,label:"Download files",onClick:()=>r.download()}]}]}}))!=null?t:[]}});return(e,t)=>(D(),x(E,{"entity-name":"build",loading:B(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:_.value,live:""},null,8,["loading","table"]))}});const ge=C(S,[["__scopeId","data-v-c3cc84ec"]]);export{ge as default};
//# sourceMappingURL=Builds.3c2e5ac0.js.map
