import{d as b,eA as I,o as v,N as w,J as h,b as x,c as D,u as B,x as C}from"./outputWidgets.75a5b0b9.js";import{a as k}from"./asyncComputed.c701d7b0.js";import{P as A}from"./project.f661f5a0.js";import{B as P}from"./build.e584ce68.js";import{r as j}from"./console.3fb52eaf.js";import"./index.a131125e.js";import{N as L,P as M}from"./icons.c04528be.js";import{_ as N}from"./CrudView.vue_vue_type_script_setup_true_lang.ff628288.js";import{f as E}from"./index.b048d0fb.js";import"./gateway.99e43695.js";import"./activeRecord.115270b9.js";import"./pubsub.3fa240d3.js";import"./index.a1ee75ca.js";import"./Form.2c716183.js";import"./Title.b6c9692d.js";import"./index.b50eb903.js";import"./index.4598445f.js";import"./index.b6767512.js";import"./dayjs.d3366d83.js";import"./index.e24c456b.js";import"./index.7aacb57f.js";import"./TabPane.0d7849ee.js";import"./index.e9ba5796.js";import"./CollapsePanel.46ee4c6b.js";import"./index.3916405f.js";import"./index.5a67eb5f.js";import"./index.fe803cdf.js";import"./index.5e9c5434.js";import"./index.00d295c9.js";import"./index.fc88890c.js";import"./index.9c0809a0.js";import"./index.49e953af.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]="425f8a53-3dff-4b4e-a5ce-8bb69265b117",o._sentryDebugIdIdentifier="sentry-dbid-425f8a53-3dff-4b4e-a5ce-8bb69265b117")}catch{}})();function F(o){return o.charAt(0).toUpperCase()+o.slice(1)}const S=b({__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:f,result:a,refetch:d}=k(()=>Promise.all([P.list(s),A.get(s).then(m)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;v(()=>{i=setInterval(d,5e3)}),w(()=>{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":F(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 _=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,u)=>{var p,c;return{key:r.id,cells:[{text:r.id.slice(0,8)},{text:E(r.createdAt,Date.now(),{addSuffix:!0})},{text:g(r,u,(p=a.value)==null?void 0:p.lastDeploymentId),tagColor:y(r,u,(c=a.value)==null?void 0:c.lastDeploymentId)},{text:"",actions:[{icon:L,label:"View application logs",onClick:()=>j.push({name:"logs",params:{projectId:s},query:{buildId:r.id}})},{icon:M,label:"Download files",onClick:()=>r.download()}]}]}}))!=null?t:[]}});return(e,t)=>(x(),D(N,{"entity-name":"build",loading:B(f),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.f57100a9.js.map
