import{d as F,r as I,H as B,G as R,eA as $,F as q,eJ as C,b as p,c as v,w as u,u as e,eI as E,f as a,az as P,ad as _,cs as j,bx as G,cG as k,eu as O,eB as V,b6 as H,bU as J,co as M}from"./outputWidgets.6d6b4a37.js";import{L,a as K}from"./Log.5c4b495f.js";import{d as Q}from"./index.72c317ca.js";import{A as g}from"./router.4e9df257.js";import{B as W}from"./build.9462cb9f.js";import"./index.2cafcd9c.js";import{a as X}from"./asyncComputed.17a6198d.js";import{R as Y}from"./dayjs.6150060b.js";import{A as Z}from"./Title.b41b4f96.js";import{A as U}from"./index.9eddb8ae.js";import{A as c,F as ee}from"./Form.1ff54ed5.js";import{T as te}from"./index.1c6494ef.js";import"./gateway.7a58b0c8.js";import"./ant-design.c99b7781.js";import"./index.f2a53bdb.js";import"./record.7835c07e.js";import"./pubsub.7d377b25.js";import"./index.eb9c41b1.js";(function(){try{var f=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(f._sentryDebugIds=f._sentryDebugIds||{},f._sentryDebugIds[o]="b0508bb0-5182-4a9d-bd44-a21a0735de29",f._sentryDebugIdIdentifier="sentry-dbid-b0508bb0-5182-4a9d-bd44-a21a0735de29")}catch{}})();const we=F({__name:"Logs",setup(f){const o=I(1),i=I(10);B([o,i],([n,t])=>{o.value=n,i.value=t,A()});const h=R(()=>{var n,t;return{runtimes:(n=d.value)==null?void 0:n.filters.runtimes.map(({runtimeName:r,runtimeType:l})=>({label:`[${l}] ${r}`,value:r})),events:(t=d.value)==null?void 0:t.filters.events.map(r=>({label:`[${r.runtimeType}] ${r.event}`,value:r.event}))}}),m=$(),b=m.params.projectId;function D(){const n=[];return typeof m.query.runtimeId=="string"&&n.push(m.query.runtimeId),typeof m.query.runtimeTitle=="string"&&n.push(m.query.runtimeTitle),n}const s=q({selectedBuild:m.query.buildId||"latest",dateRange:void 0,search:"",runtimeNames:D(),events:[]}),N=C.exports.debounce(async()=>{await A(),y.value=!1},500),y=I(!1);B(s,()=>{y.value=!0,o.value=1,N()});const T=R(()=>d.value?[{label:"Latest",value:"latest"},{label:"All",value:"all"},...d.value.builds.map(n=>({label:`${Q(n.createdAt)} (${n.id.slice(0,8)})`,value:n.id}))]:[{label:"Latest",value:"latest"},{label:"All",value:"all"}]),x=n=>{s.selectedBuild=n,A()},{loading:S,result:d,refetch:A}=X(()=>{var n,t;return Promise.all([L.list({projectId:b,limit:i.value,offset:(o.value-1)*i.value,buildId:s.selectedBuild,from:(n=s.dateRange)==null?void 0:n[0].toDate(),to:(t=s.dateRange)==null?void 0:t[1].toDate(),search:s.search,executionIds:[],runtimeNames:s.runtimeNames,events:s.events}),W.list(b),L.filters(b)]).then(([{total:r,logs:l},w,z])=>E({total:r,logs:l,builds:w,filters:z}))});return(n,t)=>(p(),v(e(k),{direction:"vertical"},{default:u(()=>{var r;return[a(e(Z),null,{default:u(()=>[P("Logs")]),_:1}),a(e(ee),{layout:"vertical"},{default:u(()=>[a(e(U),{gutter:10},{default:u(()=>[a(e(g),{span:12},{default:u(()=>[a(e(c),{label:"Build"},{default:u(()=>[a(e(_),{value:s.selectedBuild,"onUpdate:value":t[0]||(t[0]=l=>s.selectedBuild=l),options:T.value,"option-label":"label","option-value":"value",filter:!1,onChange:x},null,8,["value","options"])]),_:1})]),_:1}),a(e(g),{span:12},{default:u(()=>[a(e(c),{label:"Date"},{default:u(()=>[a(e(Y),{value:s.dateRange,"onUpdate:value":t[1]||(t[1]=l=>s.dateRange=l),style:{width:"100%"}},null,8,["value"])]),_:1})]),_:1})]),_:1}),a(e(U),{gutter:10},{default:u(()=>[a(e(g),{span:12},{default:u(()=>[a(e(c),{label:"Runtimes"},{default:u(()=>[a(e(_),{value:s.runtimeNames,"onUpdate:value":t[2]||(t[2]=l=>s.runtimeNames=l),options:h.value.runtimes,mode:"multiple"},null,8,["value","options"])]),_:1})]),_:1}),a(e(g),{span:12},{default:u(()=>[a(e(c),{label:"Events"},{default:u(()=>[a(e(_),{value:s.events,"onUpdate:value":t[3]||(t[3]=l=>s.events=l),options:h.value.events,mode:"multiple"},null,8,["value","options"])]),_:1})]),_:1})]),_:1}),a(e(c),{label:"Search"},{default:u(()=>[a(e(j),{value:s.search,"onUpdate:value":t[4]||(t[4]=l=>s.search=l),type:"search"},null,8,["value"])]),_:1})]),_:1}),e(S)||y.value?(p(),v(e(G),{key:0,style:{width:"100%"}})):(r=e(d))!=null&&r.logs.length?(p(),v(e(k),{key:1,direction:"vertical",style:{width:"100%"}},{default:u(()=>[a(e(te),null,{default:u(()=>[(p(!0),O(H,null,V(e(d).logs,(l,w)=>(p(),v(K,{key:w,log:l},null,8,["log"]))),128))]),_:1}),a(e(J),{current:o.value,"onUpdate:current":t[5]||(t[5]=l=>o.value=l),"page-size":i.value,"onUpdate:pageSize":t[6]||(t[6]=l=>i.value=l),"show-size-changer":"",total:e(d).total},null,8,["current","page-size","total"])]),_:1})):(p(),v(e(M),{key:2}))]}),_:1}))}});export{we as default};
//# sourceMappingURL=Logs.3f8ec104.js.map
