Skip to content

Commit ae4e4ab

Browse files
author
Oleg Sergeev
committed
Merge branch 'master' of github.com:provectus/kafka-ui into issues/2728
2 parents d4f3b2a + e67d940 commit ae4e4ab

File tree

95 files changed

+1299
-2380
lines changed

Some content is hidden

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

95 files changed

+1299
-2380
lines changed

.github/workflows/e2e-checks.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ jobs:
7676
target_url: https://${{ github.repository_owner }}.github.io/kafka-ui/allure/allure-results/${{ github.run_number }}
7777
- name: Dump docker logs on failure
7878
if: failure()
79-
uses: jwalton/[email protected].0
79+
uses: jwalton/[email protected].1

.github/workflows/frontend.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
# Disabling shallow clone is recommended for improving relevancy of reporting
2121
fetch-depth: 0
2222
ref: ${{ github.event.pull_request.head.sha }}
23-
- uses: pnpm/[email protected].2
23+
- uses: pnpm/[email protected].4
2424
with:
2525
version: 7.4.0
2626
- name: Install node
27-
uses: actions/setup-node@v3.4.1
27+
uses: actions/setup-node@v3.5.1
2828
with:
2929
node-version: "16.15.0"
3030
cache: "pnpm"

.github/workflows/helm.yaml

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
name: Helm
22
on:
3-
pull_request:
4-
types: [ 'opened', 'edited', 'reopened', 'synchronize' ]
5-
paths:
6-
- "charts/**"
7-
8-
schedule:
9-
# * is a special character in YAML so you have to quote this string
10-
- cron: '0 8 * * 3'
11-
3+
pull_request:
4+
types: ["opened", "edited", "reopened", "synchronize"]
5+
branches:
6+
- 'master'
7+
paths:
8+
- "charts/**"
129
jobs:
1310
build-and-test:
1411
runs-on: ubuntu-latest
1512
steps:
1613
- uses: actions/checkout@v3
1714
- name: Helm tool installer
18-
uses: Azure/setup-helm@v1
15+
uses: Azure/setup-helm@v3
1916
- name: Setup Kubeval
2017
18+
#check, was helm version increased in Chart.yaml?
19+
- name: Check version
20+
shell: bash
21+
run: |
22+
helm_version_new=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}')
23+
helm_version_old=$(curl -s https://raw.githubusercontent.com/provectus/kafka-ui/master/charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}' )
24+
echo $helm_version_old
25+
echo $helm_version_new
26+
if [[ "$helm_version_new" > "$helm_version_old" ]]; then exit 0 ; else exit 1 ; fi
2127
- name: Run kubeval
2228
shell: bash
2329
run: |

.github/workflows/release-helm.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release helm
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- "charts/**"
8+
9+
jobs:
10+
release-helm:
11+
runs-on:
12+
ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 1
17+
18+
- run: |
19+
git config user.name github-actions
20+
git config user.email [email protected]
21+
22+
- uses: azure/setup-helm@v1
23+
24+
- name: add chart #realse helm with new version
25+
run: |
26+
echo "VERSION=$(cat charts/kafka-ui/Chart.yaml | grep version | awk '{print $2}')" >> $GITHUB_ENV
27+
MSG=$(helm package charts/kafka-ui)
28+
git fetch origin
29+
git stash
30+
git checkout -b gh-pages origin/gh-pages
31+
helm repo index .
32+
git add -f ${MSG##*/} index.yaml
33+
git commit -m "release ${{ env.VERSION }}"
34+
git push
35+
- uses: rickstaa/action-create-tag@v1 #create new tag
36+
with:
37+
tag: "charts/kafka-ui-${{ env.VERSION }}"

.github/workflows/stale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v5
10+
- uses: actions/stale@v6
1111
with:
1212
days-before-issue-stale: 7
1313
days-before-issue-close: 3

charts/kafka-ui/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
name: kafka-ui
33
description: A Helm chart for kafka-UI
44
type: application
5-
version: 0.4.3
6-
appVersion: latest
5+
version: 0.4.4
6+
appVersion: 0.4.0
77
icon: https://github.com/provectus/kafka-ui/raw/master/documentation/images/kafka-ui-logo.png

kafka-ui-api/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@
173173
<version>${mockito.version}</version>
174174
<scope>test</scope>
175175
</dependency>
176+
<dependency>
177+
<groupId>net.bytebuddy</groupId>
178+
<artifactId>byte-buddy</artifactId>
179+
<version>${byte-buddy.version}</version>
180+
<scope>test</scope>
181+
</dependency>
176182
<dependency>
177183
<groupId>org.assertj</groupId>
178184
<artifactId>assertj-core</artifactId>

kafka-ui-api/src/main/java/com/provectus/kafka/ui/client/KsqlClient.java

-53
This file was deleted.

kafka-ui-api/src/main/java/com/provectus/kafka/ui/controller/KafkaConnectController.java

+28-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import com.provectus.kafka.ui.api.KafkaConnectApi;
44
import com.provectus.kafka.ui.model.ConnectDTO;
55
import com.provectus.kafka.ui.model.ConnectorActionDTO;
6+
import com.provectus.kafka.ui.model.ConnectorColumnsToSortDTO;
67
import com.provectus.kafka.ui.model.ConnectorDTO;
78
import com.provectus.kafka.ui.model.ConnectorPluginConfigValidationResponseDTO;
89
import com.provectus.kafka.ui.model.ConnectorPluginDTO;
910
import com.provectus.kafka.ui.model.FullConnectorInfoDTO;
1011
import com.provectus.kafka.ui.model.NewConnectorDTO;
12+
import com.provectus.kafka.ui.model.SortOrderDTO;
1113
import com.provectus.kafka.ui.model.TaskDTO;
1214
import com.provectus.kafka.ui.service.KafkaConnectService;
15+
import java.util.Comparator;
1316
import java.util.Map;
1417
import javax.validation.Valid;
1518
import lombok.RequiredArgsConstructor;
@@ -68,10 +71,16 @@ public Mono<ResponseEntity<Void>> deleteConnector(String clusterName, String con
6871
public Mono<ResponseEntity<Flux<FullConnectorInfoDTO>>> getAllConnectors(
6972
String clusterName,
7073
String search,
74+
ConnectorColumnsToSortDTO orderBy,
75+
SortOrderDTO sortOrder,
7176
ServerWebExchange exchange
7277
) {
78+
var comparator = sortOrder == null || sortOrder.equals(SortOrderDTO.ASC)
79+
? getConnectorsComparator(orderBy)
80+
: getConnectorsComparator(orderBy).reversed();
7381
return Mono.just(ResponseEntity.ok(
74-
kafkaConnectService.getAllConnectors(getCluster(clusterName), search)));
82+
kafkaConnectService.getAllConnectors(getCluster(clusterName), search).sort(comparator))
83+
);
7584
}
7685

7786
@Override
@@ -142,4 +151,22 @@ public Mono<ResponseEntity<Flux<ConnectorPluginDTO>>> getConnectorPlugins(
142151
getCluster(clusterName), connectName, pluginName, requestBody)
143152
.map(ResponseEntity::ok);
144153
}
154+
155+
private Comparator<FullConnectorInfoDTO> getConnectorsComparator(ConnectorColumnsToSortDTO orderBy) {
156+
var defaultComparator = Comparator.comparing(FullConnectorInfoDTO::getName);
157+
if (orderBy == null) {
158+
return defaultComparator;
159+
}
160+
switch (orderBy) {
161+
case CONNECT:
162+
return Comparator.comparing(FullConnectorInfoDTO::getConnect);
163+
case TYPE:
164+
return Comparator.comparing(FullConnectorInfoDTO::getType);
165+
case STATUS:
166+
return Comparator.comparing(fullConnectorInfoDTO -> fullConnectorInfoDTO.getStatus().getState());
167+
case NAME:
168+
default:
169+
return defaultComparator;
170+
}
171+
}
145172
}

