Skip to content

Commit e2ca0b5

Browse files
committed
IKC-478 fixes after merge
1 parent d8f3e38 commit e2ca0b5

File tree

15 files changed

+56
-65
lines changed

15 files changed

+56
-65
lines changed

kouncil-backend/src/main/java/com/consdata/kouncil/KouncilApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
56

6-
@SpringBootApplication
7+
@SpringBootApplication(exclude = {LdapAutoConfiguration.class})
78
public class KouncilApplication {
89

910
public static void main(String[] args) {

kouncil-backend/src/main/java/com/consdata/kouncil/broker/BrokersController.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,27 @@ public class BrokersController {
4545
@GetMapping("/brokers")
4646
@EntryExitLogger
4747
public BrokersDto getBrokers(@RequestParam("serverId") String serverId) {
48-
try {
49-
DescribeClusterResult describeClusterResult = kafkaConnectionService.getAdminClient(serverId).describeCluster();
50-
Collection<Node> nodes = describeClusterResult.nodes().get();
51-
List<KafkaBroker> kafkaBrokers = new ArrayList<>();
52-
nodes.forEach(node -> kafkaBrokers.add(KafkaBroker.builder()
53-
.host(node.host())
54-
.port(node.port())
55-
.port(node.port())
56-
.id(node.idString())
57-
.rack(node.rack())
58-
.build()));
59-
loadJmxMetrics(serverId, kafkaBrokers);
60-
Collections.sort(kafkaBrokers);
61-
return BrokersDto.builder().brokers(kafkaBrokers).build();
62-
} catch (Exception e) {
63-
Thread.currentThread().interrupt();
64-
throw new KouncilRuntimeException(e);
48+
if (serverId != null && !serverId.isBlank()) {
49+
try {
50+
DescribeClusterResult describeClusterResult = kafkaConnectionService.getAdminClient(serverId).describeCluster();
51+
Collection<Node> nodes = describeClusterResult.nodes().get();
52+
List<KafkaBroker> kafkaBrokers = new ArrayList<>();
53+
nodes.forEach(node -> kafkaBrokers.add(KafkaBroker.builder()
54+
.host(node.host())
55+
.port(node.port())
56+
.port(node.port())
57+
.id(node.idString())
58+
.rack(node.rack())
59+
.build()));
60+
loadJmxMetrics(serverId, kafkaBrokers);
61+
Collections.sort(kafkaBrokers);
62+
return BrokersDto.builder().brokers(kafkaBrokers).build();
63+
} catch (Exception e) {
64+
Thread.currentThread().interrupt();
65+
throw new KouncilRuntimeException(e);
66+
}
6567
}
68+
throw new KouncilRuntimeException("Clusters are not defined. Please register new clusters or reach out to your administrator for further information.");
6669
}
6770

6871
private void loadJmxMetrics(String serverId, List<KafkaBroker> kafkaBrokers) {

kouncil-backend/src/main/java/com/consdata/kouncil/config/security/ldap/CustomLdapAuthoritiesPopulator.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
import org.springframework.security.core.authority.SimpleGrantedAuthority;
1515
import org.springframework.security.ldap.SpringSecurityLdapTemplate;
1616
import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator;
17-
import org.springframework.stereotype.Component;
1817

19-
@Component
2018
@Data
2119
public class CustomLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator {
2220

kouncil-backend/src/main/java/com/consdata/kouncil/config/security/sso/SSOWebSecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
6868
.oauth2Login(oauth2 -> oauth2
6969
.authorizationEndpoint(authEndpoint -> authEndpoint.authorizationRequestRepository(new InMemoryAuthRepository()))
7070
.userInfoEndpoint(userInfo -> userInfo.userService(customUserService).userAuthoritiesMapper(this.authoritiesMapper()))
71+
.successHandler((HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) -> {})
7172
)
7273
.exceptionHandling(handling -> handling.authenticationEntryPoint(this::authenticationEntryPoint));
7374

kouncil-backend/src/main/java/com/consdata/kouncil/consumergroup/ConsumerGroupController.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ public class ConsumerGroupController {
2222

2323
private final ConsumerGroupService consumerGroupService;
2424

25-
@RolesAllowed(SystemFunctionNameConstants.CONSUMER_GROUP_LIST)
26-
@GetMapping
27-
public ConsumerGroupsResponse getConsumerGroups(@RequestParam("serverId") String serverId) throws ExecutionException, InterruptedException {
28-
return consumerGroupService.getConsumerGroups(serverId);
29-
}
30-
3125
@RolesAllowed(SystemFunctionNameConstants.CONSUMER_GROUP_DETAILS)
3226
@GetMapping("/{groupId}")
3327
public ConsumerGroupResponse getConsumerGroup(@PathVariable("groupId") String groupId, @RequestParam("serverId") String serverId)
Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,30 @@
11
package com.consdata.kouncil.consumergroup;
22

3-
import com.consdata.kouncil.KafkaConnectionService;
3+
import com.consdata.kouncil.KouncilRuntimeException;
44
import com.consdata.kouncil.model.admin.SystemFunctionNameConstants;
5-
import java.util.ArrayList;
6-
import java.util.List;
7-
import java.util.Map;
8-
import java.util.concurrent.ExecutionException;
95
import jakarta.annotation.security.RolesAllowed;
6+
import java.util.concurrent.ExecutionException;
107
import lombok.AllArgsConstructor;
118
import lombok.extern.slf4j.Slf4j;
12-
import org.apache.kafka.clients.admin.ConsumerGroupDescription;
13-
import org.apache.kafka.clients.admin.ConsumerGroupListing;
14-
import org.apache.kafka.clients.admin.ListConsumerGroupsResult;
15-
import org.apache.kafka.common.KafkaFuture;
169
import org.springframework.web.bind.annotation.GetMapping;
10+
import org.springframework.web.bind.annotation.RequestMapping;
1711
import org.springframework.web.bind.annotation.RequestParam;
1812
import org.springframework.web.bind.annotation.RestController;
1913

2014
@Slf4j
2115
@RestController
2216
@AllArgsConstructor
17+
@RequestMapping("/api/consumer-groups")
2318
public class ConsumerGroupsController {
2419

25-
private final KafkaConnectionService kafkaConnectionService;
20+
private final ConsumerGroupService consumerGroupService;
2621

2722
@RolesAllowed(SystemFunctionNameConstants.CONSUMER_GROUP_LIST)
28-
@GetMapping("/api/consumer-groups")
23+
@GetMapping
2924
public ConsumerGroupsResponse getConsumerGroups(@RequestParam("serverId") String serverId) throws ExecutionException, InterruptedException {
30-
ConsumerGroupsResponse result = ConsumerGroupsResponse
31-
.builder()
32-
.consumerGroups(new ArrayList<>())
33-
.build();
34-
ListConsumerGroupsResult groups = kafkaConnectionService.getAdminClient(serverId).listConsumerGroups();
35-
List<String> groupIds = groups.all().get().stream().map(ConsumerGroupListing::groupId).toList();
36-
Map<String, KafkaFuture<ConsumerGroupDescription>> consumerGroupSummary = kafkaConnectionService.getAdminClient(serverId)
37-
.describeConsumerGroups(groupIds).describedGroups();
38-
for (Map.Entry<String, KafkaFuture<ConsumerGroupDescription>> entry : consumerGroupSummary.entrySet()) {
39-
result.getConsumerGroups().add(ConsumerGroup.builder().groupId(entry.getKey()).status(entry.getValue().get().state().toString()).build());
25+
if (serverId != null && !serverId.isBlank()) {
26+
return consumerGroupService.getConsumerGroups(serverId);
4027
}
41-
return result;
28+
throw new KouncilRuntimeException("Clusters are not defined. Please register new clusters or reach out to your administrator for further information.");
4229
}
4330
}

kouncil-backend/src/main/java/com/consdata/kouncil/topic/TopicsController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.consdata.kouncil.topic;
22

3+
import com.consdata.kouncil.KouncilRuntimeException;
34
import com.consdata.kouncil.logging.EntryExitLogger;
45
import com.consdata.kouncil.model.admin.SystemFunctionNameConstants;
56
import jakarta.annotation.security.RolesAllowed;
@@ -19,6 +20,9 @@ public class TopicsController {
1920
@GetMapping("/api/topics")
2021
@EntryExitLogger
2122
public TopicsDto getTopics(@RequestParam("serverId") String serverId) {
22-
return topicsService.getTopics(serverId);
23+
if (serverId != null && !serverId.isBlank()) {
24+
return topicsService.getTopics(serverId);
25+
}
26+
throw new KouncilRuntimeException("Clusters are not defined. Please register new clusters or reach out to your administrator for further information.");
2327
}
2428
}

kouncil-backend/src/main/resources/kouncil.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ kouncil:
3232
providers: github,okta
3333
topics:
3434
exclude-regex-patterns: __.*
35-
survey:
36-
base-path: "https://kouncil-eximee-survey-n22nwdfueq-lm.a.run.app/kouncil"
3735

3836
spring:
3937
flyway:

kouncil-frontend/apps/kouncil/src/app/survey/survey.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export class SurveyComponent implements OnInit, OnDestroy {
7676
}
7777

7878
ngOnInit(): void {
79-
this.surveyService.fetchSurvey$(this.router.url);
8079
}
8180

8281
ngOnDestroy(): void {

kouncil-frontend/apps/kouncil/src/app/track/track-result/track-result.component.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ import {
99
ViewChild,
1010
} from '@angular/core';
1111
import {Subscription} from 'rxjs';
12-
import {ActivatedRoute} from '@angular/router';
13-
import {Title} from '@angular/platform-browser';
1412
import {MessageViewComponent} from '../../topic/message/message-view.component';
1513
import {TrackService} from '../track.service';
1614
import {TrackFilter} from '../track-filter/track-filter';
1715
import {MessageData, MessageDataService} from '@app/message-data';
18-
import {Crypto, DrawerService, ProgressBarService, SearchService} from '@app/common-utils';
16+
import {Crypto, DrawerService, SearchService} from '@app/common-utils';
1917
import {NoDataPlaceholderComponent} from '@app/feat-no-data';
2018
import {ServersService} from '@app/common-servers';
2119
import {AbstractTableComponent, TableColumn} from '@app/common-components';
@@ -112,10 +110,7 @@ export class TrackResultComponent extends AbstractTableComponent implements OnIn
112110
];
113111

114112
constructor(
115-
private route: ActivatedRoute,
116113
private searchService: SearchService,
117-
private titleService: Title,
118-
private progressBarService: ProgressBarService,
119114
private trackService: TrackService,
120115
private drawerService: DrawerService,
121116
private servers: ServersService,
@@ -300,8 +295,8 @@ export class TrackResultComponent extends AbstractTableComponent implements OnIn
300295
});
301296
});
302297

303-
this.parseObjectValues(items);
304298
}
299+
this.parseObjectValues(items);
305300

306301
let columns: TableColumn[] = [...this.commonColumns];
307302
if (gridColumns) {

0 commit comments

Comments
 (0)