Skip to content

Commit 06a8374

Browse files
authored
Merge branch 'main' into issues/729
2 parents 2c15651 + a05709f commit 06a8374

File tree

72 files changed

+582
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+582
-559
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
github: [kafbat]
2+
open_collective: kafka-ui

api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
<groupId>org.apache.maven.plugins</groupId>
330330
<artifactId>maven-surefire-plugin</artifactId>
331331
<configuration>
332-
<argLine>@{argLine} --illegal-access=permit</argLine>
332+
<argLine>@{argLine}</argLine>
333333
</configuration>
334334
</plugin>
335335
<plugin>

api/src/main/java/io/kafbat/ui/client/RetryingKafkaConnectClient.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import io.kafbat.ui.connect.model.ConnectorTopics;
1313
import io.kafbat.ui.connect.model.NewConnector;
1414
import io.kafbat.ui.connect.model.TaskStatus;
15-
import io.kafbat.ui.exception.KafkaConnectConflictReponseException;
15+
import io.kafbat.ui.exception.KafkaConnectConflictResponseException;
1616
import io.kafbat.ui.exception.ValidationException;
1717
import io.kafbat.ui.util.WebClientConfigurator;
1818
import jakarta.validation.constraints.NotNull;
@@ -48,7 +48,7 @@ private static Retry conflictCodeRetry() {
4848
.fixedDelay(MAX_RETRIES, RETRIES_DELAY)
4949
.filter(e -> e instanceof WebClientResponseException.Conflict)
5050
.onRetryExhaustedThrow((spec, signal) ->
51-
new KafkaConnectConflictReponseException(
51+
new KafkaConnectConflictResponseException(
5252
(WebClientResponseException.Conflict) signal.failure()));
5353
}
5454

api/src/main/java/io/kafbat/ui/config/auth/BasicAuthSecurityConfig.java

-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package io.kafbat.ui.config.auth;
22

3-
import io.kafbat.ui.util.EmptyRedirectStrategy;
43
import io.kafbat.ui.util.StaticFileWebFilter;
5-
import java.net.URI;
64
import lombok.extern.slf4j.Slf4j;
75
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
86
import org.springframework.context.annotation.Bean;
@@ -12,8 +10,6 @@
1210
import org.springframework.security.config.web.server.SecurityWebFiltersOrder;
1311
import org.springframework.security.config.web.server.ServerHttpSecurity;
1412
import org.springframework.security.web.server.SecurityWebFilterChain;
15-
import org.springframework.security.web.server.authentication.RedirectServerAuthenticationSuccessHandler;
16-
import org.springframework.security.web.server.authentication.logout.RedirectServerLogoutSuccessHandler;
1713
import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatchers;
1814

1915
@Configuration

api/src/main/java/io/kafbat/ui/config/auth/condition/ActiveDirectoryCondition.java

-21
This file was deleted.

api/src/main/java/io/kafbat/ui/config/auth/logout/CognitoLogoutSuccessHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Mono<Void> handle(WebFilterExchange exchange, Authentication authenticati
4040
requestUri.getPath(), requestUri.getQuery());
4141

4242
final UriComponents baseUrl = UriComponentsBuilder
43-
.fromHttpUrl(fullUrl)
43+
.fromUriString(fullUrl)
4444
.replacePath("/")
4545
.replaceQuery(null)
4646
.fragment(null)

api/src/main/java/io/kafbat/ui/emitter/OffsetsInfo.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private Map<TopicPartition, Long> firstOffsetsForPolling(Consumer<?, ?> consumer
5353
Collection<TopicPartition> partitions) {
5454
try {
5555
// we try to use offsetsForTimes() to find earliest offsets, since for
56-
// some topics (like compacted) beginningOffsets() ruturning 0 offsets
56+
// some topics (like compacted) beginningOffsets() returning 0 offsets
5757
// even when effectively first offset can be very high
5858
var offsets = consumer.offsetsForTimes(
5959
partitions.stream().collect(Collectors.toMap(p -> p, p -> 0L))

api/src/main/java/io/kafbat/ui/emitter/ResultSizeLimiter.java

-23
This file was deleted.

api/src/main/java/io/kafbat/ui/exception/CelException.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package io.kafbat.ui.exception;
22

3+
import lombok.Getter;
4+
5+
@Getter
36
public class CelException extends CustomBaseException {
4-
private String celOriginalExpression;
7+
private final String celOriginalExpression;
58

69
public CelException(String celOriginalExpression, String errorMessage) {
710
super("CEL error. Original expression: %s. Error message: %s".formatted(celOriginalExpression, errorMessage));

api/src/main/java/io/kafbat/ui/exception/ConnectNotFoundException.java

-13
This file was deleted.

api/src/main/java/io/kafbat/ui/exception/DuplicateEntityException.java

-13
This file was deleted.

api/src/main/java/io/kafbat/ui/exception/ErrorCode.java

-6
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,19 @@
44
import org.slf4j.LoggerFactory;
55
import org.springframework.http.HttpStatus;
66

7-
87
public enum ErrorCode {
98

10-
FORBIDDEN(403, HttpStatus.FORBIDDEN),
11-
129
UNEXPECTED(5000, HttpStatus.INTERNAL_SERVER_ERROR),
1310
KSQL_API_ERROR(5001, HttpStatus.INTERNAL_SERVER_ERROR),
1411
BINDING_FAIL(4001, HttpStatus.BAD_REQUEST),
1512
NOT_FOUND(404, HttpStatus.NOT_FOUND),
1613
VALIDATION_FAIL(4002, HttpStatus.BAD_REQUEST),
1714
READ_ONLY_MODE_ENABLE(4003, HttpStatus.METHOD_NOT_ALLOWED),
1815
CONNECT_CONFLICT_RESPONSE(4004, HttpStatus.CONFLICT),
19-
DUPLICATED_ENTITY(4005, HttpStatus.CONFLICT),
2016
UNPROCESSABLE_ENTITY(4006, HttpStatus.UNPROCESSABLE_ENTITY),
2117
CLUSTER_NOT_FOUND(4007, HttpStatus.NOT_FOUND),
2218
TOPIC_NOT_FOUND(4008, HttpStatus.NOT_FOUND),
2319
SCHEMA_NOT_FOUND(4009, HttpStatus.NOT_FOUND),
24-
CONNECT_NOT_FOUND(4010, HttpStatus.NOT_FOUND),
25-
KSQLDB_NOT_FOUND(4011, HttpStatus.NOT_FOUND),
2620
DIR_NOT_FOUND(4012, HttpStatus.BAD_REQUEST),
2721
TOPIC_OR_PARTITION_NOT_FOUND(4013, HttpStatus.BAD_REQUEST),
2822
INVALID_REQUEST(4014, HttpStatus.BAD_REQUEST),

api/src/main/java/io/kafbat/ui/exception/GlobalErrorWebExceptionHandler.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ private Mono<ServerResponse> renderErrorResponse(ServerRequest request) {
5454
Throwable throwable = getError(request);
5555

5656
// validation and params binding errors
57-
if (throwable instanceof WebExchangeBindException) {
58-
return render((WebExchangeBindException) throwable, request);
57+
if (throwable instanceof WebExchangeBindException webExchangeBindException) {
58+
return render(webExchangeBindException, request);
5959
}
6060

6161
// requests mapping & access errors
62-
if (throwable instanceof ResponseStatusException) {
63-
return render((ResponseStatusException) throwable, request);
62+
if (throwable instanceof ResponseStatusException responseStatusException) {
63+
return render(responseStatusException, request);
6464
}
6565

6666
// custom exceptions
67-
if (throwable instanceof CustomBaseException) {
68-
return render((CustomBaseException) throwable, request);
67+
if (throwable instanceof CustomBaseException customBaseException) {
68+
return render(customBaseException, request);
6969
}
7070

7171
return renderDefault(throwable, request);
@@ -102,8 +102,7 @@ private Mono<ServerResponse> render(CustomBaseException baseException, ServerReq
102102

103103
private Mono<ServerResponse> render(WebExchangeBindException exception, ServerRequest request) {
104104
Map<String, Set<String>> fieldErrorsMap = exception.getFieldErrors().stream()
105-
.collect(Collectors
106-
.toMap(FieldError::getField, f -> Set.of(extractFieldErrorMsg(f)), Sets::union));
105+
.collect(Collectors.toMap(FieldError::getField, f -> Set.of(extractFieldErrorMsg(f)), Sets::union));
107106

108107
var fieldsErrors = fieldErrorsMap.entrySet().stream()
109108
.map(e -> {
@@ -151,9 +150,7 @@ private String requestId(ServerRequest request) {
151150
}
152151

153152
private Consumer<HttpHeaders> headers(ServerRequest request) {
154-
return (HttpHeaders headers) -> {
155-
CorsGlobalConfiguration.fillCorsHeader(headers, request.exchange().getRequest());
156-
};
153+
return (HttpHeaders headers) -> CorsGlobalConfiguration.fillCorsHeader(headers, request.exchange().getRequest());
157154
}
158155

159156
private BigDecimal currentTimestamp() {

api/src/main/java/io/kafbat/ui/exception/KafkaConnectConflictReponseException.java renamed to api/src/main/java/io/kafbat/ui/exception/KafkaConnectConflictResponseException.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package io.kafbat.ui.exception;
22

3-
43
import org.springframework.web.reactive.function.client.WebClientResponseException;
54

6-
public class KafkaConnectConflictReponseException extends CustomBaseException {
5+
public class KafkaConnectConflictResponseException extends CustomBaseException {
76

8-
public KafkaConnectConflictReponseException(WebClientResponseException.Conflict e) {
7+
public KafkaConnectConflictResponseException(WebClientResponseException.Conflict e) {
98
super("Kafka Connect responded with 409 (Conflict) code. Response body: "
109
+ e.getResponseBodyAsString());
1110
}

api/src/main/java/io/kafbat/ui/exception/KsqlDbNotFoundException.java

-13
This file was deleted.

api/src/main/java/io/kafbat/ui/exception/SchemaFailedToDeleteException.java

-13
This file was deleted.

api/src/main/java/io/kafbat/ui/exception/UnprocessableEntityException.java

-14
This file was deleted.

api/src/main/java/io/kafbat/ui/mapper/ConsumerGroupMapper.java

+9-17
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,15 @@ private static BrokerDTO mapCoordinator(Node node) {
9797
return new BrokerDTO().host(node.host()).id(node.id()).port(node.port());
9898
}
9999

100-
private static ConsumerGroupStateDTO mapConsumerGroupState(
101-
org.apache.kafka.common.ConsumerGroupState state) {
102-
switch (state) {
103-
case DEAD:
104-
return ConsumerGroupStateDTO.DEAD;
105-
case EMPTY:
106-
return ConsumerGroupStateDTO.EMPTY;
107-
case STABLE:
108-
return ConsumerGroupStateDTO.STABLE;
109-
case PREPARING_REBALANCE:
110-
return ConsumerGroupStateDTO.PREPARING_REBALANCE;
111-
case COMPLETING_REBALANCE:
112-
return ConsumerGroupStateDTO.COMPLETING_REBALANCE;
113-
default:
114-
return ConsumerGroupStateDTO.UNKNOWN;
115-
}
100+
private static ConsumerGroupStateDTO mapConsumerGroupState(org.apache.kafka.common.ConsumerGroupState state) {
101+
return switch (state) {
102+
case DEAD -> ConsumerGroupStateDTO.DEAD;
103+
case EMPTY -> ConsumerGroupStateDTO.EMPTY;
104+
case STABLE -> ConsumerGroupStateDTO.STABLE;
105+
case PREPARING_REBALANCE -> ConsumerGroupStateDTO.PREPARING_REBALANCE;
106+
case COMPLETING_REBALANCE -> ConsumerGroupStateDTO.COMPLETING_REBALANCE;
107+
default -> ConsumerGroupStateDTO.UNKNOWN;
108+
};
116109
}
117110

118-
119111
}

api/src/main/java/io/kafbat/ui/mapper/DescribeLogDirsMapper.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private BrokersLogdirsDTO toBrokerLogDirs(Integer broker, String dirName,
4242

4343
private BrokerTopicLogdirsDTO toTopicLogDirs(Integer broker, String name,
4444
List<Map.Entry<TopicPartition,
45-
DescribeLogDirsResponse.ReplicaInfo>> partitions) {
45+
DescribeLogDirsResponse.ReplicaInfo>> partitions) {
4646
BrokerTopicLogdirsDTO topic = new BrokerTopicLogdirsDTO();
4747
topic.setName(name);
4848
topic.setPartitions(
@@ -54,8 +54,7 @@ private BrokerTopicLogdirsDTO toTopicLogDirs(Integer broker, String name,
5454
}
5555

5656
private BrokerTopicPartitionLogdirDTO topicPartitionLogDir(Integer broker, Integer partition,
57-
DescribeLogDirsResponse.ReplicaInfo
58-
replicaInfo) {
57+
DescribeLogDirsResponse.ReplicaInfo replicaInfo) {
5958
BrokerTopicPartitionLogdirDTO logDir = new BrokerTopicPartitionLogdirDTO();
6059
logDir.setBroker(broker);
6160
logDir.setPartition(partition);

api/src/main/java/io/kafbat/ui/model/BrokerMetrics.java

-11
This file was deleted.

api/src/main/java/io/kafbat/ui/model/InternalClusterMetrics.java

-54
This file was deleted.

0 commit comments

Comments
 (0)