mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
[Bugfix]修复消费组Offset重置后,提示重置成功,但是前端不刷新数据,Offset无变化的问题 (#1090)
请不要在没有先创建Issue的情况下创建Pull Request。 ## 变更的目的是什么 修复消费组Offset重置后,提示重置成功,但是前端不刷新数据,Offset无变化的问题 ## 简短的更新日志 使用pubsub-js解决问题 ## 验证这一变化 ### 重置前:  ### 重置指定分区   ### 重置最新offset  ### 重置最旧offset  请遵循此清单,以帮助我们快速轻松地整合您的贡献: * [x] 一个 PR(Pull Request的简写)只解决一个问题,禁止一个 PR 解决多个问题; * [x] 确保 PR 有对应的 Issue(通常在您开始处理之前创建),除非是书写错误之类的琐碎更改不需要 Issue ; * [x] 格式化 PR 及 Commit-Log 的标题及内容,例如 #861 。PS:Commit-Log 需要在 Git Commit 代码时进行填写,在 GitHub 上修改不了; * [x] 编写足够详细的 PR 描述,以了解 PR 的作用、方式和原因; * [x] 编写必要的单元测试来验证您的逻辑更正。如果提交了新功能或重大更改,请记住在 test 模块中添加 integration-test; * [x] 确保编译通过,集成测试通过;
This commit is contained in:
@@ -82,6 +82,7 @@
|
||||
"@types/lodash": "^4.14.171",
|
||||
"@types/node": "^12.12.25",
|
||||
"@types/pubsub-js": "^1.5.18",
|
||||
"pubsub-js": "^1.5.18",
|
||||
"@typescript-eslint/eslint-plugin": "4.13.0",
|
||||
"@typescript-eslint/parser": "4.13.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
|
||||
@@ -8,6 +8,7 @@ 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;
|
||||
@@ -214,6 +215,11 @@ export const ExpandedRow: any = ({ record, groupName }: any) => {
|
||||
// getTopicGroupMetric();
|
||||
// }, [sortObj]);
|
||||
|
||||
// 订阅重置offset成功的消息
|
||||
PubSub.subscribe('ConsumerGroup-ResetOffset', function(data){
|
||||
getTopicGroupMetric({});
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
const hashData = hashDataParse(location.hash);
|
||||
// if (!hashData.groupName) return;
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -106,6 +107,8 @@ export default (props: any) => {
|
||||
message: '重置offset成功',
|
||||
});
|
||||
setVisible(false);
|
||||
// 发布重置offset成功的消息
|
||||
PubSub.publish('ConsumerGroup-ResetOffset', '1');
|
||||
} else {
|
||||
notification.error({
|
||||
message: '重置offset失败',
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ClustersPermissionMap } from '../CommonConfig';
|
||||
import ResetOffsetDrawer from './ResetOffsetDrawer';
|
||||
import SwitchTab from '@src/components/SwitchTab';
|
||||
import ContentWithCopy from '@src/components/CopyContent';
|
||||
import PubSub from "pubsub-js";
|
||||
|
||||
const { Option } = Select;
|
||||
|
||||
@@ -335,6 +336,11 @@ export default (props: any) => {
|
||||
});
|
||||
}, [visible]);
|
||||
|
||||
// 订阅重置offset成功的消息
|
||||
PubSub.subscribe('TopicDetail-ResetOffset', function(message, data){
|
||||
getTopicGroupMetric({hashData: data});
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (partitionList.length === 0) return;
|
||||
getTopicGroupMetricHistory(partitionList, hashData);
|
||||
|
||||
@@ -4,6 +4,7 @@ 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;
|
||||
@@ -106,6 +107,13 @@ export default (props: any) => {
|
||||
message: '重置offset成功',
|
||||
});
|
||||
setResetOffsetVisible(false);
|
||||
// 发布重置offset成功的消息
|
||||
PubSub.publish('TopicDetail-ResetOffset',
|
||||
{
|
||||
groupName: record.groupName,
|
||||
topicName: record.topicName
|
||||
}
|
||||
);
|
||||
} else {
|
||||
notification.error({
|
||||
message: '重置offset失败',
|
||||
|
||||
Reference in New Issue
Block a user