diff --git a/dbm-ui/frontend/src/common/const/queryClusterTypes.ts b/dbm-ui/frontend/src/common/const/dbClusterTypes.ts similarity index 97% rename from dbm-ui/frontend/src/common/const/queryClusterTypes.ts rename to dbm-ui/frontend/src/common/const/dbClusterTypes.ts index ea08f507c0..2d1e760df4 100644 --- a/dbm-ui/frontend/src/common/const/queryClusterTypes.ts +++ b/dbm-ui/frontend/src/common/const/dbClusterTypes.ts @@ -4,7 +4,7 @@ import { DBTypes } from './dbTypes'; /** * db类型关联集群类型集合映射关系 */ -export const queryClusterTypes = { +export const DBClusterTypes = { [DBTypes.MYSQL]: [ClusterTypes.TENDBSINGLE, ClusterTypes.TENDBHA], [DBTypes.TENDBCLUSTER]: [ClusterTypes.TENDBCLUSTER], [DBTypes.REDIS]: [ diff --git a/dbm-ui/frontend/src/common/const/index.ts b/dbm-ui/frontend/src/common/const/index.ts index e600c24e77..78405019b9 100644 --- a/dbm-ui/frontend/src/common/const/index.ts +++ b/dbm-ui/frontend/src/common/const/index.ts @@ -4,6 +4,7 @@ export * from './clusterInsStatus'; export * from './clusterTypeInfos'; export * from './clusterTypes'; export * from './confLevels'; +export * from './dbClusterTypes'; export * from './dbSysExclude'; export * from './dbTypeInfos'; export * from './dbTypes'; @@ -12,7 +13,6 @@ export * from './machineTypes'; export * from './occupiedInnerHeight'; export * from './osTypes'; export * from './pipelineStatus'; -export * from './queryClusterTypes'; export * from './ticketTypeInfos'; export * from './ticketTypes'; export * from './userPersonalSettings'; diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 0f8031c8f8..c1186c116c 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3659,5 +3659,6 @@ "模糊搜索": "模糊搜索", "精确搜索": "精确搜索", "每个分类最多显示 10 条记录,点击搜索可查看全部记录。": "每个分类最多显示 10 条记录,点击搜索可查看全部记录。", + "TenDBCluster集群": "TenDBCluster集群", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/services/source/dbbase.ts b/dbm-ui/frontend/src/services/source/dbbase.ts index 8170495351..16e92f132f 100644 --- a/dbm-ui/frontend/src/services/source/dbbase.ts +++ b/dbm-ui/frontend/src/services/source/dbbase.ts @@ -11,7 +11,7 @@ * the specific language governing permissions and limitations under the License. */ -import type { InstanceInfos, ListBase } from '@services/types'; +import type { ClusterInfo, InstanceInfos, ListBase } from '@services/types'; import { ClusterTypes } from '@common/const'; @@ -106,6 +106,28 @@ export function checkInstance(params: { instance_addres // 查询全集群信息 export function queryAllTypeCluster(params: { + bk_biz_id: number; + cluster_types?: string; + immute_domain?: string; + phase?: string; + limit?: number; + offset?: number; +}) { + return http.get< + { + bk_cloud_id: number; + cluster_type: string; + id: number; + immute_domain: string; + major_version: string; + name: string; + region: string; + }[] + >(`${path}/simple_query_cluster/`, params); +} + +// 全集群列表 +export function queryAllTypeClusterList(params: { bk_biz_id?: number; // 业务id cluster_types?: string; // 集群类型(逗号间隔) immute_domain?: string; // 集群域名 @@ -121,24 +143,12 @@ export function queryAllTypeCluster(params: { limit?: number; offset?: number; }) { - return http.get< - ListBase< - { - alias: string; - bk_biz_id: number; - bk_cloud_id: number; - bk_cloud_name: string; - cluster_type: string; - db_module_id: number; - db_module_name: string; - id: number; - immute_domain: string; - major_version: string; - name: string; - phase: string; - region: string; - status: string; - }[] - > - >(`${path}/simple_query_cluster/`, params); + return http.get>(`${path}/simple_query_cluster_v2/`, params); +} + +/** + * 根据用户手动输入的域名列表查询 + */ +export function checkDomains(params: { domains: string[] }) { + return http.post(`${path}/check_domains/`, params); } diff --git a/dbm-ui/frontend/src/services/source/mysql.ts b/dbm-ui/frontend/src/services/source/mysql.ts index edf6079f95..4e9077ac8f 100644 --- a/dbm-ui/frontend/src/services/source/mysql.ts +++ b/dbm-ui/frontend/src/services/source/mysql.ts @@ -39,10 +39,3 @@ export function getClusterList(params: { }) { return http.post>(`/apis/mysql/query_clusters/`, params); } - -/** - * 根据用户手动输入的域名列表查询 - */ -export function checkDomains(params: { domains: Array }) { - return http.post>(`/apis/mysql/check_domains/`, params); -} diff --git a/dbm-ui/frontend/src/services/types/clusterInfo.ts b/dbm-ui/frontend/src/services/types/clusterInfo.ts new file mode 100644 index 0000000000..b9fb14200b --- /dev/null +++ b/dbm-ui/frontend/src/services/types/clusterInfo.ts @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/** + * 通用集群信息 + */ +export interface ClusterInfo { + alias: string; + bk_biz_id: number; + bk_cloud_id: number; + bk_cloud_name: string; + cluster_type: string; + db_module_id: number; + db_module_name: string; + id: number; + immute_domain: string; + major_version: string; + name: string; + phase: string; + region: string; + status: string; +} diff --git a/dbm-ui/frontend/src/services/types/index.ts b/dbm-ui/frontend/src/services/types/index.ts index 7611694be7..82bdce0f3c 100644 --- a/dbm-ui/frontend/src/services/types/index.ts +++ b/dbm-ui/frontend/src/services/types/index.ts @@ -12,6 +12,7 @@ */ export * from './bizItem'; +export * from './clusterInfo'; export * from './common'; export * from './db'; export * from './hostInfo'; diff --git a/dbm-ui/frontend/src/views/cluster-standardize/Index.vue b/dbm-ui/frontend/src/views/cluster-standardize/Index.vue index 72642d1ca4..a41162d0de 100644 --- a/dbm-ui/frontend/src/views/cluster-standardize/Index.vue +++ b/dbm-ui/frontend/src/views/cluster-standardize/Index.vue @@ -28,14 +28,16 @@ import Mysql from './components/mysql/Index.vue'; import Success from './components/Success.vue'; + import Tendbcluster from './components/tendbcluster/Index.vue'; const router = useRouter(); const route = useRoute(); - const exclude = Object.values(DBTypes).filter((type) => type !== DBTypes.MYSQL); + const exclude = Object.values(DBTypes).filter((type) => ![DBTypes.TENDBCLUSTER, DBTypes.MYSQL].includes(type)); const comMap = { [DBTypes.MYSQL]: Mysql, + [DBTypes.TENDBCLUSTER]: Tendbcluster, } as Record; const active = ref(DBTypes.MYSQL); diff --git a/dbm-ui/frontend/src/views/cluster-standardize/components/cluster-selector/Index.vue b/dbm-ui/frontend/src/views/cluster-standardize/components/cluster-selector/Index.vue index c1bde80c03..a7115d8383 100644 --- a/dbm-ui/frontend/src/views/cluster-standardize/components/cluster-selector/Index.vue +++ b/dbm-ui/frontend/src/views/cluster-standardize/components/cluster-selector/Index.vue @@ -31,9 +31,9 @@ - - + + diff --git a/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Index.vue b/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Index.vue new file mode 100644 index 0000000000..6d50b32741 --- /dev/null +++ b/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Index.vue @@ -0,0 +1,75 @@ + + + + + + diff --git a/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Row.vue b/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Row.vue new file mode 100644 index 0000000000..987ea13014 --- /dev/null +++ b/dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Row.vue @@ -0,0 +1,163 @@ + + + + + + + + diff --git a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/ClusterTabs.vue b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/ClusterTabs.vue index 1dca2bce9f..a085612020 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/ClusterTabs.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/ClusterTabs.vue @@ -70,7 +70,7 @@ import { queryAllTypeCluster } from '@services/source/dbbase'; - import { DBTypes, queryClusterTypes } from '@common/const'; + import { DBClusterTypes, DBTypes } from '@common/const'; import { messageWarn } from '@utils'; @@ -126,7 +126,7 @@ defaultParams: [ { bk_biz_id: window.PROJECT_CONFIG.BIZ_ID, - cluster_types: queryClusterTypes[props.dbType].join(','), + cluster_types: DBClusterTypes[props.dbType].join(','), phase: 'online', }, ], diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/partition-manage/components/Operation.vue b/dbm-ui/frontend/src/views/db-manage/mysql/partition-manage/components/Operation.vue index c898ed8ad9..112a1882be 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/partition-manage/components/Operation.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/partition-manage/components/Operation.vue @@ -145,7 +145,7 @@ verifyPartitionField, } from '@services/source/partitionManage'; - import { dbSysExclude } from '@common/const'; + import { DBClusterTypes, dbSysExclude, DBTypes } from '@common/const'; import { dbRegex } from '@common/regex'; interface Props { @@ -316,7 +316,7 @@ offset: 0, limit: -1, bk_biz_id: window.PROJECT_CONFIG.BIZ_ID, - cluster_types: 'tendbha,tendbsingle', + cluster_types: DBClusterTypes[DBTypes.MYSQL].join(','), }, ], }); diff --git a/dbm-ui/frontend/src/views/ticket-flow-setting-biz/components/render-target/components/SelectClusters.vue b/dbm-ui/frontend/src/views/ticket-flow-setting-biz/components/render-target/components/SelectClusters.vue index c5b5544cb4..f03b7887b2 100644 --- a/dbm-ui/frontend/src/views/ticket-flow-setting-biz/components/render-target/components/SelectClusters.vue +++ b/dbm-ui/frontend/src/views/ticket-flow-setting-biz/components/render-target/components/SelectClusters.vue @@ -42,7 +42,7 @@ import { queryAllTypeCluster } from '@services/source/dbbase'; - import { DBTypes, queryClusterTypes } from '@common/const'; + import { DBClusterTypes, DBTypes } from '@common/const'; import useValidtor from '@components/render-table/hooks/useValidtor'; @@ -89,7 +89,7 @@ if (props.bizId) { fetchData({ bk_biz_id: props.bizId, - cluster_types: queryClusterTypes[props.dbType as keyof typeof queryClusterTypes].join(','), + cluster_types: DBClusterTypes[props.dbType].join(','), phase: 'online', limit: -1, });