Skip to content

Commit 63d3133

Browse files
committed
fix(Tenant): diagnostics view for table indexes
1 parent 86ac17f commit 63d3133

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

src/containers/Tenant/Diagnostics/Diagnostics.tsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ import Tablets from '../../Tablets/Tablets';
3030

3131
import routes, {createHref} from '../../../routes';
3232
import type {EPathType} from '../../../types/api/schema';
33-
import {isTableType} from '../utils/schema';
3433
import {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
3736
import {enableAutorefresh, disableAutorefresh} from '../../../store/reducers/schema';
3837
import {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));

src/containers/Tenant/Diagnostics/DiagnosticsPages.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import {EPathType} from "../../../types/api/schema";
2+
13
export enum GeneralPagesIds {
24
'overview' = 'Overview',
35
'topQueries' = 'topQueries',
@@ -73,3 +75,21 @@ export const DATABASE_PAGES = [
7375
export const TABLE_PAGES = [overview, topShards, graph, tablets, hotKeys, describe];
7476

7577
export const DIR_PAGES = [overview, topShards, describe];
78+
79+
export const INDEX_PAGES = [overview];
80+
81+
export const getPagesByType = (type?: EPathType) => {
82+
switch (type) {
83+
case EPathType.EPathTypeColumnStore:
84+
case EPathType.EPathTypeSubDomain:
85+
return DATABASE_PAGES;
86+
case EPathType.EPathTypeColumnTable:
87+
case EPathType.EPathTypeTable:
88+
return TABLE_PAGES;
89+
case EPathType.EPathTypeTableIndex:
90+
return INDEX_PAGES;
91+
case EPathType.EPathTypeDir:
92+
default:
93+
return DIR_PAGES;
94+
}
95+
}

0 commit comments

Comments
 (0)