Skip to content

Commit 8d742ba

Browse files
hadisfrHaarolean
andauthored
Brokers: Improve accessibility for r/o clusters (#556)
Co-authored-by: Roman Zabaluev <gpg@haarolean.dev>
1 parent 19b13ea commit 8d742ba

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

api/src/main/java/io/kafbat/ui/config/ReadOnlyModeFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ReadOnlyModeFilter implements WebFilter {
2525
Pattern.compile("/api/clusters/(?<clusterName>[^/]++)");
2626

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

3131
private final ClustersStorage clustersStorage;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class InternalBrokerConfig {
1616
private final boolean isReadOnly;
1717
private final List<ConfigEntry.ConfigSynonym> synonyms;
1818

19-
public static InternalBrokerConfig from(ConfigEntry configEntry) {
19+
public static InternalBrokerConfig from(ConfigEntry configEntry, boolean readOnlyCluster) {
2020
InternalBrokerConfig.InternalBrokerConfigBuilder builder = InternalBrokerConfig.builder()
2121
.name(configEntry.name())
2222
.value(configEntry.value())
2323
.source(configEntry.source())
24-
.isReadOnly(configEntry.isReadOnly())
24+
.isReadOnly(readOnlyCluster || configEntry.isReadOnly())
2525
.isSensitive(configEntry.isSensitive())
2626
.synonyms(configEntry.synonyms());
2727
return builder.build();

api/src/main/java/io/kafbat/ui/service/BrokerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private Flux<InternalBrokerConfig> getBrokersConfig(KafkaCluster cluster, Intege
5959
}
6060
return loadBrokersConfig(cluster, brokerId)
6161
.map(list -> list.stream()
62-
.map(InternalBrokerConfig::from)
62+
.map(configEntry -> InternalBrokerConfig.from(configEntry, cluster.isReadOnly()))
6363
.collect(Collectors.toList()))
6464
.flatMapMany(Flux::fromIterable);
6565
}

frontend/src/components/Brokers/Broker/Configs/TableComponents/InputCell/InputCellViewMode.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ const InputCellViewMode: FC<InputCellViewModeProps> = ({
3131
);
3232

3333
return (
34-
<S.ValueWrapper $isDynamic={isDynamic}>
35-
<S.Value title={title}>{displayValue}</S.Value>
34+
<S.ValueWrapper>
35+
<S.Value $isDynamic={isDynamic} title={title}>
36+
{displayValue}
37+
</S.Value>
3638
<Tooltip
3739
value={
3840
<Button

frontend/src/components/Brokers/Broker/Configs/TableComponents/InputCell/styled.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import styled from 'styled-components';
22

3-
export const ValueWrapper = styled.div<{ $isDynamic?: boolean }>`
3+
export const ValueWrapper = styled.div`
44
display: flex;
55
justify-content: space-between;
6-
font-weight: ${({ $isDynamic }) => ($isDynamic ? 600 : 400)};
6+
font-weight: 400;
77
88
button {
99
margin: 0 10px;
1010
}
1111
`;
1212

13-
export const Value = styled.span`
13+
export const Value = styled.span<{ $isDynamic?: boolean }>`
1414
line-height: 24px;
1515
margin-right: 10px;
1616
text-overflow: ellipsis;
1717
max-width: 400px;
1818
overflow: hidden;
1919
white-space: nowrap;
20+
font-weight: ${({ $isDynamic }) => ($isDynamic ? 600 : 400)};
2021
`;
2122

2223
export const ButtonsWrapper = styled.div`

0 commit comments

Comments
 (0)