import{r as p}from"./router.bb51d819.js";import{d as y,eB as _,o as h,K as k,G as I,b as x,c as C,u as v,v as w}from"./outputWidgets.470cd725.js";import{d as B}from"./index.672f7932.js";import{a as D}from"./asyncComputed.72d91ef9.js";import"./authorManager.176ccd94.js";import{B as A}from"./build.dabf30ab.js";import"./index.d44cde0e.js";import{P}from"./project.f4c30a7f.js";import{C as R}from"./CrudView.e08250db.js";import{L as j,Q as E,R as F}from"./icons.732210f6.js";import"./FormItem.bd89e955.js";import"./hasIn.6bd3aa8a.js";import"./gateway.6d700df7.js";import"./index.cf4c23b9.js";import"./record.19f593f6.js";import"./pubsub.bb7b27fb.js";import"./Title.edbac04b.js";import"./Text.fbb768c7.js";import"./Form.bf13abb6.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.702cb95e.js";import"./url.28fafd73.js";import"./index.e48b3db7.js";import"./index.2d4e9800.js";import"./index.52ab7ae6.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="0a565471-819a-447e-8022-dbe68fd6c601",s._sentryDebugIdIdentifier="sentry-dbid-0a565471-819a-447e-8022-dbe68fd6c601")}catch{}})();const S=y({__name:"Builds",setup(s){const l=_().params.projectId,{loading:m,result:n,refetch:g}=D(async()=>{const[t,e]=await Promise.all([A.list(l),P.getStatus(l)]);return{b:t.map(a=>({build:a,status:e.filter(i=>i.buildId==a.id).map(i=>i.status)})),status:e}});let u;h(()=>{u=setInterval(g,1e4)}),k(()=>{clearInterval(u)});const c=[{text:"Deploying",tagColor:"blue",check:t=>{var e,o;return(o=t.build.latest&&t.status.some(a=>a=="Running")&&((e=n.value)==null?void 0:e.status.some(a=>a.buildId!==t.build.id)))!=null?o:!1}},{text:"Deactivating",tagColor:"orange",check:t=>t.build.status==="success"&&!t.build.latest&&t.status.some(e=>e=="Running")},{text:"Failed",tagColor:"orange",check:t=>t.build.latest&&t.status.some(e=>e=="Failed")},{text:"LIVE",tagColor:"green",check:t=>t.build.latest},{text:"Inactive",tagColor:"lightgray",check:t=>t.build.status==="success"},{text:"Aborted",tagColor:"orange",check:t=>t.build.status==="aborted"||t.build.status==="aborted-by-user"},{text:"Failed",tagColor:"orange",check:t=>t.build.status==="failure"},{text:"In progress",tagColor:"red",check:t=>t.build.status==="in-progress"},{text:"Pending",tagColor:"yellow",check:t=>t.build.status==="pending"}];function b(t){var e,o,a,i;return{text:(o=(e=c.find(d=>d.check(t)))==null?void 0:e.text)!=null?o:"unknown",tagColor:(i=(a=c.find(d=>d.check(t)))==null?void 0:a.tagColor)!=null?i:"lightgray"}}const f=I(()=>{const t=[{name:"Id"},{name:"Date"},{name:"Status"},{name:"Actions",align:"right"}];return n.value?{columns:t,rows:n.value.b.map(e=>{var o;return{key:e.build.id,cells:[{link:`/builds/${e.build.id}`,text:e.build.id.slice(0,8)},{text:B(e.build.createdAt)},{...b(e),hover:(o=e.build.log)!=null?o:void 0},{text:"",actions:[{icon:j,label:"Inspect build",onClick:()=>p.push({name:"build",params:{buildId:e.build.id}})},{icon:E,label:"View application logs",onClick:()=>p.push({name:"logs",params:{projectId:l},query:{buildId:e.build.id}})},{icon:F,label:"Download files",onClick:()=>e.build.download()}]}]}})}:{columns:t,rows:[]}});return(t,e)=>(x(),C(R,{"entity-name":"build",loading:v(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:f.value,live:""},null,8,["loading","table"]))}});const st=w(S,[["__scopeId","data-v-808c1b1c"]]);export{st as default};
//# sourceMappingURL=Builds.179133be.js.map
