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 u,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.fdae7e91.js";import{a as L,L as M}from"./log.9c0911a3.js";import{d as Q}from"./index.6f560850.js";import"./authorManager.adc33c37.js";import{B as W}from"./build.d2fa7aee.js";import"./index.30fe2a77.js";import{a as X}from"./asyncComputed.43537aae.js";import{R as Y}from"./dayjs.ddeefa5a.js";import{a as Z}from"./Title.e4079793.js";import{a as D,A as g}from"./router.ae435e74.js";import{A as c}from"./FormItem.45b6065e.js";import{F as ee}from"./Form.d4070d32.js";import{T as te}from"./index.26ed9813.js";import"./ant-design.f2f7cc3b.js";import"./index.dedb9dc3.js";import"./gateway.8c35b4b8.js";import"./index.cf4c23b9.js";import"./record.f963a373.js";import"./pubsub.61789656.js";import"./index.a1355aa9.js";import"./index.9026b0b4.js";import"./Text.2d7466b9.js";import"./hasIn.e6601643.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]="170fbba2-14c8-42ea-bda7-3a8396952556",f._sentryDebugIdIdentifier="sentry-dbid-170fbba2-14c8-42ea-bda7-3a8396952556")}catch{}})();const Re=x({__name:"Logs",setup(f){const o=I(1),i=I(10);B([o,i],([n,t])=>{o.value=n,i.value=t,w()});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=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 w(),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,w()},{loading:C,result:d,refetch:w}=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},A,S])=>E({total:r,logs:l,builds:A,filters:S}))});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(D),{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:U.value,"option-label":"label","option-value":"value",filter:!1,onChange:q},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(D),{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(C)||y.value?(p(),v(e(O),{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),V(H,null,G(e(d).logs,(l,A)=>(p(),v(M,{key:A,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{Re as default};
//# sourceMappingURL=Logs.7934cfca.js.map
