From a08645d147c6b0225e804fe83698569aabdb29ce Mon Sep 17 00:00:00 2001 From: hitozhang Date: Wed, 1 Nov 2023 15:10:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E4=B8=8BPODs=E5=88=A0=E9=99=A4=E6=B2=A1=E6=9C=89=E5=B8=A6?= =?UTF-8?q?=E9=9B=86=E7=BE=A4ID=E9=97=AE=E9=A2=98=20(merge=20request=20!14?= =?UTF-8?q?88)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squash merge branch 'tools' into 'master' fix: 修复节点下PODs删除没有带集群ID问题 --- bcs-ui/frontend/src/components/metric.vue | 2 +- bcs-ui/frontend/src/composables/use-page.ts | 5 ++++- bcs-ui/frontend/src/store/index.ts | 7 ++++++- .../src/views/cluster-manage/node-list/node-overview.vue | 3 +++ bcs-ui/frontend/src/views/resource-view/sidebar.vue | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bcs-ui/frontend/src/components/metric.vue b/bcs-ui/frontend/src/components/metric.vue index 8f35c913fb..ea07bc958f 100644 --- a/bcs-ui/frontend/src/components/metric.vue +++ b/bcs-ui/frontend/src/components/metric.vue @@ -164,7 +164,7 @@ export default defineComponent({ const series: any[] = []; data.forEach((item, index) => { const suffix = metricSuffix.value[index]; - const list = item?.result.map((result) => { + const list = item?.result?.map((result) => { // series 配置 const name = result.metric?.[metricNameProp.value] || metricMap[metrics[index]]; const defaultSeries = props.series[index] || {}; diff --git a/bcs-ui/frontend/src/composables/use-page.ts b/bcs-ui/frontend/src/composables/use-page.ts index 3904ba6983..6537b8aaf8 100644 --- a/bcs-ui/frontend/src/composables/use-page.ts +++ b/bcs-ui/frontend/src/composables/use-page.ts @@ -1,5 +1,7 @@ import { computed, ComputedRef, reactive, Ref } from 'vue'; +import $store from '@/store'; + export interface IPageConf { current: number; limit: number; @@ -31,7 +33,7 @@ export interface IPageConfResult { */ export default function usePageConf(data: Ref, options: IOptions = { current: 1, - limit: 10, + limit: $store.state.globalPageSize || 10, }): IPageConfResult { const pageConf = reactive({ current: options.current, @@ -51,6 +53,7 @@ export default function usePageConf(data: Ref, options: IOptions = { const pageSizeChange = (pageSize = 10) => { pageConf.limit = pageSize; + $store.commit('updatePageSize', pageSize); pageConf.current = 1; const { onPageSizeChange = null } = options; onPageSizeChange && typeof onPageSizeChange === 'function' && onPageSizeChange(pageSize); diff --git a/bcs-ui/frontend/src/store/index.ts b/bcs-ui/frontend/src/store/index.ts index f855593f46..9d4ff65cb8 100644 --- a/bcs-ui/frontend/src/store/index.ts +++ b/bcs-ui/frontend/src/store/index.ts @@ -77,6 +77,7 @@ const store = new Vuex.Store<{ isEn: boolean crdInstanceList: any[] cluster: typeof cluster.state + globalPageSize: number }>({ // todo 废弃模块 modules: { @@ -103,7 +104,7 @@ const store = new Vuex.Store<{ plugins: [ VuexStorage({ key: '__bcs_vuex_stroage__', - paths: ['curProject.projectID', 'curProject.projectCode', 'curProject.businessID', 'curCluster.clusterID', 'openSideMenu', 'curNamespace', 'clusterViewType'], + paths: ['curProject.projectID', 'curProject.projectCode', 'curProject.businessID', 'curCluster.clusterID', 'openSideMenu', 'curNamespace', 'clusterViewType', 'globalPageSize'], mutationEffect: [ { type: 'cluster/forceUpdateClusterList', @@ -129,6 +130,7 @@ const store = new Vuex.Store<{ clusterViewType: 'card', // 集群展示模式 card 或者 list isEn: lang === 'en-US', // todo 废弃 crdInstanceList: [], // todo 放入对应的module中 + globalPageSize: 10, } as any, // 公共 getters getters: { @@ -204,6 +206,9 @@ const store = new Vuex.Store<{ updateFeatureFlags(state, data) { state.featureFlags = data; }, + updatePageSize(state, size = 10) { + state.globalPageSize = size; + }, }, actions: { /** diff --git a/bcs-ui/frontend/src/views/cluster-manage/node-list/node-overview.vue b/bcs-ui/frontend/src/views/cluster-manage/node-list/node-overview.vue index 3aaa15992c..e5d733f81e 100644 --- a/bcs-ui/frontend/src/views/cluster-manage/node-list/node-overview.vue +++ b/bcs-ui/frontend/src/views/cluster-manage/node-list/node-overview.vue @@ -377,6 +377,7 @@ export default defineComponent({ params: { namespace, name, + clusterId: clusterId.value, }, query: { type: 'workloads', @@ -390,6 +391,7 @@ export default defineComponent({ params: { namespace, name, + clusterId: clusterId.value, }, query: { type: 'workloads', @@ -415,6 +417,7 @@ export default defineComponent({ $type: 'workloads', $category: 'pods', $name: name, + $clusterId: clusterId.value, }); result && $bkMessage({ theme: 'success', diff --git a/bcs-ui/frontend/src/views/resource-view/sidebar.vue b/bcs-ui/frontend/src/views/resource-view/sidebar.vue index 5420efa23a..f0cc4c1edb 100644 --- a/bcs-ui/frontend/src/views/resource-view/sidebar.vue +++ b/bcs-ui/frontend/src/views/resource-view/sidebar.vue @@ -20,7 +20,7 @@