Skip to content

Commit 058c156

Browse files
committed
Merge remote-tracking branch 'origin/master' into enhancement/fix-eslint-errors
# Conflicts: # kafka-ui-react-app/package-lock.json # kafka-ui-react-app/src/components/Brokers/Brokers.tsx # kafka-ui-react-app/src/components/Brokers/BrokersContainer.ts # kafka-ui-react-app/src/components/Dashboard/ClustersWidget/ClusterWidget.tsx # kafka-ui-react-app/src/components/Dashboard/ClustersWidget/ClustersWidget.tsx # kafka-ui-react-app/src/components/Topics/Details/DetailsContainer.ts # kafka-ui-react-app/src/components/Topics/Details/Messages/Messages.tsx # kafka-ui-react-app/src/components/Topics/List/ListItem.tsx # kafka-ui-react-app/src/components/Topics/New/NewContainer.ts # kafka-ui-react-app/src/components/Topics/TopicsContainer.ts # kafka-ui-react-app/src/redux/actions/actions.ts # kafka-ui-react-app/src/redux/api/clusters.ts # kafka-ui-react-app/src/redux/api/consumerGroups.ts # kafka-ui-react-app/src/redux/api/topics.ts # kafka-ui-react-app/src/redux/interfaces/broker.ts # kafka-ui-react-app/src/redux/interfaces/topic.ts # kafka-ui-react-app/src/redux/reducers/clusters/selectors.ts # kafka-ui-react-app/src/redux/reducers/topics/reducer.ts
2 parents be4b954 + 494443b commit 058c156

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+406
-508
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ build/
3232
/kafka-ui-api/app/node
3333

3434
.DS_Store
35+
*.code-workspace

kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/mapper/ClusterMapper.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ default BigDecimal sumMetrics(Map<String, BigDecimal> metrics) {
6666
}
6767

6868
default Path resolvePath(String path) {
69-
return Path.of(path);
69+
if (path != null) {
70+
return Path.of(path);
71+
} else {
72+
return null;
73+
}
7074
}
7175

7276
}

