From 17ec2e0b9053f7408e0e90886d0d7eb2c881a64f Mon Sep 17 00:00:00 2001 From: Austin <1344583166@qq.com> Date: Tue, 5 Nov 2024 17:05:00 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E8=A7=84=E6=A0=BC=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84=E6=8E=A5=E5=8F=A3=E4=B8=8E=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20#6955=20#=20Reviewed,=20transaction=20id:?= =?UTF-8?q?=2023064?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/common/const/clusterTypeInfos.ts | 159 ++++++----- .../frontend/src/common/const/dbTypeInfos.ts | 138 ++++++++- .../frontend/src/common/const/machineTypes.ts | 58 ++-- .../render-table/columns/input/index.vue | 16 +- dbm-ui/frontend/src/locales/en.json | 2 +- dbm-ui/frontend/src/locales/zh-cn.json | 21 +- .../services/model/db-resource/DbResource.ts | 2 +- .../src/services/model/db-resource/summary.ts | 13 +- .../src/services/source/dbresourceResource.ts | 27 +- dbm-ui/frontend/src/types/auto-imports.d.ts | 2 +- .../common/apply-items/BackendQPSSpec.vue | 8 +- .../common/apply-items/SpecSelector.vue | 24 +- .../cluster-spec-plan-selector/Index.vue | 2 +- .../page1/components/ChooseDeployPlan.vue | 3 +- .../mongodb/components/MongoConfigSpec.vue | 5 +- .../db-replace/pages/page1/components/Row.vue | 2 +- .../page1/components/RenderTargetSpec.vue | 2 +- .../proxy-scale-up/pages/page1/Index.vue | 2 +- .../mongodb/replica-set-apply/Index.vue | 2 +- .../mongodb/shared-cluster-apply/Index.vue | 4 +- .../db-manage/mysql/apply/ApplyMySQL.vue | 10 +- .../views/db-manage/redis/apply-ha/Index.vue | 6 +- .../db-manage/redis/apply/ApplyRedis.vue | 16 +- .../apply/components/backend-spec/Index.vue | 2 +- .../backend-spec/components/CustomSchema.vue | 2 +- .../capacity-change/pages/page1/Index.vue | 6 +- .../page1/components/ClusterDeployPlan.vue | 8 +- .../pages/page1/Index.vue | 2 +- .../common/cluster-deploy-plan/Index.vue | 8 +- .../src/views/db-manage/redis/common/const.ts | 15 +- .../pages/page1/components/Row.vue | 33 +-- .../db-manage/sqlserver/apply/SqlServer.vue | 4 +- .../db-manage/tendb-cluster/apply/Index.vue | 6 +- .../RenderData/RenderTargetResourceSpec.vue | 2 +- .../common/spec-panel-select/Index.vue | 61 ++-- .../list/components/CapacityChange.vue | 2 +- .../proxy-scale-up/pages/page1/Index.vue | 2 +- .../render-data/RenderNewSlaveHost.vue | 2 +- .../src/views/deployment-plan/list/Index.vue | 6 +- .../src/views/resource-manage/pool/Index.vue | 2 +- .../resource-manage/pool/host-list/Index.vue | 4 +- .../components/batch-setting/Index.vue | 6 +- .../import-host/components/FormPanel.vue | 6 +- .../host-list/components/search-box/Index.vue | 4 + .../com-factory/components/DeviceClass.vue | 46 ++- .../com-factory/components/SpecId.vue | 66 +++-- .../components/CollectSearchParams.vue | 2 +- .../components/search-box/Index.vue | 53 ++-- .../components/search-box/components/Biz.vue | 18 +- .../components/search-box/components/Db.vue | 18 +- .../search-box/components/Region.vue | 31 +-- .../components/search-box/components/Spec.vue | 85 +++--- .../src/views/resource-manage/spec/Index.vue | 30 +- .../spec/components/SpecCreate.vue | 164 +++++------ .../spec/components/SpecList.vue | 108 ++++---- .../components/spec-form-item/SpecCPU.vue | 8 +- .../components/spec-form-item/SpecDevice.vue | 85 ++++-- .../components/spec-form-item/SpecMem.vue | 14 +- .../components/spec-form-item/SpecStorage.vue | 4 +- .../spec-device-or-cpu-mem/Index.vue | 207 ++++++++++++++ .../components/SpecCPU.vue | 112 ++++++++ .../components/SpecDevice.vue | 250 +++++++++++++++++ .../components/SpecMem.vue | 117 ++++++++ .../spec-form-item/spec-storage/Index.vue | 146 ++++++++++ .../spec-storage/components/RenderTable.vue | 52 ++++ .../spec-storage/components/Row.vue | 261 ++++++++++++++++++ .../spec-form-item/specFormItem.less | 8 +- .../resource-manage/spec/hooks/useHasQPS.ts | 6 +- .../bigdata/RiakExpansionCapacity.vue | 2 +- .../redis/ClusterShardUpdate.vue | 18 +- .../redis/ClusterTypeUpdate.vue | 29 +- .../demand-factory/spider/AddNodes.vue | 24 +- .../demand-factory/spider/NodeRebalance.vue | 22 +- .../demand-factory/spider/ReduceNodes.vue | 26 +- .../demand-factory/spider/SlaveApply.vue | 24 +- 75 files changed, 2065 insertions(+), 678 deletions(-) create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-device-or-cpu-mem/Index.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-device-or-cpu-mem/components/SpecCPU.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-device-or-cpu-mem/components/SpecDevice.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-device-or-cpu-mem/components/SpecMem.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-storage/Index.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-storage/components/RenderTable.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/spec/components/spec-form-item/spec-storage/components/Row.vue diff --git a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts index 417cae0033..1a9c8785ee 100644 --- a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts +++ b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts @@ -9,6 +9,7 @@ import { MachineTypes } from './machineTypes'; export interface ClusterTypeInfoItem { id: ClusterTypes; name: string; + specClusterName: string; // 规格对应的集群名,磨平集群类型差异 dbType: DBTypes; moduleId: ExtractedControllerDataKeys; machineList: { @@ -27,28 +28,34 @@ const mysql: InfoType = { [ClusterTypes.TENDBSINGLE]: { id: ClusterTypes.TENDBSINGLE, name: t('MySQL单节点'), + specClusterName: 'MySQL', dbType: DBTypes.MYSQL, moduleId: 'mysql', machineList: [ { - id: MachineTypes.SINGLE, - name: t('后端存储机型'), + id: MachineTypes.MYSQL_PROXY, + name: 'Proxy', + }, + { + id: MachineTypes.MYSQL_BACKEND, + name: t('后端存储'), }, ], }, [ClusterTypes.TENDBHA]: { id: ClusterTypes.TENDBHA, name: t('MySQL主从'), + specClusterName: 'MySQL', dbType: DBTypes.MYSQL, moduleId: 'mysql', machineList: [ { - id: MachineTypes.BACKEND, - name: t('后端存储机型'), + id: MachineTypes.MYSQL_PROXY, + name: 'Proxy', }, { - id: MachineTypes.PROXY, - name: t('Proxy机型'), + id: MachineTypes.MYSQL_BACKEND, + name: t('后端存储'), }, ], }, @@ -58,16 +65,17 @@ const spider: InfoType = { [ClusterTypes.TENDBCLUSTER]: { id: ClusterTypes.TENDBCLUSTER, name: 'TenDBCluster', + specClusterName: 'TenDBCluster', dbType: DBTypes.TENDBCLUSTER, moduleId: 'mysql', machineList: [ { - id: MachineTypes.SPIDER, + id: MachineTypes.TENDBCLUSTER_PROXY, name: t('接入层Master'), }, { - id: MachineTypes.REMOTE, - name: t('后端存储规格'), + id: MachineTypes.TENDBCLUSTER_BACKEND, + name: t('后端存储'), }, ], }, @@ -77,76 +85,81 @@ const redis: InfoType = { [ClusterTypes.TWEMPROXY_REDIS_INSTANCE]: { id: ClusterTypes.TWEMPROXY_REDIS_INSTANCE, name: 'TendisCache', + specClusterName: 'Redis', dbType: DBTypes.REDIS, moduleId: 'redis', machineList: [ { - id: MachineTypes.TENDISCACHE, - name: t('后端存储机型'), + id: MachineTypes.REDIS_TENDIS_CACHE, + name: t('TendisCache/RedisCluster/Redis主从 后端存储'), }, { - id: MachineTypes.TWEMPROXY, - name: t('Proxy机型'), + id: MachineTypes.REDIS_PROXY, + name: 'Proxy', }, ], }, [ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE]: { id: ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE, name: 'TendisSSD', + specClusterName: 'Redis', dbType: DBTypes.REDIS, moduleId: 'redis', machineList: [ { - id: MachineTypes.TENDISSSD, - name: t('后端存储机型'), + id: MachineTypes.REDIS_TENDIS_CACHE, + name: t('TendisCache/RedisCluster/Redis主从 后端存储'), }, { - id: MachineTypes.TWEMPROXY, - name: t('Proxy机型'), + id: MachineTypes.REDIS_PROXY, + name: 'Proxy', }, ], }, [ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER]: { id: ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER, name: 'Tendisplus', + specClusterName: 'Redis', dbType: DBTypes.REDIS, moduleId: 'redis', machineList: [ { - id: MachineTypes.TENDISPLUS, - name: t('后端存储机型'), + id: MachineTypes.REDIS_TENDIS_PLUS, + name: t('TendisPlus后端存储'), }, { - id: MachineTypes.PREDIXY, - name: t('Proxy机型'), + id: MachineTypes.REDIS_PROXY, + name: 'Proxy', }, ], }, [ClusterTypes.PREDIXY_REDIS_CLUSTER]: { id: ClusterTypes.PREDIXY_REDIS_CLUSTER, name: 'RedisCluster', + specClusterName: 'Redis', dbType: DBTypes.REDIS, moduleId: 'redis', machineList: [ { - id: MachineTypes.TENDISCACHE, - name: t('后端存储机型'), + id: MachineTypes.REDIS_TENDIS_CACHE, + name: t('TendisCache/RedisCluster/Redis主从 后端存储'), }, { - id: MachineTypes.PREDIXY, - name: t('Proxy机型'), + id: MachineTypes.REDIS_PROXY, + name: 'Proxy', }, ], }, [ClusterTypes.REDIS_INSTANCE]: { id: ClusterTypes.REDIS_INSTANCE, name: t('Redis主从'), + specClusterName: 'Redis', dbType: DBTypes.REDIS, moduleId: 'redis', machineList: [ { - id: MachineTypes.TENDISCACHE, - name: t('后端存储机型'), + id: MachineTypes.REDIS_TENDIS_CACHE, + name: t('TendisCache/RedisCluster/Redis主从 后端存储'), }, ], }, @@ -156,58 +169,62 @@ const bigdata: InfoType = { [ClusterTypes.ES]: { id: ClusterTypes.ES, name: 'ElasticSearch', + specClusterName: 'ElasticSearch', dbType: DBTypes.ES, moduleId: 'bigdata', machineList: [ { id: MachineTypes.ES_MASTER, - name: t('Master节点规格'), + name: t('Master节点'), }, { id: MachineTypes.ES_CLIENT, - name: t('Client节点规格'), + name: t('Client节点'), }, { id: MachineTypes.ES_DATANODE, - name: t('冷_热节点规格'), + name: t('冷_热节点'), }, ], }, [ClusterTypes.KAFKA]: { id: ClusterTypes.KAFKA, name: 'Kafka', + specClusterName: 'Kafka', dbType: DBTypes.KAFKA, moduleId: 'bigdata', machineList: [ { - id: MachineTypes.ZOOKEEPER, - name: t('Zookeeper节点规格'), + id: MachineTypes.KAFKA_ZOOKEEPER, + name: t('Zookeeper节点'), }, { - id: MachineTypes.BROKER, - name: t('Broker节点规格'), + id: MachineTypes.KAFKA_BROKER, + name: t('Broker节点'), }, ], }, [ClusterTypes.HDFS]: { id: ClusterTypes.HDFS, name: 'HDFS', + specClusterName: 'HDFS', dbType: DBTypes.HDFS, moduleId: 'bigdata', machineList: [ { id: MachineTypes.HDFS_DATANODE, - name: t('DataNode节点规格'), + name: t('DataNode节点'), }, { id: MachineTypes.HDFS_MASTER, - name: t('NameNode_Zookeeper_JournalNode节点规格'), + name: t('NameNode_Zookeeper_JournalNode节点'), }, ], }, [ClusterTypes.INFLUXDB]: { id: ClusterTypes.INFLUXDB, name: 'InfuxDB', + specClusterName: 'InfuxDB', dbType: DBTypes.INFLUXDB, moduleId: 'bigdata', machineList: [ @@ -220,42 +237,44 @@ const bigdata: InfoType = { [ClusterTypes.PULSAR]: { id: ClusterTypes.PULSAR, name: 'Pulsar', + specClusterName: 'Pulsar', dbType: DBTypes.PULSAR, moduleId: 'bigdata', machineList: [ { id: MachineTypes.PULSAR_BOOKKEEPER, - name: t('Bookkeeper节点规格'), + name: t('Bookkeeper节点'), }, { id: MachineTypes.PULSAR_ZOOKEEPER, - name: t('Zookeeper节点规格'), + name: t('Zookeeper节点'), }, { id: MachineTypes.PULSAR_BROKER, - name: t('Broker节点规格'), + name: t('Broker节点'), + }, + ], + }, + [ClusterTypes.DORIS]: { + id: ClusterTypes.DORIS, + name: 'Doris', + specClusterName: '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('冷_热节点规格'), - }, - ], - }, }, }; @@ -263,32 +282,34 @@ const mongodb: InfoType = { [ClusterTypes.MONGO_REPLICA_SET]: { id: ClusterTypes.MONGO_REPLICA_SET, name: t('Mongo副本集'), + specClusterName: 'MongoDB', dbType: DBTypes.MONGODB, moduleId: 'mongodb', machineList: [ { id: MachineTypes.MONGODB, - name: t('Mongodb规格'), + name: '副本集/ShardSvr', }, ], }, [ClusterTypes.MONGO_SHARED_CLUSTER]: { id: ClusterTypes.MONGO_SHARED_CLUSTER, - name: t('Mongo 分片集群'), + name: t('Mongo分片集'), + specClusterName: 'MongoDB', dbType: DBTypes.MONGODB, moduleId: 'mongodb', machineList: [ { id: MachineTypes.MONGOS, - name: t('Mongos规格'), + name: 'Mongos', }, { id: MachineTypes.MONGODB, - name: t('ConfigSvr规格'), + name: '副本集/ShardSvr', }, { id: MachineTypes.MONGO_CONFIG, - name: t('ShardSvr规格'), + name: 'ConfigSvr', }, ], }, @@ -298,24 +319,26 @@ const sqlserver: InfoType = { [ClusterTypes.SQLSERVER_SINGLE]: { id: ClusterTypes.SQLSERVER_SINGLE, name: t('SQLServer单节点'), + specClusterName: 'SQLServer', dbType: DBTypes.SQLSERVER, moduleId: 'sqlserver', machineList: [ { - id: MachineTypes.SQLSERVER_SINGLE, - name: t('单节点规格'), + id: MachineTypes.SQLSERVER, + name: t('后端存储'), }, ], }, [ClusterTypes.SQLSERVER_HA]: { id: ClusterTypes.SQLSERVER_HA, name: t('SQLServer主从'), + specClusterName: 'SQLServer', dbType: DBTypes.SQLSERVER, moduleId: 'sqlserver', machineList: [ { - id: MachineTypes.SQLSERVER_HA, - name: t('主从规格'), + id: MachineTypes.SQLSERVER, + name: t('后端存储'), }, ], }, diff --git a/dbm-ui/frontend/src/common/const/dbTypeInfos.ts b/dbm-ui/frontend/src/common/const/dbTypeInfos.ts index 9eee2db5ee..7789d99bf4 100644 --- a/dbm-ui/frontend/src/common/const/dbTypeInfos.ts +++ b/dbm-ui/frontend/src/common/const/dbTypeInfos.ts @@ -1,15 +1,24 @@ import type { ExtractedControllerDataKeys } from '@services/model/function-controller/functionController'; +import { t } from '@locales/index'; + import { DBTypes } from './dbTypes'; +import { MachineTypes } from './machineTypes'; -interface InfoItem { +export interface InfoItem { id: DBTypes; name: string; moduleId: ExtractedControllerDataKeys; + machineList: { + label: string; + value: MachineTypes; + }[]; } + type InfoType = { [x in DBTypes]?: InfoItem; }; + type RequiredInfoType = { [x in DBTypes]: InfoItem; }; @@ -19,11 +28,31 @@ const mysql: InfoType = { id: DBTypes.MYSQL, name: 'MySQL', moduleId: 'mysql', + machineList: [ + { + label: 'Proxy', + value: MachineTypes.MYSQL_PROXY, + }, + { + label: t('后端存储'), + value: MachineTypes.MYSQL_BACKEND, + }, + ], }, [DBTypes.TENDBCLUSTER]: { id: DBTypes.TENDBCLUSTER, name: 'TenDBCluster', moduleId: 'mysql', + machineList: [ + { + label: t('接入层Master'), + value: MachineTypes.TENDBCLUSTER_PROXY, + }, + { + label: t('后端存储'), + value: MachineTypes.TENDBCLUSTER_BACKEND, + }, + ], }, }; const redis: InfoType = { @@ -31,6 +60,32 @@ const redis: InfoType = { id: DBTypes.REDIS, name: 'Redis', moduleId: 'redis', + machineList: [ + { + label: 'Proxy', + value: MachineTypes.REDIS_PROXY, + }, + { + label: t('TendisCache/RedisCluster/Redis主从 后端存储'), + value: MachineTypes.REDIS_TENDIS_CACHE, + }, + { + label: t('TendisSSD后端存储'), + value: MachineTypes.REDIS_TENDIS_SSD, + }, + { + label: t('TendisPlus后端存储'), + value: MachineTypes.REDIS_TENDIS_PLUS, + }, + // { + // label: 'RedisCluster', + // value: MachineTypes.REDIS_CLUSTER, // 合入 REDIS_TENDIS_CACHE except 部署方案维持 + // }, + // { + // label: t('Redis主从'), + // value: MachineTypes.REDIS_INSTANCE, // 合入 REDIS_TENDIS_CACHE + // }, + ], }, }; const mongo: InfoType = { @@ -38,6 +93,20 @@ const mongo: InfoType = { id: DBTypes.MONGODB, name: 'MongoDB', moduleId: 'mongodb', + machineList: [ + { + label: 'ConfigSvr', + value: MachineTypes.MONGO_CONFIG, + }, + { + label: 'Mongos', + value: MachineTypes.MONGOS, + }, + { + label: t('副本集/ShardSvr'), + value: MachineTypes.MONGODB, + }, + ], }, }; const sqlserver: InfoType = { @@ -45,6 +114,12 @@ const sqlserver: InfoType = { id: DBTypes.SQLSERVER, name: 'SQLServer', moduleId: 'sqlserver', + machineList: [ + { + label: t('后端存储'), + value: MachineTypes.SQLSERVER, + }, + ], }, }; const bigdata: InfoType = { @@ -52,36 +127,97 @@ const bigdata: InfoType = { id: DBTypes.ES, name: 'ElasticSearch', moduleId: 'bigdata', + machineList: [ + { + label: t('Master节点'), + value: MachineTypes.ES_MASTER, + }, + { + label: t('Client节点'), + value: MachineTypes.ES_CLIENT, + }, + { + label: t('冷_热节点'), + value: MachineTypes.ES_DATANODE, + }, + ], }, [DBTypes.KAFKA]: { id: DBTypes.KAFKA, name: 'Kafka', moduleId: 'bigdata', + machineList: [ + { + label: t('Zookeeper节点'), + value: MachineTypes.KAFKA_ZOOKEEPER, + }, + { + label: t('Broker节点'), + value: MachineTypes.KAFKA_BROKER, + }, + ], }, [DBTypes.HDFS]: { id: DBTypes.HDFS, name: 'HDFS', moduleId: 'bigdata', + machineList: [ + { + label: t('DataNode节点'), + value: MachineTypes.HDFS_DATANODE, + }, + { + label: t('NameNode_Zookeeper_JournalNode节点'), + value: MachineTypes.HDFS_MASTER, + }, + ], }, [DBTypes.INFLUXDB]: { id: DBTypes.INFLUXDB, name: 'InfuxDB', moduleId: 'bigdata', + machineList: [ + { + label: t('后端存储'), + value: MachineTypes.INFLUXDB, + }, + ], }, [DBTypes.RIAK]: { id: DBTypes.RIAK, name: 'Riak', moduleId: 'bigdata', + machineList: [ + { + label: t('后端存储'), + value: MachineTypes.RIAK, + }, + ], }, [DBTypes.PULSAR]: { id: DBTypes.PULSAR, name: 'Pulsar', moduleId: 'bigdata', + machineList: [ + { + label: t('Bookkeeper节点'), + value: MachineTypes.PULSAR_BOOKKEEPER, + }, + { + label: t('Zookeeper节点'), + value: MachineTypes.PULSAR_ZOOKEEPER, + }, + { + label: t('Broker节点'), + value: MachineTypes.PULSAR_BROKER, + }, + ], }, [DBTypes.DORIS]: { id: DBTypes.DORIS, name: 'Doris', moduleId: 'bigdata', + machineList: [], }, }; export const DBTypeInfos = { diff --git a/dbm-ui/frontend/src/common/const/machineTypes.ts b/dbm-ui/frontend/src/common/const/machineTypes.ts index 800e06123e..3723848abc 100644 --- a/dbm-ui/frontend/src/common/const/machineTypes.ts +++ b/dbm-ui/frontend/src/common/const/machineTypes.ts @@ -4,61 +4,65 @@ // mysql export enum MachineTypes { - BACKEND = 'backend', - PROXY = 'proxy', - SINGLE = 'single', + MYSQL_PROXY = 'proxy', // Proxy + MYSQL_BACKEND = 'backend', // 后端存储 + // SINGLE = 'single', } // spider export enum MachineTypes { - SPIDER = 'spider', - REMOTE = 'remote', + // SPIDER = 'spider', + // REMOTE = 'remote', + TENDBCLUSTER_PROXY = 'proxy', // 接入层Master + TENDBCLUSTER_BACKEND = 'backend', // 后端存储 } // redis export enum MachineTypes { - TENDISCACHE = 'tendiscache', - TENDISSSD = 'tendisssd', - TENDISPLUS = 'tendisplus', - TWEMPROXY = 'twemproxy', - PREDIXY = 'predixy', + 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', - MONGODB = 'mongodb', - MONGO_CONFIG = 'mongo_config', + MONGOS = 'mongos', // Mongos + MONGODB = 'mongodb', // 副本集/ShardSvr + MONGO_CONFIG = 'mongo_config', // ConfigSvr } // sqlserver export enum MachineTypes { - SQLSERVER_HA = 'sqlserver_ha', - SQLSERVER_SINGLE = 'sqlserver_single', + // SQLSERVER_HA = 'sqlserver_ha', + // SQLSERVER_SINGLE = 'sqlserver_single', + SQLSERVER = 'sqlserver', // 后端存储 } // kefka export enum MachineTypes { - BROKER = 'broker', - ZOOKEEPER = 'zookeeper', + KAFKA_BROKER = 'broker', // Broker节点 + KAFKA_ZOOKEEPER = 'zookeeper', // Zookeeper节点 } // es export enum MachineTypes { - ES_DATANODE = 'es_datanode', - ES_MASTER = 'es_master', - ES_CLIENT = 'es_client', + ES_DATANODE = 'es_datanode', // 冷/热节点 + ES_MASTER = 'es_master', // Master节点 + ES_CLIENT = 'es_client', // Client节点 } // hdfs export enum MachineTypes { - HDFS_MASTER = 'hdfs_master', - HDFS_DATANODE = 'hdfs_datanode', + HDFS_MASTER = 'hdfs_master', // NameNode/Zookeeper/JournalNode节点 + HDFS_DATANODE = 'hdfs_datanode', // DataNode节点 } // pulsar export enum MachineTypes { - PULSAR_BROKER = 'pulsar_broker', - PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', - PULSAR_ZOOKEEPER = 'pulsar_zookeeper', + PULSAR_BROKER = 'pulsar_broker', // Broker节点 + PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', // Bookkeeper节点 + PULSAR_ZOOKEEPER = 'pulsar_zookeeper', // Zookeeper节点 } // influxdb export enum MachineTypes { - INFLUXDB = 'influxdb', + INFLUXDB = 'influxdb', // 后端存储 } // riak export enum MachineTypes { - RIAK = 'riak', + RIAK = 'riak', // 后端存储 } diff --git a/dbm-ui/frontend/src/components/render-table/columns/input/index.vue b/dbm-ui/frontend/src/components/render-table/columns/input/index.vue index a4aec95275..89605fff0c 100644 --- a/dbm-ui/frontend/src/components/render-table/columns/input/index.vue +++ b/dbm-ui/frontend/src/components/render-table/columns/input/index.vue @@ -38,7 +38,7 @@ @paste="handlePaste"> @@ -72,17 +72,19 @@ pasteFn?: (value: string) => string; } + type ValueType = string | number; + interface Emits { - (e: 'blur', value: string): void; - (e: 'input', value: string): void; - (e: 'submit', value: string): void; + (e: 'blur', value: ValueType): void; + (e: 'input', value: ValueType): void; + (e: 'submit', value: ValueType): void; (e: 'error', result: boolean): void; (e: 'focus'): void; (e: 'clear'): void; } interface Exposes { - getValue: () => Promise; + getValue: () => Promise; validator: () => Promise; focus: () => void; } @@ -102,7 +104,7 @@ const emits = defineEmits(); - const modelValue = defineModel({ + const modelValue = defineModel({ default: '', }); @@ -111,7 +113,7 @@ const isPassword = computed(() => props.type === 'password'); - let oldInputText = ''; + let oldInputText = '' as ValueType; const { message: errorMessage, validator } = useValidtor(props.rules); diff --git a/dbm-ui/frontend/src/locales/en.json b/dbm-ui/frontend/src/locales/en.json index c44980d59c..93281073e4 100644 --- a/dbm-ui/frontend/src/locales/en.json +++ b/dbm-ui/frontend/src/locales/en.json @@ -1295,7 +1295,7 @@ "克隆规格": "Clone specification", "内存(G)": "Memory(G)", "再提一单": "Submit another new ticket", - "冷_热节点规格": "Cold/Hot node specification", + "冷_热节点": "Cold/Hot node specification", "匹配目标容量": "Match target capacity", "后端存储机型": "Backend storage specification", "后端存储资源规格": "Backend storage Specification", diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 88f5b6ff09..37b7981a1a 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -351,7 +351,6 @@ "访问DB": "访问 DB", "访问源预览": "访问源预览", "旧从库主机": "旧从库主机", - "新从库主机": "新从库主机", "备份源": "备份源", "目标从库实例": "目标从库实例", "请输入域名_集群名称_所属DB模块": "请输入域名,集群名称,所属DB模块", @@ -1337,8 +1336,8 @@ "Bookkeeper节点规格": "Bookkeeper 节点规格", "Master节点规格": "Master 节点规格", "Client节点规格": "Client 节点规格", - "冷_热节点规格": "冷/热节点规格", - "NameNode_Zookeeper_JournalNode节点规格": "NameNode/Zookeeper/JournalNode 节点规格", + "冷_热节点": "冷/热节点", + "NameNode_Zookeeper_JournalNode节点": "NameNode/Zookeeper/JournalNode 节点", "确认删除以下规格": "确认删除以下规格?", "Pulsar集群管理": "【Pulsar】集群管理", "InfluxDB实例详情": "InfluxDB 实例详情", @@ -2690,7 +2689,6 @@ "保留索引": "保留索引", "删除索引": "删除索引", "索引处理": "索引处理", - "备份保存时间": "备份保存时间", "备份方式": "备份方式", "当前Shard节点规格": "当前 Shard 节点规格", "当前Shard节点数": "当前 Shard 节点数", @@ -3176,7 +3174,6 @@ "目标Proxy主机重复": "目标Proxy主机重复", "目标实例": "目标实例", "关联集群": "关联集群", - "缩容数量(台)": "缩容数量(台)", "自动匹配": "自动匹配", "Master 主机": "Master 主机", "缩容后不能少于2台": "缩容后不能少于2台", @@ -3460,7 +3457,6 @@ "整型(int)": "整型(int)", "整型(bigint)": "整型(bigint)", "新proxy主机": "新proxy主机", - "必须要能除尽总分片数": "必须要能除尽总分片数", "开启弱密码检测": "开启弱密码检测", "开启后,不允许超过 x 位连续字符,如出现以下示例密码将无法通过检测": "开启后,不允许超过 {x} 位连续字符,如出现以下示例密码将无法通过检测", "连续键盘序_如_xx": "连续键盘序,如:{0}", @@ -3488,7 +3484,6 @@ "【MongoDB】分片集群管理": "【MongoDB】分片集群管理", "请至少选择一种类型": "请至少选择一种类型", "如忽略,有连接的情况下也会执行强制升级": "如忽略,有连接的情况下也会执行强制升级", - "库表名支持数字、字母、中划线、下划线,最大64字符": "库表名支持数字、字母、中划线、下划线,最大64字符", "暂不支持 use 语句,请使用 db.table 指定 database": "暂不支持 use 语句,请使用 db.table 指定 database", "请添加账号规则": "请添加账号规则", "请指定特殊字符": "请指定特殊字符", @@ -3582,7 +3577,6 @@ "机器类型": "机器类型", "Proxy数量不足,至少 2 台": "Proxy数量不足,至少 2 台", "忽略DB名、忽略表名要么同时为空, 要么同时不为空": "忽略DB名、忽略表名要么同时为空, 要么同时不为空", - "至多n台": "至多n台", "同一个副本集,一次只能替换一个节点": "同一个副本集,一次只能替换一个节点", "同一个分片集群,config一次只能替换一个节点": "同一个分片集群,config一次只能替换一个节点", "config一次只能替换一个节点": "config一次只能替换一个节点", @@ -3592,5 +3586,16 @@ "ShardSvr 名称": "ShardSvr 名称", "回档至指定时间": "回档至指定时间", "待替换的主机 ": "待替换的主机", + "后端存储": "后端存储", + "TendisCache后端存储": "TendisCache 后端存储", + "TendisSSD后端存储": "TendisSSD 后端存储", + "TendisPlus后端存储": "TendisPlus 后端存储", + "DataNode节点": "DataNode 节点", + "副本集/ShardSvr": "副本集/ShardSvr", + "必须要能除尽总分片数": "必须要能除尽总分片数", + "变更机器组数": "变更机器组数", + "CPU/内存": "CPU/内存", + "添加机型": "添加机型", + "TendisCache/RedisCluster/Redis主从 后端存储": "TendisCache/RedisCluster/Redis主从 后端存储", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts b/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts index 61422ca573..30692db00f 100644 --- a/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts +++ b/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts @@ -117,6 +117,6 @@ export default class DbResource { if (!this.resource_type || this.resource_type === 'PUBLIC') { return t('通用'); } - return DBTypeInfos[this.resource_type as DBTypes].name; + return DBTypeInfos[this.resource_type as DBTypes]?.name; } } diff --git a/dbm-ui/frontend/src/services/model/db-resource/summary.ts b/dbm-ui/frontend/src/services/model/db-resource/summary.ts index 9b03cc2f0e..945a61bada 100644 --- a/dbm-ui/frontend/src/services/model/db-resource/summary.ts +++ b/dbm-ui/frontend/src/services/model/db-resource/summary.ts @@ -11,7 +11,7 @@ * the specific language governing permissions and limitations under the License. */ -import { clusterTypeInfos, ClusterTypes, MachineTypes } from '@common/const'; +import { DBTypeInfos, DBTypes, MachineTypes } from '@common/const'; export default class Summary { dedicated_biz: number; @@ -19,7 +19,7 @@ export default class Summary { city: string; spec_id?: number; spec_name?: string; - spec_cluster_type?: ClusterTypes; + spec_cluster_type?: DBTypes; spec_machine_type?: MachineTypes; device_class?: string; disk_summary?: { @@ -66,9 +66,12 @@ export default class Summary { if (!this.spec_cluster_type || !this.spec_machine_type) { return '--'; } - const { name, machineList } = clusterTypeInfos[this.spec_cluster_type]; - const matchMachine = machineList.find(({ id }) => id === this.spec_machine_type); - return matchMachine ? `${name} - ${matchMachine.name}` : '--'; + const { name, machineList } = DBTypeInfos[this.spec_cluster_type] || { + name: '', + machineList: [], + }; + const matchMachine = machineList.find(({ value }) => value === this.spec_machine_type); + return matchMachine ? `${name} - ${matchMachine.label}` : '--'; } get subzoneDetailDisplay() { diff --git a/dbm-ui/frontend/src/services/source/dbresourceResource.ts b/dbm-ui/frontend/src/services/source/dbresourceResource.ts index 39ab16639e..a02bbbae5c 100644 --- a/dbm-ui/frontend/src/services/source/dbresourceResource.ts +++ b/dbm-ui/frontend/src/services/source/dbresourceResource.ts @@ -32,8 +32,31 @@ export function removeResource(params: { bk_host_ids: number[] }) { /** * 获取机型列表 */ -export function fetchDeviceClass() { - return http.get(`${path}/get_device_class/`); +export function fetchDeviceClass(params: { offset?: number; limit?: number; name?: string }) { + return http.post< + ListBase< + { + capacity_flag: number; // 容量标志 + comment: string; // 评论 + cpu: number; // CPU 核心数 + disk: number; // 磁盘大小 (GB) + enable_apply: boolean; // 是否启用申请 + enable_capacity: boolean; // 是否启用容量 + id: number; // 设备唯一标识 + label: { + device_group: string; // 设备组 + device_size: string; // 设备大小 + }; + mem: number; // 内存大小 (GB) + region: string; // 区域 + require_type: number; // 需求类型 + remark: string; // 备注 + score: number; // 评分 + zone: string; // 可用区 + device_type: string; // 设备类型 + }[] + > + >(`${path}/get_device_class/`, params); } /** diff --git a/dbm-ui/frontend/src/types/auto-imports.d.ts b/dbm-ui/frontend/src/types/auto-imports.d.ts index 7021ac5101..d0c217f6f1 100644 --- a/dbm-ui/frontend/src/types/auto-imports.d.ts +++ b/dbm-ui/frontend/src/types/auto-imports.d.ts @@ -71,6 +71,6 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' import('vue') } diff --git a/dbm-ui/frontend/src/views/db-manage/common/apply-items/BackendQPSSpec.vue b/dbm-ui/frontend/src/views/db-manage/common/apply-items/BackendQPSSpec.vue index b2a59862b6..8812b03500 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/apply-items/BackendQPSSpec.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/apply-items/BackendQPSSpec.vue @@ -108,7 +108,7 @@ :biz-id="bizId" :cloud-id="cloudId" :cluster-type="ClusterTypes.TENDBCLUSTER" - machine-type="remote" + machine-type="backend" style="width: 314px" /> {{ t('可用主机数') }}: {{ item.count ?? 0 }} -
- CPU: - ({{ item.cpu.min }} ~ {{ item.cpu.max }}) {{ t('核') }} -
-
- {{ t('内存') }}: - ({{ item.mem.min }} ~ {{ item.mem.max }}) G + +
+ {{ t('机型') }}: + + {{ item.device_class.length > 0 ? item.device_class.join(',') : t('无限制') }} +
0) { isTableLoading.value = true; const params = { - // spec_cluster_type: 'MongoShardedCluster', - spec_cluster_type: props.data.clusterType, + spec_cluster_type: 'mongodb', spec_machine_type: 'mongodb', capacity: capacityNeed.value, shard_num: props.data.shardNum, diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue index 87a1fa83bd..43deab9bd3 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue @@ -71,7 +71,7 @@ import { getFilterClusterSpec } from '@services/source/dbresourceSpec'; import { - ClusterTypes, + DBTypes, MachineTypes, } from '@common/const'; @@ -98,7 +98,6 @@ shardNodeCount?: number, isApply?: boolean originSpecId?: number | string - clusterType: ClusterTypes.MONGO_REPLICA_SET | ClusterTypes.MONGO_SHARED_CLUSTER } interface Emits { @@ -339,7 +338,7 @@ } getFilterClusterSpecRun({ - spec_cluster_type: props.clusterType, + spec_cluster_type: DBTypes.MONGODB, spec_machine_type: MachineTypes.MONGODB, capacity: Number(modelValue.value.capacity), shard_num: props.shardNum, diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/db-replace/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/db-replace/pages/page1/components/Row.vue index eb3ecca849..c4c4a31135 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/db-replace/pages/page1/components/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/db-replace/pages/page1/components/Row.vue @@ -191,7 +191,7 @@ ([clusterType, machineType]) => { if (clusterType && machineType) { fetchResourceSpecList({ - spec_cluster_type: clusterType, + spec_cluster_type: 'mongodb', spec_machine_type: machineType, limit: -1, offset: 0, diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue index 46ead8fad5..1a519a4aec 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue @@ -23,7 +23,7 @@ v-model="moduleValue" :biz-id="3" :cloud-id="0" - :cluster-type="clusterType" + cluster-type="mongodb" machine-type="mongodb" :show-refresh="false" />
diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue index eb470ccac6..f598d65b51 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue @@ -116,7 +116,7 @@ useRequest(getResourceSpecList, { defaultParams: [ { - spec_cluster_type: 'MongoShardedCluster', + spec_cluster_type: 'mongodb', spec_machine_type: 'mongos', limit: -1, offset: 0, diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue index 1f7944d889..50e76015af 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue @@ -127,7 +127,7 @@ :biz-id="formData.bk_biz_id" :city="formData.details.city_code" :cloud-id="formData.details.bk_cloud_id" - :cluster-type="ClusterTypes.MONGO_REPLICA_SET" + :cluster-type="DBTypes.MONGODB" :machine-type="MachineTypes.MONGODB" style="width: 314px" /> diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-apply/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-apply/Index.vue index d1e09f537c..9239c01213 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-apply/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-apply/Index.vue @@ -87,7 +87,7 @@ :biz-id="formData.bk_biz_id" :city="formData.details.city_code" :cloud-id="formData.details.bk_cloud_id" - :cluster-type="ClusterTypes.MONGO_SHARED_CLUSTER" + :cluster-type="DBTypes.MONGODB" :machine-type="MachineTypes.MONGO_CONFIG" style="width: 314px" /> @@ -117,7 +117,7 @@ :biz-id="formData.bk_biz_id" :city="formData.details.city_code" :cloud-id="formData.details.bk_cloud_id" - :cluster-type="ClusterTypes.MONGO_SHARED_CLUSTER" + :cluster-type="DBTypes.MONGODB" :machine-type="MachineTypes.MONGOS" style="width: 314px" /> diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/apply/ApplyMySQL.vue b/dbm-ui/frontend/src/views/db-manage/mysql/apply/ApplyMySQL.vue index 3c16007991..fbc6b4844a 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/apply/ApplyMySQL.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/apply/ApplyMySQL.vue @@ -283,8 +283,8 @@ :biz-id="formdata.bk_biz_id" :city="formdata.details.city_code" :cloud-id="formdata.details.bk_cloud_id" - :cluster-type="ClusterTypes.TENDBSINGLE" - machine-type="single" + cluster-type="mysql" + machine-type="backend" style="width: 435px" />