Skip to content

Commit

Permalink
fix: 修复节点下PODs删除没有带集群ID问题 (merge request !1488)
Browse files Browse the repository at this point in the history
Squash merge branch 'tools' into 'master'
fix: 修复节点下PODs删除没有带集群ID问题
  • Loading branch information
hitozhang committed Nov 1, 2023
1 parent dbe8e64 commit a08645d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bcs-ui/frontend/src/components/metric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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] || {};
Expand Down
5 changes: 4 additions & 1 deletion bcs-ui/frontend/src/composables/use-page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { computed, ComputedRef, reactive, Ref } from 'vue';

import $store from '@/store';

export interface IPageConf {
current: number;
limit: number;
Expand Down Expand Up @@ -31,7 +33,7 @@ export interface IPageConfResult {
*/
export default function usePageConf(data: Ref<any[]>, options: IOptions = {
current: 1,
limit: 10,
limit: $store.state.globalPageSize || 10,
}): IPageConfResult {
const pageConf = reactive<IPageConf>({
current: options.current,
Expand All @@ -51,6 +53,7 @@ export default function usePageConf(data: Ref<any[]>, 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);
Expand Down
7 changes: 6 additions & 1 deletion bcs-ui/frontend/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const store = new Vuex.Store<{
isEn: boolean
crdInstanceList: any[]
cluster: typeof cluster.state
globalPageSize: number
}>({
// todo 废弃模块
modules: {
Expand All @@ -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',
Expand All @@ -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: {
Expand Down Expand Up @@ -204,6 +206,9 @@ const store = new Vuex.Store<{
updateFeatureFlags(state, data) {
state.featureFlags = data;
},
updatePageSize(state, size = 10) {
state.globalPageSize = size;
},
},
actions: {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ export default defineComponent({
params: {
namespace,
name,
clusterId: clusterId.value,
},
query: {
type: 'workloads',
Expand All @@ -390,6 +391,7 @@ export default defineComponent({
params: {
namespace,
name,
clusterId: clusterId.value,
},
query: {
type: 'workloads',
Expand All @@ -415,6 +417,7 @@ export default defineComponent({
$type: 'workloads',
$category: 'pods',
$name: name,
$clusterId: clusterId.value,
});
result && $bkMessage({
theme: 'success',
Expand Down
2 changes: 1 addition & 1 deletion bcs-ui/frontend/src/views/resource-view/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</span>
<template #content>
<!-- 监听change事件会多次触发,这里监听click事件 -->
<ClusterSelectPopover cluster-type="all" @click="handleClusterClick" />
<ClusterSelectPopover cluster-type="all" :key="curCluster.clusterID" @click="handleClusterClick" />
</template>
</PopoverSelector>
</div>
Expand Down

0 comments on commit a08645d

Please sign in to comment.