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.b13a87c2.js";import{a as k}from"./asyncComputed.02afd50e.js";import{P as A}from"./project.d6937cfa.js";import{B as P}from"./build.135ca081.js";import{r as j}from"./console.d76c010c.js";import"./index.b8915c7f.js";import{N as L,P as M}from"./icons.76c1fe8b.js";import{_ as N}from"./CrudView.vue_vue_type_script_setup_true_lang.cf244ae9.js";import{f as E}from"./index.b048d0fb.js";import"./gateway.f581ef9f.js";import"./activeRecord.f5a2d19d.js";import"./pubsub.dab46576.js";import"./index.98e61e8e.js";import"./Form.e21e0d73.js";import"./Title.6f86755a.js";import"./index.3d7f8177.js";import"./index.55a2786b.js";import"./index.c4d59e95.js";import"./dayjs.2e90d17d.js";import"./index.fbf04eaa.js";import"./index.7011a200.js";import"./TabPane.3cb0210e.js";import"./index.0345671f.js";import"./index.24360d49.js";import"./index.c32ce6af.js";import"./index.73746068.js";import"./index.7dcc157a.js";import"./index.0b99f8ef.js";import"./index.1b5bc05c.js";import"./index.957937c4.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]="f9f09187-2dac-4352-9f4f-1cd416f3b874",o._sentryDebugIdIdentifier="sentry-dbid-f9f09187-2dac-4352-9f4f-1cd416f3b874")}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 f(e){const t=`https://${e.subdomain}.abstra.app/_version`;return(await fetch(t)).text()}const{loading:m,result:a,refetch:d}=k(()=>Promise.all([P.list(s),A.get(s).then(f)]).then(([e,t])=>({builds:e,lastDeploymentId:t})));let i;w(()=>{i=setInterval(d,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":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 _=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,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=a.value)==null?void 0:c.lastDeploymentId),tagColor:y(r,u,(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(m),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 me=C(S,[["__scopeId","data-v-c3cc84ec"]]);export{me as default};
//# sourceMappingURL=Builds.82474867.js.map
