import{d as I,eA as v,o as w,N as h,J as b,b as x,c as D,u as B,x as C}from"./outputWidgets.b9aa154a.js";import{a as k}from"./asyncComputed.9bda3979.js";import{P as A}from"./project.c2b2df99.js";import{B as P}from"./build.5fd4cec8.js";import{r as j}from"./console.ee73e2aa.js";import"./index.4d631048.js";import{N as L,P as M}from"./icons.4ed83c58.js";import{_ as N}from"./CrudView.vue_vue_type_script_setup_true_lang.8866a12f.js";import{f as E}from"./index.b048d0fb.js";import"./gateway.5aa82c5f.js";import"./activeRecord.8939db5d.js";import"./pubsub.967f482a.js";import"./index.ade1bec6.js";import"./Form.55f226f4.js";import"./Title.6cd833fd.js";import"./index.74d4e484.js";import"./index.6b140cad.js";import"./index.29aa7167.js";import"./dayjs.d2a09bae.js";import"./index.ea68e603.js";import"./index.bb85a084.js";import"./TabPane.3d00468a.js";import"./index.ab1855db.js";import"./index.14f3ef13.js";import"./index.eb23b22d.js";import"./index.45ef6041.js";import"./index.45ac8fb9.js";import"./index.004b987c.js";import"./index.23063916.js";import"./index.55488473.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]="194ce7e8-cc51-438d-8e33-8c59ec352dc8",o._sentryDebugIdIdentifier="sentry-dbid-194ce7e8-cc51-438d-8e33-8c59ec352dc8")}catch{}})();function F(o){return o.charAt(0).toUpperCase()+o.slice(1)}const S=I({__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([P.list(s),A.get(s).then(m)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;w(()=>{i=setInterval(f,5e3)}),h(()=>{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":F(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 _=b(()=>{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:E(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:()=>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 de=C(S,[["__scopeId","data-v-c3cc84ec"]]);export{de as default};
//# sourceMappingURL=Builds.40f73f37.js.map
