Skip to content

Commit f2e9384

Browse files
committed
fix: review
1 parent ec547d7 commit f2e9384

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/containers/Tenant/Diagnostics/Diagnostics.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ import {
1010
useFeatureFlagsAvailable,
1111
useTopicDataAvailable,
1212
} from '../../../store/reducers/capabilities/hooks';
13-
import {useClusterBaseInfo} from '../../../store/reducers/cluster/cluster';
1413
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../store/reducers/tenant/constants';
15-
import {setDiagnosticsTab} from '../../../store/reducers/tenant/tenant';
14+
import {setDiagnosticsTab, useTenantBaseInfo} from '../../../store/reducers/tenant/tenant';
1615
import type {AdditionalNodesProps, AdditionalTenantsProps} from '../../../types/additionalProps';
1716
import {uiFactory} from '../../../uiFactory/uiFactory';
1817
import {cn} from '../../../utils/cn';
@@ -51,7 +50,7 @@ const b = cn('kv-tenant-diagnostics');
5150

5251
function Diagnostics(props: DiagnosticsProps) {
5352
const {path, database, type, subType} = useCurrentSchema();
54-
const {control_plane: controlPlane} = useClusterBaseInfo();
53+
const {controlPlane} = useTenantBaseInfo(path);
5554
const containerRef = React.useRef<HTMLDivElement>(null);
5655
const dispatch = useTypedDispatch();
5756
const {diagnosticsTab = TENANT_DIAGNOSTICS_TABS_IDS.overview} = useTypedSelector(

src/store/reducers/tenant/tenant.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {PayloadAction} from '@reduxjs/toolkit';
44
import {DEFAULT_USER_SETTINGS, settingsManager} from '../../../services/settings';
55
import type {TTenantInfo} from '../../../types/api/tenant';
66
import {TENANT_INITIAL_PAGE_KEY} from '../../../utils/constants';
7+
import {useClusterNameFromQuery} from '../../../utils/hooks/useDatabaseFromQuery';
78
import {api} from '../api';
89

910
import {TENANT_DIAGNOSTICS_TABS_IDS, TENANT_METRICS_TABS_IDS} from './constants';
@@ -100,3 +101,18 @@ export const tenantApi = api.injectEndpoints({
100101
}),
101102
overrideExisting: 'throw',
102103
});
104+
105+
export function useTenantBaseInfo(path: string) {
106+
const clusterNameFromQuery = useClusterNameFromQuery();
107+
108+
const {currentData} = tenantApi.useGetTenantInfoQuery({
109+
path,
110+
clusterName: clusterNameFromQuery,
111+
});
112+
113+
const {ControlPlane} = currentData || {};
114+
115+
return {
116+
controlPlane: ControlPlane,
117+
};
118+
}

0 commit comments

Comments
 (0)