import{d as w,u as I,y as c,b as d,q as L,c as r,v as e,e as x,U as y,X as S,L as i,B,F as k,K as D,ae as O,H as V,aq as C,N,O as T,p as A}from"./registerWidgets.4cc86716.js";import{C as U}from"./gateway.6112d0c1.js";import{B as j}from"./build.3fdd5895.js";import{a as F}from"./asyncComputed.f9d446a7.js";import{L as E}from"./CircularLoading.249aa989.js";import"./passwordlessManager.d432fb48.js";import"./activeRecord.57c6bf02.js";class R{list(s){const n=new URLSearchParams({offset:s.offset.toString(),limit:s.limit.toString(),from:s.from.getTime().toString(),to:s.to.getTime().toString(),search:s.search});return U.get(`projects/${s.projectId}/builds/${s.buildId}/logs?${n}`)}}const $=new R;class _{constructor(s,n,l,t,h,g,v){this.executionId=s,this.runtimeType=n,this.runtimeName=l,this.payload=t,this.event=h,this.buildId=g,this.createdAt=v}static fromDTO(s){return new _(s.executionId,s.runtimeType,s.runtimeName,s.payload,s.event,s.buildId,new Date(s.createdAt))}static async list(s){return(await $.list(s)).logs.map(_.fromDTO)}}const u=m=>(N("data-v-121cc759"),m=m(),T(),m),P={key:1,class:"logs"},G=u(()=>e("h1",null,"Logs",-1)),H={class:"filters"},K={class:"field field-build"},M=u(()=>e("label",null,"Build",-1)),X={class:"field"},z=u(()=>e("label",null,"From",-1)),J={class:"field"},Q=u(()=>e("label",null,"To",-1)),W={class:"field"},Y=u(()=>e("label",null,"Search",-1)),Z={key:0,class:"log-list"},q={class:"search-summary"},ee={class:"log"},te={class:"log-header"},se={key:0,class:"log-date log-header-item"},oe=u(()=>e("span",{class:"log-header-item-name"},"Build",-1)),ae=[oe],le=O('<div class="log-date log-header-item" data-v-121cc759><span class="log-header-item-name" data-v-121cc759>Date</span></div><div class="log-runtime log-header-item" data-v-121cc759><span class="log-header-item-name" data-v-121cc759>Runtime</span></div><div class="log-execution log-header-item" data-v-121cc759><span class="log-header-item-name" data-v-121cc759>Execution</span></div><div class="log-event log-header-item" data-v-121cc759><span class="log-header-item-name" data-v-121cc759>Event</span></div>',4),ie={class:"log-header"},de={key:0,class:"log-date log-header-item"},ne={class:"log-header-item-value"},ce={class:"log-date log-header-item"},re={class:"log-header-item-value"},ue={class:"log-runtime log-header-item"},me={class:"log-header-item-value"},pe={class:"log-execution log-header-item"},_e={class:"log-header-item-value"},he={class:"log-event log-header-item"},ge={class:"log-header-item-value"},ve={class:"log-payload"},fe=["textContent"],be={key:1,class:"no-logs"},ye=u(()=>e("p",null,"No logs found.",-1)),Se=[ye],Ie=w({__name:"Logs",setup(m){const n=V().params.projectId,l=I({buildOptions:[{label:"Latest",value:"latest"},{label:"All",value:"all"}],buildsLoading:!1,buildLoaded:!1}),t=I({selectedBuild:"all",from:new Date(Date.now()-1e3*60*60*24*7).toISOString().slice(0,16),to:new Date().toISOString().slice(0,16),search:"",limit:50,offset:0}),h=async()=>{if(l.buildLoaded)return;l.buildsLoading=!0;const p=await j.list(n);l.buildOptions=[...l.buildOptions,...p.map(a=>({label:a.label,value:a.id}))],l.buildLoaded=!0,l.buildsLoading=!1},g=p=>{t.selectedBuild=p.value,b()},{loading:v,result:f,refetch:b}=F(()=>_.list({projectId:n,limit:t.limit,offset:t.offset,buildId:t.selectedBuild,from:new Date(t.from),to:new Date(t.to),search:t.search}));return(p,a)=>c(v)||!c(f)?(d(),L(E,{key:0})):(d(),r("div",P,[G,e("div",H,[e("div",K,[M,x(c(C),{modelValue:t.selectedBuild,"onUpdate:modelValue":a[0]||(a[0]=o=>t.selectedBuild=o),class:"build-dropdown",options:l.buildOptions,"option-label":"label","option-value":"value",loading:l.buildsLoading,filter:!1,onShow:h,onChange:g},null,8,["modelValue","options","loading"])]),e("div",X,[z,y(e("input",{"onUpdate:modelValue":a[1]||(a[1]=o=>t.from=o),type:"datetime-local"},null,512),[[S,t.from]])]),e("div",J,[Q,y(e("input",{"onUpdate:modelValue":a[2]||(a[2]=o=>t.to=o),type:"datetime-local"},null,512),[[S,t.to]])]),e("div",W,[Y,y(e("input",{"onUpdate:modelValue":a[3]||(a[3]=o=>t.search=o),type:"search"},null,512),[[S,t.search]])]),e("button",{onClick:a[4]||(a[4]=(...o)=>c(b)&&c(b)(...o))},"Filter")]),c(f).length>0?(d(),r("div",Z,[e("div",q," Showing from "+i(t.offset+1)+" to "+i(t.offset+t.limit),1),e("details",ee,[e("summary",te,[t.selectedBuild=="all"?(d(),r("div",se,ae)):B("",!0),le])]),(d(!0),r(k,null,D(c(f),o=>(d(),r("details",{key:o.createdAt.toString(),class:"log"},[e("summary",ie,[t.selectedBuild=="all"?(d(),r("div",de,[e("span",ne,i(o.buildId.split("-")[0]),1)])):B("",!0),e("div",ce,[e("span",re,i(o.createdAt.toISOString()),1)]),e("div",ue,[e("span",me,i(o.runtimeType)+":"+i(o.runtimeName),1)]),e("div",pe,[e("span",_e,i(o.executionId.slice(0,8)),1)]),e("div",he,[e("span",ge,i(o.event),1)])]),e("div",ve,[e("pre",{class:"log-payload-content",textContent:i(o.payload)},null,8,fe)])]))),128))])):(d(),r("div",be,Se))]))}});const Ve=A(Ie,[["__scopeId","data-v-121cc759"]]);export{Ve as default};
//# sourceMappingURL=Logs.d9a9400d.js.map
