From 6a13855db0a9395c24cc0c9eface350147d35f21 Mon Sep 17 00:00:00 2001 From: chenwenchang <479999519@qq.com> Date: Thu, 14 Nov 2024 11:07:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E9=9B=86=E7=BE=A4=E6=A0=87?= =?UTF-8?q?=E5=87=86=E5=8C=96=20#4654=20#=20Reviewed,=20transaction=20id:?= =?UTF-8?q?=2024305?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...queryClusterTypes.ts => dbClusterTypes.ts} | 2 +- dbm-ui/frontend/src/common/const/index.ts | 2 +- dbm-ui/frontend/src/locales/zh-cn.json | 1 + dbm-ui/frontend/src/services/source/dbbase.ts | 32 ++- dbm-ui/frontend/src/services/source/mysql.ts | 7 - .../src/views/cluster-standardize/Index.vue | 4 +- .../components/cluster-selector/Index.vue | 83 ++++--- .../components/cluster-select/Index.vue | 8 +- .../components/cluster-select/Table.vue | 18 +- .../cluster-select/hooks/useTableData.ts | 27 ++- .../components/common/PanelTab.vue | 44 +++- .../components/manual-input/Index.vue | 52 +++-- .../components/manual-input/Table.vue | 18 +- .../components/preview-result/Index.vue | 16 +- .../components/mysql/Index.vue | 15 +- .../components/tendbcluster/Index.vue | 208 ++++++++++++++++++ .../components/render-data/Index.vue | 75 +++++++ .../components/render-data/Row.vue | 163 ++++++++++++++ .../webconsole/components/ClusterTabs.vue | 4 +- .../partition-manage/components/Operation.vue | 4 +- .../components/SelectClusters.vue | 4 +- 21 files changed, 652 insertions(+), 135 deletions(-) rename dbm-ui/frontend/src/common/const/{queryClusterTypes.ts => dbClusterTypes.ts} (97%) create mode 100644 dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/Index.vue create mode 100644 dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Index.vue create mode 100644 dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/components/render-data/Row.vue 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..149d2ebc61 100644 --- a/dbm-ui/frontend/src/services/source/dbbase.ts +++ b/dbm-ui/frontend/src/services/source/dbbase.ts @@ -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; // 集群域名 @@ -140,5 +162,13 @@ export function queryAllTypeCluster(params: { status: string; }[] > - >(`${path}/simple_query_cluster/`, params); + >(`${path}/simple_query_cluster_v2/`, params); +} +export type ClusterInfo = ServiceReturnType['results'][number]; + +/** + * 根据用户手动输入的域名列表查询 + */ +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/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..f37a9c76b8 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, });