UNPKG

p3x-redis-ui-material

Version:

💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity

1 lines • 3.34 kB
import{A as e,C as t,D as n,E as r,I as i,M as a,Nt as o,T as s,Tt as c,Y as l,Z as u,Zt as d,_t as f,at as p,k as m,lt as h,t as g,w as _,y as v}from"./i18n.store-Bn0-vXNV.js";import{t as y}from"./_plugin-vue_export-helper-CSr60JSh.js";import{t as b}from"./redis-state.store-CQLjozNg.js";import{m as x,p as S,u as C}from"./index-fkAw1zcW.js";i(),h(),o();var w={key:0,style:{padding:`16px`}},T={key:1,class:`p3xr-statistics`},E={class:`p3xr-statistics-content`},D={key:0,class:`p3xr-statistics-items`},O={key:1,class:`p3xr-statistics-items`},k={style:{"text-align":`right`,"word-break":`break-all`,"max-width":`60%`}},A=y(a({__name:`StatisticsPage`,setup(i){let a=[`in`,`run`,`per`],o={perc:`percent`,sec:`seconds`};function h(e,t){return t?.title?.hasOwnProperty(e)?t.title[e]:e.split(`_`).map((e,t)=>(o.hasOwnProperty(e)&&(e=o[e]),e.length<4&&!a.includes(e)?e.toUpperCase():t===0?e[0].toUpperCase()+e.substring(1):e)).join(` `)}function y(e){return e==null?``:typeof e==`object`?JSON.stringify(e):String(e)}let A=g(),j=b();C();let M=t(()=>A.strings),N=f(0),P=f(0),F=t(()=>j.connection?.cluster===!0),I=t(()=>{let e=j.info?.keyspaceDatabases??{};return Object.keys(e).map(t=>({key:t,value:e[t]}))}),L=t(()=>{let e={};for(let t of I.value){let n=j.info?.keyspace?.[`db`+t.key];e[t.key]=n?Object.keys(n).map(e=>({key:e,value:n[e]})):[]}return e}),R=t(()=>I.value.length>0),z=t(()=>{if(!j.info)return[];let e=Object.keys(j.info).filter(e=>e!==`keyspace`&&e!==`keyspaceDatabases`).map(e=>({key:e,label:h(e,M.value),items:Object.keys(j.info[e]).map(t=>({key:t,value:j.info[e][t]}))})),t=Array.isArray(j.modules)?j.modules:[];if(t.length>0){let n=t.map(e=>({key:e.name,value:`v${e.ver}`})),r=e.findIndex(e=>e.key.toLowerCase()===`modules`);r>=0?e[r].items=n:e.push({key:`modules`,label:h(`modules`,M.value),items:n})}return e.filter(e=>e.items.length>0)}),B=t(()=>{let e=[];return R.value&&!F.value&&e.push({key:`__db__`,label:M.value?.title?.db??`DB`,items:[]}),e.push(...z.value),e}),V=t(()=>B.value[N.value]),H=t(()=>V.value?.key===`__db__`);return(t,i)=>c(j).connection?(l(),n(`div`,T,[e(S,{modelValue:N.value,"onUpdate:modelValue":i[0]||=e=>N.value=e,variant:`scrollable`,"show-arrows":``,class:`p3xr-statistics-tabs`,color:`primary`,"slider-color":`primary`},{default:p(()=>[(l(!0),n(v,null,u(B.value,e=>(l(),s(x,{key:e.key},{default:p(()=>[m(d(e.label),1)]),_:2},1024))),128))]),_:1},8,[`modelValue`]),_(`div`,E,[H.value?(l(),n(v,{key:0},[e(S,{modelValue:P.value,"onUpdate:modelValue":i[1]||=e=>P.value=e,variant:`scrollable`,"show-arrows":``,class:`p3xr-statistics-db-tabs`,"bg-color":`primary`},{default:p(()=>[(l(!0),n(v,null,u(I.value,e=>(l(),s(x,{key:e.key},{default:p(()=>[m(d(e.key),1)]),_:2},1024))),128))]),_:1},8,[`modelValue`]),(l(!0),n(v,null,u(I.value,(e,t)=>(l(),n(`div`,{key:e.key},[P.value===t?(l(),n(`div`,D,[(l(!0),n(v,null,u(L.value[e.key]??[],e=>(l(),n(`div`,{key:e.key,class:`p3xr-statistics-row`},[_(`strong`,null,d(h(e.key,M.value)),1),_(`span`,null,d(e.value),1)]))),128))])):r(``,!0)]))),128))],64)):V.value?(l(),n(`div`,O,[(l(!0),n(v,null,u(V.value.items,e=>(l(),n(`div`,{key:e.key,class:`p3xr-statistics-row`},[_(`strong`,null,d(h(e.key,M.value)),1),_(`span`,k,d(y(e.value)),1)]))),128))])):r(``,!0)])])):(l(),n(`div`,w,d(M.value?.title?.main),1))}}),[[`__scopeId`,`data-v-163e4e8a`]]);export{A as default};