Repository: provectus/kafka-ui
Issue: Not displayed success message about removing a Topic
Labels: type/bug
scope/frontend
status/accepted
status/confirmed

**Describe the bug**
Success message is not displayed with removing a Topic from both: Topics page and the Topic's profile

**Set up**
https://www.kafka-ui.provectus.io/


**Steps to Reproduce**
Steps to reproduce the behavior:

1. Navigate to Topics
2. Press menu icon
3. Select Remove Topic

**Expected behavior**
The success message about Topic removing should be displayed



Issue comments:

Pull request review comments:

Patch that resolved the issue:
diff --git a/kafka-ui-react-app/src/redux/reducers/topics/__test__/reducer.spec.ts b/kafka-ui-react-app/src/redux/reducers/topics/__test__/reducer.spec.ts
index c81eb696e18..c4a0657970a 100644
--- a/kafka-ui-react-app/src/redux/reducers/topics/__test__/reducer.spec.ts
+++ b/kafka-ui-react-app/src/redux/reducers/topics/__test__/reducer.spec.ts
@@ -368,7 +368,16 @@ describe('topics Slice', () => {
   describe('Thunks', () => {
     const store = mockStoreCreator;
     const topicName = topic.name;
+    const RealDate = Date.now;
 
+    beforeAll(() => {
+      global.Date.now = jest.fn(() =>
+        new Date('2019-04-07T10:20:30Z').getTime()
+      );
+    });
+    afterAll(() => {
+      global.Date.now = RealDate;
+    });
     afterEach(() => {
       fetchMock.restore();
       store.clearActions();
@@ -495,6 +504,18 @@ describe('topics Slice', () => {
 
         expect(getTypeAndPayload(store)).toEqual([
           { type: deleteTopic.pending.type },
+          { type: showSuccessAlert.pending.type },
+          {
+            type: alertAdded.type,
+            payload: {
+              id: 'message-topic-local',
+              title: '',
+              type: 'success',
+              createdAt: global.Date.now(),
+              message: 'Topic successfully deleted!',
+            },
+          },
+          { type: showSuccessAlert.fulfilled.type },
           {
             type: deleteTopic.fulfilled.type,
             payload: { topicName },
@@ -662,17 +683,6 @@ describe('topics Slice', () => {
       });
     });
     describe('updateTopicPartitionsCount', () => {
-      const RealDate = Date.now;
-
-      beforeAll(() => {
-        global.Date.now = jest.fn(() =>
-          new Date('2019-04-07T10:20:30Z').getTime()
-        );
-      });
-
-      afterAll(() => {
-        global.Date.now = RealDate;
-      });
       it('updateTopicPartitionsCount/fulfilled', async () => {
         fetchMock.patchOnce(
           `/api/clusters/${clusterName}/topics/${topicName}/partitions`,
diff --git a/kafka-ui-react-app/src/redux/reducers/topics/topicsSlice.ts b/kafka-ui-react-app/src/redux/reducers/topics/topicsSlice.ts
index 3a35cc3d0ee..dfeb437b242 100644
--- a/kafka-ui-react-app/src/redux/reducers/topics/topicsSlice.ts
+++ b/kafka-ui-react-app/src/redux/reducers/topics/topicsSlice.ts
@@ -201,11 +201,16 @@ export const updateTopic = createAsyncThunk<
 export const deleteTopic = createAsyncThunk<
   { topicName: TopicName },
   DeleteTopicRequest
->('topic/deleteTopic', async (payload, { rejectWithValue }) => {
+>('topic/deleteTopic', async (payload, { rejectWithValue, dispatch }) => {
   try {
-    const { topicName } = payload;
+    const { topicName, clusterName } = payload;
     await topicsApiClient.deleteTopic(payload);
-
+    dispatch(
+      showSuccessAlert({
+        id: `message-${topicName}-${clusterName}`,
+        message: 'Topic successfully deleted!',
+      })
+    );
     return { topicName };
   } catch (err) {
     return rejectWithValue(await getResponse(err as Response));


Test patch: