diff --git a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/Detail.tsx b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/Detail.tsx index 44d613740..6438a139d 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/Detail.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/Detail.tsx @@ -236,6 +236,7 @@ const GroupDetail = (props: any) => { chartData={chartData} groupName={hashDataParse(location.hash).groupName} loading={loadingObj} + refreshKey={refreshKey} /> ), // expandedRowRender, @@ -268,7 +269,12 @@ const GroupDetail = (props: any) => { }, }} /> - + ); }; diff --git a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ExpandedRow.tsx b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ExpandedRow.tsx index 85ab81cc4..3c2c24d00 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ExpandedRow.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ExpandedRow.tsx @@ -8,7 +8,6 @@ import { IconFont } from '@knowdesign/icons'; import API from '@src/api/index'; import { hashDataParse } from '@src/constants/common'; const { Option } = Select; -import PubSub from 'pubsub-js' export interface MetricLine { createTime?: number; @@ -42,7 +41,7 @@ const metricWithType = [ { metricName: 'Lag', metricType: 102 }, ]; -export const ExpandedRow: any = ({ record, groupName }: any) => { +export const ExpandedRow: any = ({ record, groupName, refreshKey }: any) => { const params: any = useParams<{ clusterId: string; }>(); @@ -194,7 +193,7 @@ export const ExpandedRow: any = ({ record, groupName }: any) => { endTime: timeRange[1], topNu: 0, }; - Utils.post(API.getTopicGroupMetricHistory(clusterId), params).then((data: Array) => { + Utils.post(API.getTopicGroupMetricHistory(clusterId), params, { timeout: 300000 }).then((data: Array) => { // ! 替换接口返回 setAllGroupMetricsData(data); }); @@ -211,15 +210,6 @@ export const ExpandedRow: any = ({ record, groupName }: any) => { getTopicGroupMetric({ pagination, sorter }); }; - // useEffect(() => { - // getTopicGroupMetric(); - // }, [sortObj]); - - // 订阅重置offset成功的消息 - PubSub.subscribe('ConsumerGroup-ResetOffset', function(data){ - getTopicGroupMetric({}); - }) - useEffect(() => { const hashData = hashDataParse(location.hash); // if (!hashData.groupName) return; @@ -248,7 +238,7 @@ export const ExpandedRow: any = ({ record, groupName }: any) => { // 获取Consumer列表 表格模式 getTopicGroupMetric({}); }); - }, [hashDataParse(location.hash).groupName]); + }, [hashDataParse(location.hash).groupName, refreshKey]); useEffect(() => { if (partitionList.length === 0) return; diff --git a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ResetOffsetDrawer.tsx b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ResetOffsetDrawer.tsx index da88da008..1e53f350c 100644 --- a/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ResetOffsetDrawer.tsx +++ b/km-console/packages/layout-clusters-fe/src/pages/ConsumerGroup/ResetOffsetDrawer.tsx @@ -4,7 +4,6 @@ import { useParams } from 'react-router-dom'; import EditTable from '../TestingProduce/component/EditTable'; import Api from '@src/api/index'; import moment from 'moment'; -import PubSub from 'pubsub-js'; const CustomSelectResetTime = (props: { value?: string; onChange?: (val: Number | String) => void }) => { const { value, onChange } = props; @@ -45,7 +44,7 @@ const CustomSelectResetTime = (props: { value?: string; onChange?: (val: Number }; export default (props: any) => { - const { record, visible, setVisible } = props; + const { record, visible, setVisible, resetOffsetFn } = props; const routeParams = useParams<{ clusterId: string; }>(); @@ -108,7 +107,7 @@ export default (props: any) => { }); setVisible(false); // 发布重置offset成功的消息 - PubSub.publish('ConsumerGroup-ResetOffset', '1'); + resetOffsetFn(); } else { notification.error({ message: '重置offset失败',