Skip to content

Commit c1e13ef

Browse files
author
iliax
committed
endpoints improvement
1 parent 5255e05 commit c1e13ef

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.provectus.kafka.ui.service.analyze.TopicAnalysisService;
2828
import com.provectus.kafka.ui.service.reassign.ReassignmentService;
2929
import java.util.Comparator;
30+
import java.util.HashSet;
3031
import java.util.List;
3132
import java.util.stream.Collectors;
3233
import javax.validation.Valid;
@@ -235,14 +236,9 @@ public Mono<ResponseEntity<TopicAnalysisDTO>> getTopicAnalysis(String clusterNam
235236

236237
@Override
237238
public Mono<ResponseEntity<ReassignPartitionsCommandDTO>> getCurrentPartitionAssignment(String clusterName,
238-
Flux<String> topicsList,
239+
List<String> topics,
239240
ServerWebExchange exchange) {
240-
return topicsList
241-
.collect(Collectors.toSet())
242-
.flatMap(topics ->
243-
reassignmentService.getCurrentAssignment(
244-
getCluster(clusterName),
245-
topics))
241+
return reassignmentService.getCurrentAssignment(getCluster(clusterName), new HashSet<>(topics))
246242
.map(ResponseEntity::ok);
247243
}
248244

@@ -263,9 +259,9 @@ public Mono<ResponseEntity<InProgressReassignmentDTO>> getInProgressAssignments(
263259
}
264260

265261
@Override
266-
public Mono<ResponseEntity<Void>> cancelPartitionAssignment(String clusterName,
267-
Mono<PartitionReassignmentCancellationDTO> cancelDto,
268-
ServerWebExchange exchange) {
262+
public Mono<ResponseEntity<Void>> cancelRunningPartitionAssignment(String clusterName,
263+
Mono<PartitionReassignmentCancellationDTO> cancelDto,
264+
ServerWebExchange exchange) {
269265
return cancelDto
270266
.flatMap(dto ->
271267
reassignmentService.cancelReassignment(

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ paths:
17301730
404:
17311731
description: Not found
17321732

1733-
/api/clusters/{clusterName}/partitionsreaassignments/generate:
1733+
/api/clusters/{clusterName}/partitionsreaassignments/suggestions:
17341734
post:
17351735
tags:
17361736
- Topics
@@ -1755,7 +1755,7 @@ paths:
17551755
$ref: '#/components/schemas/ReassignPartitionsCommand'
17561756

17571757
/api/clusters/{clusterName}/partitionsreaassignments/current:
1758-
post:
1758+
get:
17591759
tags:
17601760
- Topics
17611761
operationId: getCurrentPartitionAssignment
@@ -1765,13 +1765,14 @@ paths:
17651765
required: true
17661766
schema:
17671767
type: string
1768-
requestBody:
1769-
content:
1770-
application/json:
1771-
schema:
1772-
type: array
1773-
items:
1774-
type: string
1768+
- name: topics
1769+
required: true
1770+
in: query
1771+
description: topic names for which assignments should be returned
1772+
schema:
1773+
type: array
1774+
items:
1775+
type: string
17751776
responses:
17761777
200:
17771778
description: OK
@@ -1780,7 +1781,7 @@ paths:
17801781
schema:
17811782
$ref: '#/components/schemas/ReassignPartitionsCommand'
17821783

1783-
/api/clusters/{clusterName}/partitionsreaassignments/execute:
1784+
/api/clusters/{clusterName}/partitionsreaassignments/running:
17841785
post:
17851786
tags:
17861787
- Topics
@@ -1799,12 +1800,10 @@ paths:
17991800
responses:
18001801
200:
18011802
description: OK
1802-
1803-
/api/clusters/{clusterName}/partitionsreaassignments/cancel:
18041803
delete:
18051804
tags:
18061805
- Topics
1807-
operationId: cancelPartitionAssignment
1806+
operationId: cancelRunningPartitionAssignment
18081807
parameters:
18091808
- name: clusterName
18101809
in: path
@@ -1819,8 +1818,6 @@ paths:
18191818
responses:
18201819
200:
18211820
description: OK
1822-
1823-
/api/clusters/{clusterName}/partitionsreaassignments/inprogress:
18241821
get:
18251822
tags:
18261823
- Topics

0 commit comments

Comments
 (0)