Sfoglia il codice sorgente

endpoints improvement

iliax 2 anni fa
parent
commit
c1e13ef0f8

+ 6 - 10
kafka-ui-api/src/main/java/com/provectus/kafka/ui/controller/TopicsController.java

@@ -27,6 +27,7 @@ import com.provectus.kafka.ui.service.TopicsService;
 import com.provectus.kafka.ui.service.analyze.TopicAnalysisService;
 import com.provectus.kafka.ui.service.reassign.ReassignmentService;
 import java.util.Comparator;
+import java.util.HashSet;
 import java.util.List;
 import java.util.stream.Collectors;
 import javax.validation.Valid;
@@ -235,14 +236,9 @@ public class TopicsController extends AbstractController implements TopicsApi {
 
   @Override
   public Mono<ResponseEntity<ReassignPartitionsCommandDTO>> getCurrentPartitionAssignment(String clusterName,
-                                                                                          Flux<String> topicsList,
+                                                                                          List<String> topics,
                                                                                           ServerWebExchange exchange) {
-    return topicsList
-        .collect(Collectors.toSet())
-        .flatMap(topics ->
-            reassignmentService.getCurrentAssignment(
-                getCluster(clusterName),
-                topics))
+    return reassignmentService.getCurrentAssignment(getCluster(clusterName), new HashSet<>(topics))
         .map(ResponseEntity::ok);
   }
 
@@ -263,9 +259,9 @@ public class TopicsController extends AbstractController implements TopicsApi {
   }
 
   @Override
-  public Mono<ResponseEntity<Void>> cancelPartitionAssignment(String clusterName,
-                                                              Mono<PartitionReassignmentCancellationDTO> cancelDto,
-                                                              ServerWebExchange exchange) {
+  public Mono<ResponseEntity<Void>> cancelRunningPartitionAssignment(String clusterName,
+                                                                     Mono<PartitionReassignmentCancellationDTO> cancelDto,
+                                                                     ServerWebExchange exchange) {
     return cancelDto
         .flatMap(dto ->
             reassignmentService.cancelReassignment(

+ 12 - 15
kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml

@@ -1730,7 +1730,7 @@ paths:
         404:
           description: Not found
 
-  /api/clusters/{clusterName}/partitionsreaassignments/generate:
+  /api/clusters/{clusterName}/partitionsreaassignments/suggestions:
     post:
       tags:
         - Topics
@@ -1755,7 +1755,7 @@ paths:
                   $ref: '#/components/schemas/ReassignPartitionsCommand'
 
   /api/clusters/{clusterName}/partitionsreaassignments/current:
-    post:
+    get:
       tags:
         - Topics
       operationId: getCurrentPartitionAssignment
@@ -1765,13 +1765,14 @@ paths:
           required: true
           schema:
             type: string
-      requestBody:
-        content:
-          application/json:
-            schema:
-              type: array
-              items:
-                type: string
+        - name: topics
+          required: true
+          in: query
+          description: topic names for which assignments should be returned
+          schema:
+            type: array
+            items:
+              type: string
       responses:
         200:
           description: OK
@@ -1780,7 +1781,7 @@ paths:
               schema:
                 $ref: '#/components/schemas/ReassignPartitionsCommand'
 
-  /api/clusters/{clusterName}/partitionsreaassignments/execute:
+  /api/clusters/{clusterName}/partitionsreaassignments/running:
     post:
       tags:
         - Topics
@@ -1799,12 +1800,10 @@ paths:
       responses:
         200:
           description: OK
-
-  /api/clusters/{clusterName}/partitionsreaassignments/cancel:
     delete:
       tags:
         - Topics
-      operationId: cancelPartitionAssignment
+      operationId: cancelRunningPartitionAssignment
       parameters:
         - name: clusterName
           in: path
@@ -1819,8 +1818,6 @@ paths:
       responses:
         200:
           description: OK
-
-  /api/clusters/{clusterName}/partitionsreaassignments/inprogress:
     get:
       tags:
         - Topics