Skip to content

Commit

Permalink
fix(frontend): 集群拓扑、实例视图基本信息补充 #8830
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia committed Dec 27, 2024
1 parent 69543a9 commit 6f78006
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 34 deletions.
2 changes: 1 addition & 1 deletion dbm-ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@icon-cool/bk-icon-bk-biz-components": "^0.0.4",
"@vueuse/core": "^12.0.0",
"axios": "^1.7.9",
"bkui-vue": "2.0.1-beta.87",
"bkui-vue": "2.0.1-beta.89",
"date-fns": "^4.1.0",
"dayjs": "^1.11.13",
"echarts": "^5.5.1",
Expand Down
24 changes: 22 additions & 2 deletions dbm-ui/frontend/src/common/const/clusterTypeInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MachineTypes } from './machineTypes';
export interface ClusterTypeInfoItem {
id: ClusterTypes;
name: string;
architectureName: string; // 部署架构名称
specClusterName: string; // 规格对应的集群名,磨平集群类型差异
dbType: DBTypes;
moduleId: ExtractedControllerDataKeys;
Expand All @@ -28,6 +29,7 @@ const mysql: InfoType = {
[ClusterTypes.TENDBSINGLE]: {
id: ClusterTypes.TENDBSINGLE,
name: t('MySQL单节点'),
architectureName: t('MySQL单节点集群'),
specClusterName: 'MySQL',
dbType: DBTypes.MYSQL,
moduleId: 'mysql',
Expand All @@ -45,6 +47,7 @@ const mysql: InfoType = {
[ClusterTypes.TENDBHA]: {
id: ClusterTypes.TENDBHA,
name: t('MySQL主从'),
architectureName: t('MySQL高可用集群'),
specClusterName: 'MySQL',
dbType: DBTypes.MYSQL,
moduleId: 'mysql',
Expand All @@ -65,6 +68,7 @@ const spider: InfoType = {
[ClusterTypes.TENDBCLUSTER]: {
id: ClusterTypes.TENDBCLUSTER,
name: 'TenDBCluster',
architectureName: t('TendbCluster集群'),
specClusterName: 'TenDBCluster',
dbType: DBTypes.TENDBCLUSTER,
moduleId: 'mysql',
Expand All @@ -85,6 +89,7 @@ const redis: InfoType = {
[ClusterTypes.TWEMPROXY_REDIS_INSTANCE]: {
id: ClusterTypes.TWEMPROXY_REDIS_INSTANCE,
name: 'TendisCache',
architectureName: t('TendisCache集群'),
specClusterName: 'Redis',
dbType: DBTypes.REDIS,
moduleId: 'redis',
Expand All @@ -102,6 +107,7 @@ const redis: InfoType = {
[ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE]: {
id: ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE,
name: 'TendisSSD',
architectureName: t('TendisSSD集群'),
specClusterName: 'Redis',
dbType: DBTypes.REDIS,
moduleId: 'redis',
Expand All @@ -119,6 +125,7 @@ const redis: InfoType = {
[ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER]: {
id: ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER,
name: 'Tendisplus',
architectureName: t('Tendisplus存储版集群'),
specClusterName: 'Redis',
dbType: DBTypes.REDIS,
moduleId: 'redis',
Expand All @@ -136,6 +143,7 @@ const redis: InfoType = {
[ClusterTypes.PREDIXY_REDIS_CLUSTER]: {
id: ClusterTypes.PREDIXY_REDIS_CLUSTER,
name: 'RedisCluster',
architectureName: t('RedisCluster集群'),
specClusterName: 'Redis',
dbType: DBTypes.REDIS,
moduleId: 'redis',
Expand All @@ -153,6 +161,7 @@ const redis: InfoType = {
[ClusterTypes.REDIS_INSTANCE]: {
id: ClusterTypes.REDIS_INSTANCE,
name: t('Redis主从'),
architectureName: t('RedisCache主从版'),
specClusterName: 'Redis',
dbType: DBTypes.REDIS,
moduleId: 'redis',
Expand All @@ -169,6 +178,7 @@ const bigdata: InfoType = {
[ClusterTypes.ES]: {
id: ClusterTypes.ES,
name: 'ElasticSearch',
architectureName: t('ES集群'),
specClusterName: 'ElasticSearch',
dbType: DBTypes.ES,
moduleId: 'bigdata',
Expand All @@ -190,6 +200,7 @@ const bigdata: InfoType = {
[ClusterTypes.KAFKA]: {
id: ClusterTypes.KAFKA,
name: 'Kafka',
architectureName: t('Kafka集群'),
specClusterName: 'Kafka',
dbType: DBTypes.KAFKA,
moduleId: 'bigdata',
Expand All @@ -207,6 +218,7 @@ const bigdata: InfoType = {
[ClusterTypes.HDFS]: {
id: ClusterTypes.HDFS,
name: 'HDFS',
architectureName: t('Hdfs集群'),
specClusterName: 'HDFS',
dbType: DBTypes.HDFS,
moduleId: 'bigdata',
Expand All @@ -224,6 +236,7 @@ const bigdata: InfoType = {
[ClusterTypes.INFLUXDB]: {
id: ClusterTypes.INFLUXDB,
name: 'InfuxDB',
architectureName: t('Influxdb实例'),
specClusterName: 'InfuxDB',
dbType: DBTypes.INFLUXDB,
moduleId: 'bigdata',
Expand All @@ -237,6 +250,7 @@ const bigdata: InfoType = {
[ClusterTypes.PULSAR]: {
id: ClusterTypes.PULSAR,
name: 'Pulsar',
architectureName: t('Pulsar集群'),
specClusterName: 'Pulsar',
dbType: DBTypes.PULSAR,
moduleId: 'bigdata',
Expand All @@ -258,6 +272,7 @@ const bigdata: InfoType = {
[ClusterTypes.DORIS]: {
id: ClusterTypes.DORIS,
name: 'Doris',
architectureName: t('Doris集群'),
specClusterName: 'Doris',
dbType: DBTypes.DORIS,
moduleId: 'bigdata',
Expand All @@ -279,6 +294,7 @@ const bigdata: InfoType = {
[ClusterTypes.RIAK]: {
id: ClusterTypes.RIAK,
name: 'Riak',
architectureName: t('Riak集群'),
specClusterName: 'Riak',
dbType: DBTypes.RIAK,
moduleId: 'bigdata',
Expand All @@ -295,6 +311,7 @@ const mongodb: InfoType = {
[ClusterTypes.MONGO_REPLICA_SET]: {
id: ClusterTypes.MONGO_REPLICA_SET,
name: t('Mongo副本集'),
architectureName: t('Mongo副本集'),
specClusterName: 'MongoDB',
dbType: DBTypes.MONGODB,
moduleId: 'mongodb',
Expand All @@ -307,7 +324,8 @@ const mongodb: InfoType = {
},
[ClusterTypes.MONGO_SHARED_CLUSTER]: {
id: ClusterTypes.MONGO_SHARED_CLUSTER,
name: t('Mongo 分片集群'),
name: t('Mongo分片集群'),
architectureName: t('Mongo分片集群'),
specClusterName: 'MongoDB',
dbType: DBTypes.MONGODB,
moduleId: 'mongodb',
Expand All @@ -318,7 +336,7 @@ const mongodb: InfoType = {
},
{
id: MachineTypes.MONGODB,
name: '副本集/ShardSvr',
name: t('副本集/ShardSvr'),
},
{
id: MachineTypes.MONGO_CONFIG,
Expand All @@ -332,6 +350,7 @@ const sqlserver: InfoType = {
[ClusterTypes.SQLSERVER_SINGLE]: {
id: ClusterTypes.SQLSERVER_SINGLE,
name: t('SQLServer单节点'),
architectureName: t('sqlserver单节点版'),
specClusterName: 'SQLServer',
dbType: DBTypes.SQLSERVER,
moduleId: 'sqlserver',
Expand All @@ -345,6 +364,7 @@ const sqlserver: InfoType = {
[ClusterTypes.SQLSERVER_HA]: {
id: ClusterTypes.SQLSERVER_HA,
name: t('SQLServer主从'),
architectureName: t('sqlserver主从版'),
specClusterName: 'SQLServer',
dbType: DBTypes.SQLSERVER,
moduleId: 'sqlserver',
Expand Down
11 changes: 11 additions & 0 deletions dbm-ui/frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1644,5 +1644,16 @@
"分片集群": "Sharded Cluster",
"主从管理": "HA Management",
"DB 重命名:database 重命名": "DB Rename:database rename",
"MySQL单节点集群": "",
"MySQL高可用集群": "",
"TendisCache集群": "",
"RedisCache主从版": "",
"Kafka集群": "",
"Hdfs集群": "",
"Pulsar集群": "",
"Riak集群": "",
"Mongo分片集群": "",
"sqlserver单节点版": "",
"sqlserver主从版": "",
"这行勿动!新增翻译请在上一行添加!": ""
}
11 changes: 11 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3871,6 +3871,17 @@
"导出数据:": "导出数据:",
"脚本来源:": "脚本来源:",
"脚本执行内容:": "脚本执行内容:",
"MySQL单节点集群": "MySQL 单节点集群",
"MySQL高可用集群": "MySQL 高可用集群",
"TendisCache集群": "TendisCache集群",
"RedisCache主从版": "RedisCache主从版",
"Kafka集群": "Kafka 集群",
"Hdfs集群": "Hdfs 集群",
"Pulsar集群": "Pulsar 集群",
"Riak集群": "Riak 集群",
"Mongo分片集群": "Mongo 分片集群",
"sqlserver单节点版": "sqlserver 单节点版",
"sqlserver主从版": "sqlserver 主从版",
"这行勿动!新增翻译请在上一行添加!": ""

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { clusterTypeInfos } from '@common/const/clusterTypeInfos';
import { ClusterTypes } from '@common/const/clusterTypes';

export default class MongodbInstanceDetail {
bk_agent_id: string;
bk_cloud_id: number;
Expand All @@ -6,8 +9,10 @@ export default class MongodbInstanceDetail {
bk_disk: number;
bk_host_id: number;
bk_host_innerip: string;
bk_idc_id: string;
bk_idc_id: number;
bk_idc_name: string;
bk_idc_city_id: string;
bk_idc_city_name: string;
bk_mem: number;
bk_os_name: string;
cluster_id: number;
Expand Down Expand Up @@ -39,6 +44,8 @@ export default class MongodbInstanceDetail {
this.bk_host_innerip = payload.bk_host_innerip;
this.bk_idc_id = payload.bk_idc_id;
this.bk_idc_name = payload.bk_idc_name;
this.bk_idc_city_id = payload.bk_idc_city_id || '';
this.bk_idc_city_name = payload.bk_idc_city_name || '';
this.bk_mem = payload.bk_mem;
this.bk_os_name = payload.bk_os_name;
this.cluster_id = payload.cluster_id;
Expand All @@ -60,4 +67,8 @@ export default class MongodbInstanceDetail {
this.status = payload.status;
this.version = payload.version;
}

get clusterTypeName() {
return clusterTypeInfos[this.cluster_type as ClusterTypes].architectureName || '';
}
}
17 changes: 17 additions & 0 deletions dbm-ui/frontend/src/services/model/mysql/tendbha-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

import type { HostInfo, InstanceListSpecConfig, InstanceRelatedCluster } from '@services/types';

import { clusterTypeInfos } from '@common/const/clusterTypeInfos';
import { ClusterTypes } from '@common/const/clusterTypes';

import { utcDisplayTime } from '@utils';

export default class TendbhaInstance {
Expand All @@ -22,6 +25,11 @@ export default class TendbhaInstance {
db_version: string;
bk_disk: number;
bk_host_id: number;
bk_host_innerip: string;
bk_idc_id: number;
bk_idc_name: string;
bk_idc_city_id: string;
bk_idc_city_name: string;
bk_mem: number;
bk_sub_zone: string;
cluster_id: number;
Expand Down Expand Up @@ -53,6 +61,11 @@ export default class TendbhaInstance {
this.bk_cpu = payload.bk_cpu || 0;
this.bk_disk = payload.bk_disk || 0;
this.bk_host_id = payload.bk_host_id || 0;
this.bk_host_innerip = payload.bk_host_innerip || '';
this.bk_idc_id = payload.bk_idc_id || 0;
this.bk_idc_name = payload.bk_idc_name || '';
this.bk_idc_city_id = payload.bk_idc_city_id || '';
this.bk_idc_city_name = payload.bk_idc_city_name || '';
this.bk_mem = payload.bk_mem || 0;
this.bk_sub_zone = payload.bk_sub_zone || '';
this.cluster_id = payload.cluster_id || 0;
Expand Down Expand Up @@ -81,4 +94,8 @@ export default class TendbhaInstance {
get createAtDisplay() {
return utcDisplayTime(this.create_at);
}

get clusterTypeName() {
return clusterTypeInfos[this.cluster_type as ClusterTypes].architectureName || '';
}
}
16 changes: 16 additions & 0 deletions dbm-ui/frontend/src/services/model/redis/redis-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import type { HostInfo, InstanceListSpecConfig, InstanceRelatedCluster } from '@services/types';

import { type ClusterInstStatus, clusterInstStatus } from '@common/const';
import { clusterTypeInfos } from '@common/const/clusterTypeInfos';
import { ClusterTypes } from '@common/const/clusterTypes';

import { isRecentDays, utcDisplayTime } from '@utils';

Expand All @@ -23,6 +25,11 @@ export default class RedisInstance {
bk_cpu: number;
bk_disk: number;
bk_host_id: number;
bk_host_innerip: string;
bk_idc_id: number;
bk_idc_name: string;
bk_idc_city_id: string;
bk_idc_city_name: string;
bk_mem: number;
db_version: string;
bk_sub_zone: string;
Expand Down Expand Up @@ -53,6 +60,11 @@ export default class RedisInstance {
this.bk_cpu = payload.bk_cpu || 0;
this.bk_disk = payload.bk_disk || 0;
this.bk_host_id = payload.bk_host_id || 0;
this.bk_host_innerip = payload.bk_host_innerip || '';
this.bk_idc_id = payload.bk_idc_id || 0;
this.bk_idc_name = payload.bk_idc_name || '';
this.bk_idc_city_id = payload.bk_idc_city_id || '';
this.bk_idc_city_name = payload.bk_idc_city_name || '';
this.bk_mem = payload.bk_mem || 0;
this.bk_sub_zone = payload.bk_sub_zone || '';
this.cluster_id = payload.cluster_id || 0;
Expand Down Expand Up @@ -87,4 +99,8 @@ export default class RedisInstance {
get getStatusInfo() {
return clusterInstStatus[this.status] || clusterInstStatus.unavailable;
}

get clusterTypeName() {
return clusterTypeInfos[this.cluster_type as ClusterTypes].architectureName || '';
}
}
10 changes: 10 additions & 0 deletions dbm-ui/frontend/src/services/model/riak/riak-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export default class RiakInstance {
bk_cloud_id: number;
bk_cloud_name: string;
bk_host_id: number;
bk_host_innerip: string;
bk_idc_id: number;
bk_idc_name: string;
bk_idc_city_id: string;
bk_idc_city_name: string;
cluster_id: number;
cluster_name: string;
cluster_type: string;
Expand All @@ -27,6 +32,11 @@ export default class RiakInstance {
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_host_id = payload.bk_host_id;
this.bk_host_innerip = payload.bk_host_innerip || '';
this.bk_idc_id = payload.bk_idc_id || 0;
this.bk_idc_name = payload.bk_idc_name || '';
this.bk_idc_city_id = payload.bk_idc_city_id || '';
this.bk_idc_city_name = payload.bk_idc_city_name || '';
this.cluster_id = payload.cluster_id;
this.cluster_name = payload.cluster_name;
this.cluster_type = payload.cluster_type;
Expand Down
Loading

0 comments on commit 6f78006

Please sign in to comment.