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 25, 2024
1 parent 232973d commit a0c85fe
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 56 deletions.
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主从版": "",
"这行勿动!新增翻译请在上一行添加!": ""
}
59 changes: 18 additions & 41 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3857,49 +3857,26 @@
"数量:": "数量:",
"源 DB 名": "源 DB 名",
"产品文档": "产品文档",
"迁移提交成功": "迁移提交成功",
"集群架构:将集群的部分实例迁移到新机器,迁移保持规格、版本不变;主从架构:主从实例成对迁移到新机器上,可选择部分实例迁移,也可整机所有实例一起迁移。": "集群架构:将集群的部分实例迁移到新机器,迁移保持规格、版本不变;主从架构:主从实例成对迁移到新机器上,可选择部分实例迁移,也可整机所有实例一起迁移。",
"迁移": "迁移",
"实例迁移": "实例迁移",
"如 TendisCache 等,迁移过程保持规格、版本不变": "如 TendisCache 等,迁移过程保持规格、版本不变",
"支持部分或整机所有实例成对迁移至新主机,版本规格可变": "支持部分或整机所有实例成对迁移至新主机,版本规格可变",
"主从架构": "主从架构",
"只迁移目标实例": "只迁移目标实例",
"主机关联的所有实例一并迁移": "主机关联的所有实例一并迁移",
"整机迁移": "整机迁移",
"目标 Master 实例": "目标 Master 实例",
"实例选择": "实例选择",
"目标 Master 主机": "目标 Master 主机",
"关联的实例": "关联的实例",
"关联的主从实例": "关联的主从实例",
"目标实例输入格式有误": "目标实例输入格式有误",
"目标实例重复": "目标实例重复",
"Master 实例": "Master 实例",
"请先选择主机": "请先选择主机",
"集群或实例状态异常,不可选择": "集群或实例状态异常,不可选择",
"迁移提交成功": "迁移提交成功",
"集群架构:将集群的部分实例迁移到新机器,迁移保持规格、版本不变;主从架构:主从实例成对迁移到新机器上,可选择部分实例迁移,也可整机所有实例一起迁移。": "集群架构:将集群的部分实例迁移到新机器,迁移保持规格、版本不变;主从架构:主从实例成对迁移到新机器上,可选择部分实例迁移,也可整机所有实例一起迁移。",
"迁移": "迁移",
"实例迁移": "实例迁移",
"如 TendisCache 等,迁移过程保持规格、版本不变": "如 TendisCache 等,迁移过程保持规格、版本不变",
"支持部分或整机所有实例成对迁移至新主机,版本规格可变": "支持部分或整机所有实例成对迁移至新主机,版本规格可变",
"主从架构": "主从架构",
"只迁移目标实例": "只迁移目标实例",
"主机关联的所有实例一并迁移": "主机关联的所有实例一并迁移",
"整机迁移": "整机迁移",
"目标 Master 实例": "目标 Master 实例",
"实例选择": "实例选择",
"目标 Master 主机": "目标 Master 主机",
"关联的实例": "关联的实例",
"关联的主从实例": "关联的主从实例",
"目标实例输入格式有误": "目标实例输入格式有误",
"目标实例重复": "目标实例重复",
"Master 实例": "Master 实例",
"请先选择主机": "请先选择主机",
"集群或实例状态异常,不可选择": "集群或实例状态异常,不可选择",
"审批人": "审批人",
"协助人": "协助人",
"单据通知": "单据通知",
"去处理": "去处理",
"集群数量:": "集群数量:",
"每组主机部署集群:": "每组主机部署集群:",
"服务器选择:": "服务器选择:",
"后端存储规格:": "后端存储规格:",
"SQLServer起始端口:": "SQLServer起始端口:",
"高可用部署": "高可用部署",
"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 || '';
}
}
Loading

0 comments on commit a0c85fe

Please sign in to comment.