dsql-admin/dsql-app/.local_dist/static/chunks/pages/su/error-logs-6201f610e535041d.js

1 line
6.7 KiB
JavaScript
Raw Normal View History

2024-12-08 19:56:57 +00:00
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6257],{27646:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/su/error-logs",function(){return s(89059)}])},86286:(e,t,s)=>{"use strict";s.d(t,{A:()=>c});var r=s(74848),l=s(96540),a=s(23698),i=s(620),n=s(30861);function c(e){let{data:t}=e;Object.keys(t.users[0]);let[s,c]=l.useState(null),[o,d]=l.useState(0),[h,u]=l.useState(!1);function x(){(0,a.A)("/api/admin/grabErrorLogs").then(e=>{var t;if((null==e?void 0:e.log)&&"string"==typeof e.log&&!(null===(t=e.log)||void 0===t?void 0:t.match(/./))){c("No Logs Yet");return}(null==e?void 0:e.log)&&c("No Logs"),c(e.log.replace(/\n|\r|\n\r|\\n/gm,"<br/>"))})}return console.log(typeof s),l.useEffect(()=>{x(),0===o&&setInterval(()=>{x()},1e4)},[o]),(0,r.jsx)(l.Fragment,{children:(0,r.jsxs)("div",{className:"items-stretch gap-10 w-full",children:[(0,r.jsxs)("section",{className:"paper w-full",children:[(0,r.jsx)("h2",{className:"text-xl m-0 mb-6",children:"Users"}),(0,r.jsx)("div",{className:"flex-col items-stretch gap-10",children:t.users.map((e,t)=>(0,r.jsx)(n.A,{userObject:e},t+1))})]}),(0,r.jsxs)("section",{className:"paper",children:[(0,r.jsxs)("div",{className:"w-full justify-between",children:[(0,r.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,r.jsx)("div",{children:(0,r.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(u(!0),(0,a.A)("/api/admin/clearErrorLogs","post").then(e=>{d(e=>e+1)}),setTimeout(()=>{u(!1)},2e3))},className:"outlined gray relative",children:[h&&(0,r.jsx)(i.A,{width:"20px"}),"Clear Error Log"]})})]}),s&&(0,r.jsx)("p",{dangerouslySetInnerHTML:{__html:s||"No Log"}}),"string"!=typeof s&&(0,r.jsx)(i.A,{position:"relative",width:"25px"})]})]})})}},61975:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var r=s(74848),l=s(96540),a=s(23698),i=s(620);function n(e){let[t,s]=l.useState(null),[n,c]=l.useState(!1),[o,d]=l.useState(0);function h(){(0,a.A)("/api/admin/grabErrorLogs").then(e=>{var t;if("string"!=typeof e.log||(null===(t=e.log)||void 0===t?void 0:t.match(/./)))s("");else{s("No Logs Yet");return}s(e.log.replace(/\n|\r|\n\r|\\n/gm,"<br/>"))})}return l.useEffect(()=>{h(),0===o&&setInterval(()=>{h()},1e4)},[o]),(0,r.jsxs)(l.Fragment,{children:[(0,r.jsxs)("div",{className:"w-full justify-between",children:[(0,r.jsx)("h2",{className:"text-xl m-0",children:"Error Logs"}),(0,r.jsx)("div",{children:(0,r.jsxs)("button",{onClick:e=>{window.confirm("Clear Error Logs?")&&(c(!0),(0,a.A)("/api/admin/clearErrorLogs","post").then(e=>{console.log(e),d(e=>e+1)}),setTimeout(()=>{c(!1)},2e3))},className:"outlined gray relative",children:[n&&(0,r.jsx)(i.A,{width:"20px"}),"Clear Error Log"]})})]}),(0,r.jsxs)("section",{className:"paper",children:[t&&(0,r.jsx)("p",{dangerouslySetInnerHTML:{__html:t||"No Log"}}),!t&&(0,r.jsx)(i.A,{position:"relative",width:"25px"})]})]})}},30861:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var r=s(74848),l=s(96540);function a(e){let{userObject:t,userPage:s}=e,a=Object.keys(t),[i,n]=l.useState(!1),[c,o]=l.useState(0),[d,h]=l.useState(!s);return(0,r.jsxs)("div",{className:"card col green w-full overflow-hidden"+(d?s?" h-[100px]":" h-[85px]":" "),children:[(0,r.jsxs)("div",{className:"items-center w-full",children:[(0,r.jsx)("img",{src:t.image_thumbnail,alt:"",className:"rounded-full object-cover"+(s?" w-16 h-16":" w-12 h-12")}),!s&&(0,r.jsxs)("h3",{className:"m-0 text-xl",children:[t.first_name," ",t.last_name," "]}),(0,r.jsxs)("div",{className:"ml-auto",children:[(0,r.jsx)("button",{className:"outlined gray small-text",onClick:e=>{d?h(!1):h(!0)},children:d?"More Details":"Collapse"}),!s&&(0,r.jsx)("a",{href:"/su/users/".concat(t.id),className:"button outlined gray small-text",children:"View User"})]})]}),(0,r.jsx)("div",{className:"card no-hover col w-full light-gray-bg",children:a.map((e,s)=>(0,r.jsxs)(l.Fragment,{children:[(0,r.jsx)("div",{children:(0,r.jsxs)("span",{style:{wordBreak:"break-all"},children:[e,":"," ",(0,r.jsx)("b",{children:t[e]})]})}),s<a.length-1&&(0,r.jsx)("hr",{})]},s+1))}),(0,r.jsx)("button",{className:"outlined gray small-text w-full",onClick: