Explorar o código

[issues-252][bug] - Topic settings form is broken (#332)

add topicName in updateTopic function

Co-authored-by: mbovtryuk <mbovtryuk@provectus.com>
TEDMykhailo %!s(int64=4) %!d(string=hai) anos
pai
achega
aedf3c6536

+ 6 - 2
kafka-ui-react-app/src/components/Topics/Topic/Edit/Edit.tsx

@@ -21,7 +21,11 @@ interface Props {
   isFetched: boolean;
   isTopicUpdated: boolean;
   fetchTopicConfig: (clusterName: ClusterName, topicName: TopicName) => void;
-  updateTopic: (clusterName: ClusterName, form: TopicFormDataRaw) => void;
+  updateTopic: (
+    clusterName: ClusterName,
+    topicName: TopicName,
+    form: TopicFormDataRaw
+  ) => void;
 }
 
 const DEFAULTS = {
@@ -104,7 +108,7 @@ const Edit: React.FC<Props> = ({
   });
 
   const onSubmit = async (data: TopicFormDataRaw) => {
-    updateTopic(clusterName, data);
+    updateTopic(clusterName, topicName, data);
     setIsSubmitting(true); // Keep this action after updateTopic to prevent redirect before update.
   };
 

+ 2 - 1
kafka-ui-react-app/src/redux/actions/thunks/topics.ts

@@ -234,13 +234,14 @@ export const createTopic = (
 
 export const updateTopic = (
   clusterName: ClusterName,
+  topicName: TopicName,
   form: TopicFormDataRaw
 ): PromiseThunkResult => async (dispatch, getState) => {
   dispatch(actions.updateTopicAction.request());
   try {
     const topic: Topic = await topicsApiClient.updateTopic({
       clusterName,
-      topicName: form.name,
+      topicName,
       topicUpdate: formatTopicUpdate(form),
     });