p3x-redis-ui-material
Version:
💿 The p3x-redis-ui-material web interface that connects to the p3x-redis-ui-server via http and socket.io
1 lines • 4.12 kB
JavaScript
;(self.webpackChunkp3x_redis_ui_material=self.webpackChunkp3x_redis_ui_material||[]).push([[7002],{62951(e,t,s){s.d(t,{StatisticsComponent:()=>d});var i=s(11228),a=s(24698),n=s(30975),c=s(90870),r=s(23232),o=s(66593),p=s(51218),h=s(12027);const l=(e,t)=>t.key;function u(e,t){if(1&e&&(p.j41(0,"div",4)(1,"strong"),p.EFF(2),p.k0s(),p.j41(3,"span"),p.EFF(4),p.k0s()()),2&e){const e=t.$implicit,s=p.XpG(3);p.R7$(2),p.JRh(s.generateKey(e.key)),p.R7$(2),p.JRh(e.value)}}function m(e,t){if(1&e&&(p.j41(0,"mat-tab",1)(1,"div",3),p.Z7z(2,u,5,2,"div",4,l),p.k0s()()),2&e){const e=t.$implicit,s=p.XpG(2);p.Y8G("label",e.key),p.R7$(2),p.Dyx(s.getKeyspaceItems(e.key))}}function y(e,t){if(1&e&&(p.j41(0,"mat-tab",1)(1,"mat-tab-group",2),p.Z7z(2,m,4,1,"mat-tab",1,l),p.k0s()()),2&e){let e;const t=p.XpG();p.Y8G("label",(null==(e=t.i18n.strings())||null==e.title?null:e.title.db)??"DB"),p.R7$(2),p.Dyx(t.keyspaceDatabaseEntries)}}function b(e,t){if(1&e&&(p.j41(0,"div",4)(1,"strong"),p.EFF(2),p.k0s(),p.j41(3,"span"),p.EFF(4),p.k0s()()),2&e){const e=t.$implicit,s=p.XpG(2);p.R7$(2),p.JRh(s.generateKey(e.key)),p.R7$(2),p.JRh(s.formatValue(e.value))}}function k(e,t){if(1&e&&(p.j41(0,"mat-tab",1)(1,"div",3),p.Z7z(2,b,5,2,"div",4,l),p.k0s()()),2&e){const e=t.$implicit,s=p.XpG();p.Y8G("label",s.generateKey(e.key)),p.R7$(2),p.Dyx(e.items)}}s(11626);class d{breakpointObserver;i18n;cmd;cdr;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(e,t,s,i){this.breakpointObserver=e,this.i18n=t,this.cmd=s,this.cdr=i,(0,a.QZP)((()=>{this.i18n.currentLang(),this.cdr.markForCheck()}))}ngOnInit(){const e=h?.state,t=e?.info;e?.redisChanged&&(e.redisChanged=!1,this.broadcastRefresh());const s=e?.connection;if(this.isCluster=!0===s?.cluster,t){const s=t.keyspaceDatabases??{};this.hasDatabases=Object.keys(s).length>0,this.keyspaceDatabaseEntries=Object.keys(s).map((e=>({key:e,value:s[e]})));for(const e of this.keyspaceDatabaseEntries){const s=t?.keyspace?.["db"+e.key];this.keyspaceItems[e.key]=s?Object.keys(s).map((e=>({key:e,value:s[e]}))):[]}this.infoSections=Object.keys(t).filter((e=>"keyspace"!==e&&"keyspaceDatabases"!==e)).map((e=>({key:e,items:Object.keys(t[e]).map((s=>({key:s,value:t[e][s]})))})));const i=Array.isArray(e?.modules)?e.modules:[];if(i.length>0){const e=i.map((e=>({key:e.name,value:`v${e.ver}`}))),t=this.infoSections.findIndex((e=>"modules"===e.key.toLowerCase()));t>=0?this.infoSections[t].items=e:this.infoSections.push({key:"modules",items:e})}}const i=this.breakpointObserver.observe("(max-width: 599px)").subscribe((e=>{this.recalcHeight(e.matches),this.cdr.markForCheck()}));this.unsubFns.push((()=>i.unsubscribe()))}ngOnDestroy(){this.unsubFns.forEach((e=>e()))}getKeyspaceItems(e){return this.keyspaceItems[e]??[]}formatValue(e){return null==e?"":"object"==typeof e?JSON.stringify(e):String(e)}generateKey(e){const t=this.i18n.strings();return t?.title?.hasOwnProperty(e)?t.title[e]:e.split("_").map(((e,t)=>(d.REPLACE.hasOwnProperty(e)&&(e=d.REPLACE[e]),d.INCLUDE.includes(e)||e.length<4&&!d.EXCLUDE.includes(e)?e.toUpperCase():0===t?e[0].toUpperCase()+e.substring(1):e))).join(" ")}recalcHeight(e){if(e)this.maxHeight="auto";else{const e=document.getElementById("p3xr-database-content-container");this.maxHeight=e?e.offsetHeight-50:"auto"}}broadcastRefresh(){this.cmd.treeRefresh$.next()}static ɵfac=function(e){return new(e||d)(p.rXU(c.Q),p.rXU(r.W),p.rXU(o.y),p.rXU(i.gRc))};static ɵcmp=p.VBU({type:d,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,t){1&e&&(p.j41(0,"mat-tab-group",0),p.nVh(1,y,4,1,"mat-tab",1),p.Z7z(2,k,4,1,"mat-tab",1,l),p.k0s()),2&e&&(p.R7$(),p.vxM(t.hasDatabases&&!t.isCluster?1:-1),p.R7$(),p.Dyx(t.infoSections))},dependencies:[n.RI,n.mq,n.T8],encapsulation:2,changeDetection:0})}},11626(e,t,s){s.r(t)}}]);