kafka-ui-api/src/main/java/com/provectus/kafka/ui/cluster/service/ClusterService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public Flux<Broker> getBrokers (String clusterName) {
150150
.flatMap(client -> ClusterUtil.toMono(client.getAdminClient().describeCluster().nodes())
151151
.map(n -> n.stream().map(node -> {
152152
Broker broker = new Broker();
153-
broker.setId(node.idString());
153+
broker.setId(node.id());
154154
broker.setHost(node.host());
155155
return broker;
156156
}).collect(Collectors.toList())))

kafka-ui-contract/pom.xml

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
54
<parent>
65
<artifactId>kafka-ui</artifactId>
76
<groupId>com.provectus</groupId>
@@ -70,8 +69,57 @@
7069
</configOptions>
7170
</configuration>
7271
</execution>
72+
<execution>
73+
<id>generate-frontend-api</id>
74+
<goals>
75+
<goal>generate</goal>
76+
</goals>
77+
<configuration>
78+
<inputSpec>${project.basedir}/src/main/resources/swagger/kafka-ui-api.yaml
79+
</inputSpec>
80+
<output>${project.build.directory}/generated-sources/frontend/</output>
81+
<generatorName>typescript-fetch</generatorName>
82+
<configOptions>
83+
<modelPackage>com.provectus.kafka.ui.model</modelPackage>
84+
<apiPackage>com.provectus.kafka.ui.api</apiPackage>
85+
<apiPackage>com.provectus.kafka.ui.invoker</apiPackage>
86+
<sourceFolder>kafka-ui-contract</sourceFolder>
87+
<typescriptThreePlus>true</typescriptThreePlus>
88+
<supportsES6>true</supportsES6>
89+
<nullSafeAdditionalProps>true</nullSafeAdditionalProps>
90+
<withInterfaces>true</withInterfaces>
91+
</configOptions>
92+
</configuration>
93+
</execution>
7394
</executions>
7495
</plugin>
96+
<plugin>
97+
<groupId>org.apache.maven.plugins</groupId>
98+
<artifactId>maven-resources-plugin</artifactId>
99+
<version>3.1.0</version>
100+
<executions>
101+
<execution>
102+
<id>copy-resource-one</id>
103+
<phase>generate-resources</phase>
104+
<goals>
105+
<goal>copy-resources</goal>
106+
</goals>
107+
108+
<configuration>
109+
<outputDirectory>${basedir}/..//kafka-ui-react-app/src/generated-sources</outputDirectory>
110+
<resources>
111+
<resource>
112+
<directory>${project.build.directory}/generated-sources/frontend/</directory>
113+
<includes>
114+
<include>**/*.ts</include>
115+
</includes>
116+
</resource>
117+
</resources>
118+
</configuration>
119+
</execution>
120+
</executions>
121+
122+
</plugin>
75123
</plugins>
76124
</build>
77125
</profile>

kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ components:
409409
format: int64
410410
segmentCount:
411411
type: integer
412+
required:
413+
- brokerId
412414

413415
BrokerMetrics:
414416
type: object
@@ -448,6 +450,8 @@ components:
448450
type: array
449451
items:
450452
$ref: "#/components/schemas/Partition"
453+
required:
454+
- name
451455

452456
Replica:
453457
type: object
@@ -488,6 +492,8 @@ components:
488492
type: integer
489493
underReplicatedPartitions:
490494
type: integer
495+
required:
496+
- name
491497

492498
TopicConfig:
493499
type: object
@@ -498,6 +504,8 @@ components:
498504
type: string
499505
defaultValue:
500506
type: string
507+
required:
508+
- name
501509

502510
TopicFormData:
503511
type: object
@@ -512,14 +520,18 @@ components:
512520
type: object
513521
additionalProperties:
514522
type: string
523+
required:
524+
- name
515525

516526
Broker:
517527
type: object
518528
properties:
519529
id:
520-
type: string
530+
type: integer
521531
host:
522532
type: string
533+
required:
534+
- id
523535

524536
ConsumerGroup:
525537
type: object
@@ -532,6 +544,9 @@ components:
532544
type: integer
533545
numTopics:
534546
type: integer
547+
required:
548+
- clusterId
549+
- consumerGroupId
535550

536551
TopicMessage:
537552
type: object
@@ -605,12 +620,17 @@ components:
605620
partition:
606621
type: integer
607622
currentOffset:
608-
type: long
623+
type: integer
624+
format: int64
609625
endOffset:
610-
type: long
626+
type: integer
627+
format: int64
611628
messagesBehind:
612-
type: long
613-
629+
type: integer
630+
format: int64
631+
required:
632+
- consumerId
633+
614634
ConsumerGroupDetails:
615635
type: object
616636
properties:
@@ -620,6 +640,8 @@ components:
620640
type: array
621641
items:
622642
$ref: '#/components/schemas/ConsumerTopicPartitionDetail'
643+
required:
644+
- consumerGroupId
623645

624646
Metric:
625647
type: object

kafka-ui-react-app/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Kafka REST API
2-
REACT_APP_API_URL=/api
2+
REACT_APP_API_URL=

kafka-ui-react-app/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ npm-debug.log*
2323
yarn-debug.log*
2424
yarn-error.log*
2525

26-
.idea
26+
.idea
27+
28+
# generated sources
29+
src/generated-sources

kafka-ui-react-app/src/components/Brokers/Brokers.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import React from 'react';
2-
import { ClusterName, BrokerMetrics, ZooKeeperStatus } from 'redux/interfaces';
2+
import { ClusterName, ZooKeeperStatus } from 'redux/interfaces';
3+
import { ClusterStats } from 'generated-sources';
34
import useInterval from 'lib/hooks/useInterval';
45
import cx from 'classnames';
56
import MetricsWrapper from 'components/common/Dashboard/MetricsWrapper';
67
import Indicator from 'components/common/Dashboard/Indicator';
78
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
89

9-
interface Props extends BrokerMetrics {
10+
interface Props extends ClusterStats {
1011
clusterName: ClusterName;
1112
isFetched: boolean;
13+
fetchClusterStats: (clusterName: ClusterName) => void;
1214
fetchBrokers: (clusterName: ClusterName) => void;
13-
fetchBrokerMetrics: (clusterName: ClusterName) => void;
1415
}
1516

1617
const Topics: React.FC<Props> = ({
1718
clusterName,
18-
isFetched,
1919
brokerCount,
2020
activeControllers,
2121
zooKeeperStatus,
@@ -24,16 +24,16 @@ const Topics: React.FC<Props> = ({
2424
inSyncReplicasCount,
2525
outOfSyncReplicasCount,
2626
underReplicatedPartitionCount,
27+
fetchClusterStats,
2728
fetchBrokers,
28-
fetchBrokerMetrics,
2929
}) => {
3030
React.useEffect(() => {
31+
fetchClusterStats(clusterName);
3132
fetchBrokers(clusterName);
32-
fetchBrokerMetrics(clusterName);
33-
}, [fetchBrokers, fetchBrokerMetrics, clusterName]);
33+
}, [fetchClusterStats, fetchBrokers, clusterName]);
3434

3535
useInterval(() => {
36-
fetchBrokerMetrics(clusterName);
36+
fetchClusterStats(clusterName);
3737
}, 5000);
3838

3939
const zkOnline = zooKeeperStatus === ZooKeeperStatus.online;
@@ -62,7 +62,7 @@ const Topics: React.FC<Props> = ({
6262
<span className="subtitle has-text-weight-light">
6363
{' '}
6464
of
65-
{onlinePartitionCount + offlinePartitionCount}
65+
{(onlinePartitionCount || 0) + (offlinePartitionCount || 0)}
6666
</span>
6767
</Indicator>
6868
<Indicator label="URP" title="Under replicated partitions">

kafka-ui-react-app/src/components/Brokers/BrokersContainer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { connect } from 'react-redux';
2-
import { fetchBrokers, fetchBrokerMetrics } from 'redux/actions';
2+
import { fetchClusterStats, fetchBrokers } from 'redux/actions';
33
import * as brokerSelectors from 'redux/reducers/brokers/selectors';
44
import { RootState, ClusterName } from 'redux/interfaces';
55
import { RouteComponentProps } from 'react-router-dom';
@@ -34,9 +34,9 @@ const mapStateToProps = (
3434
});
3535

3636
const mapDispatchToProps = {
37+
fetchClusterStats: (clusterName: ClusterName) =>
38+
fetchClusterStats(clusterName),
3739
fetchBrokers: (clusterName: ClusterName) => fetchBrokers(clusterName),
38-
fetchBrokerMetrics: (clusterName: ClusterName) =>
39-
fetchBrokerMetrics(clusterName),
4040
};
4141

4242
export default connect(mapStateToProps, mapDispatchToProps)(Brokers);

kafka-ui-react-app/src/components/ConsumerGroups/Details/Details.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import React from 'react';
22
import { ClusterName } from 'redux/interfaces';
33
import Breadcrumb from 'components/common/Breadcrumb/Breadcrumb';
44
import { clusterConsumerGroupsPath } from 'lib/paths';
5+
import { ConsumerGroupID } from 'redux/interfaces/consumerGroup';
56
import {
6-
ConsumerGroupID,
77
ConsumerGroup,
88
ConsumerGroupDetails,
9-
Consumer,
10-
} from 'redux/interfaces/consumerGroup';
9+
ConsumerTopicPartitionDetail,
10+
} from 'generated-sources';
1111

1212
import PageLoader from 'components/common/PageLoader/PageLoader';
1313
import ListItem from './ListItem';
1414

1515
interface Props extends ConsumerGroup, ConsumerGroupDetails {
1616
clusterName: ClusterName;
1717
consumerGroupID: ConsumerGroupID;
18-
consumers: Consumer[];
18+
consumers?: ConsumerTopicPartitionDetail[];
1919
isFetched: boolean;
2020
fetchConsumerGroupDetails: (
2121
clusterName: ClusterName,

0 commit comments

Comments
 (0)