Skip to content

Commit

Permalink
Brokers: Improve accessibility for r/o clusters (#556)
Browse files Browse the repository at this point in the history
Co-authored-by: Roman Zabaluev <[email protected]>
  • Loading branch information
hadisfr and Haarolean authored Oct 16, 2024
1 parent 19b13ea commit 8d742ba
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
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 @@ -31,8 +31,10 @@ const InputCellViewMode: FC<InputCellViewModeProps> = ({
);

return (
<S.ValueWrapper $isDynamic={isDynamic}>
<S.Value title={title}>{displayValue}</S.Value>
<S.ValueWrapper>
<S.Value $isDynamic={isDynamic} title={title}>
{displayValue}
</S.Value>
<Tooltip
value={
<Button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
import styled from 'styled-components';

export const ValueWrapper = styled.div<{ $isDynamic?: boolean }>`
export const ValueWrapper = styled.div`
display: flex;
justify-content: space-between;
font-weight: ${({ $isDynamic }) => ($isDynamic ? 600 : 400)};
font-weight: 400;
button {
margin: 0 10px;
}
`;

export const Value = styled.span`
export const Value = styled.span<{ $isDynamic?: boolean }>`
line-height: 24px;
margin-right: 10px;
text-overflow: ellipsis;
max-width: 400px;
overflow: hidden;
white-space: nowrap;
font-weight: ${({ $isDynamic }) => ($isDynamic ? 600 : 400)};
`;

export const ButtonsWrapper = styled.div`
Expand Down

0 comments on commit 8d742ba

Please sign in to comment.