Skip to content

Commit 07a5858

Browse files
authored
Merge branch 'main' into infra/build_with_serde
2 parents 192c053 + c7b4d16 commit 07a5858

File tree

9 files changed

+42
-42
lines changed

9 files changed

+42
-42
lines changed

api/src/main/java/io/kafbat/ui/KafkaUiApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.springframework.scheduling.annotation.EnableAsync;
99
import org.springframework.scheduling.annotation.EnableScheduling;
1010

11-
@SpringBootApplication(exclude = LdapAutoConfiguration.class)
11+
@SpringBootApplication
1212
@EnableScheduling
1313
@EnableAsync
1414
public class KafkaUiApplication {

api/src/main/java/io/kafbat/ui/config/auth/LdapProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class LdapProperties {
2020

2121
@Value("${oauth2.ldap.activeDirectory:false}")
2222
private boolean isActiveDirectory;
23-
@Value("${oauth2.ldap.aсtiveDirectory.domain:@null}")
23+
@Value("${oauth2.ldap.activeDirectory.domain:@null}")
2424
private String activeDirectoryDomain;
2525

2626
}

api/src/main/java/io/kafbat/ui/config/auth/LdapSecurityConfig.java

+4-10
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
import lombok.RequiredArgsConstructor;
1111
import lombok.extern.slf4j.Slf4j;
1212
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
13-
import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration;
1413
import org.springframework.boot.context.properties.EnableConfigurationProperties;
1514
import org.springframework.context.ApplicationContext;
1615
import org.springframework.context.annotation.Bean;
1716
import org.springframework.context.annotation.Configuration;
18-
import org.springframework.context.annotation.Import;
19-
import org.springframework.context.annotation.Primary;
2017
import org.springframework.ldap.core.DirContextOperations;
2118
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
2219
import org.springframework.ldap.core.support.LdapContextSource;
@@ -43,7 +40,6 @@
4340
@Configuration
4441
@EnableWebFluxSecurity
4542
@ConditionalOnProperty(value = "auth.type", havingValue = "LDAP")
46-
@Import(LdapAutoConfiguration.class)
4743
@EnableConfigurationProperties(LdapProperties.class)
4844
@RequiredArgsConstructor
4945
@Slf4j
@@ -52,18 +48,18 @@ public class LdapSecurityConfig {
5248
private final LdapProperties props;
5349

5450
@Bean
55-
public ReactiveAuthenticationManager authenticationManager(BaseLdapPathContextSource contextSource,
51+
public ReactiveAuthenticationManager authenticationManager(LdapContextSource ldapContextSource,
5652
LdapAuthoritiesPopulator authoritiesExtractor,
5753
AccessControlService acs) {
5854
var rbacEnabled = acs.isRbacEnabled();
59-
BindAuthenticator ba = new BindAuthenticator(contextSource);
55+
BindAuthenticator ba = new BindAuthenticator(ldapContextSource);
6056
if (props.getBase() != null) {
6157
ba.setUserDnPatterns(new String[] {props.getBase()});
6258
}
6359
if (props.getUserFilterSearchFilter() != null) {
6460
LdapUserSearch userSearch =
6561
new FilterBasedLdapUserSearch(props.getUserFilterSearchBase(), props.getUserFilterSearchFilter(),
66-
contextSource);
62+
ldapContextSource);
6763
ba.setUserSearch(userSearch);
6864
}
6965

@@ -88,8 +84,7 @@ public ReactiveAuthenticationManager authenticationManager(BaseLdapPathContextSo
8884
}
8985

9086
@Bean
91-
@Primary
92-
public BaseLdapPathContextSource contextSource() {
87+
public LdapContextSource ldapContextSource() {
9388
LdapContextSource ctx = new LdapContextSource();
9489
ctx.setUrl(props.getUrls());
9590
ctx.setUserDn(props.getAdminUser());
@@ -99,7 +94,6 @@ public BaseLdapPathContextSource contextSource() {
9994
}
10095

10196
@Bean
102-
@Primary
10397
public DefaultLdapAuthoritiesPopulator ldapAuthoritiesExtractor(ApplicationContext context,
10498
BaseLdapPathContextSource contextSource,
10599
AccessControlService acs) {

api/src/main/resources/application-local.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dynamic.config.enabled: true
4040
oauth2:
4141
ldap:
4242
activeDirectory: false
43-
aсtiveDirectory.domain: domain.com
43+
activeDirectory.domain: domain.com
4444

4545
auth:
4646
type: DISABLED

documentation/compose/ui-ldap.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ services:
2525
SPRING_LDAP_USER_FILTER_SEARCH_FILTER: "(&(uid={0})(objectClass=inetOrgPerson))"
2626
SPRING_LDAP_GROUP_FILTER_SEARCH_BASE: "ou=people,dc=planetexpress,dc=com"
2727
# OAUTH2.LDAP.ACTIVEDIRECTORY: true
28-
# OAUTH2.LDAP.AСTIVEDIRECTORY.DOMAIN: "memelord.lol"
28+
# OAUTH2.LDAP.ACTIVEDIRECTORY.DOMAIN: "memelord.lol"
2929

3030
ldap:
3131
image: rroemhild/test-openldap:latest

frontend/src/components/App.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,28 @@ import {
88
clusterNewConfigPath,
99
} from 'lib/paths';
1010
import PageLoader from 'components/common/PageLoader/PageLoader';
11-
import Dashboard from 'components/Dashboard/Dashboard';
12-
import ClusterPage from 'components/ClusterPage/ClusterPage';
1311
import { ThemeProvider } from 'styled-components';
1412
import { theme, darkTheme } from 'theme/theme';
1513
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
1614
import { showServerError } from 'lib/errorHandling';
1715
import { Toaster } from 'react-hot-toast';
1816
import GlobalCSS from 'components/globalCss';
1917
import * as S from 'components/App.styled';
20-
import ClusterConfigForm from 'widgets/ClusterConfigForm';
2118
import { ThemeModeContext } from 'components/contexts/ThemeModeContext';
2219

2320
import ConfirmationModal from './common/ConfirmationModal/ConfirmationModal';
2421
import { ConfirmContextProvider } from './contexts/ConfirmContext';
2522
import { GlobalSettingsProvider } from './contexts/GlobalSettingsContext';
26-
import ErrorPage from './ErrorPage/ErrorPage';
2723
import { UserInfoRolesAccessProvider } from './contexts/UserInfoRolesAccessContext';
2824
import PageContainer from './PageContainer/PageContainer';
2925

26+
const Dashboard = React.lazy(() => import('components/Dashboard/Dashboard'));
27+
const ClusterPage = React.lazy(
28+
() => import('components/ClusterPage/ClusterPage')
29+
);
30+
const ClusterConfigForm = React.lazy(() => import('widgets/ClusterConfigForm'));
31+
const ErrorPage = React.lazy(() => import('components/ErrorPage/ErrorPage'));
32+
3033
const queryClient = new QueryClient({
3134
defaultOptions: {
3235
queries: {
+20-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React from 'react';
1+
import React, { Suspense } from 'react';
22
import { Route, Routes } from 'react-router-dom';
3+
import PageLoader from 'components/common/PageLoader/PageLoader';
34
import {
45
clusterTopicCopyRelativePath,
56
clusterTopicNewRelativePath,
@@ -8,24 +9,26 @@ import {
89
} from 'lib/paths';
910
import SuspenseQueryComponent from 'components/common/SuspenseQueryComponent/SuspenseQueryComponent';
1011

11-
import New from './New/New';
12-
import ListPage from './List/ListPage';
13-
import Topic from './Topic/Topic';
12+
const New = React.lazy(() => import('./New/New'));
13+
const ListPage = React.lazy(() => import('./List/ListPage'));
14+
const Topic = React.lazy(() => import('./Topic/Topic'));
1415

1516
const Topics: React.FC = () => (
16-
<Routes>
17-
<Route index element={<ListPage />} />
18-
<Route path={clusterTopicNewRelativePath} element={<New />} />
19-
<Route path={clusterTopicCopyRelativePath} element={<New />} />
20-
<Route
21-
path={getNonExactPath(RouteParams.topicName)}
22-
element={
23-
<SuspenseQueryComponent>
24-
<Topic />
25-
</SuspenseQueryComponent>
26-
}
27-
/>
28-
</Routes>
17+
<Suspense fallback={<PageLoader />}>
18+
<Routes>
19+
<Route index element={<ListPage />} />
20+
<Route path={clusterTopicNewRelativePath} element={<New />} />
21+
<Route path={clusterTopicCopyRelativePath} element={<New />} />
22+
<Route
23+
path={getNonExactPath(RouteParams.topicName)}
24+
element={
25+
<SuspenseQueryComponent>
26+
<Topic />
27+
</SuspenseQueryComponent>
28+
}
29+
/>
30+
</Routes>
31+
</Suspense>
2932
);
3033

3134
export default Topics;

frontend/src/components/Topics/__tests__/Topics.spec.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ describe('Topics Component', () => {
3535
{ initialEntries: [path] }
3636
);
3737

38-
it('should check if the page is Topics List rendered', () => {
38+
it('should check if the page is Topics List rendered', async () => {
3939
setUpComponent(clusterTopicsPath(clusterName));
40-
expect(screen.getByText(listContainer)).toBeInTheDocument();
40+
expect(await screen.findByText(listContainer)).toBeInTheDocument();
4141
});
4242

43-
it('should check if the page is New Topic rendered', () => {
43+
it('should check if the page is New Topic rendered', async () => {
4444
setUpComponent(clusterTopicNewPath(clusterName));
45-
expect(screen.getByText(newCopyContainer)).toBeInTheDocument();
45+
expect(await screen.findByText(newCopyContainer)).toBeInTheDocument();
4646
});
4747

4848
it('should check if the page is Copy Topic rendered', () => {
4949
setUpComponent(clusterTopicCopyPath(clusterName));
5050
expect(screen.getByText(newCopyContainer)).toBeInTheDocument();
5151
});
5252

53-
it('should check if the page is Topic page rendered', () => {
53+
it('should check if the page is Topic page rendered', async () => {
5454
setUpComponent(clusterTopicPath(clusterName, topicName));
55-
expect(screen.getByText(topicContainer)).toBeInTheDocument();
55+
expect(await screen.findByText(topicContainer)).toBeInTheDocument();
5656
});
5757
});

frontend/src/components/__tests__/App.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('App', () => {
3333
});
3434

3535
it('Renders navigation', async () => {
36-
expect(screen.getByText('Navigation')).toBeInTheDocument();
36+
expect(await screen.findByText('Navigation')).toBeInTheDocument();
3737
});
3838

3939
it('Renders NavBar', async () => {

0 commit comments

Comments
 (0)