test de déploiement du build depuis gitlab
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
3.0 KiB

import{o as e}from"./chunk-jRWAZmH_.js";import{n as t,t as n}from"./jsx-runtime-CEixWuwE.js";import{nt as r}from"./axios-BDcMaxoP.js";import{S as i,c as a,u as o}from"./ctiAxios-HKh7HuhO.js";import{t as s}from"./button-xukQsL9n.js";import{n as c}from"./chunk-4N6VE7H7-DnASKJzj.js";import{I as l,pt as u,s as d}from"./index-C1mw6CgG.js";import{n as f}from"./logs.queries-Dl26GlbD.js";var p=e(t()),m=n(),h=async()=>{let e=await i.getItem(`REACT_QUERY_OFFLINE_CACHE`);return e?(a(e)?.clientState?.queries??[]).map(e=>({queryKey:e.queryKey,status:e.state?.status??``,dataUpdatedAt:e.state?.dataUpdatedAt?new Date(e.state.dataUpdatedAt).toLocaleString():``,data:e.state?.data})):[]},g=()=>{let e=f(),t=l(),n=e.data??[],i=t.data?.session,[a,g]=(0,p.useState)(`logs`),[_,v]=(0,p.useState)([]),y=(0,p.useRef)(null);(0,p.useEffect)(()=>{if(a!==`cache`)return;let e=async()=>{v(await h())};e();let t=o.getQueryCache().subscribe(()=>{clearTimeout(y.current),y.current=setTimeout(e,1500)});return()=>{t(),clearTimeout(y.current)}},[a]);let b=()=>{e.refetch()},x=[{title:`Id`,dataKey:`id`},{title:`Date`,dataKey:`createdAt`,width:150},{title:`Code`,dataKey:`code`,width:100},{title:`Count`,dataKey:`count`,width:100},{title:`Erreur`,dataKey:`error`,width:200},{title:`Texte`,dataKey:`text`,width:200},{title:`Message`,dataKey:`message`,width:200},{title:`Utilisateur`,dataKey:`user`,dataGetter:({rowData:e})=>e.extra.user,width:100},{title:`URL`,dataKey:`url`,dataGetter:({rowData:e})=>e.extra.url,width:300}].map(e=>({width:50,resizable:!0,key:e.dataKey,...e}));return i.CONNECTEDUSER===`cti`?(0,m.jsxs)(`div`,{className:`cti-page`,children:[(0,m.jsxs)(`div`,{className:`page-header`,children:[(0,m.jsx)(`div`,{className:`header-title`,children:`Logs`}),(0,m.jsxs)(`div`,{className:`header-actions`,children:[(0,m.jsx)(s,{type:a===`logs`?`primary`:`default`,onClick:()=>g(`logs`),children:`Logs serveur`}),(0,m.jsx)(s,{type:a===`cache`?`primary`:`default`,onClick:()=>g(`cache`),children:`Cache persistant`}),a===`logs`&&(0,m.jsx)(s,{onClick:b,children:`Reload`})]})]}),(0,m.jsxs)(`div`,{className:`page-content`,children:[a===`logs`&&(0,m.jsx)(`div`,{className:`logs-table`,children:(0,m.jsx)(d,{rowKey:`id`,columns:x,data:n,loading:e.isFetching,cellProps:({rowData:e,column:t})=>({onClick:n=>{n.preventDefault();var i=document.createElement(`textarea`);i.value=e[t.dataKey],document.body.appendChild(i),i.select(),document.execCommand(`copy`),document.body.removeChild(i),r.success(`Copié !`)}})})}),a===`cache`&&(0,m.jsx)(`div`,{className:`logs-cache-pre`,children:_===null||_.length===0?(0,m.jsx)(`p`,{children:`Aucun cache persistant trouvé.`}):(0,m.jsx)(u,{children:_.map((e,t)=>(0,m.jsx)(u.Panel,{header:(0,m.jsxs)(`span`,{children:[(0,m.jsx)(`strong`,{children:JSON.stringify(e.queryKey)}),``,e.status,``,e.dataUpdatedAt]}),children:(0,m.jsx)(`pre`,{style:{margin:0,fontSize:11,overflow:`auto`},children:JSON.stringify(e.data,null,2)})},t))})})]})]}):(0,m.jsx)(c,{to:`/accueil`,replace:!0})};g.propTypes={};export{g as default};