PageSourceSearch

https://app.knockknockapp.ai/assets/List-BuJ8UA_J.js

js knockknockapp.ai collected 2026-09-24 13:19:04 UTC 9,373 bytes, 1 lines download raw bytes

1import{a4 as J,w as T,l as d,m as n,q as e,D as r,u as t,B as b,aa as S,ac as K,ab as O,K as c,p,F as C,v as Q,y as k,r as y,J as N,ad as j,e as G}from"./vue-vendor-B52ivs5F.js";import{a as V,u as H,b as W,c as X}from"./query-vendor-Ab0nfCYP.js";import{_ as Y}from"./Pagination-BR1DzaAC.js";import{u as Z,t as F}from"./index-NM9cAr_v.js";import{b as ee,R as E,c as te,bJ as se,a7 as re,a5 as ae}from"./ui-vendor-D-1UBobO.js";import"./date-vendor-HBGOQ70J.js";import"./twilio-DAuME2Y9.js";import"./charts-D4hDxUnJ.js";import"./socket-CzTGKfeH.js";const oe=async(i={})=>{const g=new URLSearchParams;if(i.page&&i.pageSize){const f=(i.page-1)*i.pageSize;g.append("skip",f),g.append("limit",i.pageSize)}return i.search&&g.append("search",i.search),i.sort&&g.append("sort",i.sort),i.order&&g.append("order",i.order),(await V.get(`/error-logs?${g.toString()}`)).data},le=async i=>(await V.delete(`/error-logs/${i}`)).data,ie={class:"mb-6"},de={class:"grid gap-4 md:grid-cols-2"},ne={class:"relative"},ce={class:"text-center"},ge={class:"flex items-start gap-3"},ue={class:"overflow-x-auto"},ye={class:"w-full"},pe={colspan:"4",class:"px-4 py-8 text-center"},xe={class:"max-w-md"},me={class:"truncate text-sm"},be={class:"px-4 py-3"},ve={class:"px-4 py-3 text-right"},he={class:"flex items-center justify-end gap-2"},_e=["onClick"],fe=["onClick","disabled"],we={colspan:"4",class:"px-4 py-4"},Se={class:"space-y-3"},ke={class:"grid grid-cols-2 gap-4 md:grid-cols-4"},ze={key:0},De={key:1},Le={key:2},Te={key:3},Me={__name:"List",setup(i){const g=Z(),{isDarkMode:s}=J(g),f=H(),w=y(""),u=y(1),v=y(10),x=y("created_at"),m=y(new Set),h=y(new Set),z=y("");let D=null;T(w,o=>{clearTimeout(D),D=setTimeout(()=>{z.value=o,u.value=1},300)}),T([x,v],()=>{u.value=1});const L=G(()=>{const o=x.value.startsWith("-")?1:-1,l=x.value.replace(/^-/,"");return{page:u.value,pageSize:v.value,search:z.value,sort:l,order:o}}),{isPending:q,isError:A,error:$,data:_}=W({queryKey:["admin","logs",L],queryFn:()=>oe(L.value)}),{mutate:B}=X({mutationFn:o=>le(o),onMutate:o=>{h.value.add(o)},onSuccess:()=>{f.invalidateQueries({queryKey:["admin","logs"]}),F.success("Log deleted successfully")},onError:o=>{F.error(o.response?.data?.message||"Failed to delete log")},onSettled:(o,l,a)=>{h.value.delete(a)}}),M=o=>{confirm("Are you sure you want to delete this log?")&&B(o)},U=o=>{m.value.has(o)?m.value.delete(o):m.value.add(o)},P=o=>o?new Date(o).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"N/A",R=o=>{if(!o)return"N/A";try{const l=JSON.parse(o);return JSON.stringify(l,null,2)}catch{return o}};return(o,l)=>(d(),n("div",null,[e("div",ie,[e("h1",{class:r(["text-2xl font-bold",t(s)?"text-white":"text-gray-900"])}," System Logs ",2),e("p",{class:r(["mt-1 text-sm",t(s)?"text-gray-400":"text-gray-600"])}," View and monitor system error logs ",2)]),e("div",{class:r(["mb-6 rounded-lg border p-4",t(s)?"border-gray-700 bg-gray-800":"border-gray-200 bg-white"])},[e("div",de,[e("div",null,[e("label",{class:r(["mb-2 block text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Search ",2),e("div",ne,[b(t(ee),{size:18,class:r(["absolute top-1/2 left-3 -translate-y-1/2",t(s)?"text-gray-500":"text-gray-400"])},null,8,["class"]),S(e("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>w.value=a),type:"text",placeholder:"Search logs...",class:r(["w-full rounded-lg border py-2 pr-4 pl-10 text-sm focus:ring-2 focus:ring-teal-500 focus:outline-none",t(s)?"border-gray-600 bg-gray-700 text-white placeholder-gray-400":"border-gray-300 bg-white text-gray-900 placeholder-gray-500"])},null,2),[[K,w.value]])])]),e("div",null,[e("label",{class:r(["mb-2 block text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Sort By ",2),S(e("select",{"onUpdate:modelValue":l[1]||(l[1]=a=>x.value=a),class:r(["w-full cursor-pointer rounded-lg border px-4 py-2 text-sm focus:ring-2 focus:ring-teal-500 focus:outline-none",t(s)?"border-gray-600 bg-gray-700 text-white":"border-gray-300 bg-white text-gray-900"])},[...l[6]||(l[6]=[e("option",{value:"created_at"},"Date (Newest First)",-1),e("option",{value:"-created_at"},"Date (Oldest First)",-1)])],2),[[O,x.value]])])])],2),t(q)?(d(),n("div",{key:0,class:r(["flex items-center justify-center rounded-lg border py-12",t(s)?"border-gray-700 bg-gray-800":"border-gray-200 bg-white"])},[e("div",ce,[b(t(E),{size:32,class:r(["mx-auto animate-spin",t(s)?"text-gray-600":"text-gray-400"])},null,8,["class"]),e("p",{class:r(["mt-4 text-sm",t(s)?"text-gray-400":"text-gray-600"])}," Loading logs... ",2)])],2)):t(A)?(d(),n("div",{key:1,class:r(["rounded-lg border border-red-200 bg-red-50 p-4",t(s)&&"border-red-900/50 bg-red-900/20"])},[e("div",ge,[b(t(te),{size:20,class:"text-red-600"}),e("div",null,[e("h3",{class:r(["font-medium",t(s)?"text-red-400":"text-red-900"])}," Error Loading Logs ",2),e("p",{class:r(["mt-1 text-sm",t(s)?"text-red-300":"text-red-700"])},c(t($)?.message||"An error occurred"),3)])])],2)):(d(),n("div",{key:2,class:r(["overflow-hidden rounded-lg border",t(s)?"border-gray-700":"border-gray-200"])},[e("div",ue,[e("table",ye,[e("thead",{class:r(["border-b text-left text-sm font-medium",t(s)?"border-gray-700 bg-gray-800/50":"border-gray-200 bg-gray-50"])},[e("tr",null,[e("th",{class:r(["px-4 py-3",t(s)?"text-gray-300":"text-gray-700"])}," Timestamp ",2),e("th",{class:r(["px-4 py-3",t(s)?"text-gray-300":"text-gray-700"])}," Description ",2),e("th",{class:r(["px-4 py-3",t(s)?"text-gray-300":"text-gray-700"])},"Type",2),e("th",{class:r(["px-4 py-3 text-right",t(s)?"text-gray-300":"text-gray-700"])}," Actions ",2)])],2),e("tbody",{class:r(t(s)?"bg-gray-800":"bg-white")},[t(_)?.results?.length?p("",!0):(d(),n("tr",{key:0,class:r(["border-t",t(s)?"border-gray-700":"border-gray-200"])},[e("td",pe,[b(t(se),{size:48,class:r(["mx-auto",t(s)?"text-gray-600":"text-gray-300"])},null,8,["class"]),e("p",{class:r(["mt-4 font-medium",t(s)?"text-gray-400":"text-gray-600"])}," No logs found ",2)])],2)),(d(!0),n(C,null,Q(t(_)?.results,a=>(d(),n(C,{key:a._id},[e("tr",{class:r(["border-t transition-colors",t(s)?"border-gray-700 hover:bg-gray-700/50":"border-gray-200 hover:bg-gray-50"])},[e("td",{class:r(["px-4 py-3 text-sm",t(s)?"text-gray-300":"text-gray-700"])},c(P(a.created_at)),3),e("td",{class:r(["px-4 py-3",t(s)?"text-white":"text-gray-900"])},[e("div",xe,[e("p",me,c(a.description),1)])],2),e("td",be,[e("span",{class:r(["inline-flex rounded-full px-2 py-1 text-xs font-medium capitalize",a.type==="error"?t(s)?"bg-red-500/20 text-red-400":"bg-red-50 text-red-700":a.type==="info"?t(s)?"bg-blue-500/20 text-blue-400":"bg-blue-50 text-blue-700":t(s)?"bg-yellow-500/20 text-yellow-400":"bg-yellow-50 text-yellow-700"])},c(a.type||"Error"),3)]),e("td",ve,[e("div",he,[e("button",{onClick:I=>U(a._id),class:r(["inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors",t(s)?"bg-blue-500/20 text-blue-400 hover:bg-blue-500/30":"bg-blue-50 text-blue-600 hover:bg-blue-100"])},[b(t(re),{size:14}),N(" "+c(m.value.has(a._id)?"Hide":"View"),1)],10,_e),e("button",{onClick:I=>M(a._id),disabled:h.value.has(a._id),class:r(["inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",t(s)?"bg-red-500/20 text-red-400 hover:bg-red-500/30":"bg-red-50 text-red-600 hover:bg-red-100"])},[h.value.has(a._id)?(d(),k(t(E),{key:1,size:14,class:"animate-spin"})):(d(),k(t(ae),{key:0,size:14})),l[7]||(l[7]=N(" Delete ",-1))],10,fe)])])],2),S(e("tr",{class:r(["border-t",t(s)?"border-gray-700 bg-gray-900/50":"border-gray-200 bg-gray-50"])},[e("td",we,[e("div",Se,[e("div",null,[e("h4",{class:r(["mb-1 text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Full Description ",2),e("pre",{class:r(["overflow-x-auto rounded-lg p-3 text-xs whitespace-pre-wrap",t(s)?"bg-gray-800 text-gray-300":"bg-white text-gray-900"])},c(R(a.description)),3)]),e("div",ke,[a.company_id?(d(),n("div",ze,[e("h4",{class:r(["mb-1 text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Company ID ",2),e("p",{class:r(["text-xs",t(s)?"text-gray-400":"text-gray-600"])},c(a.company_id),3)])):p("",!0),a.user_session_id?(d(),n("div",De,[e
1("h4",{class:r(["mb-1 text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Session ID ",2),e("p",{class:r(["text-xs",t(s)?"text-gray-400":"text-gray-600"])},c(a.user_session_id),3)])):p("",!0),a.user_type?(d(),n("div",Le,[e("h4",{class:r(["mb-1 text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," User Type ",2),e("p",{class:r(["text-xs capitalize",t(s)?"text-gray-400":"text-gray-600"])},c(a.user_type),3)])):p("",!0),a.service_room_id?(d(),n("div",Te,[e("h4",{class:r(["mb-1 text-sm font-medium",t(s)?"text-gray-300":"text-gray-700"])}," Service Room ID ",2),e("p",{class:r(["text-xs",t(s)?"text-gray-400":"text-gray-600"])},c(a.service_room_id),3)])):p("",!0)])])])],2),[[j,m.value.has(a._id)]])],64))),128))],2)])]),t(_)?.results?.length?(d(),k(Y,{key:0,page:u.value,"page-size":v.value,total:t(_)?.pagination?.total||0,"item-name":"logs","show-per-page-selector":"","show-page-buttons":"",onPrev:l[2]||(l[2]=a=>u.value--),onNext:l[3]||(l[3]=a=>u.value++),onGoto:l[4]||(l[4]=a=>u.value=a),"onUpdate:pageSize":l[5]||(l[5]=a=>v.value=a)},null,8,["page","page-size","total"])):p("",!0)],2))]))}};export{Me as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.