From befed7ad259f6fa5a29104db2a29988a163b477f Mon Sep 17 00:00:00 2001 From: chenwenchang <479999519@qq.com> Date: Thu, 26 Sep 2024 15:42:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E8=B5=84=E6=BA=90=E6=B1=A0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=A7=86=E5=9B=BE=20#6519?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/frontend/package.json | 3 +- .../src/common/const/clusterTypeInfos.ts | 193 ++++++++- .../frontend/src/common/const/dbTypeInfos.ts | 4 +- .../frontend/src/common/const/machineTypes.ts | 57 ++- dbm-ui/frontend/src/locales/en.json | 6 +- dbm-ui/frontend/src/locales/zh-cn.json | 20 + .../services/model/db-resource/DbResource.ts | 28 +- .../src/services/model/db-resource/summary.ts | 69 ++++ .../model/resource-spec/resourceSpec.ts | 8 +- .../src/services/source/dbresourceResource.ts | 46 ++- dbm-ui/frontend/src/services/source/infras.ts | 14 + .../components/table/Index.vue | 28 +- .../quick-search/components/ResourcePool.vue | 43 +- .../src/views/resource-manage/pool/Index.vue | 374 +++-------------- .../com-factory/components/City.vue | 56 --- .../com-factory/components/SpecId.vue | 382 ------------------ .../com-factory/components/Subzones.vue | 68 ---- .../resource-manage/pool/host-list/Index.vue | 343 ++++++++++++++++ .../components/ImportHostBtn.vue | 0 .../components/RenderTable.vue | 68 ++-- .../components/batch-setting/Index.vue | 75 ++-- .../components/ResourceSpecStorage.vue | 0 .../components/import-host/Index.vue | 4 +- .../import-host/components/FormPanel.vue | 81 ++-- .../components/select-host-panel/Index.vue | 0 .../components/HostEmpty.vue | 0 .../components/search-box/Index.vue | 78 ++-- .../components/com-factory/Index.vue | 18 +- .../com-factory/components/AgentStatus.vue | 0 .../com-factory/components/BkCloudIds.vue | 0 .../com-factory/components/CitySubzones.vue | 119 ++++++ .../components/com-factory/components/Cpu.vue | 0 .../com-factory/components/DeviceClass.vue | 0 .../com-factory/components/Disk.vue | 0 .../com-factory/components/DiskType.vue | 14 +- .../com-factory/components/ForBiz.vue} | 65 +-- .../com-factory/components/Hosts.vue | 0 .../components/com-factory/components/Mem.vue | 0 .../com-factory/components/MountPoint.vue | 0 .../com-factory/components/OSType.vue | 0 .../com-factory/components/ResourceType.vue} | 50 ++- .../com-factory/components/SpecId.vue | 175 ++++++++ .../search-box/components/field-config.ts | 44 +- .../components/field-input/Index.vue | 24 +- .../components/CollectSearchParams.vue | 2 +- .../search-box/components/field-tag/Index.vue | 0 .../components/field-tag/ValueTag.vue | 0 .../components/search-box/components/utils.ts | 4 +- .../{ => host-list}/hooks/useTableSetting.ts | 12 +- .../pool/summary-view/Index.vue | 9 + .../pool/summary-view/components/BarChart.vue | 135 +++++++ .../components/DimensionSelect.vue | 119 ++++++ .../pool/summary-view/components/Export.vue | 83 ++++ .../pool/summary-view/components/List.vue | 198 +++++++++ .../components/search-box/Index.vue | 120 ++++++ .../components/search-box/components/Biz.vue | 67 +++ .../components/search-box/components/Db.vue | 65 +++ .../search-box/components/Region.vue | 114 ++++++ .../components/search-box/components/Spec.vue | 138 +++++++ .../src/views/resource-manage/routes.ts | 3 +- .../src/views/resource-manage/spec/Index.vue | 296 +------------- 61 files changed, 2462 insertions(+), 1460 deletions(-) create mode 100644 dbm-ui/frontend/src/services/model/db-resource/summary.ts delete mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/City.vue delete mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/SpecId.vue delete mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Subzones.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/host-list/Index.vue rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/ImportHostBtn.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/RenderTable.vue (93%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/batch-setting/Index.vue (79%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/batch-setting/components/ResourceSpecStorage.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/import-host/Index.vue (97%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/import-host/components/FormPanel.vue (87%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/import-host/components/select-host-panel/Index.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/import-host/components/select-host-panel/components/HostEmpty.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/Index.vue (70%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/Index.vue (91%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/AgentStatus.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/BkCloudIds.vue (100%) create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/CitySubzones.vue rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Cpu.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/DeviceClass.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Disk.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/DiskType.vue (89%) rename dbm-ui/frontend/src/views/resource-manage/pool/{components/search-box/components/com-factory/components/ForBizs.vue => host-list/components/search-box/components/com-factory/components/ForBiz.vue} (67%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Hosts.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Mem.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/MountPoint.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/OSType.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{components/search-box/components/com-factory/components/ResourceTypes.vue => host-list/components/search-box/components/com-factory/components/ResourceType.vue} (72%) create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/SpecId.vue rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-config.ts (86%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-input/Index.vue (95%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-input/components/CollectSearchParams.vue (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-tag/Index.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-tag/ValueTag.vue (100%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/utils.ts (62%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/hooks/useTableSetting.ts (93%) create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/Index.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/BarChart.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/DimensionSelect.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/Export.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/List.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/search-box/Index.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/search-box/components/Biz.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/search-box/components/Db.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/search-box/components/Region.vue create mode 100644 dbm-ui/frontend/src/views/resource-manage/pool/summary-view/components/search-box/components/Spec.vue diff --git a/dbm-ui/frontend/package.json b/dbm-ui/frontend/package.json index 396751294d..2e8b9e5959 100644 --- a/dbm-ui/frontend/package.json +++ b/dbm-ui/frontend/package.json @@ -30,6 +30,7 @@ "bkui-vue": "2.0.1-beta.74", "date-fns": "3.6.0", "dayjs": "^1.11.13", + "echarts": "^5.5.1", "html-to-image": "1.11.11", "js-cookie": "3.0.5", "jsencrypt": "3.3.2", @@ -49,7 +50,7 @@ "vue-router": "^4.4.5", "vue-types": "^5.1.3", "vuedraggable": "4.1.0", - "xlsx": "0.18.5" + "xlsx": "^0.18.5" }, "devDependencies": { "@commitlint/config-conventional": "^19.5.0", diff --git a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts index a5e450ba8e..85d7eedf73 100644 --- a/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts +++ b/dbm-ui/frontend/src/common/const/clusterTypeInfos.ts @@ -4,18 +4,23 @@ import { t } from '@locales/index'; import { ClusterTypes } from './clusterTypes'; import { DBTypes } from './dbTypes'; +import { MachineTypes } from './machineTypes'; -interface InfoItem { +export interface ClusterTypeInfoItem { id: ClusterTypes; name: string; dbType: DBTypes; moduleId: ExtractedControllerDataKeys; + machineList: { + id: MachineTypes; + name: string; + }[]; } type InfoType = { - [x in ClusterTypes]?: InfoItem; + [x in ClusterTypes]?: ClusterTypeInfoItem; }; type RequiredInfoType = { - [x in ClusterTypes]: InfoItem; + [x in ClusterTypes]: ClusterTypeInfoItem; }; const mysql: InfoType = { @@ -24,18 +29,47 @@ const mysql: InfoType = { name: t('MySQL单节点'), dbType: DBTypes.MYSQL, moduleId: 'mysql', + machineList: [ + { + id: MachineTypes.SINGLE, + name: t('后端存储机型'), + }, + ], }, [ClusterTypes.TENDBHA]: { id: ClusterTypes.TENDBHA, name: t('MySQL主从'), dbType: DBTypes.MYSQL, moduleId: 'mysql', + machineList: [ + { + id: MachineTypes.BACKEND, + name: t('后端存储机型'), + }, + { + id: MachineTypes.PROXY, + name: t('Proxy机型'), + }, + ], }, +}; + +const spider: InfoType = { [ClusterTypes.TENDBCLUSTER]: { id: ClusterTypes.TENDBCLUSTER, name: 'TenDBCluster', - dbType: DBTypes.MYSQL, + dbType: DBTypes.TENDBCLUSTER, moduleId: 'mysql', + machineList: [ + { + id: MachineTypes.SPIDER, + name: t('接入层Master'), + }, + { + id: MachineTypes.REMOTE, + name: t('后端存储规格'), + }, + ], }, }; @@ -45,90 +79,198 @@ const redis: InfoType = { name: 'TendisCache', dbType: DBTypes.REDIS, moduleId: 'redis', + machineList: [ + { + id: MachineTypes.TENDISCACHE, + name: t('后端存储机型'), + }, + { + id: MachineTypes.TWEMPROXY, + name: t('Proxy机型'), + }, + ], }, [ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE]: { id: ClusterTypes.TWEMPROXY_TENDIS_SSD_INSTANCE, name: 'TendisSSD', dbType: DBTypes.REDIS, moduleId: 'redis', + machineList: [ + { + id: MachineTypes.TENDISSSD, + name: t('后端存储机型'), + }, + { + id: MachineTypes.TWEMPROXY, + name: t('Proxy机型'), + }, + ], }, [ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER]: { id: ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER, name: 'Tendisplus', dbType: DBTypes.REDIS, moduleId: 'redis', + machineList: [ + { + id: MachineTypes.TENDISPLUS, + name: t('后端存储机型'), + }, + { + id: MachineTypes.PREDIXY, + name: t('Proxy机型'), + }, + ], }, [ClusterTypes.PREDIXY_REDIS_CLUSTER]: { id: ClusterTypes.PREDIXY_REDIS_CLUSTER, name: 'RedisCluster', dbType: DBTypes.REDIS, moduleId: 'redis', + machineList: [ + { + id: MachineTypes.TENDISCACHE, + name: t('后端存储机型'), + }, + { + id: MachineTypes.PREDIXY, + name: t('Proxy机型'), + }, + ], }, [ClusterTypes.REDIS_INSTANCE]: { id: ClusterTypes.REDIS_INSTANCE, name: t('Redis主从'), dbType: DBTypes.REDIS, moduleId: 'redis', + machineList: [ + { + id: MachineTypes.TENDISCACHE, + name: t('后端存储机型'), + }, + ], }, }; const bigdata: InfoType = { [ClusterTypes.ES]: { id: ClusterTypes.ES, - name: 'ES', + name: 'ElasticSearch', dbType: DBTypes.ES, moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.ES_MASTER, + name: t('Master节点规格'), + }, + { + id: MachineTypes.ES_CLIENT, + name: t('Client节点规格'), + }, + { + id: MachineTypes.ES_DATANODE, + name: t('冷_热节点规格'), + }, + ], }, [ClusterTypes.KAFKA]: { id: ClusterTypes.KAFKA, name: 'Kafka', dbType: DBTypes.KAFKA, moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.ZOOKEEPER, + name: t('Zookeeper节点规格'), + }, + { + id: MachineTypes.BROKER, + name: t('Broker节点规格'), + }, + ], }, [ClusterTypes.HDFS]: { id: ClusterTypes.HDFS, name: 'HDFS', dbType: DBTypes.HDFS, moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.HDFS_DATANODE, + name: t('DataNode节点规格'), + }, + { + id: MachineTypes.HDFS_MASTER, + name: t('NameNode_Zookeeper_JournalNode节点规格'), + }, + ], }, [ClusterTypes.INFLUXDB]: { id: ClusterTypes.INFLUXDB, name: 'InfuxDB', dbType: DBTypes.INFLUXDB, moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.INFLUXDB, + name: t('后端存储机型'), + }, + ], }, [ClusterTypes.PULSAR]: { id: ClusterTypes.PULSAR, name: 'Pulsar', dbType: DBTypes.PULSAR, moduleId: 'bigdata', - }, - [ClusterTypes.RIAK]: { - id: ClusterTypes.RIAK, - name: 'Riak', - dbType: DBTypes.RIAK, - moduleId: 'bigdata', - }, - [ClusterTypes.DORIS]: { - id: ClusterTypes.DORIS, - name: 'Dodis', - dbType: DBTypes.DORIS, - moduleId: 'bigdata', + machineList: [ + { + id: MachineTypes.PULSAR_BOOKKEEPER, + name: t('Bookkeeper节点规格'), + }, + { + id: MachineTypes.PULSAR_ZOOKEEPER, + name: t('Zookeeper节点规格'), + }, + { + id: MachineTypes.PULSAR_BROKER, + name: t('Broker节点规格'), + }, + ], }, }; -const mongo: InfoType = { +const mongodb: InfoType = { [ClusterTypes.MONGO_REPLICA_SET]: { id: ClusterTypes.MONGO_REPLICA_SET, name: t('Mongo副本集'), dbType: DBTypes.MONGODB, moduleId: 'mongodb', + machineList: [ + { + id: MachineTypes.MONGODB, + name: t('Mongodb规格'), + }, + ], }, [ClusterTypes.MONGO_SHARED_CLUSTER]: { id: ClusterTypes.MONGO_SHARED_CLUSTER, name: t('Mongo分片集'), dbType: DBTypes.MONGODB, moduleId: 'mongodb', + machineList: [ + { + id: MachineTypes.MONGOS, + name: t('Mongos规格'), + }, + { + id: MachineTypes.MONGODB, + name: t('ConfigSvr规格'), + }, + { + id: MachineTypes.MONGO_CONFIG, + name: t('ShardSvr规格'), + }, + ], }, }; @@ -138,12 +280,24 @@ const sqlserver: InfoType = { name: t('SQLServer单节点'), dbType: DBTypes.SQLSERVER, moduleId: 'sqlserver', + machineList: [ + { + id: MachineTypes.SQLSERVER_SINGLE, + name: t('单节点规格'), + }, + ], }, [ClusterTypes.SQLSERVER_HA]: { id: ClusterTypes.SQLSERVER_HA, name: t('SQLServer主从'), dbType: DBTypes.SQLSERVER, moduleId: 'sqlserver', + machineList: [ + { + id: MachineTypes.SQLSERVER_HA, + name: t('主从规格'), + }, + ], }, }; @@ -152,9 +306,10 @@ const sqlserver: InfoType = { */ export const clusterTypeInfos: RequiredInfoType = { ...mysql, + ...spider, ...redis, ...bigdata, - ...mongo, + ...mongodb, ...sqlserver, } as RequiredInfoType; export type ClusterTypeInfos = keyof typeof clusterTypeInfos; diff --git a/dbm-ui/frontend/src/common/const/dbTypeInfos.ts b/dbm-ui/frontend/src/common/const/dbTypeInfos.ts index dc4cd47cba..9eee2db5ee 100644 --- a/dbm-ui/frontend/src/common/const/dbTypeInfos.ts +++ b/dbm-ui/frontend/src/common/const/dbTypeInfos.ts @@ -50,7 +50,7 @@ const sqlserver: InfoType = { const bigdata: InfoType = { [DBTypes.ES]: { id: DBTypes.ES, - name: 'ES', + name: 'ElasticSearch', moduleId: 'bigdata', }, [DBTypes.KAFKA]: { @@ -84,7 +84,7 @@ const bigdata: InfoType = { moduleId: 'bigdata', }, }; -export const DBTypeInfos: RequiredInfoType = { +export const DBTypeInfos = { ...mysql, ...redis, ...mongo, diff --git a/dbm-ui/frontend/src/common/const/machineTypes.ts b/dbm-ui/frontend/src/common/const/machineTypes.ts index 3cad0dd538..800e06123e 100644 --- a/dbm-ui/frontend/src/common/const/machineTypes.ts +++ b/dbm-ui/frontend/src/common/const/machineTypes.ts @@ -1,47 +1,64 @@ /** * 机器类型 */ + +// mysql export enum MachineTypes { - SPIDER = 'spider', - REMOTE = 'remote', - PROXY = 'proxy', BACKEND = 'backend', + PROXY = 'proxy', SINGLE = 'single', - PREDIXY = 'predixy', - TWEMPROXY = 'twemproxy', - INFLUXDB = 'influxdb', - RIAK = 'riak', } +// spider +export enum MachineTypes { + SPIDER = 'spider', + REMOTE = 'remote', +} +// redis export enum MachineTypes { - REDIS = 'redis', TENDISCACHE = 'tendiscache', TENDISSSD = 'tendisssd', TENDISPLUS = 'tendisplus', + TWEMPROXY = 'twemproxy', + PREDIXY = 'predixy', } -export enum MachineTypes { - ES_DATANODE = 'es_datanode', - ES_MASTER = 'es_master', - ES_CLIENT = 'es_client', -} -export enum MachineTypes { - HDFS_MASTER = 'hdfs_master', - HDFS_DATANODE = 'hdfs_datanode', -} +// mongodb export enum MachineTypes { MONGOS = 'mongos', MONGODB = 'mongodb', MONGO_CONFIG = 'mongo_config', } +// sqlserver export enum MachineTypes { SQLSERVER_HA = 'sqlserver_ha', SQLSERVER_SINGLE = 'sqlserver_single', } +// kefka export enum MachineTypes { + BROKER = 'broker', ZOOKEEPER = 'zookeeper', - PULSAR_ZOOKEEPER = 'pulsar_zookeeper', - PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', } +// es +export enum MachineTypes { + ES_DATANODE = 'es_datanode', + ES_MASTER = 'es_master', + ES_CLIENT = 'es_client', +} +// hdfs +export enum MachineTypes { + HDFS_MASTER = 'hdfs_master', + HDFS_DATANODE = 'hdfs_datanode', +} +// pulsar export enum MachineTypes { - BROKER = 'broker', PULSAR_BROKER = 'pulsar_broker', + PULSAR_BOOKKEEPER = 'pulsar_bookkeeper', + PULSAR_ZOOKEEPER = 'pulsar_zookeeper', +} +// influxdb +export enum MachineTypes { + INFLUXDB = 'influxdb', +} +// riak +export enum MachineTypes { + RIAK = 'riak', } diff --git a/dbm-ui/frontend/src/locales/en.json b/dbm-ui/frontend/src/locales/en.json index 1d56985a0f..5aa731aa89 100644 --- a/dbm-ui/frontend/src/locales/en.json +++ b/dbm-ui/frontend/src/locales/en.json @@ -1292,8 +1292,6 @@ "Zookeeper节点规格": "Zookeeper node specifications", "不支持修改": "Cannot modify", "与目标容量不匹配": "Does not match the target capacity", - "专用 DB": "Specially for DB", - "专用业务": "Specially for business", "克隆": "Clone", "克隆规格": "Clone specification", "内存(G)": "Memory(G)", @@ -1388,8 +1386,8 @@ "请输入 IP 用,分割": "Please enter the IP to use, split", "请输入操作人或选择条件搜索": "Please enter the operator or select the criteria to search", "请选择 Agent 状态": "Please select an Agent Status", - "请选择专用 DB": "Please select a dedicated DB", - "请选择专用业务": "Please select a dedicated business", + "请选择所属DB类型": "Please select a dedicated DB", + "请选择所属业务": "Please select a dedicated business", "请选择城市": "Please choose the city", "请选择机型": "Please select a model", "请选择磁盘挂载点": "Please select a disk mount point", diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index d550a30814..c74a241450 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3436,5 +3436,25 @@ "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符": "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符", "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用": "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用", "复制所属集群": "复制所属集群", + "公共资源池": "公共资源池", + "统计视图": "统计视图", + "分布情况": "分布情况", + "规格类型": "规格类型", + "机型(硬盘)": "机型(硬盘)", + "CPU 内存": "CPU 内存", + "园区分布(台)": "园区分布(台)", + "地域 - 园区": "地域 - 园区", + "Mongo 分片集群": "Mongo 分片集群", + "所属DB类型": "所属DB类型", + "请选择所属业务": "请选择所属业务", + "请选择所属DB类型": "请选择所属DB类型", + "总数(台)": "总数(台)", + "聚合维度": "聚合维度", + "导出列表内容": "导出列表内容", + "数量(台)": "数量(台)", + "主机列表": "主机列表", + "所属业务 + 地域 + 规格": "所属业务 + 地域 + 规格", + "所属业务 + 地域 + 机型(硬盘)": "所属业务 + 地域 + 机型(硬盘)", + "主机数量 - 按DB类型统计": "主机数量 - 按DB类型统计", "这行勿动!新增翻译请在上一行添加!": "" } 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 7a703f2bc1..4a92f1c4eb 100644 --- a/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts +++ b/dbm-ui/frontend/src/services/model/db-resource/DbResource.ts @@ -11,8 +11,12 @@ * the specific language governing permissions and limitations under the License. */ +import { DBTypeInfos, DBTypes } from '@common/const'; + import { bytePretty } from '@utils'; +import { t } from '@locales/index'; + export default class DbResource { agent_status: number; asset_id: string; @@ -29,10 +33,10 @@ export default class DbResource { consume_time: string; create_time: string; device_class: string; - for_bizs: Array<{ + for_biz: { bk_biz_id: number; bk_biz_name: string; - }>; + }; ip: string; label: string; net_device_id: string; @@ -44,7 +48,7 @@ export default class DbResource { }; rack_id: string; raid: string; - resource_types: string[]; + resource_type: string; status: string; storage_device: { [key: string]: { @@ -75,7 +79,7 @@ export default class DbResource { this.consume_time = payload.consume_time; this.create_time = payload.create_time; this.device_class = payload.device_class; - this.for_bizs = payload.for_bizs || []; + this.for_biz = payload.for_biz; this.ip = payload.ip; this.label = payload.label; this.net_device_id = payload.net_device_id; @@ -85,7 +89,7 @@ export default class DbResource { this.permission = payload.permission; this.rack_id = payload.rack_id; this.raid = payload.raid; - this.resource_types = payload.resource_types || []; + this.resource_type = payload.resource_type; this.status = payload.status; this.storage_device = payload.storage_device || {}; this.sub_zone = payload.sub_zone; @@ -101,4 +105,18 @@ export default class DbResource { get isAbnormal() { return this.agent_status === 0; } + + get for_biz_display() { + if (this.for_biz.bk_biz_id === 0 || !this.for_biz.bk_biz_name) { + return t('公共资源池'); + } + return this.for_biz.bk_biz_name; + } + + get resource_type_display() { + if (!this.resource_type || this.resource_type === 'PUBLIC') { + return t('通用'); + } + 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 new file mode 100644 index 0000000000..e0d8da47dd --- /dev/null +++ b/dbm-ui/frontend/src/services/model/db-resource/summary.ts @@ -0,0 +1,69 @@ +/* + * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. + * + * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. + * + * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://opensource.org/licenses/MIT + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for + * the specific language governing permissions and limitations under the License. + */ + +import { clusterTypeInfos, ClusterTypes, MachineTypes } from '@common/const'; + +export default class Summary { + dedicated_biz: number; + for_biz_name: string; + city: string; + spec_id?: number; + spec_name?: string; + spec_cluster_type?: ClusterTypes; + spec_machine_type?: MachineTypes; + device_class?: string; + disk_summary?: string; + cpu_mem_summary?: string; + count: number; + sub_zone_detail: Record< + number, + { + name: string; + count: number; + } + >; + + constructor(payload = {} as Summary) { + this.dedicated_biz = payload.dedicated_biz; + this.for_biz_name = payload.for_biz_name; + this.city = payload.city; + this.spec_id = payload.spec_id; + this.spec_name = payload.spec_name; + this.spec_cluster_type = payload.spec_cluster_type; + this.spec_machine_type = payload.spec_machine_type; + this.device_class = payload.device_class; + this.disk_summary = payload.disk_summary; + this.cpu_mem_summary = payload.cpu_mem_summary; + this.count = payload.count; + this.sub_zone_detail = payload.sub_zone_detail; + } + + get deviceDisplay() { + return `${this.device_class} (${this.disk_summary})`; + } + + get specTypeDisplay() { + 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}` : '--'; + } + + get subzoneDetailDisplay() { + return `${Object.entries(this.sub_zone_detail) + .map(([zone, count]) => `${zone}: ${count}`) + .join(', ')};`; + } +} diff --git a/dbm-ui/frontend/src/services/model/resource-spec/resourceSpec.ts b/dbm-ui/frontend/src/services/model/resource-spec/resourceSpec.ts index 4217b007e6..61a2e7d899 100644 --- a/dbm-ui/frontend/src/services/model/resource-spec/resourceSpec.ts +++ b/dbm-ui/frontend/src/services/model/resource-spec/resourceSpec.ts @@ -12,6 +12,8 @@ */ import { differenceInSeconds } from 'date-fns'; +import type { ClusterTypes, DBTypes, MachineTypes } from '@common/const'; + import { utcDisplayTime } from '@utils'; export default class ResourceSpec { @@ -33,8 +35,9 @@ export default class ResourceSpec { creator: string; desc: string; enable: boolean; - spec_cluster_type: string; - spec_machine_type: string; + spec_db_type: DBTypes; + spec_cluster_type: ClusterTypes; + spec_machine_type: MachineTypes; spec_name: string; update_at: string; updater: string; @@ -60,6 +63,7 @@ export default class ResourceSpec { this.creator = payload.creator; this.desc = payload.desc; this.enable = payload.enable; + this.spec_db_type = payload.spec_db_type; this.spec_cluster_type = payload.spec_cluster_type; this.spec_machine_type = payload.spec_machine_type; this.spec_name = payload.spec_name; diff --git a/dbm-ui/frontend/src/services/source/dbresourceResource.ts b/dbm-ui/frontend/src/services/source/dbresourceResource.ts index 87b1a9617d..af3e7a28dc 100644 --- a/dbm-ui/frontend/src/services/source/dbresourceResource.ts +++ b/dbm-ui/frontend/src/services/source/dbresourceResource.ts @@ -13,8 +13,11 @@ import DbResourceModel from '@services/model/db-resource/DbResource'; import OperationModel from '@services/model/db-resource/Operation'; +import SummaryModel from '@services/model/db-resource/summary'; import type { HostInfo, ListBase } from '@services/types'; +import type { DBTypes } from '@common/const'; + import http, { type IRequestPayload } from '../http'; const path = '/apis/dbresource/resource'; @@ -47,19 +50,12 @@ export function fetchMountPoints() { return http.get(`${path}/get_mountpoints/`); } -/** - * 根据逻辑城市查询园区 - */ -export function fetchSubzones(params: { citys: string }) { - return http.get(`${path}/get_subzones/`, params); -} - /** * 资源池导入 */ export function importResource(params: { - for_bizs: number[]; - resource_types: string[]; + for_biz: number; + resource_type: string; hosts: Array<{ ip: string; host_id: number; @@ -169,9 +165,9 @@ export function getSpecResourceCount(params: { */ export function updateResource(params: { bk_host_ids: number[]; - for_bizs: number[]; + for_biz: number; rack_id: string; - resource_types: string[]; + resource_type: string; set_empty_biz: boolean; set_empty_resource_type: boolean; storage_device: Record; @@ -185,3 +181,31 @@ export function updateResource(params: { export function getOsTypeList(params: { offset?: number; limit?: number }) { return http.get(`${path}/get_os_types/`, params); } + +/** + * 按照组件统计资源数量 + */ +export function getGroupCount() { + return http.post<{ rs_type: string; count: number }[]>(`${path}/resource_group_count/`); +} + +/** + * 按照条件聚合资源统计 + */ +export function getSummaryList(params: { + group_by: string; + for_biz?: number; + city?: string; + sub_zones?: string[]; + spec_param: { + db_type: DBTypes; + machine_type?: string; + cluster_type?: string; + spec_id_list?: number[]; + }; +}) { + return http.get(`${path}/resource_summary/`, params).then((data) => ({ + count: data.length || 0, + results: data.map((item) => new SummaryModel(item)), + })); +} diff --git a/dbm-ui/frontend/src/services/source/infras.ts b/dbm-ui/frontend/src/services/source/infras.ts index 7974f14744..013abe8892 100644 --- a/dbm-ui/frontend/src/services/source/infras.ts +++ b/dbm-ui/frontend/src/services/source/infras.ts @@ -29,6 +29,20 @@ export function getInfrasCities() { >(`${path}/cities/`); } +/** + * 查询城市园区信息 + */ +export function getInfrasSubzonesByCity(params: { city_code: string }) { + return http.get< + { + bk_city: number; + bk_city_code: string; + bk_sub_zone_id: number; + bk_sub_zone: string; + }[] + >(`${path}/cities/list_subzones/`, params); +} + /** * redis 容量列表 */ diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/slave-rebuild/pages/page1/components/new-host/components/resource-pool-manual-selector/components/table/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/slave-rebuild/pages/page1/components/new-host/components/resource-pool-manual-selector/components/table/Index.vue index 170c5fc46f..9a13d5223f 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/slave-rebuild/pages/page1/components/new-host/components/resource-pool-manual-selector/components/table/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/slave-rebuild/pages/page1/components/new-host/components/resource-pool-manual-selector/components/table/Index.vue @@ -140,26 +140,16 @@ render: ({ data }: {data: DbResourceModel}) => , }, { - label: t('专用业务'), - field: 'for_bizs', + label: t('所属业务'), + field: 'for_biz', width: 170, - render: ({ data }: {data: DbResourceModel}) => { - if (data.for_bizs.length < 1) { - return t('无限制'); - } - return data.for_bizs.map(item => item.bk_biz_name).join(','); - }, + render: ({ data }: {data: DbResourceModel}) => data.for_biz.bk_biz_name || t('无限制'), }, { - label: t('专用 DB'), - field: 'resource_types', + label: t('所属DB类型'), + field: 'resource_type', width: 150, - render: ({ data }: {data: DbResourceModel}) => { - if (data.resource_types.length < 1) { - return t('无限制'); - } - return data.resource_types.join(','); - }, + render: ({ data }: {data: DbResourceModel}) => data.resource_type || t('无限制'), }, { label: t('机型'), @@ -208,14 +198,14 @@ fields: columns.filter(item => item.field).map(item => ({ label: item.label, field: item.field, - disabled: ['ip', 'for_bizs', 'resource_types'].includes(item.field as string), + disabled: ['ip', 'for_biz', 'resource_type'].includes(item.field as string), })), checked: [ 'ip', 'bk_cloud_name', 'agent_status', - 'for_bizs', - 'resource_types', + 'for_biz', + 'resource_type', ], size: 'small', }; diff --git a/dbm-ui/frontend/src/views/quick-search/components/ResourcePool.vue b/dbm-ui/frontend/src/views/quick-search/components/ResourcePool.vue index ee64259631..e367428712 100644 --- a/dbm-ui/frontend/src/views/quick-search/components/ResourcePool.vue +++ b/dbm-ui/frontend/src/views/quick-search/components/ResourcePool.vue @@ -85,15 +85,13 @@ const deviceClassSet = new Set(); props.data.forEach((dataItem) => { - dataItem.for_bizs.forEach((forBizItem) => { - if (!bizNameMap[forBizItem.bk_biz_id]) { - bizNameMap[forBizItem.bk_biz_id] = currentBizNameMap[forBizItem.bk_biz_id]; + if (!bizNameMap[dataItem.for_biz.bk_biz_id]) { + bizNameMap[dataItem.for_biz.bk_biz_id] = currentBizNameMap[dataItem.for_biz.bk_biz_id]; } - }); - dataItem.resource_types.forEach((resourceTypesItem) => { - resourceTypesSet.add(resourceTypesItem); - }); + if(dataItem.resource_type) { + resourceTypesSet.add(dataItem.resource_type); + } if (dataItem.device_class) { deviceClassSet.add(dataItem.device_class); @@ -162,8 +160,8 @@ render: ({ data }: { data: DbResourceModel }) => , }, { - label: t('专用业务'), - field: 'for_bizs', + label: t('所属业务'), + field: 'for_biz', width: 100, filter: { list: Object.entries(filterMap.value.bizNameMap).map(bizItem => ({ @@ -174,19 +172,14 @@ if (checked.length === 0) { return true; } - return checked.some(checkedItem => row.for_bizs.some(forBizItem => forBizItem.bk_biz_id === checkedItem)); + return checked.some(checkedItem => row.for_biz.bk_biz_id === checkedItem); }, }, - render: ({ data }: { data: DbResourceModel }) => { - if (data.for_bizs.length < 1) { - return t('无限制'); - } - return data.for_bizs.map(item => {item.bk_biz_name}); - }, + render: ({ data }: { data: DbResourceModel }) => data.for_biz.bk_biz_id ? {data.for_biz.bk_biz_name} : t('无限制'), }, { - label: t('专用DB'), - field: 'resource_types', + label: t('所属DB类型'), + field: 'resource_type', filter: { list: Array.from(filterMap.value.resourceTypesSet).map(resourceTypeItem => ({ value: resourceTypeItem, @@ -196,16 +189,10 @@ if (checked.length === 0) { return true; } - return checked.some(checkedItem => row.resource_types - .some(resourceTypeItem => resourceTypeItem === checkedItem)); + return checked.some(checkedItem => row.resource_type === checkedItem); }, }, - render: ({ data }: { data: DbResourceModel }) => { - if (data.resource_types.length < 1) { - return t('无限制'); - } - return data.resource_types.map(typeItem => {typeItem}); - }, + render: ({ data }: { data: DbResourceModel }) => data.resource_type ? {data.resource_type} : t('无限制'), }, { label: t('机型'), @@ -263,8 +250,8 @@ 'ip', 'bk_cloud_id', 'agent_status', - 'for_bizs', - 'resource_types', + 'for_biz', + 'resource_type', 'device_class', 'city', 'sub_zone', diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/Index.vue index 5dffe2d9ba..14a55b4b6b 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/Index.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/Index.vue @@ -12,346 +12,90 @@ --> - - diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/City.vue b/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/City.vue deleted file mode 100644 index d4d5a45249..0000000000 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/City.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/SpecId.vue b/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/SpecId.vue deleted file mode 100644 index 9f76911619..0000000000 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/SpecId.vue +++ /dev/null @@ -1,382 +0,0 @@ - - - - - diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Subzones.vue b/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Subzones.vue deleted file mode 100644 index 70fd2819e0..0000000000 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Subzones.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - - diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/Index.vue new file mode 100644 index 0000000000..586e5b1cef --- /dev/null +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/Index.vue @@ -0,0 +1,343 @@ + + + + + diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/ImportHostBtn.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/ImportHostBtn.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/ImportHostBtn.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/ImportHostBtn.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/RenderTable.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/RenderTable.vue similarity index 93% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/RenderTable.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/RenderTable.vue index f751330827..38808067f5 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/RenderTable.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/RenderTable.vue @@ -78,6 +78,36 @@ export interface IPaginationExtra { small?: boolean; } + + interface Props { + columns: InstanceType['$props']['columns']; + dataSource: (params: any, payload?: IRequestPayload) => Promise; + fixedPagination?: boolean; + clearSelection?: boolean; + paginationExtra?: IPaginationExtra; + selectable?: boolean; + disableSelectMethod?: (data: any) => boolean | string; + // data 数据的主键 + primaryKey?: string; + } + + interface Emits { + (e: 'requestSuccess', value: any): void; + (e: 'requestFinished', value: any[]): void; + (e: 'clearSearch'): void; + (e: 'selection', key: string[], list: any[]): void; + (e: 'selection', key: number[], list: any[]): void; + } + + interface Exposes { + fetchData: (params: Record, baseParams: Record) => void; + getData: () => Array; + clearSelected: () => void; + loading: Ref; + bkTableRef: Ref>; + updateTableKey: () => void; + removeSelectByKey: (key: string) => void; + } + diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Cpu.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Cpu.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Cpu.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Cpu.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/DeviceClass.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/DeviceClass.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/DeviceClass.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/DeviceClass.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Disk.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Disk.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Disk.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Disk.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/DiskType.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/DiskType.vue similarity index 89% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/DiskType.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/DiskType.vue index 97af5873ec..081b10780d 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/DiskType.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/DiskType.vue @@ -42,7 +42,7 @@ (e: 'change', value: Props['defaultValue']): void; } - const props = defineProps(); + defineProps(); const emits = defineEmits(); defineOptions({ inheritAttrs: false, @@ -56,16 +56,4 @@ const handleChange = (value: Props['defaultValue']) => { emits('change', value); }; - - watch( - () => props.model, - () => { - if (props.model.spec_id) { - handleChange(''); - } - }, - { - immediate: true, - }, - ); diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ForBizs.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ForBiz.vue similarity index 67% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ForBizs.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ForBiz.vue index 291e001da7..5803fe7e7e 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ForBizs.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ForBiz.vue @@ -13,23 +13,12 @@ diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Hosts.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Hosts.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Hosts.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Hosts.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Mem.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Mem.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/Mem.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/Mem.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/MountPoint.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/MountPoint.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/MountPoint.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/MountPoint.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/OSType.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/OSType.vue similarity index 100% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/OSType.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/OSType.vue diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ResourceTypes.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ResourceType.vue similarity index 72% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ResourceTypes.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ResourceType.vue index 0f7cc9ecfd..85b3e67fd7 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/com-factory/components/ResourceTypes.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/ResourceType.vue @@ -13,23 +13,12 @@ diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/SpecId.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/SpecId.vue new file mode 100644 index 0000000000..7a93b9fc1f --- /dev/null +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/com-factory/components/SpecId.vue @@ -0,0 +1,175 @@ + + + + + diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-config.ts b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-config.ts similarity index 86% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-config.ts rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-config.ts index 1e8c48e99f..dd5b02ed41 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-config.ts +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-config.ts @@ -14,9 +14,9 @@ import _ from 'lodash'; import { getBizs } from '@services/source/cmdb'; -import { fetchMountPoints, fetchSubzones } from '@services/source/dbresourceResource'; +import { fetchMountPoints } from '@services/source/dbresourceResource'; import { getResourceSpec } from '@services/source/dbresourceSpec'; -import { fetchDbTypeList, getInfrasCities } from '@services/source/infras'; +import { fetchDbTypeList } from '@services/source/infras'; import { getCloudList } from '@services/source/ipchooser'; import { ipv4 } from '@common/regex'; @@ -26,7 +26,7 @@ import { t } from '@locales/index'; type Config = { label: string; component: string; - type?: 'number' | 'string' | 'array' | 'rang'; + type: 'number' | 'string' | 'array' | 'rang'; flex?: number; validator?: (value: any) => boolean | string; service?: (params?: any) => Promise> | Promise; @@ -34,10 +34,10 @@ type Config = { }; export default { - for_bizs: { - label: t('专用业务'), - component: 'for_bizs', - type: 'array', + for_biz: { + label: t('所属业务'), + component: 'for_biz', + type: 'number', service: getBizs, getNameByKey: (value: number, item: { bk_biz_id: number; display_name: string }) => { if (`${value}` === `${item.bk_biz_id}`) { @@ -46,10 +46,10 @@ export default { return undefined; }, }, - resource_types: { - label: t('专用 DB'), - component: 'resource_types', - type: 'array', + resource_type: { + label: t('所属DB类型'), + component: 'resource_type', + type: 'string', service: fetchDbTypeList, getNameByKey: (value: string, item: { id: string; name: string }) => { if (value === item.id) { @@ -80,32 +80,29 @@ export default { type: 'number', }, city: { - label: t('城市'), + label: t('地域 - 园区'), component: 'city', - service: getInfrasCities, - getNameByKey: (value: string, item: { city_code: string; city_name: string }) => { - if (value === item.city_code) { - return item.city_name; - } - return undefined; - }, + type: 'string', }, - subzones: { - label: t('园区'), - component: 'subzones', - service: fetchSubzones, + subzone_ids: { + label: t('地域 - 园区'), + component: 'city', + type: 'array', }, device_class: { label: t('机型'), component: 'device_class', + type: 'string', }, os_type: { label: t('操作系统类型'), component: 'os_type', + type: 'string', }, mount_point: { label: t('磁盘挂载点'), component: 'mount_point', + type: 'string', service: fetchMountPoints, }, cpu: { @@ -156,6 +153,7 @@ export default { disk_type: { label: t('磁盘类型'), component: 'disk_type', + type: 'string', }, spec_id: { label: t('规格'), diff --git a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-input/Index.vue b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-input/Index.vue similarity index 95% rename from dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-input/Index.vue rename to dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-input/Index.vue index 1e768c7a90..7cecd48424 100644 --- a/dbm-ui/frontend/src/views/resource-manage/pool/components/search-box/components/field-input/Index.vue +++ b/dbm-ui/frontend/src/views/resource-manage/pool/host-list/components/search-box/components/field-input/Index.vue @@ -15,14 +15,14 @@
+ -