mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
2 lines
4.6 KiB
JavaScript
2 lines
4.6 KiB
JavaScript
import{u as B,f as e,ah as J,i as t,ai as I,aj as K,F as x,ak as Q,al as U,am as d,an as Y,ao as ee,g as C,ap as V,aq as R,ar as H,P as te,t as v,A as L,r as j,w as ae,C as re,b as le,y as se,R as ne,$ as k,D as oe,a2 as ie,a3 as ce,B as A,a5 as ue,a1 as G,a6 as de,a9 as ge,aa as he,a0 as q,ae as ve,ag as fe,l as me}from"./index-DWMGWNy8.js";import{c as be,g as pe,a as $e,e as _e,f as N,r as Se}from"./index-6_sXLHMR.js";var xe=v('<div class="flex flex-col gap-4"><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full"></select></div><div><select class="select select-bordered w-full">'),M=v("<option>");const Ce=u=>{const[r]=B();return e(te,{ref:s=>{var n;return(n=u.ref)==null?void 0:n.call(u,s)},get icon(){return e(J,{size:24})},get title(){return r("logsSettings")},get children(){var s=xe(),n=s.firstChild,i=n.firstChild,$=n.nextSibling,m=$.firstChild,w=$.nextSibling,b=w.firstChild;return t(n,e(I,{withDivider:!0,get children(){return r("tableSize")}}),i),i.addEventListener("change",a=>K(a.target.value)),t(i,e(x,{get each(){return Object.values(Q)},children:a=>(()=>{var o=M();return o.value=a,t(o,()=>r(a)),o})()})),t($,e(I,{withDivider:!0,get children(){return r("logLevel")}}),m),m.addEventListener("change",a=>U(a.target.value)),t(m,e(x,{get each(){return[d.Info,d.Error,d.Warning,d.Debug,d.Silent]},children:a=>(()=>{var o=M();return o.value=a,t(o,()=>r(a)),o})()})),t(w,e(I,{withDivider:!0,get children(){return r("logMaxRows")}}),b),b.addEventListener("change",a=>Y(parseInt(a.target.value))),t(b,e(x,{each:ee,children:a=>(()=>{var o=M();return o.value=a,t(o,a),o})()})),C(()=>i.value=V()),C(()=>m.value=R()),C(()=>b.value=H()),s}})};let W=1;const[we,ye]=L([]),[X,Le]=L(!1);j(ae(R,(u,r)=>{if(u===r)return;const s=re("logs",{level:R()});j(()=>{const n=s();!n||X()||(ye(i=>[{...n,seq:W},...i].slice(0,H())),W++)})}));const Fe=()=>({logs:we,paused:X,setPaused:Le});var Ie=v("<span>"),ke=v('<div class="flex h-full flex-col gap-2"><div class="join w-full"><input type=search class="input input-sm join-item input-primary flex-1 flex-shrink-0"></div><div class="overflow-x-auto whitespace-nowrap rounded-md bg-base-300"><table><thead class="sticky top-0 z-10"></thead><tbody>'),Me=v("<tr>"),Re=v('<th class=bg-base-200><div class="flex items-center"><div>'),Ee=v('<tr class="hover:!bg-primary hover:text-primary-content">'),De=v("<td class=py-2>");const O=(u,r,s,n)=>{const i=Se(u.getValue(r),s);return n({itemRank:i}),i.passed},Pe=()=>{const u=le();if(!se())return u("/setup",{replace:!0}),null;let r;const[s]=B(),[n,i]=L(""),{logs:$,paused:m,setPaused:w}=Fe(),[b,a]=ne(L([]),{name:"logsTableSorting",storage:localStorage}),o=[{header:s("sequence"),accessorFn:c=>c.seq},{header:s("type"),accessorFn:c=>c.type,cell:({row:c})=>{const p=c.original.type;let g="";switch(p){case d.Error:g="text-error";break;case d.Warning:g="text-warning";break;case d.Info:g="text-info";break;case d.Debug:g="text-success";break}return(()=>{var _=Ie();return k(_,g),t(_,()=>`[${c.original.type}]`),_})()}},{header:s("payload"),accessorFn:c=>c.payload}],E=be({filterFns:{fuzzy:O},state:{get globalFilter(){return n()},get sorting(){return b()}},get data(){return $()},sortDescFirst:!0,columns:o,onGlobalFilterChange:i,onSortingChange:a,globalFilterFn:O,getFilteredRowModel:pe(),getSortedRowModel:$e(),getCoreRowModel:_e()});return(()=>{var c=ke(),p=c.firstChild,g=p.firstChild,_=p.nextSibling,D=_.firstChild,z=D.firstChild,Z=z.nextSibling;return g.$$input=l=>i(l.target.value),t(p,e(A,{class:"btn-primary join-item btn-sm",onClick:()=>w(l=>!l),get icon(){return oe(()=>!!m())()?e(ie,{}):e(ce,{})}}),null),t(p,e(A,{class:"btn-primary join-item btn-sm",onClick:()=>r==null?void 0:r.showModal(),get icon(){return e(ue,{})}}),null),t(z,e(G,{get each(){return E.getHeaderGroups()},children:l=>{const f=l();return(()=>{var h=Me();return t(h,e(G,{get each(){return f.headers},children:y=>{const S=y();return(()=>{var T=Re(),P=T.firstChild,F=P.firstChild;return de(F,"click",S.column.getToggleSortingHandler(),!0),t(F,()=>N(S.column.columnDef.header,S.getContext())),t(P,()=>({asc:e(ge,{}),desc:e(he,{})})[S.column.getIsSorted()]??null,null),C(()=>k(F,q(S.column.getCanSort()&&"cursor-pointer select-none","flex-1"))),T})()}})),h})()}})),t(Z,e(x,{get each(){return E.getRowModel().rows},children:l=>(()=>{var f=Ee();return t(f,e(x,{get each(){return l.getVisibleCells()},children:h=>(()=>{var y=De();return t(y,()=>N(h.column.columnDef.cell,h.getContext())),y})()})),f})()})),t(c,e(Ce,{ref:l=>r=l}),null),C(l=>{var f=s("search"),h=q(ve(V()),"table relative rounded-none");return f!==l.e&&fe(g,"placeholder",l.e=f),h!==l.t&&k(D,l.t=h),l},{e:void 0,t:void 0}),c})()};me(["input","click"]);export{Pe as default};
|