Skip to content

Commit

Permalink
rollback forced typing leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugong42 committed Jan 3, 2025
1 parent e802bf1 commit 0e1bdb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions api/src/main/java/io/kafbat/ui/service/TopicsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import io.kafbat.ui.model.InternalLogDirStats;
import io.kafbat.ui.model.InternalPartition;
import io.kafbat.ui.model.InternalPartitionsOffsets;
import io.kafbat.ui.model.InternalPartitionsOffsets.Offsets;
import io.kafbat.ui.model.InternalReplica;
import io.kafbat.ui.model.InternalTopic;
import io.kafbat.ui.model.InternalTopicConfig;
Expand Down Expand Up @@ -144,11 +143,13 @@ private Mono<InternalPartitionsOffsets> getPartitionOffsets(Map<String, TopicDes
var descriptions = descriptionsMap.values();
return ac.listOffsets(descriptions, OffsetSpec.earliest())
.zipWith(ac.listOffsets(descriptions, OffsetSpec.latest()),
(earliest, latest) -> (Map<TopicPartition, Offsets>) Sets.intersection(earliest.keySet(), latest.keySet())
(earliest, latest) ->
Sets.intersection(earliest.keySet(), latest.keySet())
.stream()
.map(tp -> Map.entry(tp,
new InternalPartitionsOffsets.Offsets(
earliest.get(tp), latest.get(tp))))
.map(tp ->
Map.entry(tp,
new InternalPartitionsOffsets.Offsets(
earliest.get(tp), latest.get(tp))))
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue)))
.map(InternalPartitionsOffsets::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ private Mono<AuthenticatedUser> extractUser(Signal<?> sig) {

return sig.getContextView().<Mono<SecurityContext>>get(key)
.map(context -> context.getAuthentication().getPrincipal())
.map(AuditService::extractUserFromObject)
.map(AuditService::extractUser)
.switchIfEmpty(Mono.just(UNKNOWN_USER));
}

private static AuthenticatedUser extractUserFromObject(Object principal) {
private static AuthenticatedUser extractUser(Object principal) {
if (principal instanceof UserDetails u) {
return new AuthenticatedUser(u.getUsername(), Set.of());
} else if (principal instanceof AuthenticatedPrincipal p) {
Expand Down

0 comments on commit 0e1bdb9

Please sign in to comment.