From a3a14e289cda2ce731c35dfd2ad7eb130c344879 Mon Sep 17 00:00:00 2001 From: kain Date: Wed, 1 Mar 2023 08:46:25 +0800 Subject: [PATCH] Update: monitor db --- .../available-connections.component.ts | 3 ++- .../command-per-second.component.ts | 10 ++++++++-- src/app/admin/monitor/db/db.component.html | 2 +- .../document-operations.component.ts | 18 +++++++++++------ .../db/network-io/network-io.component.ts | 15 ++++++++++---- .../open-connections.component.ts | 3 ++- .../query-operations.component.ts | 20 ++++++++++++------- 7 files changed, 49 insertions(+), 22 deletions(-) diff --git a/src/app/admin/monitor/db/available-connections/available-connections.component.ts b/src/app/admin/monitor/db/available-connections/available-connections.component.ts index 04f1ef5a..f4af75b0 100644 --- a/src/app/admin/monitor/db/available-connections/available-connections.component.ts +++ b/src/app/admin/monitor/db/available-connections/available-connections.component.ts @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-available-connections', template: ` - + 可用连接 +
` diff --git a/src/app/admin/monitor/db/commands-per-second/command-per-second.component.ts b/src/app/admin/monitor/db/commands-per-second/command-per-second.component.ts index 24ae44f2..a61d88e6 100644 --- a/src/app/admin/monitor/db/commands-per-second/command-per-second.component.ts +++ b/src/app/admin/monitor/db/commands-per-second/command-per-second.component.ts @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-commands-per-second', template: ` - + 每秒命令 +
` @@ -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(); } diff --git a/src/app/admin/monitor/db/db.component.html b/src/app/admin/monitor/db/db.component.html index d9e6df8d..1ec76e44 100644 --- a/src/app/admin/monitor/db/db.component.html +++ b/src/app/admin/monitor/db/db.component.html @@ -3,7 +3,7 @@ - 已运行了 {{ uptime }} 分钟 + 已运行了 {{ uptime }} 小时 diff --git a/src/app/admin/monitor/db/document-operations/document-operations.component.ts b/src/app/admin/monitor/db/document-operations/document-operations.component.ts index 96bf87cc..518ccaae 100644 --- a/src/app/admin/monitor/db/document-operations/document-operations.component.ts +++ b/src/app/admin/monitor/db/document-operations/document-operations.component.ts @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-document-operations', template: ` - + 文档操作 +
` @@ -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(); } @@ -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`返回`; } } } diff --git a/src/app/admin/monitor/db/network-io/network-io.component.ts b/src/app/admin/monitor/db/network-io/network-io.component.ts index 97430d18..a4cf77fe 100644 --- a/src/app/admin/monitor/db/network-io/network-io.component.ts +++ b/src/app/admin/monitor/db/network-io/network-io.component.ts @@ -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'; @@ -9,7 +10,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-network-io', template: ` - + 网络 IO +
` @@ -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(); } @@ -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`输入`; } } } diff --git a/src/app/admin/monitor/db/open-connections/open-connections.component.ts b/src/app/admin/monitor/db/open-connections/open-connections.component.ts index d4e84327..971c4b3c 100644 --- a/src/app/admin/monitor/db/open-connections/open-connections.component.ts +++ b/src/app/admin/monitor/db/open-connections/open-connections.component.ts @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-open-connections', template: ` - + 打开连接 +
` diff --git a/src/app/admin/monitor/db/query-operations/query-operations.component.ts b/src/app/admin/monitor/db/query-operations/query-operations.component.ts index f1b782d0..455ffbc2 100644 --- a/src/app/admin/monitor/db/query-operations/query-operations.component.ts +++ b/src/app/admin/monitor/db/query-operations/query-operations.component.ts @@ -9,7 +9,8 @@ import { MonitorService } from '../../monitor.service'; @Component({ selector: 'app-admin-monitor-db-query-operations', template: ` - + 查询操作 +
` @@ -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(); } @@ -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`命令`; } } }