Skip to content

Commit

Permalink
Merge branch 'main' into feat/button-state-in-ro-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
spartanns authored Oct 17, 2024
2 parents 0fb3841 + b4ffd96 commit 849aa1c
Show file tree
Hide file tree
Showing 12 changed files with 199 additions and 177 deletions.
13 changes: 0 additions & 13 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,6 @@
<artifactId>cel</artifactId>
</dependency>
<!-- CVE fixes -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.12</version>
</dependency>
<!-- CVE fixes -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.12</version>
</dependency>
<!-- CVE fixes -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
Expand All @@ -289,7 +277,6 @@
<artifactId>commons-compress</artifactId>
<version>1.26.0</version>
</dependency>

</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ReadOnlyModeFilter implements WebFilter {
Pattern.compile("/api/clusters/(?<clusterName>[^/]++)");

private static final Set<Pattern> SAFE_ENDPOINTS = Set.of(
Pattern.compile("/api/clusters/[^/]+/topics/[^/]+/(smartfilters)$")
Pattern.compile("/api/clusters/[^/]+/topics/[^/]+/(smartfilters|analysis)$")
);

private final ClustersStorage clustersStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ public class InternalBrokerConfig {
private final boolean isReadOnly;
private final List<ConfigEntry.ConfigSynonym> synonyms;

public static InternalBrokerConfig from(ConfigEntry configEntry) {
public static InternalBrokerConfig from(ConfigEntry configEntry, boolean readOnlyCluster) {
InternalBrokerConfig.InternalBrokerConfigBuilder builder = InternalBrokerConfig.builder()
.name(configEntry.name())
.value(configEntry.value())
.source(configEntry.source())
.isReadOnly(configEntry.isReadOnly())
.isReadOnly(readOnlyCluster || configEntry.isReadOnly())
.isSensitive(configEntry.isSensitive())
.synonyms(configEntry.synonyms());
return builder.build();
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/io/kafbat/ui/service/BrokerService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private Flux<InternalBrokerConfig> getBrokersConfig(KafkaCluster cluster, Intege
}
return loadBrokersConfig(cluster, brokerId)
.map(list -> list.stream()
.map(InternalBrokerConfig::from)
.map(configEntry -> InternalBrokerConfig.from(configEntry, cluster.isReadOnly()))
.collect(Collectors.toList()))
.flatMapMany(Flux::fromIterable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.boot.context.properties.bind.BindException;
Expand All @@ -21,11 +19,7 @@ class PropertyResolverImplTest {

private final MockEnvironment env = new MockEnvironment();

@Data
@AllArgsConstructor
public static class CustomPropertiesClass {
private String f1;
private Integer f2;
public record CustomPropertiesClass(String f1, Integer f2) {
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
import static org.assertj.core.api.Assertions.assertThat;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.DecimalNode;
import com.fasterxml.jackson.databind.node.DoubleNode;
import com.fasterxml.jackson.databind.node.IntNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.TextNode;
import io.kafbat.ui.AbstractIntegrationTest;
import java.math.BigDecimal;
import java.time.Duration;
import java.util.Map;
import org.junit.jupiter.api.AfterAll;
Expand Down Expand Up @@ -80,23 +79,23 @@ private void assertLastKsqTutorialQueryResult(KsqlApiClient client) {
assertThat(header.getValues()).isNull();
})
.assertNext(row -> {
var distance = (DecimalNode) row.getValues().get(0).get(0);
var distance = (DoubleNode) row.getValues().get(0).get(0);
var riders = (ArrayNode) row.getValues().get(0).get(1);
var count = (IntNode) row.getValues().get(0).get(2);

assertThat(distance).isEqualTo(new DecimalNode(new BigDecimal(0)));
assertThat(distance).isEqualTo(new DoubleNode(0D));
assertThat(riders).isEqualTo(new ArrayNode(JsonNodeFactory.instance)
.add(new TextNode("4ab5cbad"))
.add(new TextNode("8b6eae59"))
.add(new TextNode("4a7c7b41")));
assertThat(count).isEqualTo(new IntNode(3));
})
.assertNext(row -> {
var distance = (DecimalNode) row.getValues().get(0).get(0);
var distance = (DoubleNode) row.getValues().get(0).get(0);
var riders = (ArrayNode) row.getValues().get(0).get(1);
var count = (IntNode) row.getValues().get(0).get(2);

assertThat(distance).isEqualTo(new DecimalNode(new BigDecimal(10)));
assertThat(distance).isEqualTo(new DoubleNode(10D));
assertThat(riders).isEqualTo(new ArrayNode(JsonNodeFactory.instance)
.add(new TextNode("18f4ea86")));
assertThat(count).isEqualTo(new IntNode(1));
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"pretty-ms": "7.0.1",
"react": "18.2.0",
"react-ace": "11.0.1",
"react-datepicker": "6.9.0",
"react-datepicker": "7.4.0",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.13",
"react-hook-form": "7.51.3",
Expand Down
Loading

0 comments on commit 849aa1c

Please sign in to comment.