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.c072fe4e.js";import{a as k}from"./asyncComputed.376cdc00.js";import{P as A}from"./project.5033d689.js";import{B as P}from"./build.31b04234.js";import{r as j}from"./console.a87f2a82.js";import"./index.90440471.js";import{N as L,P as M}from"./icons.158b4825.js";import{_ as N}from"./CrudView.vue_vue_type_script_setup_true_lang.9296340f.js";import{f as E}from"./index.b048d0fb.js";import"./gateway.18ca6e0a.js";import"./activeRecord.fdc25b97.js";import"./pubsub.98ad9fe0.js";import"./index.00103e26.js";import"./Form.9f52866c.js";import"./Title.e3dcb8ea.js";import"./CollapsePanel.ecfd8c73.js";import"./index.d808811c.js";import"./index.ec8e038a.js";import"./index.dce83dc7.js";import"./dayjs.a56ae918.js";import"./index.4e6af937.js";import"./index.8ab39784.js";import"./TabPane.df5f41ca.js";import"./index.c5fd7926.js";import"./index.148bcdd7.js";import"./index.d9c3e0de.js";import"./index.e5a5efcd.js";import"./index.e7c5574b.js";import"./index.96de14c0.js";import"./index.28ce0851.js";import"./index.2e3640f1.js";import"./index.4cff163b.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]="e3f50073-7b75-4671-bcb2-7a545c8a1a6c",o._sentryDebugIdIdentifier="sentry-dbid-e3f50073-7b75-4671-bcb2-7a545c8a1a6c")}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:n,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=n.value)==null?void 0:e.builds.map((r,u)=>{var c,p;return{key:r.id,cells:[{text:r.id.slice(0,8)},{text:E(r.createdAt,Date.now(),{addSuffix:!0})},{text:g(r,u,(c=n.value)==null?void 0:c.lastDeploymentId),tagColor:y(r,u,(p=n.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(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.8faac443.js.map
