Skip to content

Commit

Permalink
Update: monitor db
Browse files Browse the repository at this point in the history
  • Loading branch information
kainonly committed Mar 1, 2023
1 parent 25af5b8 commit a3a14e2
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-available-connections',
template: `
<nz-card nzTitle="Available Connections">
<ng-template #titleTpl><b i18n>可用连接</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-commands-per-second',
template: `
<nz-card nzTitle="Command Per Second">
<ng-template #titleTpl><b i18n>每秒命令</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down Expand Up @@ -41,7 +42,12 @@ export class CommandPerSecondComponent implements OnInit, AfterViewInit, OnDestr
height: 150,
data: [],
xField: 'time',
yField: 'value'
yField: 'value',
meta: {
value: {
formatter: value => `${value} ops`
}
}
});
this.plot.render();
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/admin/monitor/db/db.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span nz-icon nzType="loading"></span>
</ng-template>
<ng-template #textTpl>
<span i18n>已运行了 {{ uptime }} 分钟</span>
<span i18n>已运行了 {{ uptime }} 小时</span>
</ng-template>
</nz-alert>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-document-operations',
template: `
<nz-card nzTitle="Document Operations">
<ng-template #titleTpl><b i18n>文档操作</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down Expand Up @@ -42,7 +43,12 @@ export class DocumentOperationsComponent implements OnInit, AfterViewInit, OnDes
data: [],
xField: 'time',
yField: 'value',
seriesField: 'operate'
seriesField: 'operate',
meta: {
value: {
formatter: value => `${value} ops`
}
}
});
this.plot.render();
}
Expand All @@ -55,13 +61,13 @@ export class DocumentOperationsComponent implements OnInit, AfterViewInit, OnDes
getOperate(v: number): string {
switch (v) {
case 1:
return 'inserted';
return $localize`插入`;
case 2:
return 'updated';
return $localize`更新`;
case 3:
return 'deleted';
return $localize`删除`;
default:
return 'returned';
return $localize`返回`;
}
}
}
15 changes: 11 additions & 4 deletions src/app/admin/monitor/db/network-io/network-io.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AfterViewInit, Component, ElementRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Meta } from '@angular/platform-browser';
import { Subscription, timer } from 'rxjs';
import { switchMap } from 'rxjs/operators';

Expand All @@ -9,7 +10,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-network-io',
template: `
<nz-card nzTitle="Network IO">
<ng-template #titleTpl><b i18n>网络 IO</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down Expand Up @@ -42,7 +44,12 @@ export class NetworkIoComponent implements OnInit, AfterViewInit, OnDestroy {
data: [],
xField: 'time',
yField: 'value',
seriesField: 'type'
seriesField: 'type',
meta: {
value: {
formatter: value => `${value} bytes`
}
}
});
this.plot.render();
}
Expand All @@ -55,9 +62,9 @@ export class NetworkIoComponent implements OnInit, AfterViewInit, OnDestroy {
getType(v: number): string {
switch (v) {
case 1:
return 'net_out_bytes';
return $localize`输出`;
default:
return 'net_in_bytes';
return $localize`输入`;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-open-connections',
template: `
<nz-card nzTitle="Open Connections">
<ng-template #titleTpl><b i18n>打开连接</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service';
@Component({
selector: 'app-admin-monitor-db-query-operations',
template: `
<nz-card nzTitle="Query Operations">
<ng-template #titleTpl><b i18n>查询操作</b></ng-template>
<nz-card [nzTitle]="titleTpl">
<div #ref></div>
</nz-card>
`
Expand Down Expand Up @@ -42,7 +43,12 @@ export class QueryOperationsComponent implements OnInit, AfterViewInit, OnDestro
data: [],
xField: 'time',
yField: 'value',
seriesField: 'operate'
seriesField: 'operate',
meta: {
value: {
formatter: value => `${value} ops`
}
}
});
this.plot.render();
}
Expand All @@ -55,15 +61,15 @@ export class QueryOperationsComponent implements OnInit, AfterViewInit, OnDestro
getOperate(v: number): string {
switch (v) {
case 1:
return 'getmores';
return $localize`获取`;
case 2:
return 'inserts';
return $localize`删除`;
case 3:
return 'updates';
return $localize`更新`;
case 4:
return 'deletes';
return $localize`删除`;
default:
return 'commands';
return $localize`命令`;
}
}
}

0 comments on commit a3a14e2

Please sign in to comment.