import{d as x,r as I,H as B,G as R,eB as F,F as $,eK as z,b as p,c as v,w as r,u as e,eJ as E,f as a,aq as P,ad as _,co as j,bg as O,cC as k,ev as V,eC as G,bq as H,bL as J,ck as K}from"./outputWidgets.31ce2d5c.js";import{L,a as M}from"./Log.b8415eca.js";import{d as Q}from"./index.0d76378d.js";import{A as g}from"./router.8f071dc2.js";import{B as W}from"./build.f953a592.js";import"./index.e05c62e3.js";import{a as X}from"./asyncComputed.7e3e21f4.js";import{R as Y}from"./dayjs.e48aa226.js";import{A as Z}from"./Title.951eccc5.js";import{A as D}from"./index.ef6e34b6.js";import{A as c}from"./FormItem.5f0b61bf.js";import{F as ee}from"./Form.482980d3.js";import{T as te}from"./index.fa166136.js";import"./gateway.3615e807.js";import"./ant-design.feb03817.js";import"./index.7e964756.js";import"./Modal.32a7843c.js";import"./index.cf4c23b9.js";import"./record.b2148451.js";import"./pubsub.2d9ab3f4.js";import"./index.519d0ddc.js";import"./index.627ab86d.js";import"./Base.eeda2dae.js";import"./hasIn.932773c2.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]="f5abbd74-d6ae-4ffa-aa82-f2551c160c26",f._sentryDebugIdIdentifier="sentry-dbid-f5abbd74-d6ae-4ffa-aa82-f2551c160c26")}catch{}})();const ke=x({__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:u,runtimeType:l})=>({label:`[${l}] ${u}`,value:u})),events:(t=d.value)==null?void 0:t.filters.events.map(u=>({label:`[${u.runtimeType}] ${u.event}`,value:u.event}))}}),m=F(),b=m.params.projectId;function N(){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=$({selectedBuild:m.query.buildId||"latest",dateRange:void 0,search:"",runtimeNames:N(),events:[]}),T=z.exports.debounce(async()=>{await A(),y.value=!1},500),y=I(!1);B(s,()=>{y.value=!0,o.value=1,T()});const U=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"}]),q=n=>{s.selectedBuild=n,A()},{loading:C,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:u,logs:l},w,S])=>E({total:u,logs:l,builds:w,filters:S}))});return(n,t)=>(p(),v(e(k),{direction:"vertical"},{default:r(()=>{var u;return[a(e(Z),null,{default:r(()=>[P("Logs")]),_:1}),a(e(ee),{layout:"vertical"},{default:r(()=>[a(e(D),{gutter:10},{default:r(()=>[a(e(g),{span:12},{default:r(()=>[a(e(c),{label:"Build"},{default:r(()=>[a(e(_),{value:s.selectedBuild,"onUpdate:value":t[0]||(t[0]=l=>s.selectedBuild=l),options:U.value,"option-label":"label","option-value":"value",filter:!1,onChange:q},null,8,["value","options"])]),_:1})]),_:1}),a(e(g),{span:12},{default:r(()=>[a(e(c),{label:"Date"},{default:r(()=>[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(D),{gutter:10},{default:r(()=>[a(e(g),{span:12},{default:r(()=>[a(e(c),{label:"Runtimes"},{default:r(()=>[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:r(()=>[a(e(c),{label:"Events"},{default:r(()=>[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:r(()=>[a(e(j),{value:s.search,"onUpdate:value":t[4]||(t[4]=l=>s.search=l),type:"search"},null,8,["value"])]),_:1})]),_:1}),e(C)||y.value?(p(),v(e(O),{key:0,style:{width:"100%"}})):(u=e(d))!=null&&u.logs.length?(p(),v(e(k),{key:1,direction:"vertical",style:{width:"100%"}},{default:r(()=>[a(e(te),null,{default:r(()=>[(p(!0),V(H,null,G(e(d).logs,(l,w)=>(p(),v(M,{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(K),{key:2}))]}),_:1}))}});export{ke as default};
//# sourceMappingURL=Logs.d60f70a6.js.map
