Merge branch 'master' into FE_ISSUE_754_acl
This commit is contained in:
commit
9894df334c
53 changed files with 630 additions and 409 deletions
|
@ -12,7 +12,7 @@
|
|||
<artifactId>kafka-ui-api</artifactId>
|
||||
|
||||
<properties>
|
||||
<jacoco.version>0.8.8</jacoco.version>
|
||||
<jacoco.version>0.8.10</jacoco.version>
|
||||
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
|
||||
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
|
||||
<sonar.jacoco.reportPath>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPath>
|
||||
|
|
|
@ -14,13 +14,11 @@ public class LdapProperties {
|
|||
private String adminPassword;
|
||||
private String userFilterSearchBase;
|
||||
private String userFilterSearchFilter;
|
||||
private String groupFilterSearchBase;
|
||||
|
||||
@Value("${oauth2.ldap.activeDirectory:false}")
|
||||
private boolean isActiveDirectory;
|
||||
@Value("${oauth2.ldap.aсtiveDirectory.domain:@null}")
|
||||
private String activeDirectoryDomain;
|
||||
|
||||
@Value("${oauth2.ldap.groupRoleAttribute:cn}")
|
||||
private String groupRoleAttribute;
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.provectus.kafka.ui.config.auth;
|
|||
import static com.provectus.kafka.ui.config.auth.AbstractAuthSecurityConfig.AUTH_WHITELIST;
|
||||
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
import com.provectus.kafka.ui.service.rbac.extractor.RbacLdapAuthoritiesExtractor;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -12,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
@ -34,6 +32,8 @@ import org.springframework.security.ldap.authentication.LdapAuthenticationProvid
|
|||
import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider;
|
||||
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
|
||||
import org.springframework.security.ldap.search.LdapUserSearch;
|
||||
import org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator;
|
||||
import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
|
||||
import org.springframework.security.ldap.userdetails.LdapUserDetailsMapper;
|
||||
import org.springframework.security.web.server.SecurityWebFilterChain;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class LdapSecurityConfig {
|
|||
|
||||
@Bean
|
||||
public ReactiveAuthenticationManager authenticationManager(BaseLdapPathContextSource contextSource,
|
||||
ApplicationContext context,
|
||||
LdapAuthoritiesPopulator ldapAuthoritiesPopulator,
|
||||
@Nullable AccessControlService acs) {
|
||||
var rbacEnabled = acs != null && acs.isRbacEnabled();
|
||||
BindAuthenticator ba = new BindAuthenticator(contextSource);
|
||||
|
@ -67,7 +67,7 @@ public class LdapSecurityConfig {
|
|||
AbstractLdapAuthenticationProvider authenticationProvider;
|
||||
if (!props.isActiveDirectory()) {
|
||||
authenticationProvider = rbacEnabled
|
||||
? new LdapAuthenticationProvider(ba, new RbacLdapAuthoritiesExtractor(context))
|
||||
? new LdapAuthenticationProvider(ba, ldapAuthoritiesPopulator)
|
||||
: new LdapAuthenticationProvider(ba);
|
||||
} else {
|
||||
authenticationProvider = new ActiveDirectoryLdapAuthenticationProvider(props.getActiveDirectoryDomain(),
|
||||
|
@ -95,6 +95,15 @@ public class LdapSecurityConfig {
|
|||
return ctx;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public LdapAuthoritiesPopulator ldapAuthoritiesPopulator(BaseLdapPathContextSource contextSource) {
|
||||
var authoritiesPopulator = new DefaultLdapAuthoritiesPopulator(contextSource, props.getGroupFilterSearchBase());
|
||||
authoritiesPopulator.setRolePrefix("");
|
||||
authoritiesPopulator.setConvertToUpperCase(false);
|
||||
return authoritiesPopulator;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain configureLdap(ServerHttpSecurity http) {
|
||||
log.info("Configuring LDAP authentication.");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.provectus.kafka.ui.config.auth;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -14,7 +15,16 @@ public class OAuthProperties {
|
|||
private Map<String, OAuth2Provider> client = new HashMap<>();
|
||||
|
||||
@PostConstruct
|
||||
public void validate() {
|
||||
public void init() {
|
||||
getClient().values().forEach((provider) -> {
|
||||
if (provider.getCustomParams() == null) {
|
||||
provider.setCustomParams(Collections.emptyMap());
|
||||
}
|
||||
if (provider.getScope() == null) {
|
||||
provider.setScope(Collections.emptySet());
|
||||
}
|
||||
});
|
||||
|
||||
getClient().values().forEach(this::validateProvider);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,7 @@ public final class OAuthPropertiesConverter {
|
|||
}
|
||||
|
||||
private static boolean isGoogle(OAuth2Provider provider) {
|
||||
return provider.getCustomParams() != null
|
||||
&& GOOGLE.equalsIgnoreCase(provider.getCustomParams().get(TYPE));
|
||||
return GOOGLE.equalsIgnoreCase(provider.getCustomParams().get(TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,13 +72,13 @@ public class OAuthSecurityConfig extends AbstractAuthSecurityConfig {
|
|||
final OidcReactiveOAuth2UserService delegate = new OidcReactiveOAuth2UserService();
|
||||
return request -> delegate.loadUser(request)
|
||||
.flatMap(user -> {
|
||||
String providerId = request.getClientRegistration().getRegistrationId();
|
||||
final var extractor = getExtractor(providerId, acs);
|
||||
var provider = getProviderByProviderId(request.getClientRegistration().getRegistrationId());
|
||||
final var extractor = getExtractor(provider, acs);
|
||||
if (extractor == null) {
|
||||
return Mono.just(user);
|
||||
}
|
||||
|
||||
return extractor.extract(acs, user, Map.of("request", request))
|
||||
return extractor.extract(acs, user, Map.of("request", request, "provider", provider))
|
||||
.map(groups -> new RbacOidcUser(user, groups));
|
||||
});
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ public class OAuthSecurityConfig extends AbstractAuthSecurityConfig {
|
|||
final DefaultReactiveOAuth2UserService delegate = new DefaultReactiveOAuth2UserService();
|
||||
return request -> delegate.loadUser(request)
|
||||
.flatMap(user -> {
|
||||
String providerId = request.getClientRegistration().getRegistrationId();
|
||||
final var extractor = getExtractor(providerId, acs);
|
||||
var provider = getProviderByProviderId(request.getClientRegistration().getRegistrationId());
|
||||
final var extractor = getExtractor(provider, acs);
|
||||
if (extractor == null) {
|
||||
return Mono.just(user);
|
||||
}
|
||||
|
||||
return extractor.extract(acs, user, Map.of("request", request))
|
||||
return extractor.extract(acs, user, Map.of("request", request, "provider", provider))
|
||||
.map(groups -> new RbacOAuth2User(user, groups));
|
||||
});
|
||||
}
|
||||
|
@ -113,18 +113,18 @@ public class OAuthSecurityConfig extends AbstractAuthSecurityConfig {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
private ProviderAuthorityExtractor getExtractor(final String providerId, AccessControlService acs) {
|
||||
final String provider = getProviderByProviderId(providerId);
|
||||
private ProviderAuthorityExtractor getExtractor(final OAuthProperties.OAuth2Provider provider,
|
||||
AccessControlService acs) {
|
||||
Optional<ProviderAuthorityExtractor> extractor = acs.getOauthExtractors()
|
||||
.stream()
|
||||
.filter(e -> e.isApplicable(provider))
|
||||
.filter(e -> e.isApplicable(provider.getProvider(), provider.getCustomParams()))
|
||||
.findFirst();
|
||||
|
||||
return extractor.orElse(null);
|
||||
}
|
||||
|
||||
private String getProviderByProviderId(final String providerId) {
|
||||
return properties.getClient().get(providerId).getProvider();
|
||||
private OAuthProperties.OAuth2Provider getProviderByProviderId(final String providerId) {
|
||||
return properties.getClient().get(providerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,10 +46,8 @@ public class CognitoLogoutSuccessHandler implements LogoutSuccessHandler {
|
|||
.fragment(null)
|
||||
.build();
|
||||
|
||||
Assert.isTrue(
|
||||
provider.getCustomParams() != null && provider.getCustomParams().containsKey("logoutUrl"),
|
||||
"Custom params should contain 'logoutUrl'"
|
||||
);
|
||||
Assert.isTrue(provider.getCustomParams().containsKey("logoutUrl"),
|
||||
"Custom params should contain 'logoutUrl'");
|
||||
final var uri = UriComponentsBuilder
|
||||
.fromUri(URI.create(provider.getCustomParams().get("logoutUrl")))
|
||||
.queryParam("client_id", provider.getClientId())
|
||||
|
|
|
@ -39,41 +39,42 @@ public class MessageFilters {
|
|||
}
|
||||
|
||||
static Predicate<TopicMessageDTO> groovyScriptFilter(String script) {
|
||||
var compiledScript = compileScript(script);
|
||||
var engine = getGroovyEngine();
|
||||
var compiledScript = compileScript(engine, script);
|
||||
var jsonSlurper = new JsonSlurper();
|
||||
return new Predicate<TopicMessageDTO>() {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public boolean test(TopicMessageDTO msg) {
|
||||
var bindings = getGroovyEngine().createBindings();
|
||||
var bindings = engine.createBindings();
|
||||
bindings.put("partition", msg.getPartition());
|
||||
bindings.put("offset", msg.getOffset());
|
||||
bindings.put("timestampMs", msg.getTimestamp().toInstant().toEpochMilli());
|
||||
bindings.put("keyAsText", msg.getKey());
|
||||
bindings.put("valueAsText", msg.getContent());
|
||||
bindings.put("headers", msg.getHeaders());
|
||||
bindings.put("key", parseToJsonOrReturnNull(jsonSlurper, msg.getKey()));
|
||||
bindings.put("value", parseToJsonOrReturnNull(jsonSlurper, msg.getContent()));
|
||||
bindings.put("key", parseToJsonOrReturnAsIs(jsonSlurper, msg.getKey()));
|
||||
bindings.put("value", parseToJsonOrReturnAsIs(jsonSlurper, msg.getContent()));
|
||||
var result = compiledScript.eval(bindings);
|
||||
if (result instanceof Boolean) {
|
||||
return (Boolean) result;
|
||||
} else {
|
||||
throw new ValidationException(
|
||||
String.format("Unexpected script result: %s, Boolean should be returned instead", result));
|
||||
"Unexpected script result: %s, Boolean should be returned instead".formatted(result));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Object parseToJsonOrReturnNull(JsonSlurper parser, @Nullable String str) {
|
||||
private static Object parseToJsonOrReturnAsIs(JsonSlurper parser, @Nullable String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return parser.parseText(str);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,9 +87,9 @@ public class MessageFilters {
|
|||
return GROOVY_ENGINE;
|
||||
}
|
||||
|
||||
private static CompiledScript compileScript(String script) {
|
||||
private static CompiledScript compileScript(GroovyScriptEngineImpl engine, String script) {
|
||||
try {
|
||||
return getGroovyEngine().compile(script);
|
||||
return engine.compile(script);
|
||||
} catch (ScriptException e) {
|
||||
throw new ValidationException("Script syntax error: " + e.getMessage());
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.provectus.kafka.ui.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.MathContext;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -21,8 +21,6 @@ public class PartitionDistributionStats {
|
|||
// avg skew will show unuseful results on low number of partitions
|
||||
private static final int MIN_PARTITIONS_FOR_SKEW_CALCULATION = 50;
|
||||
|
||||
private static final MathContext ROUNDING_MATH_CTX = new MathContext(3);
|
||||
|
||||
private final Map<Node, Integer> partitionLeaders;
|
||||
private final Map<Node, Integer> partitionsCount;
|
||||
private final Map<Node, Integer> inSyncPartitions;
|
||||
|
@ -88,6 +86,7 @@ public class PartitionDistributionStats {
|
|||
return null;
|
||||
}
|
||||
value = value == null ? 0 : value;
|
||||
return new BigDecimal((value - avgValue) / avgValue * 100.0).round(ROUNDING_MATH_CTX);
|
||||
return new BigDecimal((value - avgValue) / avgValue * 100.0)
|
||||
.setScale(1, RoundingMode.HALF_UP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ public enum Provider {
|
|||
|
||||
OAUTH_COGNITO,
|
||||
|
||||
OAUTH,
|
||||
|
||||
LDAP,
|
||||
LDAP_AD;
|
||||
|
||||
|
@ -22,6 +24,8 @@ public enum Provider {
|
|||
public static String GOOGLE = "google";
|
||||
public static String GITHUB = "github";
|
||||
public static String COGNITO = "cognito";
|
||||
|
||||
public static String OAUTH = "oauth";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,16 +4,13 @@ import com.provectus.kafka.ui.model.ClusterFeature;
|
|||
import com.provectus.kafka.ui.model.KafkaCluster;
|
||||
import com.provectus.kafka.ui.service.ReactiveAdminClient.ClusterDescription;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.kafka.common.Node;
|
||||
import org.apache.kafka.common.acl.AclOperation;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
@ -24,11 +21,10 @@ import reactor.core.publisher.Mono;
|
|||
@Slf4j
|
||||
public class FeatureService {
|
||||
|
||||
private static final String DELETE_TOPIC_ENABLED_SERVER_PROPERTY = "delete.topic.enable";
|
||||
|
||||
private final AdminClientService adminClientService;
|
||||
|
||||
public Mono<List<ClusterFeature>> getAvailableFeatures(KafkaCluster cluster,
|
||||
public Mono<List<ClusterFeature>> getAvailableFeatures(ReactiveAdminClient adminClient,
|
||||
KafkaCluster cluster,
|
||||
ClusterDescription clusterDescription) {
|
||||
List<Mono<ClusterFeature>> features = new ArrayList<>();
|
||||
|
||||
|
@ -46,29 +42,17 @@ public class FeatureService {
|
|||
features.add(Mono.just(ClusterFeature.SCHEMA_REGISTRY));
|
||||
}
|
||||
|
||||
features.add(topicDeletionEnabled(cluster, clusterDescription.getController()));
|
||||
features.add(topicDeletionEnabled(adminClient));
|
||||
features.add(aclView(cluster));
|
||||
features.add(aclEdit(clusterDescription));
|
||||
|
||||
return Flux.fromIterable(features).flatMap(m -> m).collectList();
|
||||
}
|
||||
|
||||
private Mono<ClusterFeature> topicDeletionEnabled(KafkaCluster cluster, @Nullable Node controller) {
|
||||
if (controller == null) {
|
||||
return Mono.just(ClusterFeature.TOPIC_DELETION); // assuming it is enabled by default
|
||||
}
|
||||
return adminClientService.get(cluster)
|
||||
.flatMap(ac -> ac.loadBrokersConfig(List.of(controller.id())))
|
||||
.map(config ->
|
||||
config.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
.filter(e -> e.name().equals(DELETE_TOPIC_ENABLED_SERVER_PROPERTY))
|
||||
.map(e -> Boolean.parseBoolean(e.value()))
|
||||
.findFirst()
|
||||
.orElse(true))
|
||||
.flatMap(enabled -> enabled
|
||||
? Mono.just(ClusterFeature.TOPIC_DELETION)
|
||||
: Mono.empty());
|
||||
private Mono<ClusterFeature> topicDeletionEnabled(ReactiveAdminClient adminClient) {
|
||||
return adminClient.isTopicDeletionEnabled()
|
||||
? Mono.just(ClusterFeature.TOPIC_DELETION)
|
||||
: Mono.empty();
|
||||
}
|
||||
|
||||
private Mono<ClusterFeature> aclEdit(ClusterDescription clusterDescription) {
|
||||
|
|
|
@ -32,8 +32,9 @@ import java.util.stream.Collectors;
|
|||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.kafka.clients.admin.AdminClient;
|
||||
|
@ -75,7 +76,6 @@ import org.apache.kafka.common.errors.TopicAuthorizationException;
|
|||
import org.apache.kafka.common.errors.UnknownTopicOrPartitionException;
|
||||
import org.apache.kafka.common.errors.UnsupportedVersionException;
|
||||
import org.apache.kafka.common.requests.DescribeLogDirsResponse;
|
||||
import org.apache.kafka.common.resource.ResourcePattern;
|
||||
import org.apache.kafka.common.resource.ResourcePatternFilter;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
@ -85,7 +85,7 @@ import reactor.util.function.Tuples;
|
|||
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReactiveAdminClient implements Closeable {
|
||||
|
||||
public enum SupportedFeature {
|
||||
|
@ -104,7 +104,8 @@ public class ReactiveAdminClient implements Closeable {
|
|||
this.predicate = (admin, ver) -> Mono.just(ver != null && ver >= fromVersion);
|
||||
}
|
||||
|
||||
static Mono<Set<SupportedFeature>> forVersion(AdminClient ac, @Nullable Float kafkaVersion) {
|
||||
static Mono<Set<SupportedFeature>> forVersion(AdminClient ac, String kafkaVersionStr) {
|
||||
@Nullable Float kafkaVersion = KafkaVersion.parse(kafkaVersionStr).orElse(null);
|
||||
return Flux.fromArray(SupportedFeature.values())
|
||||
.flatMap(f -> f.predicate.apply(ac, kafkaVersion).map(enabled -> Tuples.of(f, enabled)))
|
||||
.filter(Tuple2::getT2)
|
||||
|
@ -123,19 +124,46 @@ public class ReactiveAdminClient implements Closeable {
|
|||
Set<AclOperation> authorizedOperations;
|
||||
}
|
||||
|
||||
public static Mono<ReactiveAdminClient> create(AdminClient adminClient) {
|
||||
return getClusterVersion(adminClient)
|
||||
.flatMap(ver ->
|
||||
getSupportedUpdateFeaturesForVersion(adminClient, ver)
|
||||
.map(features ->
|
||||
new ReactiveAdminClient(adminClient, ver, features)));
|
||||
@Builder
|
||||
private record ConfigRelatedInfo(String version,
|
||||
Set<SupportedFeature> features,
|
||||
boolean topicDeletionIsAllowed) {
|
||||
|
||||
private static Mono<ConfigRelatedInfo> extract(AdminClient ac, int controllerId) {
|
||||
return loadBrokersConfig(ac, List.of(controllerId))
|
||||
.map(map -> map.isEmpty() ? List.<ConfigEntry>of() : map.get(controllerId))
|
||||
.flatMap(configs -> {
|
||||
String version = "1.0-UNKNOWN";
|
||||
boolean topicDeletionEnabled = true;
|
||||
for (ConfigEntry entry : configs) {
|
||||
if (entry.name().contains("inter.broker.protocol.version")) {
|
||||
version = entry.value();
|
||||
}
|
||||
if (entry.name().equals("delete.topic.enable")) {
|
||||
topicDeletionEnabled = Boolean.parseBoolean(entry.value());
|
||||
}
|
||||
}
|
||||
var builder = ConfigRelatedInfo.builder()
|
||||
.version(version)
|
||||
.topicDeletionIsAllowed(topicDeletionEnabled);
|
||||
return SupportedFeature.forVersion(ac, version)
|
||||
.map(features -> builder.features(features).build());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static Mono<Set<SupportedFeature>> getSupportedUpdateFeaturesForVersion(AdminClient ac, String versionStr) {
|
||||
@Nullable Float kafkaVersion = KafkaVersion.parse(versionStr).orElse(null);
|
||||
return SupportedFeature.forVersion(ac, kafkaVersion);
|
||||
public static Mono<ReactiveAdminClient> create(AdminClient adminClient) {
|
||||
return describeClusterImpl(adminClient, Set.of())
|
||||
// choosing node from which we will get configs (starting with controller)
|
||||
.flatMap(descr -> descr.controller != null
|
||||
? Mono.just(descr.controller)
|
||||
: Mono.justOrEmpty(descr.nodes.stream().findFirst())
|
||||
)
|
||||
.flatMap(node -> ConfigRelatedInfo.extract(adminClient, node.id()))
|
||||
.map(info -> new ReactiveAdminClient(adminClient, info));
|
||||
}
|
||||
|
||||
|
||||
private static Mono<Boolean> isAuthorizedSecurityEnabled(AdminClient ac, @Nullable Float kafkaVersion) {
|
||||
return toMono(ac.describeAcls(AclBindingFilter.ANY).values())
|
||||
.thenReturn(true)
|
||||
|
@ -174,11 +202,10 @@ public class ReactiveAdminClient implements Closeable {
|
|||
|
||||
@Getter(AccessLevel.PACKAGE) // visible for testing
|
||||
private final AdminClient client;
|
||||
private final String version;
|
||||
private final Set<SupportedFeature> features;
|
||||
private volatile ConfigRelatedInfo configRelatedInfo;
|
||||
|
||||
public Set<SupportedFeature> getClusterFeatures() {
|
||||
return features;
|
||||
return configRelatedInfo.features();
|
||||
}
|
||||
|
||||
public Mono<Set<String>> listTopics(boolean listInternal) {
|
||||
|
@ -190,7 +217,20 @@ public class ReactiveAdminClient implements Closeable {
|
|||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return configRelatedInfo.version();
|
||||
}
|
||||
|
||||
public boolean isTopicDeletionEnabled() {
|
||||
return configRelatedInfo.topicDeletionIsAllowed();
|
||||
}
|
||||
|
||||
public Mono<Void> updateInternalStats(@Nullable Node controller) {
|
||||
if (controller == null) {
|
||||
return Mono.empty();
|
||||
}
|
||||
return ConfigRelatedInfo.extract(client, controller.id())
|
||||
.doOnNext(info -> this.configRelatedInfo = info)
|
||||
.then();
|
||||
}
|
||||
|
||||
public Mono<Map<String, List<ConfigEntry>>> getTopicsConfig() {
|
||||
|
@ -200,7 +240,7 @@ public class ReactiveAdminClient implements Closeable {
|
|||
//NOTE: skips not-found topics (for which UnknownTopicOrPartitionException was thrown by AdminClient)
|
||||
//and topics for which DESCRIBE_CONFIGS permission is not set (TopicAuthorizationException was thrown)
|
||||
public Mono<Map<String, List<ConfigEntry>>> getTopicsConfig(Collection<String> topicNames, boolean includeDoc) {
|
||||
var includeDocFixed = features.contains(SupportedFeature.CONFIG_DOCUMENTATION_RETRIEVAL) && includeDoc;
|
||||
var includeDocFixed = includeDoc && getClusterFeatures().contains(SupportedFeature.CONFIG_DOCUMENTATION_RETRIEVAL);
|
||||
// we need to partition calls, because it can lead to AdminClient timeouts in case of large topics count
|
||||
return partitionCalls(
|
||||
topicNames,
|
||||
|
@ -349,7 +389,7 @@ public class ReactiveAdminClient implements Closeable {
|
|||
}
|
||||
|
||||
public Mono<ClusterDescription> describeCluster() {
|
||||
return describeClusterImpl(client, features);
|
||||
return describeClusterImpl(client, getClusterFeatures());
|
||||
}
|
||||
|
||||
private static Mono<ClusterDescription> describeClusterImpl(AdminClient client, Set<SupportedFeature> features) {
|
||||
|
@ -371,23 +411,6 @@ public class ReactiveAdminClient implements Closeable {
|
|||
);
|
||||
}
|
||||
|
||||
private static Mono<String> getClusterVersion(AdminClient client) {
|
||||
return describeClusterImpl(client, Set.of())
|
||||
// choosing node from which we will get configs (starting with controller)
|
||||
.flatMap(descr -> descr.controller != null
|
||||
? Mono.just(descr.controller)
|
||||
: Mono.justOrEmpty(descr.nodes.stream().findFirst())
|
||||
)
|
||||
.flatMap(node -> loadBrokersConfig(client, List.of(node.id())))
|
||||
.flatMap(configs -> configs.values().stream()
|
||||
.flatMap(Collection::stream)
|
||||
.filter(entry -> entry.name().contains("inter.broker.protocol.version"))
|
||||
.findFirst()
|
||||
.map(configEntry -> Mono.just(configEntry.value()))
|
||||
.orElse(Mono.empty()))
|
||||
.switchIfEmpty(Mono.just("1.0-UNKNOWN"));
|
||||
}
|
||||
|
||||
public Mono<Void> deleteConsumerGroups(Collection<String> groupIds) {
|
||||
return toMono(client.deleteConsumerGroups(groupIds).all())
|
||||
.onErrorResume(GroupIdNotFoundException.class,
|
||||
|
@ -421,7 +444,7 @@ public class ReactiveAdminClient implements Closeable {
|
|||
// NOTE: places whole current topic config with new one. Entries that were present in old config,
|
||||
// but missed in new will be set to default
|
||||
public Mono<Void> updateTopicConfig(String topicName, Map<String, String> configs) {
|
||||
if (features.contains(SupportedFeature.INCREMENTAL_ALTER_CONFIGS)) {
|
||||
if (getClusterFeatures().contains(SupportedFeature.INCREMENTAL_ALTER_CONFIGS)) {
|
||||
return getTopicsConfigImpl(List.of(topicName), false)
|
||||
.map(conf -> conf.getOrDefault(topicName, List.of()))
|
||||
.flatMap(currentConfigs -> incrementalAlterConfig(topicName, currentConfigs, configs));
|
||||
|
@ -596,17 +619,17 @@ public class ReactiveAdminClient implements Closeable {
|
|||
}
|
||||
|
||||
public Mono<Collection<AclBinding>> listAcls(ResourcePatternFilter filter) {
|
||||
Preconditions.checkArgument(features.contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
Preconditions.checkArgument(getClusterFeatures().contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
return toMono(client.describeAcls(new AclBindingFilter(filter, AccessControlEntryFilter.ANY)).values());
|
||||
}
|
||||
|
||||
public Mono<Void> createAcls(Collection<AclBinding> aclBindings) {
|
||||
Preconditions.checkArgument(features.contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
Preconditions.checkArgument(getClusterFeatures().contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
return toMono(client.createAcls(aclBindings).all());
|
||||
}
|
||||
|
||||
public Mono<Void> deleteAcls(Collection<AclBinding> aclBindings) {
|
||||
Preconditions.checkArgument(features.contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
Preconditions.checkArgument(getClusterFeatures().contains(SupportedFeature.AUTHORIZED_SECURITY_ENABLED));
|
||||
var filters = aclBindings.stream().map(AclBinding::toFilter).collect(Collectors.toSet());
|
||||
return toMono(client.deleteAcls(filters).all()).then();
|
||||
}
|
||||
|
|
|
@ -37,25 +37,26 @@ public class StatisticsService {
|
|||
private Mono<Statistics> getStatistics(KafkaCluster cluster) {
|
||||
return adminClientService.get(cluster).flatMap(ac ->
|
||||
ac.describeCluster().flatMap(description ->
|
||||
Mono.zip(
|
||||
List.of(
|
||||
metricsCollector.getBrokerMetrics(cluster, description.getNodes()),
|
||||
getLogDirInfo(description, ac),
|
||||
featureService.getAvailableFeatures(cluster, description),
|
||||
loadTopicConfigs(cluster),
|
||||
describeTopics(cluster)),
|
||||
results ->
|
||||
Statistics.builder()
|
||||
.status(ServerStatusDTO.ONLINE)
|
||||
.clusterDescription(description)
|
||||
.version(ac.getVersion())
|
||||
.metrics((Metrics) results[0])
|
||||
.logDirInfo((InternalLogDirStats) results[1])
|
||||
.features((List<ClusterFeature>) results[2])
|
||||
.topicConfigs((Map<String, List<ConfigEntry>>) results[3])
|
||||
.topicDescriptions((Map<String, TopicDescription>) results[4])
|
||||
.build()
|
||||
)))
|
||||
ac.updateInternalStats(description.getController()).then(
|
||||
Mono.zip(
|
||||
List.of(
|
||||
metricsCollector.getBrokerMetrics(cluster, description.getNodes()),
|
||||
getLogDirInfo(description, ac),
|
||||
featureService.getAvailableFeatures(ac, cluster, description),
|
||||
loadTopicConfigs(cluster),
|
||||
describeTopics(cluster)),
|
||||
results ->
|
||||
Statistics.builder()
|
||||
.status(ServerStatusDTO.ONLINE)
|
||||
.clusterDescription(description)
|
||||
.version(ac.getVersion())
|
||||
.metrics((Metrics) results[0])
|
||||
.logDirInfo((InternalLogDirStats) results[1])
|
||||
.features((List<ClusterFeature>) results[2])
|
||||
.topicConfigs((Map<String, List<ConfigEntry>>) results[3])
|
||||
.topicDescriptions((Map<String, TopicDescription>) results[4])
|
||||
.build()
|
||||
))))
|
||||
.doOnError(e ->
|
||||
log.error("Failed to collect cluster {} info", cluster.getName(), e))
|
||||
.onErrorResume(
|
||||
|
|
|
@ -20,6 +20,7 @@ import com.provectus.kafka.ui.model.rbac.permission.TopicAction;
|
|||
import com.provectus.kafka.ui.service.rbac.extractor.CognitoAuthorityExtractor;
|
||||
import com.provectus.kafka.ui.service.rbac.extractor.GithubAuthorityExtractor;
|
||||
import com.provectus.kafka.ui.service.rbac.extractor.GoogleAuthorityExtractor;
|
||||
import com.provectus.kafka.ui.service.rbac.extractor.OauthAuthorityExtractor;
|
||||
import com.provectus.kafka.ui.service.rbac.extractor.ProviderAuthorityExtractor;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.util.Collections;
|
||||
|
@ -76,6 +77,7 @@ public class AccessControlService {
|
|||
case OAUTH_COGNITO -> new CognitoAuthorityExtractor();
|
||||
case OAUTH_GOOGLE -> new GoogleAuthorityExtractor();
|
||||
case OAUTH_GITHUB -> new GithubAuthorityExtractor();
|
||||
case OAUTH -> new OauthAuthorityExtractor();
|
||||
default -> null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.provectus.kafka.ui.service.rbac.extractor;
|
||||
|
||||
import static com.provectus.kafka.ui.model.rbac.provider.Provider.Name.COGNITO;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.provectus.kafka.ui.model.rbac.Role;
|
||||
import com.provectus.kafka.ui.model.rbac.provider.Provider;
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
|
@ -18,8 +21,8 @@ public class CognitoAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
private static final String COGNITO_GROUPS_ATTRIBUTE_NAME = "cognito:groups";
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(String provider) {
|
||||
return Provider.Name.COGNITO.equalsIgnoreCase(provider);
|
||||
public boolean isApplicable(String provider, Map<String, String> customParams) {
|
||||
return COGNITO.equalsIgnoreCase(provider) || COGNITO.equalsIgnoreCase(customParams.get(TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +66,7 @@ public class CognitoAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
.map(Role::getName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
return Mono.just(Stream.concat(groupsByUsername.stream(), groupsByGroups.stream()).collect(Collectors.toSet()));
|
||||
return Mono.just(Sets.union(groupsByUsername, groupsByGroups));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.provectus.kafka.ui.service.rbac.extractor;
|
||||
|
||||
import static com.provectus.kafka.ui.model.rbac.provider.Provider.Name.GITHUB;
|
||||
|
||||
import com.provectus.kafka.ui.model.rbac.Role;
|
||||
import com.provectus.kafka.ui.model.rbac.provider.Provider;
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
|
@ -28,8 +30,8 @@ public class GithubAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
private static final String DUMMY = "dummy";
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(String provider) {
|
||||
return Provider.Name.GITHUB.equalsIgnoreCase(provider);
|
||||
public boolean isApplicable(String provider, Map<String, String> customParams) {
|
||||
return GITHUB.equalsIgnoreCase(provider) || GITHUB.equalsIgnoreCase(customParams.get(TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package com.provectus.kafka.ui.service.rbac.extractor;
|
||||
|
||||
import static com.provectus.kafka.ui.model.rbac.provider.Provider.Name.GOOGLE;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.provectus.kafka.ui.model.rbac.Role;
|
||||
import com.provectus.kafka.ui.model.rbac.provider.Provider;
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
@ -19,8 +20,8 @@ public class GoogleAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
public static final String EMAIL_ATTRIBUTE_NAME = "email";
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(String provider) {
|
||||
return Provider.Name.GOOGLE.equalsIgnoreCase(provider);
|
||||
public boolean isApplicable(String provider, Map<String, String> customParams) {
|
||||
return GOOGLE.equalsIgnoreCase(provider) || GOOGLE.equalsIgnoreCase(customParams.get(TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +53,7 @@ public class GoogleAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
return Mono.just(groupsByUsername);
|
||||
}
|
||||
|
||||
List<String> groupsByDomain = acs.getRoles()
|
||||
Set<String> groupsByDomain = acs.getRoles()
|
||||
.stream()
|
||||
.filter(r -> r.getSubjects()
|
||||
.stream()
|
||||
|
@ -60,10 +61,9 @@ public class GoogleAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
.filter(s -> s.getType().equals("domain"))
|
||||
.anyMatch(s -> s.getValue().equals(domain)))
|
||||
.map(Role::getName)
|
||||
.toList();
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
return Mono.just(Stream.concat(groupsByUsername.stream(), groupsByDomain.stream())
|
||||
.collect(Collectors.toSet()));
|
||||
return Mono.just(Sets.union(groupsByUsername, groupsByDomain));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,44 @@
|
|||
package com.provectus.kafka.ui.service.rbac.extractor;
|
||||
|
||||
import static com.provectus.kafka.ui.model.rbac.provider.Provider.Name.OAUTH;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.provectus.kafka.ui.config.auth.OAuthProperties;
|
||||
import com.provectus.kafka.ui.model.rbac.Role;
|
||||
import com.provectus.kafka.ui.model.rbac.provider.Provider;
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;
|
||||
import org.springframework.util.Assert;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Slf4j
|
||||
public class OauthAuthorityExtractor implements ProviderAuthorityExtractor {
|
||||
|
||||
public static final String ROLES_FIELD_PARAM_NAME = "roles-field";
|
||||
|
||||
@Override
|
||||
public boolean isApplicable(String provider) {
|
||||
return false; // TODO #2844
|
||||
public boolean isApplicable(String provider, Map<String, String> customParams) {
|
||||
var containsRolesFieldNameParam = customParams.containsKey(ROLES_FIELD_PARAM_NAME);
|
||||
if (!containsRolesFieldNameParam) {
|
||||
log.debug("Provider [{}] doesn't contain a roles field param name, mapping won't be performed", provider);
|
||||
return false;
|
||||
}
|
||||
|
||||
return OAUTH.equalsIgnoreCase(provider) || OAUTH.equalsIgnoreCase(customParams.get(TYPE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mono<Set<String>> extract(AccessControlService acs, Object value, Map<String, Object> additionalParams) {
|
||||
log.trace("Extracting OAuth2 user authorities");
|
||||
|
||||
DefaultOAuth2User principal;
|
||||
try {
|
||||
principal = (DefaultOAuth2User) value;
|
||||
|
@ -25,7 +47,67 @@ public class OauthAuthorityExtractor implements ProviderAuthorityExtractor {
|
|||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
return Mono.just(Set.of(principal.getName())); // TODO #2844
|
||||
var provider = (OAuthProperties.OAuth2Provider) additionalParams.get("provider");
|
||||
Assert.notNull(provider, "provider is null");
|
||||
var rolesFieldName = provider.getCustomParams().get(ROLES_FIELD_PARAM_NAME);
|
||||
|
||||
Set<String> rolesByUsername = acs.getRoles()
|
||||
.stream()
|
||||
.filter(r -> r.getSubjects()
|
||||
.stream()
|
||||
.filter(s -> s.getProvider().equals(Provider.OAUTH))
|
||||
.filter(s -> s.getType().equals("user"))
|
||||
.anyMatch(s -> s.getValue().equals(principal.getName())))
|
||||
.map(Role::getName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<String> rolesByRolesField = acs.getRoles()
|
||||
.stream()
|
||||
.filter(role -> role.getSubjects()
|
||||
.stream()
|
||||
.filter(s -> s.getProvider().equals(Provider.OAUTH))
|
||||
.filter(s -> s.getType().equals("role"))
|
||||
.anyMatch(subject -> {
|
||||
var roleName = subject.getValue();
|
||||
var principalRoles = convertRoles(principal.getAttribute(rolesFieldName));
|
||||
var roleMatched = principalRoles.contains(roleName);
|
||||
|
||||
if (roleMatched) {
|
||||
log.debug("Assigning role [{}] to user [{}]", roleName, principal.getName());
|
||||
} else {
|
||||
log.trace("Role [{}] not found in user [{}] roles", roleName, principal.getName());
|
||||
}
|
||||
|
||||
return roleMatched;
|
||||
})
|
||||
)
|
||||
.map(Role::getName)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
return Mono.just(Sets.union(rolesByUsername, rolesByRolesField));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Collection<String> convertRoles(Object roles) {
|
||||
if (roles == null) {
|
||||
log.debug("Param missing from attributes, skipping");
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
if ((roles instanceof List<?>) || (roles instanceof Set<?>)) {
|
||||
log.trace("The field is either a set or a list, returning as is");
|
||||
return (Collection<String>) roles;
|
||||
}
|
||||
|
||||
if (!(roles instanceof String)) {
|
||||
log.debug("The field is not a string, skipping");
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
log.trace("Trying to deserialize the field value [{}] as a string", roles);
|
||||
|
||||
return Arrays.stream(((String) roles).split(","))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ import reactor.core.publisher.Mono;
|
|||
|
||||
public interface ProviderAuthorityExtractor {
|
||||
|
||||
boolean isApplicable(String provider);
|
||||
String TYPE = "type";
|
||||
|
||||
boolean isApplicable(String provider, Map<String, String> customParams);
|
||||
|
||||
Mono<Set<String>> extract(AccessControlService acs, Object value, Map<String, Object> additionalParams);
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
package com.provectus.kafka.ui.service.rbac.extractor;
|
||||
|
||||
import com.provectus.kafka.ui.config.auth.LdapProperties;
|
||||
import com.provectus.kafka.ui.model.rbac.Role;
|
||||
import com.provectus.kafka.ui.model.rbac.provider.Provider;
|
||||
import com.provectus.kafka.ui.service.rbac.AccessControlService;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.ldap.core.DirContextOperations;
|
||||
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@Slf4j
|
||||
public class RbacLdapAuthoritiesExtractor extends DefaultLdapAuthoritiesPopulator {
|
||||
|
||||
private final AccessControlService acs;
|
||||
private final LdapProperties props;
|
||||
|
||||
private final Function<Map<String, List<String>>, GrantedAuthority> authorityMapper = (record) -> {
|
||||
String role = record.get(getGroupRoleAttribute()).get(0);
|
||||
return new SimpleGrantedAuthority(role);
|
||||
};
|
||||
|
||||
public RbacLdapAuthoritiesExtractor(ApplicationContext context) {
|
||||
super(context.getBean(BaseLdapPathContextSource.class), null);
|
||||
this.acs = context.getBean(AccessControlService.class);
|
||||
this.props = context.getBean(LdapProperties.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<GrantedAuthority> getAdditionalRoles(DirContextOperations user, String username) {
|
||||
return acs.getRoles()
|
||||
.stream()
|
||||
.map(Role::getSubjects)
|
||||
.flatMap(List::stream)
|
||||
.filter(s -> s.getProvider().equals(Provider.LDAP))
|
||||
.filter(s -> s.getType().equals("group"))
|
||||
.flatMap(subject -> getRoles(subject.getValue(), user.getNameInNamespace(), username).stream())
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
private Set<GrantedAuthority> getRoles(String groupSearchBase, String userDn, String username) {
|
||||
Assert.notNull(groupSearchBase, "groupSearchBase is empty");
|
||||
|
||||
log.trace(
|
||||
"Searching for roles for user [{}] with DN [{}], groupRoleAttribute [{}] and filter [{}] in search base [{}]",
|
||||
username, userDn, props.getGroupRoleAttribute(), getGroupSearchFilter(), groupSearchBase);
|
||||
|
||||
var ldapTemplate = getLdapTemplate();
|
||||
ldapTemplate.setIgnoreNameNotFoundException(true);
|
||||
|
||||
Set<Map<String, List<String>>> userRoles = ldapTemplate.searchForMultipleAttributeValues(
|
||||
groupSearchBase, getGroupSearchFilter(), new String[] {userDn, username},
|
||||
new String[] {props.getGroupRoleAttribute()});
|
||||
|
||||
return userRoles.stream()
|
||||
.map(authorityMapper)
|
||||
.peek(a -> log.debug("Mapped role [{}] for user [{}]", a, username))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
}
|
|
@ -230,7 +230,7 @@ public class DynamicConfigOperations {
|
|||
|
||||
Optional.ofNullable(auth)
|
||||
.flatMap(a -> Optional.ofNullable(a.oauth2))
|
||||
.ifPresent(OAuthProperties::validate);
|
||||
.ifPresent(OAuthProperties::init);
|
||||
|
||||
Optional.ofNullable(webclient)
|
||||
.ifPresent(WebclientProperties::validate);
|
||||
|
|
|
@ -118,10 +118,18 @@ class MessageFiltersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void keySetToNullIfKeyCantBeParsedToJson() {
|
||||
var f = groovyScriptFilter("key == null");
|
||||
void keySetToKeyStringIfCantBeParsedToJson() {
|
||||
var f = groovyScriptFilter("key == \"not json\"");
|
||||
assertTrue(f.test(msg().key("not json")));
|
||||
assertFalse(f.test(msg().key("{ \"k\" : \"v\" }")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void keyAndKeyAsTextSetToNullIfRecordsKeyIsNull() {
|
||||
var f = groovyScriptFilter("key == null");
|
||||
assertTrue(f.test(msg().key(null)));
|
||||
|
||||
f = groovyScriptFilter("keyAsText == null");
|
||||
assertTrue(f.test(msg().key(null)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -132,10 +140,18 @@ class MessageFiltersTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
void valueSetToNullIfKeyCantBeParsedToJson() {
|
||||
var f = groovyScriptFilter("value == null");
|
||||
void valueSetToContentStringIfCantBeParsedToJson() {
|
||||
var f = groovyScriptFilter("value == \"not json\"");
|
||||
assertTrue(f.test(msg().content("not json")));
|
||||
assertFalse(f.test(msg().content("{ \"k\" : \"v\" }")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void valueAndValueAsTextSetToNullIfRecordsContentIsNull() {
|
||||
var f = groovyScriptFilter("value == null");
|
||||
assertTrue(f.test(msg().content(null)));
|
||||
|
||||
f = groovyScriptFilter("valueAsText == null");
|
||||
assertTrue(f.test(msg().content(null)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -185,4 +201,4 @@ class MessageFiltersTest {
|
|||
.partition(1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<httpcomponents.version>5.2.1</httpcomponents.version>
|
||||
<selenium.version>4.8.1</selenium.version>
|
||||
<selenide.version>6.12.3</selenide.version>
|
||||
<testng.version>7.7.0</testng.version>
|
||||
<testng.version>7.7.1</testng.version>
|
||||
<allure.version>2.21.0</allure.version>
|
||||
<qase.io.version>3.0.4</qase.io.version>
|
||||
<aspectj.version>1.9.9.1</aspectj.version>
|
||||
|
|
|
@ -48,7 +48,8 @@ public class BrokersList extends BasePage {
|
|||
}
|
||||
|
||||
private List<SelenideElement> getEnabledColumnHeaders() {
|
||||
return Stream.of("Broker ID", "Segment Size", "Segment Count", "Port", "Host")
|
||||
return Stream.of("Broker ID", "Disk usage", "Partitions skew",
|
||||
"Leaders", "Leader skew", "Online partitions", "Port", "Host")
|
||||
.map(name -> $x(String.format(columnHeaderLocator, name)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.provectus.kafka.ui.pages.ksqldb;
|
|||
import static com.codeborne.selenide.Condition.visible;
|
||||
import static com.codeborne.selenide.Selenide.$$x;
|
||||
import static com.codeborne.selenide.Selenide.$x;
|
||||
import static com.codeborne.selenide.Selenide.sleep;
|
||||
|
||||
import com.codeborne.selenide.CollectionCondition;
|
||||
import com.codeborne.selenide.Condition;
|
||||
|
@ -17,11 +18,12 @@ import java.util.List;
|
|||
public class KsqlQueryForm extends BasePage {
|
||||
protected SelenideElement clearBtn = $x("//div/button[text()='Clear']");
|
||||
protected SelenideElement executeBtn = $x("//div/button[text()='Execute']");
|
||||
protected SelenideElement stopQueryBtn = $x("//div/button[text()='Stop query']");
|
||||
protected SelenideElement clearResultsBtn = $x("//div/button[text()='Clear results']");
|
||||
protected SelenideElement addStreamPropertyBtn = $x("//button[text()='Add Stream Property']");
|
||||
protected SelenideElement queryAreaValue = $x("//div[@class='ace_content']");
|
||||
protected SelenideElement queryArea = $x("//div[@id='ksql']/textarea[@class='ace_text-input']");
|
||||
protected SelenideElement abortButton = $x("//div[@role='status']/div[text()='Abort']");
|
||||
protected SelenideElement cancelledAlert = $x("//div[@role='status'][text()='Cancelled']");
|
||||
protected ElementsCollection ksqlGridItems = $$x("//tbody//tr");
|
||||
protected ElementsCollection keyField = $$x("//input[@aria-label='key']");
|
||||
protected ElementsCollection valueField = $$x("//input[@aria-label='value']");
|
||||
|
@ -36,6 +38,7 @@ public class KsqlQueryForm extends BasePage {
|
|||
@Step
|
||||
public KsqlQueryForm clickClearBtn() {
|
||||
clickByJavaScript(clearBtn);
|
||||
sleep(500);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -48,7 +51,7 @@ public class KsqlQueryForm extends BasePage {
|
|||
public KsqlQueryForm clickExecuteBtn(String query) {
|
||||
clickByActions(executeBtn);
|
||||
if (query.contains("EMIT CHANGES")) {
|
||||
loadingSpinner.shouldBe(Condition.visible);
|
||||
abortButton.shouldBe(Condition.visible);
|
||||
} else {
|
||||
waitUntilSpinnerDisappear();
|
||||
}
|
||||
|
@ -56,12 +59,21 @@ public class KsqlQueryForm extends BasePage {
|
|||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickStopQueryBtn() {
|
||||
clickByActions(stopQueryBtn);
|
||||
waitUntilSpinnerDisappear();
|
||||
public boolean isAbortBtnVisible() {
|
||||
return isVisible(abortButton);
|
||||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickAbortBtn() {
|
||||
clickByActions(abortButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Step
|
||||
public boolean isCancelledAlertVisible() {
|
||||
return isVisible(cancelledAlert);
|
||||
}
|
||||
|
||||
@Step
|
||||
public KsqlQueryForm clickClearResultsBtn() {
|
||||
clickByActions(clearResultsBtn);
|
||||
|
|
|
@ -22,72 +22,65 @@ public class SmokeBacklog extends BaseManualTest {
|
|||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = KSQL_DB_SUITE_ID)
|
||||
@QaseId(277)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(331)
|
||||
@Test
|
||||
public void testCaseB() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(331)
|
||||
@Test
|
||||
public void testCaseC() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = BROKERS_SUITE_ID)
|
||||
@QaseId(332)
|
||||
@Test
|
||||
public void testCaseD() {
|
||||
public void testCaseC() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(335)
|
||||
@Test
|
||||
public void testCaseE() {
|
||||
public void testCaseD() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(336)
|
||||
@Test
|
||||
public void testCaseF() {
|
||||
public void testCaseE() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(343)
|
||||
@Test
|
||||
public void testCaseG() {
|
||||
public void testCaseF() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = KSQL_DB_SUITE_ID)
|
||||
@QaseId(344)
|
||||
@Test
|
||||
public void testCaseH() {
|
||||
public void testCaseG() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = SCHEMAS_SUITE_ID)
|
||||
@QaseId(345)
|
||||
@Test
|
||||
public void testCaseI() {
|
||||
public void testCaseH() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = SCHEMAS_SUITE_ID)
|
||||
@QaseId(346)
|
||||
@Test
|
||||
public void testCaseJ() {
|
||||
public void testCaseI() {
|
||||
}
|
||||
|
||||
@Automation(state = TO_BE_AUTOMATED)
|
||||
@Suite(id = TOPICS_PROFILE_SUITE_ID)
|
||||
@QaseId(347)
|
||||
@Test
|
||||
public void testCaseK() {
|
||||
public void testCaseJ() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.provectus.kafka.ui.smokesuite.ksqldb;
|
||||
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlMenuTabs.STREAMS;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SELECT_ALL_FROM;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SHOW_STREAMS;
|
||||
import static com.provectus.kafka.ui.pages.ksqldb.enums.KsqlQueryConfig.SHOW_TABLES;
|
||||
import static com.provectus.kafka.ui.pages.panels.enums.MenuItem.KSQL_DB;
|
||||
|
@ -87,7 +88,8 @@ public class KsqlDbTest extends BaseTest {
|
|||
navigateToKsqlDbAndExecuteRequest(SHOW_STREAMS.getQuery());
|
||||
SoftAssert softly = new SoftAssert();
|
||||
softly.assertTrue(ksqlQueryForm.areResultsVisible(), "areResultsVisible()");
|
||||
softly.assertTrue(ksqlQueryForm.getItemByName(DEFAULT_STREAM.getName()).isVisible(), "getItemByName()");
|
||||
softly.assertTrue(ksqlQueryForm.getItemByName(DEFAULT_STREAM.getName()).isVisible(),
|
||||
String.format("getItemByName(%s)", FIRST_TABLE.getName()));
|
||||
softly.assertAll();
|
||||
}
|
||||
|
||||
|
@ -104,6 +106,16 @@ public class KsqlDbTest extends BaseTest {
|
|||
softly.assertAll();
|
||||
}
|
||||
|
||||
@QaseId(277)
|
||||
@Test(priority = 6)
|
||||
public void stopQueryFunctionalCheck() {
|
||||
navigateToKsqlDbAndExecuteRequest(String.format(SELECT_ALL_FROM.getQuery(), FIRST_TABLE.getName()));
|
||||
Assert.assertTrue(ksqlQueryForm.isAbortBtnVisible(), "isAbortBtnVisible()");
|
||||
ksqlQueryForm
|
||||
.clickAbortBtn();
|
||||
Assert.assertTrue(ksqlQueryForm.isCancelledAlertVisible(), "isCancelledAlertVisible()");
|
||||
}
|
||||
|
||||
@AfterClass(alwaysRun = true)
|
||||
public void afterClass() {
|
||||
TOPIC_NAMES_LIST.forEach(topicName -> apiService.deleteTopic(topicName));
|
||||
|
|
|
@ -34,7 +34,11 @@ const Configs: React.FC = () => {
|
|||
|
||||
const getData = () => {
|
||||
return data
|
||||
.filter((item) => item.name.toLocaleLowerCase().indexOf(keyword) > -1)
|
||||
.filter(
|
||||
(item) =>
|
||||
item.name.toLocaleLowerCase().indexOf(keyword.toLocaleLowerCase()) >
|
||||
-1
|
||||
)
|
||||
.sort((a, b) => {
|
||||
if (a.source === b.source) return 0;
|
||||
|
||||
|
|
|
@ -11,7 +11,9 @@ import CheckMarkRoundIcon from 'components/common/Icons/CheckMarkRoundIcon';
|
|||
import { ColumnDef } from '@tanstack/react-table';
|
||||
import { clusterBrokerPath } from 'lib/paths';
|
||||
import Tooltip from 'components/common/Tooltip/Tooltip';
|
||||
import ColoredCell from 'components/common/NewTable/ColoredCell';
|
||||
|
||||
import SkewHeader from './SkewHeader/SkewHeader';
|
||||
import * as S from './BrokersList.styled';
|
||||
|
||||
const NA = 'N/A';
|
||||
|
@ -57,11 +59,15 @@ const BrokersList: React.FC = () => {
|
|||
count: segmentCount || NA,
|
||||
port: broker?.port,
|
||||
host: broker?.host,
|
||||
partitionsLeader: broker?.partitionsLeader,
|
||||
partitionsSkew: broker?.partitionsSkew,
|
||||
leadersSkew: broker?.leadersSkew,
|
||||
inSyncPartitions: broker?.inSyncPartitions,
|
||||
};
|
||||
});
|
||||
}, [diskUsage, brokers]);
|
||||
|
||||
const columns = React.useMemo<ColumnDef<typeof rows>[]>(
|
||||
const columns = React.useMemo<ColumnDef<(typeof rows)[number]>[]>(
|
||||
() => [
|
||||
{
|
||||
header: 'Broker ID',
|
||||
|
@ -84,7 +90,7 @@ const BrokersList: React.FC = () => {
|
|||
),
|
||||
},
|
||||
{
|
||||
header: 'Segment Size',
|
||||
header: 'Disk usage',
|
||||
accessorKey: 'size',
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
cell: ({ getValue, table, cell, column, renderValue, row }) =>
|
||||
|
@ -98,10 +104,56 @@ const BrokersList: React.FC = () => {
|
|||
cell={cell}
|
||||
getValue={getValue}
|
||||
renderValue={renderValue}
|
||||
renderSegments
|
||||
/>
|
||||
),
|
||||
},
|
||||
{ header: 'Segment Count', accessorKey: 'count' },
|
||||
{
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
header: () => <SkewHeader />,
|
||||
accessorKey: 'partitionsSkew',
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue<number>();
|
||||
return (
|
||||
<ColoredCell
|
||||
value={value ? `${value.toFixed(2)}%` : '-'}
|
||||
warn={value >= 10 && value < 20}
|
||||
attention={value >= 20}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{ header: 'Leaders', accessorKey: 'partitionsLeader' },
|
||||
{
|
||||
header: 'Leader skew',
|
||||
accessorKey: 'leadersSkew',
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue<number>();
|
||||
return (
|
||||
<ColoredCell
|
||||
value={value ? `${value.toFixed(2)}%` : '-'}
|
||||
warn={value >= 10 && value < 20}
|
||||
attention={value >= 20}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
header: 'Online partitions',
|
||||
accessorKey: 'inSyncPartitions',
|
||||
// eslint-disable-next-line react/no-unstable-nested-components
|
||||
cell: ({ getValue, row }) => {
|
||||
const value = getValue<number>();
|
||||
return (
|
||||
<ColoredCell
|
||||
value={value}
|
||||
attention={value !== row.original.count}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{ header: 'Port', accessorKey: 'port' },
|
||||
{
|
||||
header: 'Host',
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import styled from 'styled-components';
|
||||
import { MessageTooltip } from 'components/common/Tooltip/Tooltip.styled';
|
||||
|
||||
export const CellWrapper = styled.div`
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
${MessageTooltip} {
|
||||
max-height: unset;
|
||||
}
|
||||
`;
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react';
|
||||
import Tooltip from 'components/common/Tooltip/Tooltip';
|
||||
import InfoIcon from 'components/common/Icons/InfoIcon';
|
||||
|
||||
import * as S from './SkewHeader.styled';
|
||||
|
||||
const SkewHeader: React.FC = () => (
|
||||
<S.CellWrapper>
|
||||
Partitions skew
|
||||
<Tooltip
|
||||
value={<InfoIcon />}
|
||||
content="The divergence from the average brokers' value"
|
||||
/>
|
||||
</S.CellWrapper>
|
||||
);
|
||||
|
||||
export default SkewHeader;
|
|
@ -37,7 +37,7 @@ const Config: React.FC = () => {
|
|||
formState: { isDirty, isSubmitting, isValid, errors },
|
||||
setValue,
|
||||
} = useForm<FormValues>({
|
||||
mode: 'onTouched',
|
||||
mode: 'onChange',
|
||||
resolver: yupResolver(validationSchema),
|
||||
defaultValues: {
|
||||
config: JSON.stringify(config, null, '\t'),
|
||||
|
|
|
@ -1,17 +1,31 @@
|
|||
import React from 'react';
|
||||
import { Cluster } from 'generated-sources';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Cluster, ResourceType } from 'generated-sources';
|
||||
import { CellContext } from '@tanstack/react-table';
|
||||
import { Button } from 'components/common/Button/Button';
|
||||
import { clusterConfigPath } from 'lib/paths';
|
||||
import { useGetUserInfo } from 'lib/hooks/api/roles';
|
||||
import { ActionCanButton } from 'components/common/ActionComponent';
|
||||
|
||||
type Props = CellContext<Cluster, unknown>;
|
||||
|
||||
const ClusterTableActionsCell: React.FC<Props> = ({ row }) => {
|
||||
const { name } = row.original;
|
||||
const { data } = useGetUserInfo();
|
||||
|
||||
const isApplicationConfig = useMemo(() => {
|
||||
return !!data?.userInfo?.permissions.some(
|
||||
(permission) => permission.resource === ResourceType.APPLICATIONCONFIG
|
||||
);
|
||||
}, [data]);
|
||||
|
||||
return (
|
||||
<Button buttonType="secondary" buttonSize="S" to={clusterConfigPath(name)}>
|
||||
<ActionCanButton
|
||||
buttonType="secondary"
|
||||
buttonSize="S"
|
||||
to={clusterConfigPath(name)}
|
||||
canDoAction={isApplicationConfig}
|
||||
>
|
||||
Configure
|
||||
</Button>
|
||||
</ActionCanButton>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import React, { useMemo } from 'react';
|
||||
import PageHeading from 'components/common/PageHeading/PageHeading';
|
||||
import * as Metrics from 'components/common/Metrics';
|
||||
import { Tag } from 'components/common/Tag/Tag.styled';
|
||||
import Switch from 'components/common/Switch/Switch';
|
||||
import { useClusters } from 'lib/hooks/api/clusters';
|
||||
import { Cluster, ServerStatus } from 'generated-sources';
|
||||
import { Cluster, ResourceType, ServerStatus } from 'generated-sources';
|
||||
import { ColumnDef } from '@tanstack/react-table';
|
||||
import Table, { SizeCell } from 'components/common/NewTable';
|
||||
import useBoolean from 'lib/hooks/useBoolean';
|
||||
import { Button } from 'components/common/Button/Button';
|
||||
import { clusterNewConfigPath } from 'lib/paths';
|
||||
import { GlobalSettingsContext } from 'components/contexts/GlobalSettingsContext';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { ActionCanButton } from 'components/common/ActionComponent';
|
||||
import { useGetUserInfo } from 'lib/hooks/api/roles';
|
||||
|
||||
import * as S from './Dashboard.styled';
|
||||
import ClusterName from './ClusterName';
|
||||
import ClusterTableActionsCell from './ClusterTableActionsCell';
|
||||
|
||||
const Dashboard: React.FC = () => {
|
||||
const { data } = useGetUserInfo();
|
||||
const clusters = useClusters();
|
||||
const { value: showOfflineOnly, toggle } = useBoolean(false);
|
||||
const appInfo = React.useContext(GlobalSettingsContext);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const config = React.useMemo(() => {
|
||||
const clusterList = clusters.data || [];
|
||||
const offlineClusters = clusterList.filter(
|
||||
|
@ -56,12 +57,11 @@ const Dashboard: React.FC = () => {
|
|||
return initialColumns;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (appInfo.hasDynamicConfig && !clusters.data) {
|
||||
navigate(clusterNewConfigPath);
|
||||
}
|
||||
}, [clusters, appInfo.hasDynamicConfig]);
|
||||
|
||||
const isApplicationConfig = useMemo(() => {
|
||||
return !!data?.userInfo?.permissions.some(
|
||||
(permission) => permission.resource === ResourceType.APPLICATIONCONFIG
|
||||
);
|
||||
}, [data]);
|
||||
return (
|
||||
<>
|
||||
<PageHeading text="Dashboard" />
|
||||
|
@ -87,9 +87,14 @@ const Dashboard: React.FC = () => {
|
|||
<label>Only offline clusters</label>
|
||||
</div>
|
||||
{appInfo.hasDynamicConfig && (
|
||||
<Button buttonType="primary" buttonSize="M" to={clusterNewConfigPath}>
|
||||
<ActionCanButton
|
||||
buttonType="primary"
|
||||
buttonSize="M"
|
||||
to={clusterNewConfigPath}
|
||||
canDoAction={isApplicationConfig}
|
||||
>
|
||||
Configure new cluster
|
||||
</Button>
|
||||
</ActionCanButton>
|
||||
)}
|
||||
</S.Toolbar>
|
||||
<Table
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
import React from 'react';
|
||||
import { useClusters } from 'lib/hooks/api/clusters';
|
||||
import Dashboard from 'components/Dashboard/Dashboard';
|
||||
import { Cluster, ServerStatus } from 'generated-sources';
|
||||
import { render } from 'lib/testHelpers';
|
||||
|
||||
interface DataType {
|
||||
data: Cluster[] | undefined;
|
||||
}
|
||||
jest.mock('lib/hooks/api/clusters');
|
||||
const mockedNavigate = jest.fn();
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
useNavigate: () => mockedNavigate,
|
||||
}));
|
||||
describe('Dashboard component', () => {
|
||||
const renderComponent = (hasDynamicConfig: boolean, data: DataType) => {
|
||||
const useClustersMock = useClusters as jest.Mock;
|
||||
useClustersMock.mockReturnValue(data);
|
||||
render(<Dashboard />, {
|
||||
globalSettings: { hasDynamicConfig },
|
||||
});
|
||||
};
|
||||
it('redirects to new cluster configuration page if there are no clusters and dynamic config is enabled', async () => {
|
||||
await renderComponent(true, { data: undefined });
|
||||
|
||||
expect(mockedNavigate).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not navigate to new cluster config page when there are clusters', async () => {
|
||||
await renderComponent(true, {
|
||||
data: [{ name: 'Cluster 1', status: ServerStatus.ONLINE }],
|
||||
});
|
||||
|
||||
expect(mockedNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not navigate to new cluster config page when there are no clusters and hasDynamicConfig is false', async () => {
|
||||
await renderComponent(false, {
|
||||
data: [],
|
||||
});
|
||||
|
||||
expect(mockedNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
|
@ -33,6 +33,7 @@ export const Fieldset = styled.fieldset`
|
|||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
color: ${({ theme }) => theme.default.color.normal};
|
||||
`;
|
||||
|
||||
export const ButtonsContainer = styled.div`
|
||||
|
|
|
@ -14,9 +14,6 @@ export const DiffWrapper = styled.div`
|
|||
background-color: ${({ theme }) => theme.default.backgroundColor};
|
||||
color: ${({ theme }) => theme.default.color.normal};
|
||||
}
|
||||
.ace_line {
|
||||
background-color: ${({ theme }) => theme.default.backgroundColor};
|
||||
}
|
||||
.ace_gutter-cell {
|
||||
background-color: ${({ theme }) =>
|
||||
theme.ksqlDb.query.editor.cell.backgroundColor};
|
||||
|
@ -39,10 +36,10 @@ export const DiffWrapper = styled.div`
|
|||
.ace_string {
|
||||
color: ${({ theme }) => theme.ksqlDb.query.editor.aceString};
|
||||
}
|
||||
> .codeMarker {
|
||||
background: ${({ theme }) => theme.icons.warningIcon};
|
||||
.codeMarker {
|
||||
background-color: ${({ theme }) => theme.ksqlDb.query.editor.codeMarker};
|
||||
position: absolute;
|
||||
z-index: 20;
|
||||
z-index: 2000;
|
||||
}
|
||||
`;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ const Form: React.FC = () => {
|
|||
yup.object().shape({
|
||||
newSchema:
|
||||
schema?.schemaType === SchemaType.PROTOBUF
|
||||
? yup.string().required().isEnum('Schema syntax is not valid')
|
||||
? yup.string().required()
|
||||
: yup.string().required().isJsonObject('Schema syntax is not valid'),
|
||||
});
|
||||
const methods = useForm<NewSchemaSubjectRaw>({
|
||||
|
|
|
@ -8,6 +8,7 @@ import { formatTimestamp } from 'lib/dateTimeHelpers';
|
|||
import { JSONPath } from 'jsonpath-plus';
|
||||
import Ellipsis from 'components/common/Ellipsis/Ellipsis';
|
||||
import WarningRedIcon from 'components/common/Icons/WarningRedIcon';
|
||||
import Tooltip from 'components/common/Tooltip/Tooltip';
|
||||
|
||||
import MessageContent from './MessageContent/MessageContent';
|
||||
import * as S from './MessageContent/MessageContent.styled';
|
||||
|
@ -110,14 +111,26 @@ const Message: React.FC<Props> = ({
|
|||
</td>
|
||||
<S.DataCell title={key}>
|
||||
<Ellipsis text={renderFilteredJson(key, keyFilters)}>
|
||||
{keySerde === 'Fallback' && <WarningRedIcon />}
|
||||
{keySerde === 'Fallback' && (
|
||||
<Tooltip
|
||||
value={<WarningRedIcon />}
|
||||
content="Fallback serde was used"
|
||||
placement="left"
|
||||
/>
|
||||
)}
|
||||
</Ellipsis>
|
||||
</S.DataCell>
|
||||
<S.DataCell title={content}>
|
||||
<S.Metadata>
|
||||
<S.MetadataValue>
|
||||
<Ellipsis text={renderFilteredJson(content, contentFilters)}>
|
||||
{valueSerde === 'Fallback' && <WarningRedIcon />}
|
||||
{valueSerde === 'Fallback' && (
|
||||
<Tooltip
|
||||
value={<WarningRedIcon />}
|
||||
content="Fallback serde was used"
|
||||
placement="left"
|
||||
/>
|
||||
)}
|
||||
</Ellipsis>
|
||||
</S.MetadataValue>
|
||||
</S.Metadata>
|
||||
|
|
|
@ -210,6 +210,7 @@ const SendMessage: React.FC<{ closeSidebar: () => void }> = ({
|
|||
name={name}
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
height="40px"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
@ -225,6 +226,7 @@ const SendMessage: React.FC<{ closeSidebar: () => void }> = ({
|
|||
name={name}
|
||||
onChange={onChange}
|
||||
value={value}
|
||||
height="280px"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
@ -242,7 +244,7 @@ const SendMessage: React.FC<{ closeSidebar: () => void }> = ({
|
|||
defaultValue="{}"
|
||||
name={name}
|
||||
onChange={onChange}
|
||||
height="200px"
|
||||
height="40px"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
|
|
@ -29,6 +29,16 @@ export const Wrapper = styled.div`
|
|||
width: 16px;
|
||||
fill: ${({ theme }) => theme.input.icon.color};
|
||||
}
|
||||
svg:last-child {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
line-height: 0;
|
||||
z-index: 1;
|
||||
left: unset;
|
||||
right: 12px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
`;
|
||||
|
||||
export const Input = styled.input<InputProps>(
|
||||
|
|
|
@ -16,6 +16,7 @@ export interface InputProps
|
|||
withError?: boolean;
|
||||
label?: React.ReactNode;
|
||||
hint?: React.ReactNode;
|
||||
clearIcon?: React.ReactNode;
|
||||
|
||||
// Some may only accept integer, like `Number of Partitions`
|
||||
// some may accept decimal
|
||||
|
@ -99,19 +100,22 @@ function pasteNumberCheck(
|
|||
return value;
|
||||
}
|
||||
|
||||
const Input: React.FC<InputProps> = ({
|
||||
name,
|
||||
hookFormOptions,
|
||||
search,
|
||||
inputSize = 'L',
|
||||
type,
|
||||
positiveOnly,
|
||||
integerOnly,
|
||||
withError = false,
|
||||
label,
|
||||
hint,
|
||||
...rest
|
||||
}) => {
|
||||
const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => {
|
||||
const {
|
||||
name,
|
||||
hookFormOptions,
|
||||
search,
|
||||
inputSize = 'L',
|
||||
type,
|
||||
positiveOnly,
|
||||
integerOnly,
|
||||
withError = false,
|
||||
label,
|
||||
hint,
|
||||
clearIcon,
|
||||
...rest
|
||||
} = props;
|
||||
|
||||
const methods = useFormContext();
|
||||
|
||||
const fieldId = React.useId();
|
||||
|
@ -168,7 +172,6 @@ const Input: React.FC<InputProps> = ({
|
|||
// if the field is a part of react-hook-form form
|
||||
inputOptions = { ...rest, ...methods.register(name, hookFormOptions) };
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{label && <InputLabel htmlFor={rest.id || fieldId}>{label}</InputLabel>}
|
||||
|
@ -181,8 +184,11 @@ const Input: React.FC<InputProps> = ({
|
|||
type={type}
|
||||
onKeyPress={keyPressEventHandler}
|
||||
onPaste={pasteEventHandler}
|
||||
ref={ref}
|
||||
{...inputOptions}
|
||||
/>
|
||||
{clearIcon}
|
||||
|
||||
{withError && isHookFormField && (
|
||||
<S.FormError>
|
||||
<ErrorMessage name={name} />
|
||||
|
@ -192,6 +198,6 @@ const Input: React.FC<InputProps> = ({
|
|||
</S.Wrapper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default Input;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
|
||||
interface CellProps {
|
||||
isWarning?: boolean;
|
||||
isAttention?: boolean;
|
||||
}
|
||||
|
||||
interface ColoredCellProps {
|
||||
value: number | string;
|
||||
warn?: boolean;
|
||||
attention?: boolean;
|
||||
}
|
||||
|
||||
const Cell = styled.div<CellProps>`
|
||||
color: ${(props) => {
|
||||
if (props.isAttention) {
|
||||
return props.theme.table.colored.color.attention;
|
||||
}
|
||||
|
||||
if (props.isWarning) {
|
||||
return props.theme.table.colored.color.warning;
|
||||
}
|
||||
|
||||
return 'inherit';
|
||||
}};
|
||||
`;
|
||||
|
||||
const ColoredCell: React.FC<ColoredCellProps> = ({
|
||||
value,
|
||||
warn,
|
||||
attention,
|
||||
}) => {
|
||||
return (
|
||||
<Cell isWarning={warn} isAttention={attention}>
|
||||
{value}
|
||||
</Cell>
|
||||
);
|
||||
};
|
||||
|
||||
export default ColoredCell;
|
|
@ -3,8 +3,15 @@ import { CellContext } from '@tanstack/react-table';
|
|||
import BytesFormatted from 'components/common/BytesFormatted/BytesFormatted';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const SizeCell: React.FC<CellContext<any, unknown>> = ({ getValue }) => (
|
||||
<BytesFormatted value={getValue<string | number>()} />
|
||||
type AsAny = any;
|
||||
|
||||
const SizeCell: React.FC<
|
||||
CellContext<AsAny, unknown> & { renderSegments?: boolean }
|
||||
> = ({ getValue, row, renderSegments = false }) => (
|
||||
<>
|
||||
<BytesFormatted value={getValue<string | number>()} />
|
||||
{renderSegments ? `, ${row?.original.count} segment(s)` : null}
|
||||
</>
|
||||
);
|
||||
|
||||
export default SizeCell;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import React from 'react';
|
||||
import React, { useRef } from 'react';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import Input from 'components/common/Input/Input';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import CloseIcon from 'components/common/Icons/CloseIcon';
|
||||
import styled from 'styled-components';
|
||||
|
||||
interface SearchProps {
|
||||
placeholder?: string;
|
||||
|
@ -10,6 +12,16 @@ interface SearchProps {
|
|||
value?: string;
|
||||
}
|
||||
|
||||
const IconButtonWrapper = styled.span.attrs(() => ({
|
||||
role: 'button',
|
||||
tabIndex: '0',
|
||||
}))`
|
||||
height: 16px !important;
|
||||
display: inline-block;
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
`;
|
||||
const Search: React.FC<SearchProps> = ({
|
||||
placeholder = 'Search',
|
||||
disabled = false,
|
||||
|
@ -17,7 +29,11 @@ const Search: React.FC<SearchProps> = ({
|
|||
onChange,
|
||||
}) => {
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const ref = useRef<HTMLInputElement>(null);
|
||||
const handleChange = useDebouncedCallback((e) => {
|
||||
if (ref.current != null) {
|
||||
ref.current.value = e.target.value;
|
||||
}
|
||||
if (onChange) {
|
||||
onChange(e.target.value);
|
||||
} else {
|
||||
|
@ -28,6 +44,15 @@ const Search: React.FC<SearchProps> = ({
|
|||
setSearchParams(searchParams);
|
||||
}
|
||||
}, 500);
|
||||
const clearSearchValue = () => {
|
||||
if (searchParams.get('q')) {
|
||||
searchParams.set('q', '');
|
||||
setSearchParams(searchParams);
|
||||
}
|
||||
if (ref.current != null) {
|
||||
ref.current.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Input
|
||||
|
@ -37,7 +62,13 @@ const Search: React.FC<SearchProps> = ({
|
|||
defaultValue={value || searchParams.get('q') || ''}
|
||||
inputSize="M"
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
search
|
||||
clearIcon={
|
||||
<IconButtonWrapper onClick={clearSearchValue}>
|
||||
<CloseIcon />
|
||||
</IconButtonWrapper>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -41,4 +41,24 @@ describe('Search', () => {
|
|||
render(<Search />);
|
||||
expect(screen.queryByPlaceholderText('Search')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Clear button is visible', () => {
|
||||
render(<Search placeholder={placeholder} />);
|
||||
|
||||
const clearButton = screen.getByRole('button');
|
||||
expect(clearButton).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Clear button should clear text from input', async () => {
|
||||
render(<Search placeholder={placeholder} />);
|
||||
|
||||
const searchField = screen.getAllByRole('textbox')[0];
|
||||
await userEvent.type(searchField, 'some text');
|
||||
expect(searchField).toHaveValue('some text');
|
||||
|
||||
const clearButton = screen.getByRole('button');
|
||||
await userEvent.click(clearButton);
|
||||
|
||||
expect(searchField).toHaveValue('');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,6 +39,10 @@ export const StyledSlider = styled.span<Props>`
|
|||
transition: 0.4s;
|
||||
border-radius: 20px;
|
||||
|
||||
:hover {
|
||||
background-color: ${({ theme }) => theme.switch.hover};
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
content: '';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { useAppInfo } from 'lib/hooks/api/appConfig';
|
|||
import React from 'react';
|
||||
import { ApplicationInfoEnabledFeaturesEnum } from 'generated-sources';
|
||||
|
||||
export interface GlobalSettingsContextProps {
|
||||
interface GlobalSettingsContextProps {
|
||||
hasDynamicConfig: boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
import { isValidEnum, isValidJsonObject } from 'lib/yupExtended';
|
||||
import { isValidJsonObject } from 'lib/yupExtended';
|
||||
|
||||
const invalidEnum = `
|
||||
ennum SchemType {
|
||||
AVRO = 0;
|
||||
JSON = 1;
|
||||
PROTOBUF = 3;
|
||||
}
|
||||
`;
|
||||
const validEnum = `
|
||||
enum SchemType {
|
||||
AVRO = 0;
|
||||
JSON = 1;
|
||||
PROTOBUF = 3;
|
||||
}
|
||||
`;
|
||||
describe('yup extended', () => {
|
||||
describe('isValidJsonObject', () => {
|
||||
it('returns false for no value', () => {
|
||||
|
@ -35,21 +21,4 @@ describe('yup extended', () => {
|
|||
expect(isValidJsonObject('{ "foo": "bar" }')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValidEnum', () => {
|
||||
it('returns false for invalid enum', () => {
|
||||
expect(isValidEnum(invalidEnum)).toBeFalsy();
|
||||
});
|
||||
it('returns false for no value', () => {
|
||||
expect(isValidEnum()).toBeFalsy();
|
||||
});
|
||||
it('returns true should trim value', () => {
|
||||
expect(
|
||||
isValidEnum(` enum SchemType {AVRO = 0; PROTOBUF = 3;} `)
|
||||
).toBeTruthy();
|
||||
});
|
||||
it('returns true for valid enum', () => {
|
||||
expect(isValidEnum(validEnum)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const formatTimestamp = (
|
||||
timestamp?: number | string | Date,
|
||||
format: Intl.DateTimeFormatOptions = { hour12: false }
|
||||
format: Intl.DateTimeFormatOptions = { hourCycle: 'h23' }
|
||||
): string => {
|
||||
if (!timestamp) {
|
||||
return '';
|
||||
|
@ -8,7 +8,6 @@ export const formatTimestamp = (
|
|||
|
||||
// empty array gets the default one from the browser
|
||||
const date = new Date(timestamp);
|
||||
|
||||
// invalid date
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return '';
|
||||
|
|
|
@ -26,10 +26,7 @@ import {
|
|||
} from '@tanstack/react-query';
|
||||
import { ConfirmContextProvider } from 'components/contexts/ConfirmContext';
|
||||
import ConfirmationModal from 'components/common/ConfirmationModal/ConfirmationModal';
|
||||
import {
|
||||
GlobalSettingsContext,
|
||||
GlobalSettingsContextProps,
|
||||
} from 'components/contexts/GlobalSettingsContext';
|
||||
import { GlobalSettingsContext } from 'components/contexts/GlobalSettingsContext';
|
||||
import { UserInfoRolesAccessContext } from 'components/contexts/UserInfoRolesAccessContext';
|
||||
|
||||
import { RolesType, modifyRolesData } from './permissions';
|
||||
|
@ -38,7 +35,6 @@ interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {
|
|||
preloadedState?: Partial<RootState>;
|
||||
store?: Store<Partial<RootState>, AnyAction>;
|
||||
initialEntries?: MemoryRouterProps['initialEntries'];
|
||||
globalSettings?: GlobalSettingsContextProps;
|
||||
userInfo?: {
|
||||
roles?: RolesType;
|
||||
rbacFlag: boolean;
|
||||
|
@ -114,7 +110,6 @@ const customRender = (
|
|||
preloadedState,
|
||||
}),
|
||||
initialEntries,
|
||||
globalSettings = { hasDynamicConfig: false },
|
||||
userInfo,
|
||||
...renderOptions
|
||||
}: CustomRenderOptions = {}
|
||||
|
@ -124,7 +119,7 @@ const customRender = (
|
|||
children,
|
||||
}) => (
|
||||
<TestQueryClientProvider>
|
||||
<GlobalSettingsContext.Provider value={globalSettings}>
|
||||
<GlobalSettingsContext.Provider value={{ hasDynamicConfig: false }}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<TestUserInfoProvider data={userInfo}>
|
||||
<ConfirmContextProvider>
|
||||
|
|
|
@ -10,7 +10,6 @@ declare module 'yup' {
|
|||
TFlags extends yup.Flags = ''
|
||||
> extends yup.Schema<TType, TContext, TDefault, TFlags> {
|
||||
isJsonObject(message?: string): StringSchema<TType, TContext>;
|
||||
isEnum(message?: string): StringSchema<TType, TContext>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,32 +39,6 @@ const isJsonObject = (message?: string) => {
|
|||
isValidJsonObject
|
||||
);
|
||||
};
|
||||
|
||||
export const isValidEnum = (value?: string) => {
|
||||
try {
|
||||
if (!value) return false;
|
||||
const trimmedValue = value.trim();
|
||||
if (
|
||||
trimmedValue.indexOf('enum') === 0 &&
|
||||
trimmedValue.lastIndexOf('}') === trimmedValue.length - 1
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
const isEnum = (message?: string) => {
|
||||
return yup.string().test(
|
||||
'isEnum',
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
message || '${path} is not Enum object',
|
||||
isValidEnum
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* due to yup rerunning all the object validiation during any render,
|
||||
* it makes sense to cache the async results
|
||||
|
@ -88,7 +61,6 @@ export function cacheTest(
|
|||
}
|
||||
|
||||
yup.addMethod(yup.StringSchema, 'isJsonObject', isJsonObject);
|
||||
yup.addMethod(yup.StringSchema, 'isEnum', isEnum);
|
||||
|
||||
export const topicFormValidationSchema = yup.object().shape({
|
||||
name: yup
|
||||
|
|
|
@ -237,12 +237,13 @@ const baseTheme = {
|
|||
color: Colors.neutral[90],
|
||||
},
|
||||
switch: {
|
||||
unchecked: Colors.brand[30],
|
||||
unchecked: Colors.neutral[20],
|
||||
hover: Colors.neutral[40],
|
||||
checked: Colors.brand[50],
|
||||
circle: Colors.neutral[0],
|
||||
disabled: Colors.neutral[10],
|
||||
checkedIcon: {
|
||||
backgroundColor: Colors.neutral[70],
|
||||
backgroundColor: Colors.neutral[10],
|
||||
},
|
||||
},
|
||||
pageLoader: {
|
||||
|
@ -368,6 +369,7 @@ export const theme = {
|
|||
cursor: Colors.neutral[90],
|
||||
variable: Colors.red[50],
|
||||
aceString: Colors.green[60],
|
||||
codeMarker: Colors.yellow[20],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -535,6 +537,12 @@ export const theme = {
|
|||
active: Colors.neutral[90],
|
||||
},
|
||||
},
|
||||
colored: {
|
||||
color: {
|
||||
attention: Colors.red[50],
|
||||
warning: Colors.yellow[20],
|
||||
},
|
||||
},
|
||||
expander: {
|
||||
normal: Colors.brand[30],
|
||||
hover: Colors.brand[40],
|
||||
|
@ -801,6 +809,7 @@ export const darkTheme: ThemeType = {
|
|||
cursor: Colors.neutral[0],
|
||||
variable: Colors.red[50],
|
||||
aceString: Colors.green[60],
|
||||
codeMarker: Colors.yellow[20],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -968,6 +977,12 @@ export const darkTheme: ThemeType = {
|
|||
active: Colors.neutral[0],
|
||||
},
|
||||
},
|
||||
colored: {
|
||||
color: {
|
||||
attention: Colors.red[50],
|
||||
warning: Colors.yellow[20],
|
||||
},
|
||||
},
|
||||
expander: {
|
||||
normal: Colors.brand[30],
|
||||
hover: Colors.brand[40],
|
||||
|
|
Loading…
Add table
Reference in a new issue