@@ -3,10 +3,12 @@ import React from 'react';
33import { Tabs } from '@gravity-ui/uikit' ;
44import { Helmet } from 'react-helmet-async' ;
55import { Link } from 'react-router-dom' ;
6- import { StringParam , useQueryParams } from 'use-query-params' ;
76
87import { AutoRefreshControl } from '../../../components/AutoRefreshControl/AutoRefreshControl' ;
9- import { useFeatureFlagsAvailable } from '../../../store/reducers/capabilities/hooks' ;
8+ import {
9+ useFeatureFlagsAvailable ,
10+ useTopicDataAvailable ,
11+ } from '../../../store/reducers/capabilities/hooks' ;
1012import { TENANT_DIAGNOSTICS_TABS_IDS } from '../../../store/reducers/tenant/constants' ;
1113import { setDiagnosticsTab } from '../../../store/reducers/tenant/tenant' ;
1214import type { AdditionalNodesProps , AdditionalTenantsProps } from '../../../types/additionalProps' ;
@@ -19,19 +21,19 @@ import {Operations} from '../../Operations';
1921import { PaginatedStorage } from '../../Storage/PaginatedStorage' ;
2022import { Tablets } from '../../Tablets/Tablets' ;
2123import { SchemaViewer } from '../Schema/SchemaViewer/SchemaViewer' ;
22- import { TenantTabsGroups , getTenantPath } from '../TenantPages' ;
2324import { isDatabaseEntityType } from '../utils/schema' ;
2425
2526import { Configs } from './Configs/Configs' ;
2627import { Consumers } from './Consumers' ;
2728import Describe from './Describe/Describe' ;
2829import DetailedOverview from './DetailedOverview/DetailedOverview' ;
29- import { getDataBasePages , getPagesByType } from './DiagnosticsPages' ;
30+ import { getPagesByType , useDiagnosticsPageLinkGetter } from './DiagnosticsPages' ;
3031import { HotKeys } from './HotKeys/HotKeys' ;
3132import { NetworkWrapper } from './Network/NetworkWrapper' ;
3233import { Partitions } from './Partitions/Partitions' ;
3334import { TopQueries } from './TopQueries' ;
3435import { TopShards } from './TopShards' ;
36+ import { TopicData } from './TopicData/TopicData' ;
3537
3638import './Diagnostics.scss' ;
3739
@@ -53,18 +55,17 @@ function Diagnostics(props: DiagnosticsProps) {
5355 ( state ) => state . tenant ,
5456 ) ;
5557
56- const [ queryParams ] = useQueryParams ( {
57- database : StringParam ,
58- schema : StringParam ,
59- backend : StringParam ,
60- clusterName : StringParam ,
61- } ) ;
58+ const getDiagnosticsPageLink = useDiagnosticsPageLinkGetter ( ) ;
6259
6360 const tenantName = isDatabaseEntityType ( props . type ) ? props . path : props . tenantName ;
64- const isDatabase = isDatabaseEntityType ( props . type ) || props . path === props . tenantName ;
6561
6662 const hasFeatureFlags = useFeatureFlagsAvailable ( ) ;
67- const pages = isDatabase ? getDataBasePages ( { hasFeatureFlags} ) : getPagesByType ( props . type ) ;
63+ const hasTopicData = useTopicDataAvailable ( ) ;
64+ const pages = getPagesByType ( props . type , {
65+ hasFeatureFlags,
66+ hasTopicData,
67+ isTopLevel : props . path === props . tenantName ,
68+ } ) ;
6869 let activeTab = pages . find ( ( el ) => el . id === diagnosticsTab ) ;
6970 if ( ! activeTab ) {
7071 activeTab = pages [ 0 ] ;
@@ -141,6 +142,9 @@ function Diagnostics(props: DiagnosticsProps) {
141142 case TENANT_DIAGNOSTICS_TABS_IDS . partitions : {
142143 return < Partitions path = { path } database = { tenantName } /> ;
143144 }
145+ case TENANT_DIAGNOSTICS_TABS_IDS . topicData : {
146+ return < TopicData path = { path } database = { tenantName } parentRef = { containerRef } /> ;
147+ }
144148 case TENANT_DIAGNOSTICS_TABS_IDS . configs : {
145149 return < Configs database = { tenantName } /> ;
146150 }
@@ -161,10 +165,7 @@ function Diagnostics(props: DiagnosticsProps) {
161165 items = { pages }
162166 activeTab = { activeTab ?. id }
163167 wrapTo = { ( { id} , node ) => {
164- const path = getTenantPath ( {
165- ...queryParams ,
166- [ TenantTabsGroups . diagnosticsTab ] : id ,
167- } ) ;
168+ const path = getDiagnosticsPageLink ( id ) ;
168169
169170 return (
170171 < Link to = { path } key = { id } className = { b ( 'tab' ) } >
0 commit comments