From b46b02848a3425dc4f50a1af1e8e1940b516dd8c 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=20#=20Reviewed,=20?= =?UTF-8?q?transaction=20id:=2020145?= 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 | 21 + .../services/model/db-resource/DbResource.ts | 28 +- .../src/services/model/db-resource/summary.ts | 79 ++++ .../model/resource-spec/resourceSpec.ts | 8 +- .../src/services/source/dbresourceResource.ts | 48 ++- 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 | 371 +++-------------- .../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 | 73 ++-- .../components/batch-setting/Index.vue | 100 +++-- .../components/ResourceSpecStorage.vue | 4 +- .../components/import-host/Index.vue | 4 +- .../import-host/components/FormPanel.vue | 99 ++--- .../components/select-host-panel/Index.vue | 0 .../components/HostEmpty.vue | 0 .../components/search-box/Index.vue | 112 ++--- .../components/com-factory/Index.vue | 18 +- .../com-factory/components/AgentStatus.vue | 0 .../com-factory/components/BkCloudIds.vue | 4 + .../com-factory/components/CitySubzones.vue | 117 ++++++ .../components/com-factory/components/Cpu.vue | 4 + .../com-factory/components/DeviceClass.vue | 4 + .../com-factory/components/Disk.vue | 4 + .../com-factory/components/DiskType.vue | 18 +- .../com-factory/components/ForBiz.vue} | 50 +-- .../com-factory/components/Hosts.vue | 3 + .../components/com-factory/components/Mem.vue | 4 + .../com-factory/components/MountPoint.vue | 4 + .../com-factory/components/OSType.vue | 0 .../com-factory/components/ResourceType.vue} | 46 ++- .../com-factory/components/SpecId.vue | 177 ++++++++ .../search-box/components/field-config.ts | 48 ++- .../components/field-input/Index.vue | 50 +-- .../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 | 120 ++++++ .../pool/summary-view/components/Export.vue | 85 ++++ .../pool/summary-view/components/List.vue | 206 ++++++++++ .../components/search-box/Index.vue | 121 ++++++ .../components/search-box/components/Biz.vue | 81 ++++ .../components/search-box/components/Db.vue | 77 ++++ .../search-box/components/Region.vue | 114 ++++++ .../components/search-box/components/Spec.vue | 151 +++++++ .../src/views/resource-manage/routes.ts | 3 +- .../src/views/resource-manage/spec/Index.vue | 296 +------------- 61 files changed, 2570 insertions(+), 1541 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 (67%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/batch-setting/components/ResourceSpecStorage.vue (99%) 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 (83%) 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 (66%) 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 (99%) 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 (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/DeviceClass.vue (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Disk.vue (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/DiskType.vue (90%) 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} (71%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Hosts.vue (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/Mem.vue (99%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/com-factory/components/MountPoint.vue (99%) 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 (83%) rename dbm-ui/frontend/src/views/resource-manage/pool/{ => host-list}/components/search-box/components/field-input/Index.vue (94%) 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..4335aaf966 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3436,5 +3436,26 @@ "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符": "支持 %(指代任意长度字符串), ?(指代单个字符串), *(指代全部)三个通配符", "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用": "包含通配符时, 每一单元格只允许输入单个对象。% ? 不能独立使用, * 只能单独使用", "复制所属集群": "复制所属集群", + "公共资源池": "公共资源池", + "统计视图": "统计视图", + "规格类型": "规格类型", + "机型(硬盘)": "机型(硬盘)", + "CPU 内存": "CPU 内存", + "园区分布(台)": "园区分布(台)", + "地域 - 园区": "地域 - 园区", + "所属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..61422ca573 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 forBizDisplay() { + if (this.for_biz.bk_biz_id === 0 || !this.for_biz.bk_biz_name) { + return t('公共资源池'); + } + return this.for_biz.bk_biz_name; + } + + get resourceTypeDisplay() { + 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..9b03cc2f0e --- /dev/null +++ b/dbm-ui/frontend/src/services/model/db-resource/summary.ts @@ -0,0 +1,79 @@ +/* + * 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?: { + mount_point: string; + size: number; + file_type: string; + disk_type: string; + disk_id: string | number; + }[]; + 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() { + if (this.disk_summary && this.disk_summary?.length > 0) { + const diskInfo = this.disk_summary.map((item) => `${item.mount_point}:${item.size}G:${item.disk_type}`).join(';'); + return `${this.device_class} (${diskInfo})`; + } + return `${this.device_class}`; + } + + 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.values(this.sub_zone_detail) + .map((item) => `${item.name}: ${item.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..39ab16639e 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,11 +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[]; - set_empty_biz: boolean; - set_empty_resource_type: boolean; + resource_type: string; storage_device: Record; }) { return http.post(`${path}/update/`, params); @@ -185,3 +179,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..5e716d0494 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,85 @@ --> - - 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..716697dc82 --- /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..c9b237efc8 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 99% 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 index e38fd3b4d0..17549d5f53 100644 --- 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 @@ -35,15 +35,19 @@ defaultValue?: [number, number]; model: Record; } + interface Emits { (e: 'change', value: Props['defaultValue']): void; } const props = defineProps(); + const emits = defineEmits(); + defineOptions({ inheritAttrs: false, }); + const min = ref(); const max = ref(); 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 99% 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 index a72c70c134..d133e72f41 100644 --- 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 @@ -37,15 +37,19 @@ interface Props { defaultValue?: string; } + interface Emits { (e: 'change', value: string): void; } defineProps(); + const emits = defineEmits(); + defineOptions({ inheritAttrs: false, }); + const { t } = useI18n(); const { data } = useRequest(fetchDeviceClass, { 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 99% 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 index 436b603ff4..9d2f5f0ae5 100644 --- 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 @@ -35,15 +35,19 @@ defaultValue?: [number, number]; model: Record; } + interface Emits { (e: 'change', value: Props['defaultValue']): void; } const props = defineProps(); + const emits = defineEmits(); + defineOptions({ inheritAttrs: false, }); + const min = ref(); const max = ref(); 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 90% 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..7bf7d24d35 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 @@ -38,15 +38,19 @@ defaultValue?: string; model: Record; } + interface Emits { (e: 'change', value: Props['defaultValue']): void; } - const props = defineProps(); + defineProps(); + const emits = defineEmits(); + defineOptions({ inheritAttrs: false, }); + const { t } = useI18n(); const { data } = useRequest(fetchDiskTypes, { @@ -56,16 +60,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 71% 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..25b4d31b16 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,28 +13,17 @@