Skip to content

Commit

Permalink
Merge branch 'main' into chore/rbac_ad
Browse files Browse the repository at this point in the history
  • Loading branch information
Haarolean authored Dec 16, 2024
2 parents 488f5b3 + 07c694f commit 4853eca
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions api/src/main/java/io/kafbat/ui/service/KafkaConnectService.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,22 +207,13 @@ public Mono<Void> deleteConnector(
public Mono<Void> updateConnectorState(KafkaCluster cluster, String connectName,
String connectorName, ConnectorActionDTO action) {
return api(cluster, connectName)
.mono(client -> {
switch (action) {
case RESTART:
return client.restartConnector(connectorName, false, false);
case RESTART_ALL_TASKS:
return restartTasks(cluster, connectName, connectorName, task -> true);
case RESTART_FAILED_TASKS:
return restartTasks(cluster, connectName, connectorName,
t -> t.getStatus().getState() == ConnectorTaskStatusDTO.FAILED);
case PAUSE:
return client.pauseConnector(connectorName);
case RESUME:
return client.resumeConnector(connectorName);
default:
throw new IllegalStateException("Unexpected value: " + action);
}
.mono(client -> switch (action) {
case RESTART -> client.restartConnector(connectorName, false, false);
case RESTART_ALL_TASKS -> restartTasks(cluster, connectName, connectorName, task -> true);
case RESTART_FAILED_TASKS -> restartTasks(cluster, connectName, connectorName,
t -> t.getStatus().getState() == ConnectorTaskStatusDTO.FAILED);
case PAUSE -> client.pauseConnector(connectorName);
case RESUME -> client.resumeConnector(connectorName);
});
}

Expand Down

0 comments on commit 4853eca

Please sign in to comment.