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

2 lines • 3.13 kB
import {O as Oe}from'./chunk-BITan0Uq.js';import {c as cn,k as ke,d as dn}from'./chunk-zfW9ETPx.js';import {bC as ye,X as Xe,f as fQ,cM as X,b as bi,G as It,Q,_ as _e,cN as $$1,bs as dr,B as Ba,k as bv,h as hv,v as vf,c as In,p as pv}from'./chunk-BwlFOdbx.js';import {L}from'./main-HNF44SV3.js';var $=(()=>{class o{i18n;router;socket;common;data;state;strings;selectedTab=0;routes=["/monitoring","/monitoring/profiler","/monitoring/pubsub","/monitoring/analysis"];routerSub;subs=[];servicesStarted=false;constructor(t,n,e,m,a,j){this.i18n=t,this.router=n,this.socket=e,this.common=m,this.data=a,this.state=j,this.strings=this.i18n.strings;}ngOnInit(){this.syncTab(this.router.url),this.routerSub=this.router.events.pipe(ye(t=>t instanceof $$1)).subscribe(t=>this.syncTab(t.urlAfterRedirects)),this.subs.push(this.socket.redisDisconnected$.subscribe(()=>{this.router.navigate(["/settings"]);})),this.state.connection()?this.initServices():this.subs.push(this.socket.stateChanged$.subscribe(()=>{this.state.connection()&&!this.servicesStarted&&this.initServices();}));}ngOnDestroy(){this.data.stopProfiler(),this.data.stopPubSub(),this.data.destroy(),this.routerSub?.unsubscribe(),this.subs.forEach(t=>t.unsubscribe());}initServices(){this.servicesStarted=true,this.data.init(this.socket,()=>this.i18n.currentLang()),this.startServices();}startServices(){return L(this,null,function*(){try{yield this.data.startProfiler();}catch(t){this.common.generalHandleError(t);}try{yield this.data.startPubSub();}catch(t){this.common.generalHandleError(t);}})}onTabChange(t){t>=0&&t<this.routes.length&&this.router.navigate([this.routes[t]]);}syncTab(t){t.startsWith("/monitoring/profiler")?this.selectedTab=1:t.startsWith("/monitoring/pubsub")?this.selectedTab=2:t.startsWith("/monitoring/analysis")?this.selectedTab=3:this.selectedTab=0;}static \u0275fac=function(n){return new(n||o)(Xe(fQ),Xe(X),Xe(bi),Xe(It),Xe(Oe),Xe(Q))};static \u0275cmp=_e({type:o,selectors:[["p3xr-monitoring-shell"]],decls:8,vars:5,consts:[[1,"p3xr-monitoring-shell-container"],[1,"p3xr-monitoring-tabs",3,"selectedIndexChange","selectedIndex"],[3,"label"],[1,"p3xr-monitoring-shell-content"]],template:function(n,e){n&1&&(Ba(0,"div",0)(1,"mat-tab-group",1),bv("selectedIndexChange",function(a){return e.onTabChange(a)}),hv(2,"mat-tab",2)(3,"mat-tab",2)(4,"mat-tab",2)(5,"mat-tab",2),vf(),Ba(6,"div",3),hv(7,"router-outlet"),vf()()),n&2&&(In(),pv("selectedIndex",e.selectedTab),In(),pv("label",e.strings().intention?.pulse),In(),pv("label",e.strings().intention?.profiler),In(),pv("label",e.strings().intention?.pubsubMonitor),In(),pv("label",e.strings().intention?.memoryAnalysis));},dependencies:[dr,cn,ke,dn],styles:[`p3xr-monitoring-shell{display:block;height:100%}.p3xr-monitoring-shell-container{display:flex;flex-direction:column;height:100%;margin:-5px}.p3xr-monitoring-tabs{flex-shrink:0}.p3xr-monitoring-tabs>.mat-mdc-tab-header{background-color:var(--p3xr-content-bg, #303030)!important}.p3xr-monitoring-shell-content{flex:1;overflow-y:auto;min-height:0;padding:5px} `],encapsulation:2,changeDetection:1})}return o})();export{$ as MonitoringShellComponent};