fixing message count problem when clearing or adding messages (#2029)
This commit is contained in:
parent
cc109a7125
commit
cf6454c987
3 changed files with 14 additions and 7 deletions
|
@ -39,11 +39,13 @@ const Overview: React.FC<Props> = ({
|
|||
}) => {
|
||||
const { isReadOnly } = React.useContext(ClusterContext);
|
||||
|
||||
const messageCount = React.useMemo(() => {
|
||||
return (partitions || []).reduce((memo, partition) => {
|
||||
const messageCount = React.useMemo(
|
||||
() =>
|
||||
(partitions || []).reduce((memo, partition) => {
|
||||
return memo + partition.offsetMax - partition.offsetMin;
|
||||
}, 0);
|
||||
}, [partitions]);
|
||||
}, 0),
|
||||
[partitions]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -6,7 +6,10 @@ import { useHistory, useParams } from 'react-router-dom';
|
|||
import { clusterTopicMessagesPath } from 'lib/paths';
|
||||
import jsf from 'json-schema-faker';
|
||||
import { messagesApiClient } from 'redux/reducers/topicMessages/topicMessagesSlice';
|
||||
import { fetchTopicMessageSchema } from 'redux/reducers/topics/topicsSlice';
|
||||
import {
|
||||
fetchTopicMessageSchema,
|
||||
fetchTopicDetails,
|
||||
} from 'redux/reducers/topics/topicsSlice';
|
||||
import { useAppDispatch, useAppSelector } from 'lib/hooks/redux';
|
||||
import { alertAdded } from 'redux/reducers/alerts/alertsSlice';
|
||||
import { now } from 'lodash';
|
||||
|
@ -126,6 +129,7 @@ const SendMessage: React.FC = () => {
|
|||
partition,
|
||||
},
|
||||
});
|
||||
dispatch(fetchTopicDetails({ clusterName, topicName }));
|
||||
} catch (e) {
|
||||
dispatch(
|
||||
alertAdded({
|
||||
|
|
|
@ -4,6 +4,7 @@ import { TopicMessage, Configuration, MessagesApi } from 'generated-sources';
|
|||
import { BASE_PARAMS } from 'lib/constants';
|
||||
import { getResponse } from 'lib/errorHandling';
|
||||
import { showSuccessAlert } from 'redux/reducers/alerts/alertsSlice';
|
||||
import { fetchTopicDetails } from 'redux/reducers/topics/topicsSlice';
|
||||
|
||||
const apiClientConf = new Configuration(BASE_PARAMS);
|
||||
export const messagesApiClient = new MessagesApi(apiClientConf);
|
||||
|
@ -23,7 +24,7 @@ export const clearTopicMessages = createAsyncThunk<
|
|||
topicName,
|
||||
partitions,
|
||||
});
|
||||
|
||||
dispatch(fetchTopicDetails({ clusterName, topicName }));
|
||||
dispatch(
|
||||
showSuccessAlert({
|
||||
id: `message-${topicName}-${clusterName}-${partitions}`,
|
||||
|
|
Loading…
Add table
Reference in a new issue