import{u as G}from"./ArrayPagination-26934cac.js";import{ay as P,y as K,az as l,av as H,ai as Q,q as b,c as Z,r as g,k as J,d,a1 as X,s as Y,a3 as c,i as ee,N as S,aw as te,ax as le,_ as ae}from"./index-135ae4c1.js";import"./faker-c43f92d4.js";import{g as se,$ as oe,K as ne,d as h,c as f,M as ue,I as ie,a1 as i,a6 as I,m as e,a3 as a,ab as F,Z as m,u as o,a2 as v,D as x,a8 as y,F as B,a7 as re,a5 as de,W as N}from"./vue-d2584a6d.js";import{d as me}from"./dayjs.min-1969f9c6.js";import"./vuetify-e547ef1b.js";const ce={class:"pa-3"},pe={style:{"font-size":"1.6em !important"},class:"subtitle-1 ml-2"},ge={class:"d-flex justify-end"},fe=se({__name:"Logs",setup(ve){const w=oe(),{t:O}=ne(),_=P(),$=K(),V=h([{title:l[l.NORMAL],value:l.NORMAL},{title:l[l.INFO],value:l.INFO},{title:l[l.WARNING],value:l.WARNING},{title:l[l.CRITICAL],value:l.CRITICAL}]),u=h([l.NORMAL,l.INFO,l.WARNING,l.CRITICAL]),L=h(""),M=f(()=>_.logs),U=f(()=>M.value.filter(t=>u.value.includes(t.type))),{results:C}=H(U,L,t=>t.message),T=f(()=>u.value.length>0),k=f(()=>u.value.length===V.value.length),{paginatedResults:E,currentPage:r,pageCount:p}=G(C,30),A=()=>{w.push({name:"dashboard"})},W=t=>`logtype-${l[t?.type]?.toLowerCase()}`,j=t=>l[t.type],q=t=>me(t.timestamp*1e3).format($.dateFormat),z=()=>{k.value?u.value=[]:u.value=V.value.map(t=>t.value)},R=t=>{t.key==="Escape"&&A()};return ue(async()=>{document.addEventListener("keydown",R),await _.cleanAndFetchLogs(),Q(_.fetchLogs,15e3)}),ie(()=>{document.removeEventListener("keydown",R)}),(t,n)=>(i(),I("div",ce,[e(b,{"no-gutters":"",align:"center",justify:"center"},{default:a(()=>[e(g,null,{default:a(()=>[F("h1",pe,m(o(O)("logs.title")),1)]),_:1}),e(g,null,{default:a(()=>[F("div",ge,[e(J,{icon:"mdi-close",variant:"plain",onClick:A})])]),_:1})]),_:1}),e(Z,null,{default:a(()=>[e(d,null,{default:a(()=>[e(b,null,{default:a(()=>[e(g,{cols:"6"},{default:a(()=>[e(X,{modelValue:u.value,"onUpdate:modelValue":n[0]||(n[0]=s=>u.value=s),items:V.value,label:t.$t("logs.filters.type"),"hide-details":"",multiple:"",chips:""},{"prepend-item":a(()=>[e(d,{title:t.$t("common.selectAll"),onClick:z},{prepend:a(()=>[e(Y,{indeterminate:T.value&&!k.value,"model-value":T.value},null,8,["indeterminate","model-value"])]),_:1},8,["title"]),e(c)]),_:1},8,["modelValue","items","label"])]),_:1}),e(g,{cols:"6"},{default:a(()=>[e(ee,{modelValue:L.value,"onUpdate:modelValue":n[1]||(n[1]=s=>L.value=s),label:t.$t("logs.filters.query"),"hide-details":""},null,8,["modelValue","label"])]),_:1})]),_:1})]),_:1}),e(c,{class:"my-3",thickness:"5"}),o(p)>1?(i(),v(d,{key:0},{default:a(()=>[e(S,{modelValue:o(r),"onUpdate:modelValue":n[2]||(n[2]=s=>x(r)?r.value=s:null),length:o(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):y("",!0),e(c),(i(!0),I(B,null,re(o(E),(s,D)=>(i(),I(B,null,[D>0?(i(),v(c,{key:0})):y("",!0),e(d,{class:de(W(s))},{default:a(()=>[e(te,null,{default:a(()=>[N(m(s.id)+") "+m(s.message),1)]),_:2},1024),e(le,null,{default:a(()=>[N(m(j(s))+" | "+m(q(s)),1)]),_:2},1024)]),_:2},1032,["class"])],64))),256)),o(C).length===0?(i(),v(d,{key:1},{default:a(()=>[N(m(t.$t("logs.emptyLogList")),1)]),_:1})):y("",!0),e(c),o(p)>1?(i(),v(d,{key:2},{default:a(()=>[e(S,{modelValue:o(r),"onUpdate:modelValue":n[3]||(n[3]=s=>x(r)?r.value=s:null),length:o(p),"prev-icon":"mdi-menu-left","next-icon":"mdi-menu-right"},null,8,["modelValue","length"])]),_:1})):y("",!0)]),_:1})]))}});const Ne=ae(fe,[["__scopeId","data-v-77aed2b3"]]);export{Ne as default};
