Skip to content

Commit 43ec02c

Browse files
authored
Revert "FE: Redirect the user to the wizard page if no clusters (#3481)" (#3798)
1 parent 725c95f commit 43ec02c

File tree

4 files changed

+5
-62
lines changed

4 files changed

+5
-62
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useMemo } from 'react';
1+
import React, { useMemo } from 'react';
22
import PageHeading from 'components/common/PageHeading/PageHeading';
33
import * as Metrics from 'components/common/Metrics';
44
import { Tag } from 'components/common/Tag/Tag.styled';
@@ -10,7 +10,6 @@ import Table, { SizeCell } from 'components/common/NewTable';
1010
import useBoolean from 'lib/hooks/useBoolean';
1111
import { clusterNewConfigPath } from 'lib/paths';
1212
import { GlobalSettingsContext } from 'components/contexts/GlobalSettingsContext';
13-
import { useNavigate } from 'react-router-dom';
1413
import { ActionCanButton } from 'components/common/ActionComponent';
1514
import { useGetUserInfo } from 'lib/hooks/api/roles';
1615

@@ -23,7 +22,7 @@ const Dashboard: React.FC = () => {
2322
const clusters = useClusters();
2423
const { value: showOfflineOnly, toggle } = useBoolean(false);
2524
const appInfo = React.useContext(GlobalSettingsContext);
26-
const navigate = useNavigate();
25+
2726
const config = React.useMemo(() => {
2827
const clusterList = clusters.data || [];
2928
const offlineClusters = clusterList.filter(
@@ -58,12 +57,6 @@ const Dashboard: React.FC = () => {
5857
return initialColumns;
5958
}, []);
6059

61-
useEffect(() => {
62-
if (appInfo.hasDynamicConfig && !clusters.data) {
63-
navigate(clusterNewConfigPath);
64-
}
65-
}, [clusters, appInfo.hasDynamicConfig]);
66-
6760
const isApplicationConfig = useMemo(() => {
6861
return !!data?.userInfo?.permissions.some(
6962
(permission) => permission.resource === ResourceType.APPLICATIONCONFIG

kafka-ui-react-app/src/components/Dashboard/__test__/Dashboard.spec.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

kafka-ui-react-app/src/components/contexts/GlobalSettingsContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useAppInfo } from 'lib/hooks/api/appConfig';
22
import React from 'react';
33
import { ApplicationInfoEnabledFeaturesEnum } from 'generated-sources';
44

5-
export interface GlobalSettingsContextProps {
5+
interface GlobalSettingsContextProps {
66
hasDynamicConfig: boolean;
77
}
88

kafka-ui-react-app/src/lib/testHelpers.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ import {
2626
} from '@tanstack/react-query';
2727
import { ConfirmContextProvider } from 'components/contexts/ConfirmContext';
2828
import ConfirmationModal from 'components/common/ConfirmationModal/ConfirmationModal';
29-
import {
30-
GlobalSettingsContext,
31-
GlobalSettingsContextProps,
32-
} from 'components/contexts/GlobalSettingsContext';
29+
import { GlobalSettingsContext } from 'components/contexts/GlobalSettingsContext';
3330
import { UserInfoRolesAccessContext } from 'components/contexts/UserInfoRolesAccessContext';
3431

3532
import { RolesType, modifyRolesData } from './permissions';
@@ -38,7 +35,6 @@ interface CustomRenderOptions extends Omit<RenderOptions, 'wrapper'> {
3835
preloadedState?: Partial<RootState>;
3936
store?: Store<Partial<RootState>, AnyAction>;
4037
initialEntries?: MemoryRouterProps['initialEntries'];
41-
globalSettings?: GlobalSettingsContextProps;
4238
userInfo?: {
4339
roles?: RolesType;
4440
rbacFlag: boolean;
@@ -114,7 +110,6 @@ const customRender = (
114110
preloadedState,
115111
}),
116112
initialEntries,
117-
globalSettings = { hasDynamicConfig: false },
118113
userInfo,
119114
...renderOptions
120115
}: CustomRenderOptions = {}
@@ -124,7 +119,7 @@ const customRender = (
124119
children,
125120
}) => (
126121
<TestQueryClientProvider>
127-
<GlobalSettingsContext.Provider value={globalSettings}>
122+
<GlobalSettingsContext.Provider value={{ hasDynamicConfig: false }}>
128123
<ThemeProvider theme={theme}>
129124
<TestUserInfoProvider data={userInfo}>
130125
<ConfirmContextProvider>

0 commit comments

Comments
 (0)