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
3 lines (2 loc) • 5.62 kB
JavaScript
import{a as F,b as T,c as L}from"./chunk-GT7JTAHQ.js";import{b as j}from"./chunk-VQDF6UGR.js";import"./chunk-OTFMRDKW.js";import"./chunk-3QQZQR3D.js";import"./chunk-TEXSADK3.js";import{b as O}from"./chunk-AN7C4JCR.js";import"./chunk-6J2GCUHA.js";import"./chunk-YA4NX3C4.js";import"./chunk-7JNYLOAK.js";import{$a as f,Bb as u,Cb as x,Da as l,Ia as C,Jc as I,Rd as D,Xa as k,Ya as E,Zb as S,ab as h,bb as g,cb as m,db as d,nb as b,oa as v,xa as r}from"./chunk-KQUCMSSK.js";import"./chunk-FCVD6SGJ.js";import"./chunk-O7S4L63H.js";var _=(i,n)=>n.key;function M(i,n){if(i&1&&(m(0,"div",4)(1,"strong"),u(2),d(),m(3,"span"),u(4),d()()),i&2){let t=n.$implicit,e=b(3);r(2),x(e.generateKey(t.key)),r(2),x(t.value)}}function H(i,n){if(i&1&&(m(0,"mat-tab",1)(1,"div",3),f(2,M,5,2,"div",4,_),d()()),i&2){let t=n.$implicit,e=b(2);g("label",t.key),r(2),h(e.getKeyspaceItems(t.key))}}function R(i,n){if(i&1&&(m(0,"mat-tab",1)(1,"mat-tab-group",2),f(2,H,4,1,"mat-tab",1,_),d()()),i&2){let t,e=b();g("label",((t=e.i18n.strings())==null||t.title==null?null:t.title.db)??"DB"),r(2),h(e.keyspaceDatabaseEntries)}}function w(i,n){if(i&1&&(m(0,"div",4)(1,"strong"),u(2),d(),m(3,"span"),u(4),d()()),i&2){let t=n.$implicit,e=b(2);r(2),x(e.generateKey(t.key)),r(2),x(e.formatValue(t.value))}}function U(i,n){if(i&1&&(m(0,"mat-tab",1)(1,"div",3),f(2,w,5,2,"div",4,_),d()()),i&2){let t=n.$implicit,e=b();g("label",e.generateKey(t.key)),r(2),h(t.items)}}var W=(()=>{class i{breakpointObserver;i18n;cmd;cdr;state;maxHeight="auto";hasDatabases=!1;isCluster=!1;keyspaceDatabaseEntries=[];keyspaceItems={};infoSections=[];unsubFns=[];static EXCLUDE=["in","run","per"];static INCLUDE=["sha1"];static REPLACE={perc:"percent",sec:"seconds"};constructor(t,e,a,o,y){this.breakpointObserver=t,this.i18n=e,this.cmd=a,this.cdr=o,this.state=y,v(()=>{this.i18n.currentLang(),this.cdr.markForCheck()})}ngOnInit(){let t=this.state.info();this.state.redisChanged()&&(this.state.redisChanged.set(!1),this.broadcastRefresh());let e=this.state.connection();if(this.isCluster=e?.cluster===!0,t){let o=t.keyspaceDatabases??{};this.hasDatabases=Object.keys(o).length>0,this.keyspaceDatabaseEntries=Object.keys(o).map(s=>({key:s,value:o[s]}));for(let s of this.keyspaceDatabaseEntries){let c=t?.keyspace?.["db"+s.key];this.keyspaceItems[s.key]=c?Object.keys(c).map(p=>({key:p,value:c[p]})):[]}this.infoSections=Object.keys(t).filter(s=>s!=="keyspace"&&s!=="keyspaceDatabases").map(s=>({key:s,items:Object.keys(t[s]).map(c=>({key:c,value:t[s][c]}))}));let y=Array.isArray(this.state.modules())?this.state.modules():[];if(y.length>0){let s=y.map(p=>({key:p.name,value:`v${p.ver}`})),c=this.infoSections.findIndex(p=>p.key.toLowerCase()==="modules");c>=0?this.infoSections[c].items=s:this.infoSections.push({key:"modules",items:s})}this.infoSections=this.infoSections.filter(s=>s.items.length>0)}let a=this.breakpointObserver.observe("(max-width: 599px)").subscribe(o=>{this.recalcHeight(o.matches),this.cdr.markForCheck()});this.unsubFns.push(()=>a.unsubscribe())}ngOnDestroy(){this.unsubFns.forEach(t=>t())}getKeyspaceItems(t){return this.keyspaceItems[t]??[]}formatValue(t){return t==null?"":typeof t=="object"?JSON.stringify(t):String(t)}generateKey(t){let e=this.i18n.strings();return e?.title?.hasOwnProperty(t)?e.title[t]:t.split("_").map((a,o)=>(i.REPLACE.hasOwnProperty(a)&&(a=i.REPLACE[a]),i.INCLUDE.includes(a)||a.length<4&&!i.EXCLUDE.includes(a)?a.toUpperCase():o===0?a[0].toUpperCase()+a.substring(1):a)).join(" ")}recalcHeight(t){if(t)this.maxHeight="auto";else{let e=document.getElementById("p3xr-database-content-container");this.maxHeight=e?e.offsetHeight-50:"auto"}}broadcastRefresh(){this.cmd.treeRefresh$.next()}static \u0275fac=function(e){return new(e||i)(l(I),l(D),l(j),l(S),l(O))};static \u0275cmp=C({type:i,selectors:[["p3xr-database-statistics"]],decls:4,vars:1,consts:[["dynamicHeight",""],[3,"label"],["dynamicHeight","",1,"p3xr-statistics-db-tabs"],[1,"p3xr-statistics-list"],[1,"p3xr-statistics-item"]],template:function(e,a){e&1&&(m(0,"mat-tab-group",0),k(1,R,4,1,"mat-tab",1),f(2,U,4,1,"mat-tab",1,_),d()),e&2&&(r(),E(a.hasDatabases&&!a.isCluster?1:-1),r(),h(a.infoSections))},dependencies:[L,F,T],styles:[`p3xr-ng-main-statistics>:first-child>.mat-mdc-tab-header,p3xr-database-statistics>:first-child>.mat-mdc-tab-header{position:sticky!important;top:0!important;z-index:2!important;background-color:var(--p3xr-content-bg, #303030)!important}p3xr-ng-main-statistics .mat-mdc-tab .mdc-tab__text-label,p3xr-database-statistics .mat-mdc-tab .mdc-tab__text-label{text-transform:none!important}.p3xr-statistics-list{padding:8px 16px}.p3xr-statistics-item{display:flex;align-items:baseline;justify-content:space-between;padding:8px 0;border-bottom:1px solid rgba(0,0,0,.06)}.p3xr-statistics-item span{text-align:right}body.p3xr-theme-dark .p3xr-statistics-item{border-bottom-color:#ffffff0f}.p3xr-statistics-db-tabs .mat-mdc-tab-header{background-color:var(--p3xr-btn-primary-bg)!important}.p3xr-statistics-db-tabs .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label{color:#ffffffb3!important}.p3xr-statistics-db-tabs .mat-mdc-tab.mdc-tab--active .mdc-tab__text-label{color:#fff!important}.p3xr-statistics-db-tabs .mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:#fff!important}body.p3xr-mat-theme-matrix .p3xr-statistics-db-tabs .mat-mdc-tab .mdc-tab__text-label{color:#000000de!important}body.p3xr-mat-theme-matrix .p3xr-statistics-db-tabs .mat-mdc-tab-header .mdc-tab-indicator__content--underline{border-color:#000000de!important}
`],encapsulation:2,changeDetection:0})}return i})();export{W as StatisticsComponent};