From 812a2af8c9ded49dcef8ef27c1e17647c265e774 Mon Sep 17 00:00:00 2001 From: Austin <1344583166@qq.com> Date: Thu, 30 May 2024 09:11:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E6=B1=A1=E7=82=B9=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=E4=B8=8E=E8=B5=84=E6=BA=90=E6=93=8D=E4=BD=9C=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=90=9C=E7=B4=A2=E5=A2=9E=E5=BC=BA=20#4650?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cluster-selector/ClusterSelector.vue | 2 +- .../src/hooks/useLinkQueryColumnSerach.ts | 41 ++-- dbm-ui/frontend/src/services/source/dbbase.ts | 19 ++ .../es-manage/list/components/list/Index.vue | 3 +- .../list/components/list/Index.vue | 2 + .../list/components/list/Index.vue | 2 + .../mysql/ha-cluster-list/components/List.vue | 2 + .../ha-instance-list/components/List.vue | 1 + .../single-cluster-list/components/List.vue | 2 + .../list/components/list/Index.vue | 2 + .../redis/list/components/list/Index.vue | 2 + .../resource-manage/dirty-machine/Index.vue | 161 ++++++++++---- .../views/resource-manage/record/Index.vue | 209 +++++++++++++----- .../list/components/list/Index.vue | 1 + .../list-instance/components/list/Index.vue | 1 + .../list/components/list/Index.vue | 2 + 16 files changed, 334 insertions(+), 118 deletions(-) diff --git a/dbm-ui/frontend/src/components/cluster-authorize/cluster-selector/ClusterSelector.vue b/dbm-ui/frontend/src/components/cluster-authorize/cluster-selector/ClusterSelector.vue index 60e5924987..ebdb6e4115 100644 --- a/dbm-ui/frontend/src/components/cluster-authorize/cluster-selector/ClusterSelector.vue +++ b/dbm-ui/frontend/src/components/cluster-authorize/cluster-selector/ClusterSelector.vue @@ -135,9 +135,9 @@ class="table-box" :columns="columns" :data="state.tableData" - :height="500" :is-anomalies="state.isAnomalies" :is-searching="state.search.length > 0" + :max-height="528" :pagination="{ ...state.pagination, small: true, diff --git a/dbm-ui/frontend/src/hooks/useLinkQueryColumnSerach.ts b/dbm-ui/frontend/src/hooks/useLinkQueryColumnSerach.ts index ade46cc463..9491355953 100644 --- a/dbm-ui/frontend/src/hooks/useLinkQueryColumnSerach.ts +++ b/dbm-ui/frontend/src/hooks/useLinkQueryColumnSerach.ts @@ -14,7 +14,7 @@ import type { ISearchValue } from 'bkui-vue/lib/search-select/utils'; import _ from 'lodash'; import { useI18n } from 'vue-i18n'; -import { queryBizClusterAttrs } from '@services/source/dbbase'; +import { queryBizClusterAttrs, queryResourceAdministrationAttrs } from '@services/source/dbbase'; import { useGlobalBizs } from '@stores'; @@ -37,7 +37,7 @@ export type SearchAttrs = Record; export const useLinkQueryColumnSerach = ( - clusterType: ClusterTypes, + searchType: string, attrs: string[], fetchDataFn = () => {}, isCluster = true, @@ -60,23 +60,34 @@ export const useLinkQueryColumnSerach = ( return []; }); + const resourceTypes = ['spotty_host', 'resource_record']; + const sortValue: { ordering?: string, } = {}; if (isQueryAttrs) { - const attrsObj = isCluster ? { - cluster_attrs: attrs.join(','), - } : { - instances_attrs: attrs.join(','), - }; + let requestHandler; + if (resourceTypes.includes(searchType)) { + requestHandler = queryResourceAdministrationAttrs({ + resource_type: searchType, + }); + } else { + const attrsObj = isCluster ? { + cluster_attrs: attrs.join(','), + } : { + instances_attrs: attrs.join(','), + }; + + // 查询表头筛选列表 + requestHandler = queryBizClusterAttrs({ + bk_biz_id: currentBizId, + cluster_type: searchType as ClusterTypes, + ...attrsObj, + }); + } - // 查询表头筛选列表 - queryBizClusterAttrs({ - bk_biz_id: currentBizId, - cluster_type: clusterType, - ...attrsObj, - }).then((resultObj) => { + requestHandler.then((resultObj) => { columnAttrs.value = resultObj; searchAttrs.value = Object.entries(resultObj).reduce((results, item) => { Object.assign(results, { @@ -202,8 +213,8 @@ export const useLinkQueryColumnSerach = ( return; } const values = item.values ? item.values.reduce((results, value) => { - const idList = _.uniq(`${value.id}`.split(batchSplitRegex)); - const nameList = _.uniq(`${value.name}`.split(batchSplitRegex)); + const idList = _.uniq(`${value.id.trim()}`.split(batchSplitRegex)); + const nameList = _.uniq(`${value.name.trim()}`.split(batchSplitRegex)); results.push(...idList.map((id, index) => ({ id, name: nameList[index], diff --git a/dbm-ui/frontend/src/services/source/dbbase.ts b/dbm-ui/frontend/src/services/source/dbbase.ts index bc2cf1af10..648b7a9b86 100644 --- a/dbm-ui/frontend/src/services/source/dbbase.ts +++ b/dbm-ui/frontend/src/services/source/dbbase.ts @@ -81,3 +81,22 @@ export function queryBizClusterAttrs(params: { > >(`${path}/query_biz_cluster_attrs/`, params); } + +/** + * 查询资源池,污点主机管理表头筛选数据 + */ +export function queryResourceAdministrationAttrs(params: { + resource_type: string; + limit?: number; + offset?: number; +}) { + return http.get< + Record< + string, + { + value: string; + text: string; + }[] + > + >(`${path}/query_resource_administration_attrs/`, params); +} diff --git a/dbm-ui/frontend/src/views/es-manage/list/components/list/Index.vue b/dbm-ui/frontend/src/views/es-manage/list/components/list/Index.vue index d553a67ca4..e4fe41b799 100644 --- a/dbm-ui/frontend/src/views/es-manage/list/components/list/Index.vue +++ b/dbm-ui/frontend/src/views/es-manage/list/components/list/Index.vue @@ -188,10 +188,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', @@ -200,7 +202,6 @@ { name: t('集群名称'), id: 'name', - logical: ',', }, { name: t('管控区域'), diff --git a/dbm-ui/frontend/src/views/hdfs-manage/list/components/list/Index.vue b/dbm-ui/frontend/src/views/hdfs-manage/list/components/list/Index.vue index 7fb60c7a78..b9cdf3c887 100644 --- a/dbm-ui/frontend/src/views/hdfs-manage/list/components/list/Index.vue +++ b/dbm-ui/frontend/src/views/hdfs-manage/list/components/list/Index.vue @@ -228,10 +228,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', diff --git a/dbm-ui/frontend/src/views/kafka-manage/list/components/list/Index.vue b/dbm-ui/frontend/src/views/kafka-manage/list/components/list/Index.vue index 03b4c0a670..90fd340ef6 100644 --- a/dbm-ui/frontend/src/views/kafka-manage/list/components/list/Index.vue +++ b/dbm-ui/frontend/src/views/kafka-manage/list/components/list/Index.vue @@ -223,10 +223,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', diff --git a/dbm-ui/frontend/src/views/mysql/ha-cluster-list/components/List.vue b/dbm-ui/frontend/src/views/mysql/ha-cluster-list/components/List.vue index 2258f8e569..02a5ad1030 100644 --- a/dbm-ui/frontend/src/views/mysql/ha-cluster-list/components/List.vue +++ b/dbm-ui/frontend/src/views/mysql/ha-cluster-list/components/List.vue @@ -245,10 +245,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', diff --git a/dbm-ui/frontend/src/views/mysql/ha-instance-list/components/List.vue b/dbm-ui/frontend/src/views/mysql/ha-instance-list/components/List.vue index 7ae575c740..a6c4f8505a 100644 --- a/dbm-ui/frontend/src/views/mysql/ha-instance-list/components/List.vue +++ b/dbm-ui/frontend/src/views/mysql/ha-instance-list/components/List.vue @@ -117,6 +117,7 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), diff --git a/dbm-ui/frontend/src/views/mysql/single-cluster-list/components/List.vue b/dbm-ui/frontend/src/views/mysql/single-cluster-list/components/List.vue index a91ea5e82a..0b2cfd8141 100644 --- a/dbm-ui/frontend/src/views/mysql/single-cluster-list/components/List.vue +++ b/dbm-ui/frontend/src/views/mysql/single-cluster-list/components/List.vue @@ -209,10 +209,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', diff --git a/dbm-ui/frontend/src/views/pulsar-manage/list/components/list/Index.vue b/dbm-ui/frontend/src/views/pulsar-manage/list/components/list/Index.vue index 279dc36250..5b5d6677f4 100644 --- a/dbm-ui/frontend/src/views/pulsar-manage/list/components/list/Index.vue +++ b/dbm-ui/frontend/src/views/pulsar-manage/list/components/list/Index.vue @@ -548,10 +548,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: t('集群名称'), diff --git a/dbm-ui/frontend/src/views/redis/list/components/list/Index.vue b/dbm-ui/frontend/src/views/redis/list/components/list/Index.vue index f5345352dd..cba988debe 100644 --- a/dbm-ui/frontend/src/views/redis/list/components/list/Index.vue +++ b/dbm-ui/frontend/src/views/redis/list/components/list/Index.vue @@ -329,10 +329,12 @@ { name: t('IP 或 IP:Port'), id: 'instance', + multiple: true, }, { name: t('访问入口'), id: 'domain', + multiple: true, }, { name: 'ID', diff --git a/dbm-ui/frontend/src/views/resource-manage/dirty-machine/Index.vue b/dbm-ui/frontend/src/views/resource-manage/dirty-machine/Index.vue index a9f9cbf081..a6b2d89684 100644 --- a/dbm-ui/frontend/src/views/resource-manage/dirty-machine/Index.vue +++ b/dbm-ui/frontend/src/views/resource-manage/dirty-machine/Index.vue @@ -44,29 +44,29 @@ + :validate-values="validateSearchValues" + @change="handleSearchValueChange" />