kafka-ui-api/src/main/java/com/provectus/kafka/ui/controller/KsqlController.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package com.provectus.kafka.ui.controller;
22

33
import com.provectus.kafka.ui.api.KsqlApi;
4-
import com.provectus.kafka.ui.model.KsqlCommandDTO;
5-
import com.provectus.kafka.ui.model.KsqlCommandResponseDTO;
64
import com.provectus.kafka.ui.model.KsqlCommandV2DTO;
75
import com.provectus.kafka.ui.model.KsqlCommandV2ResponseDTO;
86
import com.provectus.kafka.ui.model.KsqlResponseDTO;
97
import com.provectus.kafka.ui.model.KsqlStreamDescriptionDTO;
108
import com.provectus.kafka.ui.model.KsqlTableDescriptionDTO;
119
import com.provectus.kafka.ui.model.KsqlTableResponseDTO;
12-
import com.provectus.kafka.ui.service.KsqlService;
1310
import com.provectus.kafka.ui.service.ksql.KsqlServiceV2;
1411
import java.util.List;
1512
import java.util.Map;
@@ -27,17 +24,8 @@
2724
@RequiredArgsConstructor
2825
@Slf4j
2926
public class KsqlController extends AbstractController implements KsqlApi {
30-
private final KsqlService ksqlService;
31-
private final KsqlServiceV2 ksqlServiceV2;
3227

33-
@Override
34-
public Mono<ResponseEntity<KsqlCommandResponseDTO>> executeKsqlCommand(String clusterName,
35-
Mono<KsqlCommandDTO>
36-
ksqlCommand,
37-
ServerWebExchange exchange) {
38-
return ksqlService.executeKsqlCommand(getCluster(clusterName), ksqlCommand)
39-
.map(ResponseEntity::ok);
40-
}
28+
private final KsqlServiceV2 ksqlServiceV2;
4129

4230
@Override
4331
public Mono<ResponseEntity<KsqlCommandV2ResponseDTO>> executeKsql(String clusterName,

kafka-ui-api/src/main/java/com/provectus/kafka/ui/controller/MessagesController.java

+19-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static java.util.stream.Collectors.toMap;
66

77
import com.provectus.kafka.ui.api.MessagesApi;
8+
import com.provectus.kafka.ui.exception.ValidationException;
89
import com.provectus.kafka.ui.model.ConsumerPosition;
910
import com.provectus.kafka.ui.model.CreateTopicMessageDTO;
1011
import com.provectus.kafka.ui.model.MessageFilterTypeDTO;
@@ -18,6 +19,7 @@
1819
import java.util.List;
1920
import java.util.Map;
2021
import java.util.Optional;
22+
import javax.annotation.Nullable;
2123
import javax.validation.Valid;
2224
import lombok.RequiredArgsConstructor;
2325
import lombok.extern.slf4j.Slf4j;
@@ -63,18 +65,22 @@ public Mono<ResponseEntity<Flux<TopicMessageEventDTO>>> getTopicMessages(String
6365
String keySerde,
6466
String valueSerde,
6567
ServerWebExchange exchange) {
68+
seekType = seekType != null ? seekType : SeekTypeDTO.BEGINNING;
69+
seekDirection = seekDirection != null ? seekDirection : SeekDirectionDTO.FORWARD;
70+
filterQueryType = filterQueryType != null ? filterQueryType : MessageFilterTypeDTO.STRING_CONTAINS;
71+
int recordsLimit =
72+
Optional.ofNullable(limit).map(s -> Math.min(s, MAX_LOAD_RECORD_LIMIT)).orElse(DEFAULT_LOAD_RECORD_LIMIT);
73+
6674
var positions = new ConsumerPosition(
67-
seekType != null ? seekType : SeekTypeDTO.BEGINNING,
68-
parseSeekTo(topicName, seekTo),
69-
seekDirection
75+
seekType,
76+
topicName,
77+
parseSeekTo(topicName, seekType, seekTo)
7078
);
71-
int recordsLimit = Optional.ofNullable(limit)
72-
.map(s -> Math.min(s, MAX_LOAD_RECORD_LIMIT))
73-
.orElse(DEFAULT_LOAD_RECORD_LIMIT);
7479
return Mono.just(
7580
ResponseEntity.ok(
7681
messagesService.loadMessages(
77-
getCluster(clusterName), topicName, positions, q, filterQueryType, recordsLimit, keySerde, valueSerde)
82+
getCluster(clusterName), topicName, positions, q, filterQueryType,
83+
recordsLimit, seekDirection, keySerde, valueSerde)
7884
)
7985
);
8086
}
@@ -92,9 +98,13 @@ public Mono<ResponseEntity<Void>> sendTopicMessages(
9298
* The format is [partition]::[offset] for specifying offsets
9399
* or [partition]::[timestamp in millis] for specifying timestamps.
94100
*/
95-
private Map<TopicPartition, Long> parseSeekTo(String topic, List<String> seekTo) {
101+
@Nullable
102+
private Map<TopicPartition, Long> parseSeekTo(String topic, SeekTypeDTO seekType, List<String> seekTo) {
96103
if (seekTo == null || seekTo.isEmpty()) {
97-
return Map.of();
104+
if (seekType == SeekTypeDTO.LATEST || seekType == SeekTypeDTO.BEGINNING) {
105+
return null;
106+
}
107+
throw new ValidationException("seekTo should be set if seekType is " + seekType);
98108
}
99109
return seekTo.stream()
100110
.map(p -> {

0 commit comments

Comments
 (0)