@@ -30,9 +30,8 @@ import Tablets from '../../Tablets/Tablets';
3030
3131import routes , { createHref } from '../../../routes' ;
3232import type { EPathType } from '../../../types/api/schema' ;
33- import { isTableType } from '../utils/schema' ;
3433import { TenantGeneralTabsIds , TenantTabsGroups } from '../TenantPages' ;
35- import { GeneralPagesIds , DATABASE_PAGES , TABLE_PAGES , DIR_PAGES } from './DiagnosticsPages' ;
34+ import { GeneralPagesIds , DATABASE_PAGES , getPagesByType } from './DiagnosticsPages' ;
3635//@ts -ignore
3736import { enableAutorefresh , disableAutorefresh } from '../../../store/reducers/schema' ;
3837import { setTopLevelTab , setDiagnosticsTab } from '../../../store/reducers/tenant' ;
@@ -66,20 +65,15 @@ function Diagnostics(props: DiagnosticsProps) {
6665
6766 const { name : tenantName } = queryParams ;
6867
69- const isDatabase = currentSchemaPath === tenantName ;
68+ const isRoot = currentSchemaPath === tenantName ;
7069
7170 const pages = useMemo ( ( ) => {
72- const isTable = isTableType ( props . type ) ;
73-
74- let pages = DIR_PAGES ;
75-
76- if ( isDatabase ) {
77- pages = DATABASE_PAGES ;
78- } else if ( isTable ) {
79- pages = TABLE_PAGES ;
71+ if ( isRoot ) {
72+ return DATABASE_PAGES ;
8073 }
81- return pages ;
82- } , [ props . type , isDatabase ] ) ;
74+
75+ return getPagesByType ( props . type ) ;
76+ } , [ props . type , isRoot ] ) ;
8377
8478 const forwardToDiagnosticTab = ( tab : GeneralPagesIds ) => {
8579 dispatch ( setDiagnosticsTab ( tab ) ) ;
0 commit comments