From f5f274e30bf68ba6ec181957c2cf4e2cbc45fed1 Mon Sep 17 00:00:00 2001 From: royalpioneer Date: Tue, 26 Nov 2024 00:48:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20tendbcluster=E3=80=81doris?= =?UTF-8?q?=E7=9A=84tab=E7=BC=BA=E5=A4=B1=20#8175=20#=20Reviewed,=20transa?= =?UTF-8?q?ction=20id:=2024987?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/common/const/clusterTypeInfos.ts | 40 +++--- .../frontend/src/common/const/clusterTypes.ts | 11 +- .../frontend/src/common/const/machineTypes.ts | 121 ++++++++---------- .../views/db-configure/business/Detail.vue | 3 + .../list/components/hooks/useBaseDetails.ts | 4 +- .../db-configure/components/DetailsBase.vue | 50 +++++++- .../db-configure/components/ReadonlyTable.vue | 12 +- 7 files changed, 140 insertions(+), 101 deletions(-) diff --git a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts index 2e34f23728..588977468a 100644 --- a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts +++ b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts @@ -275,26 +275,26 @@ const bigdata: InfoType = { name: t('冷_热节点规格'), }, ], - [ClusterTypes.DORIS]: { - id: ClusterTypes.DORIS, - name: 'Doris', - dbType: DBTypes.DORIS, - moduleId: 'bigdata', - machineList: [ - { - id: MachineTypes.DORIS_FOLLOWER, - name: t('Follower节点规格'), - }, - { - id: MachineTypes.DORIS_OBSERVER, - name: t('Observer节点规格'), - }, - { - id: MachineTypes.DORIS_BACKEND, - name: t('冷_热节点规格'), - }, - ], - }, + }, + [ClusterTypes.DORIS]: { + id: ClusterTypes.DORIS, + name: 'Doris', + dbType: DBTypes.DORIS, + moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.DORIS_FOLLOWER, + name: t('Follower节点规格'), + }, + { + id: MachineTypes.DORIS_OBSERVER, + name: t('Observer节点规格'), + }, + { + id: MachineTypes.DORIS_BACKEND, + name: t('冷_热节点规格'), + }, + ], }, }; diff --git a/dbm-ui/frontend/src/common/const/clusterTypes.ts b/dbm-ui/frontend/src/common/const/clusterTypes.ts index 4f6f2fbd69..bc95f091ff 100644 --- a/dbm-ui/frontend/src/common/const/clusterTypes.ts +++ b/dbm-ui/frontend/src/common/const/clusterTypes.ts @@ -25,8 +25,9 @@ export enum ClusterTypes { TENDIS_PLUS_CLUSTER = 'TendisplusCluster', // TendisplusCluster集群 DBMON = 'dbmon', // redis监控 } -// bigdata + export enum ClusterTypes { + // bigdata ES = 'es', KAFKA = 'kafka', HDFS = 'hdfs', @@ -34,15 +35,11 @@ export enum ClusterTypes { PULSAR = 'pulsar', RIAK = 'riak', DORIS = 'doris', -} -// mongo -export enum ClusterTypes { + // mongo MONGO_REPLICA_SET = 'MongoReplicaSet', // Mongo副本集群 MONGO_SHARED_CLUSTER = 'MongoShardedCluster', // Mongo分片集群 MONGODB = 'mongodb', -} -// sqlserver -export enum ClusterTypes { + // sqlserver SQLSERVER_SINGLE = 'sqlserver_single', // SQLServer单节点版 SQLSERVER_HA = 'sqlserver_ha', // SQLServer主从版 } diff --git a/dbm-ui/frontend/src/common/const/machineTypes.ts b/dbm-ui/frontend/src/common/const/machineTypes.ts index 3474b1d2bb..82505c9bc0 100644 --- a/dbm-ui/frontend/src/common/const/machineTypes.ts +++ b/dbm-ui/frontend/src/common/const/machineTypes.ts @@ -2,73 +2,58 @@ * 机器类型 */ -// mysql export enum MachineTypes { - MYSQL_PROXY = 'proxy', // Proxy - MYSQL_BACKEND = 'backend', // 后端存储 - // SINGLE = 'single', -} -// spider -export enum MachineTypes { - // SPIDER = 'spider', - // REMOTE = 'remote', - TENDBCLUSTER_PROXY = 'proxy', // 接入层Master - TENDBCLUSTER_BACKEND = 'backend', // 后端存储 -} -// redis -export enum MachineTypes { - REDIS_PROXY = 'proxy', - REDIS_TENDIS_CACHE = 'TwemproxyRedisInstance', // TendisCache后端存储 - REDIS_TENDIS_SSD = 'TwemproxyTendisSSDInstance', // TendisSSD后端存储 - REDIS_TENDIS_PLUS = 'PredixyTendisplusCluster', // TendisPlus后端存储 - REDIS_CLUSTER = 'PredixyRedisCluster', // RedisCluster - REDIS_INSTANCE = 'RedisInstance', // Redis主从 -} -// mongodb -export enum MachineTypes { - MONGOS = 'mongos', // Mongos - MONGODB = 'mongodb', // 副本集/ShardSvr - MONGO_CONFIG = 'mongo_config', // ConfigSvr -} -// sqlserver -export enum MachineTypes { - // SQLSERVER_HA = 'sqlserver_ha', - // SQLSERVER_SINGLE = 'sqlserver_single', - SQLSERVER = 'sqlserver', // 后端存储 -} -// kafka -export enum MachineTypes { - KAFKA_BROKER = 'broker', // Broker节点 - KAFKA_ZOOKEEPER = 'zookeeper', // Zookeeper节点 -} -// es -export enum MachineTypes { - ES_DATANODE = 'es_datanode', // 冷/热节点 - ES_MASTER = 'es_master', // Master节点 - ES_CLIENT = 'es_client', // Client节点 -} -// hdfs -export enum MachineTypes { - HDFS_MASTER = 'hdfs_master', // NameNode/Zookeeper/JournalNode节点 - HDFS_DATANODE = 'hdfs_datanode', // DataNode节点 -} -// pulsar -export enum MachineTypes { - PULSAR_BROKER = 'pulsar_broker', // Broker节点 - PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', // Bookkeeper节点 - PULSAR_ZOOKEEPER = 'pulsar_zookeeper', // Zookeeper节点 -} -// influxdb -export enum MachineTypes { - INFLUXDB = 'influxdb', // 后端存储 -} -// riak -export enum MachineTypes { - RIAK = 'riak', // 后端存储 -} -// doris -export enum MachineTypes { - DORIS_FOLLOWER = 'doris_follower', // Follower节点 - DORIS_OBSERVER = 'doris_observer', // Observer节点 - DORIS_BACKEND = 'doris_backend', // 冷/热节点 + // mysql + BACKEND = 'backend', + PROXY = 'proxy', + SINGLE = 'single', + + // spider + SPIDER = 'spider', + REMOTE = 'remote', + + // redis + TENDISCACHE = 'tendiscache', + TENDISSSD = 'tendisssd', + TENDISPLUS = 'tendisplus', + TWEMPROXY = 'twemproxy', + PREDIXY = 'predixy', + + // mongodb + MONGOS = 'mongos', + MONGODB = 'mongodb', + MONGO_CONFIG = 'mongo_config', + + // sqlserver + SQLSERVER_HA = 'sqlserver_ha', + SQLSERVER_SINGLE = 'sqlserver_single', + + // kafka + BROKER = 'broker', + ZOOKEEPER = 'zookeeper', + + // es + ES_DATANODE = 'es_datanode', + ES_MASTER = 'es_master', + ES_CLIENT = 'es_client', + + // hdfs + HDFS_MASTER = 'hdfs_master', + HDFS_DATANODE = 'hdfs_datanode', + + // pulsar + PULSAR_BROKER = 'pulsar_broker', + PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', + PULSAR_ZOOKEEPER = 'pulsar_zookeeper', + + // doris + DORIS_FOLLOWER = 'doris_follower', + DORIS_OBSERVER = 'doris_observer', + DORIS_BACKEND = 'doris_backend', + + // influxdb + INFLUXDB = 'influxdb', + + // riak + RIAK = 'riak', } diff --git a/dbm-ui/frontend/src/views/db-configure/business/Detail.vue b/dbm-ui/frontend/src/views/db-configure/business/Detail.vue index 62566ee4fe..5636082677 100644 --- a/dbm-ui/frontend/src/views/db-configure/business/Detail.vue +++ b/dbm-ui/frontend/src/views/db-configure/business/Detail.vue @@ -118,6 +118,9 @@ if (!route.query.form) { router.push({ name: 'DbConfigureList', + params: { + clusterType: props.clusterType, + }, }); return; } diff --git a/dbm-ui/frontend/src/views/db-configure/business/list/components/hooks/useBaseDetails.ts b/dbm-ui/frontend/src/views/db-configure/business/list/components/hooks/useBaseDetails.ts index 6b88e88fe0..28981b0253 100644 --- a/dbm-ui/frontend/src/views/db-configure/business/list/components/hooks/useBaseDetails.ts +++ b/dbm-ui/frontend/src/views/db-configure/business/list/components/hooks/useBaseDetails.ts @@ -31,7 +31,7 @@ interface State { /** * 获取参数管理基本信息 */ -export const useBaseDetails = (immediateFetch = true) => { +export const useBaseDetails = (immediateFetch = true, confName = 'db_version') => { const getFetchParams = (versionKey: 'version' | 'proxy_version', confType = 'dbconf') => { if (treeNode === undefined) { return {} as ServiceParameters; @@ -115,7 +115,7 @@ export const useBaseDetails = (immediateFetch = true) => { getLevelConfig(params) .then((res) => { res.conf_items.forEach((item) => { - if (item.conf_name === 'db_version') { + if (item.conf_name === confName) { state.version = item.conf_value ?? ''; } else if (item.conf_name === 'charset') { state.data.charset = item.conf_value ?? ''; diff --git a/dbm-ui/frontend/src/views/db-configure/components/DetailsBase.vue b/dbm-ui/frontend/src/views/db-configure/components/DetailsBase.vue index a8bc731f01..78fb3645d3 100644 --- a/dbm-ui/frontend/src/views/db-configure/components/DetailsBase.vue +++ b/dbm-ui/frontend/src/views/db-configure/components/DetailsBase.vue @@ -39,7 +39,23 @@ class="details-base__table" :data="configItems" :level="level" - :sticky-top="stickyTop" /> + :sticky-top="stickyTop"> + + { + if (!state.version) { + return [props.data.version]; + } + return [props.data.version, state.data.version]; + }); const cardTitle = computed(() => props.title || t('参数配置')); // 是否为平台级别配置 const isPlat = computed(() => ConfLevels.PLAT === props.level); - const configItems = computed(() => props.data?.conf_items || []); + const configItems = computed(() => { + if (clusterType.value === props.data.version) { + return props.data.conf_items; + } + return state.data.conf_items; + }); const isShowCharset = computed(() => !!props.data.charset); const baseInfoColumns = computed(() => { const baseColumns = [ @@ -161,6 +192,14 @@ return baseColumns; }); + watch( + () => props.data.version, + () => { + clusterType.value = props.data.version; + }, + { immediate: true }, + ); + /** * 基础信息编辑 */ @@ -193,7 +232,12 @@ const name = isPlat.value ? 'PlatformDbConfigureEdit' : 'DbConfigureEdit'; router.push({ name, - params: { ...route.params, ...props.routeParams, ...extra }, + params: { + ...route.params, + ...props.routeParams, + ...extra, + version: clusterType.value, + }, }); }; diff --git a/dbm-ui/frontend/src/views/db-configure/components/ReadonlyTable.vue b/dbm-ui/frontend/src/views/db-configure/components/ReadonlyTable.vue index 50e61416f4..84ece2e6fe 100644 --- a/dbm-ui/frontend/src/views/db-configure/components/ReadonlyTable.vue +++ b/dbm-ui/frontend/src/views/db-configure/components/ReadonlyTable.vue @@ -13,9 +13,11 @@