import{d as v,o as x,a0 as S,u as t,b as p,ev as _,bq as j,eC as C,c as w,w as o,f as a,aq as l,eD as h,cy as A,bg as B,v as T,eB as D,G as E,cC as L}from"./outputWidgets.49a82d72.js";import{a as k}from"./asyncComputed.eabe06e7.js";import{r as $}from"./router.a6168245.js";import{B as P,a as V}from"./build.33e8d873.js";import"./index.21de586b.js";import{P as q}from"./project.807ccebb.js";import{C as R}from"./CrudView.af71ec23.js";import{Q as N}from"./icons.2150c8c5.js";import{_ as M,E as F}from"./ExecutionStatusIcon.vue_vue_type_script_setup_true_lang.889a4edf.js";import{A as I}from"./Title.d0eedb84.js";import{A as f}from"./Text.183f0e18.js";import{A as G}from"./Link.0e4e713f.js";import"./FormItem.e4d1b0b2.js";import"./hasIn.fa4a0362.js";import"./index.5029967c.js";import"./index.cf4c23b9.js";import"./record.ddefb071.js";import"./pubsub.6877ebe1.js";import"./Form.5245e582.js";import"./Modal.e7dfdcd9.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.9e950d61.js";import"./url.58ce58bc.js";import"./index.99c9b8c6.js";import"./index.8af0bb95.js";import"./CheckCircleFilled.594905e7.js";(function(){try{var d=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[u]="0707dd6b-5c1b-493e-abdf-fa58c2ca28b0",d._sentryDebugIdIdentifier="sentry-dbid-0707dd6b-5c1b-493e-abdf-fa58c2ca28b0")}catch{}})();const Q={key:0,class:"flex-row"},U={key:1,class:"flex-row"},z={key:2,class:"flex-row"},H=v({__name:"ExecutionsShort",props:{stageId:{},projectId:{}},emits:["select"],setup(d,{emit:u}){const c=d,y=new F,{result:m,refetch:g,loading:b}=k(async()=>{const{executions:r}=await y.list({projectId:c.projectId,stageId:c.stageId,limit:6});return r}),e=r=>{u("select",r)};let i=null;return x(()=>{i=setInterval(()=>g(),15e3)}),S(()=>{i&&clearInterval(i)}),(r,s)=>t(m)?(p(),_("div",Q,[(p(!0),_(j,null,C(t(m),n=>(p(),w(t(A),{key:n.id,title:n.createdAt.toLocaleString(),onClick:O=>e(n)},{content:o(()=>[a(t(I),null,{default:o(()=>[l("Status: "+h(n.status),1)]),_:2},1024),a(t(I),null,{default:o(()=>[l("Duration: "+h(n.duration_seconds)+" s",1)]),_:2},1024),a(t(I),null,{default:o(()=>[l("Build: "+h(n.buildId.slice(0,6)),1)]),_:2},1024)]),default:o(()=>[a(M,{status:n.status},null,8,["status"])]),_:2},1032,["title","onClick"]))),128))])):t(b)?(p(),_("div",U,[a(t(B))])):(p(),_("div",z,"None"))}});const J=T(H,[["__scopeId","data-v-dc7e11a2"]]),K={key:1},vt=v({__name:"Live",setup(d){const c=D().params.projectId,{loading:y,result:m}=k(async()=>{const i=(await P.list(c)).find(n=>n.latest);if(!i)return null;const[r,s]=await Promise.all([V.get(i.id),q.get(c)]);return{buildSpec:r,project:s}}),g=e=>e.type=="form"?`/${e.path}`:e.type=="hook"?`/_hooks/${e.path}`:e.type=="job"?`${e.schedule}`:"",b=E(()=>{var r;const e=[{name:"Id"},{name:"Type",align:"left"},{name:"Title",align:"left"},{name:"Trigger",align:"left"},{name:"Last Runs"},{name:"",align:"right"}],i=(r=m.value)==null?void 0:r.buildSpec;return i?{columns:e,rows:i.runtimes.map(s=>({key:s.id,cells:[{type:"text",text:s.id.slice(0,8)},{type:"text",text:s.type},{type:"text",text:s.title},{type:"text",text:g(s),secondary:!0,code:!0},{type:"slot",key:"last-runs",payload:{runtime:s}},{type:"actions",actions:[{icon:N,label:"View script logs",onClick:()=>$.push({name:"logs",params:{projectId:c},query:{runtimeId:s.id}})}]}]}))}:{columns:e,rows:[]}});return(e,i)=>{var r,s;return t(y)||((s=(r=t(m))==null?void 0:r.buildSpec.runtimes.length)!=null?s:0)>0?(p(),w(R,{key:0,"empty-title":"__empty_title","entity-name":"build",description:"Access and monitor your project's current scripts here.",table:b.value,loading:t(y),title:"Live View"},{"last-runs":o(({payload:n})=>[a(J,{"stage-id":n.runtime.id,"project-id":t(c)},null,8,["stage-id","project-id"])]),_:1},8,["table","loading"])):(p(),_("div",K,[a(t(L),{direction:"vertical"},{default:o(()=>[a(t(f),null,{default:o(()=>[l("Install abstra using pip:")]),_:1}),a(t(f),{code:"",copyable:""},{default:o(()=>[l("pip install abstra")]),_:1}),a(t(f),null,{default:o(()=>[l("Start a new project using our CLI")]),_:1}),a(t(f),{code:"",copyable:""},{default:o(()=>[l("abstra serve my-new-project")]),_:1}),a(t(f),null,{default:o(()=>[l(" If you have any questions, please reach out to our "),a(t(G),{href:"https://discord.gg/abstra",target:"_blank"},{default:o(()=>[l(" discord channel ")]),_:1})]),_:1})]),_:1})]))}}});export{vt as default};
//# sourceMappingURL=Live.0ce22e44.js.map
