import{d as I,eA as b,o as v,N as w,J as h,b as x,c as D,u as B,x as C}from"./outputWidgets.b43a489b.js";import{a as k}from"./asyncComputed.a42e75bb.js";import{P as A}from"./project.289e17e1.js";import{B as P}from"./build.bbdc1fe4.js";import{r as j}from"./console.bbd86620.js";import"./index.d989c562.js";import{N as L,P as M}from"./icons.de9af46a.js";import{_ as N}from"./CrudView.vue_vue_type_script_setup_true_lang.85d5e2a7.js";import{f as E}from"./index.b048d0fb.js";import"./gateway.38461683.js";import"./activeRecord.2bc5cc59.js";import"./pubsub.6fd47a9d.js";import"./index.42b92ee8.js";import"./Form.1797df89.js";import"./Title.47040052.js";import"./CollapsePanel.3e5384f9.js";import"./index.523f4a12.js";import"./index.65dea612.js";import"./index.9c88be1a.js";import"./dayjs.caeff4fe.js";import"./index.0279b5ff.js";import"./index.956893d2.js";import"./TabPane.b49c19a0.js";import"./index.0887e3a5.js";import"./index.a775b9cf.js";import"./index.e641ddba.js";import"./index.479accfd.js";import"./index.9367a16c.js";import"./index.8df4e710.js";import"./index.2fc0be8f.js";import"./index.8a60ee51.js";import"./index.85f24c29.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]="65a94464-b789-4547-bd3d-02ece2d239fe",o._sentryDebugIdIdentifier="sentry-dbid-65a94464-b789-4547-bd3d-02ece2d239fe")}catch{}})();function F(o){return o.charAt(0).toUpperCase()+o.slice(1)}const S=I({__name:"Builds",setup(o){const s=b().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([P.list(s),A.get(s).then(m)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;v(()=>{i=setInterval(f,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(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.31b06581.js.map
