import{d as v,ey as I,o as w,L as h,H as b,b as D,c as x,u as B,v as C}from"./registerWidgets.4340e287.js";import{a as k}from"./asyncComputed.a4cc4ebe.js";import{P}from"./project.9f1727ca.js";import{B as A}from"./build.7bd6ea8b.js";import"./gateway.1f2ccdb0.js";import"./index.dbce76fa.js";import{N as L,P as j}from"./icons.da02f7f7.js";import{r as M}from"./console.9f5c8ec8.js";import{_ as E}from"./CrudView.vue_vue_type_script_setup_true_lang.e9f57b5e.js";import{f as F}from"./index.b048d0fb.js";import"./activeRecord.c40ac301.js";import"./pubsub.3290d859.js";import"./passwordlessManager.8c70219b.js";import"./storage.dfe55847.js";import"./index.bdeb3c9e.js";import"./Form.7b78c348.js";import"./Title.4165770a.js";import"./index.87d21376.js";import"./index.c13b703c.js";import"./index.d1f57c70.js";import"./dayjs.a93d12f0.js";import"./index.17a2edf7.js";import"./index.4e740cc4.js";import"./TabPane.629b28d9.js";import"./index.a9613c76.js";import"./index.7bc7e814.js";import"./index.7512814c.js";import"./index.9aade351.js";import"./index.4f4601f4.js";import"./index.d480524f.js";import"./index.d24f6130.js";import"./index.f58e2ef8.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[a]="51079a6d-6024-4578-8504-3d6a6b25a2c8",o._sentryDebugIdIdentifier="sentry-dbid-51079a6d-6024-4578-8504-3d6a6b25a2c8")}catch{}})();function N(o){return o.charAt(0).toUpperCase()+o.slice(1)}const S=v({__name:"Builds",setup(o){const s=I().params.projectId;async function m(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:d,result:n,refetch:f}=k(()=>Promise.all([A.list(s),P.get(s).then(m)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;w(()=>{i=setInterval(f,5e3)}),h(()=>{clearInterval(i)});function l(e,t){return e.id===t}function g(e,t,r){return l(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 l(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 _=b(()=>{var e,t;return{columns:[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}],rows:(t=(e=n.value)==null?void 0:e.builds.map((r,u)=>{var p,c;return{key:r.id,cells:[{text:r.id.slice(0,8)},{text:F(r.createdAt,Date.now(),{addSuffix:!0})},{text:g(r,u,(p=n.value)==null?void 0:p.lastDeploymentId),tagColor:y(r,u,(c=n.value)==null?void 0:c.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.cf8b8363.js.map
