@@ -7,37 +7,36 @@ import {useLocation} from 'react-router';
77
88import { Switch , Tabs } from '@gravity-ui/uikit' ;
99
10+ import type { EPathType } from '../../../types/api/schema' ;
11+
12+ import { useTypedSelector } from '../../../utils/hooks' ;
13+ import routes , { createHref } from '../../../routes' ;
14+ import type { TenantDiagnosticsTab , TenantGeneralTab } from '../../../store/reducers/tenant/types' ;
15+ import { enableAutorefresh , disableAutorefresh } from '../../../store/reducers/schema' ;
16+ import { setTopLevelTab , setDiagnosticsTab } from '../../../store/reducers/tenant/tenant' ;
17+ import { TENANT_DIAGNOSTICS_TABS_IDS } from '../../../store/reducers/tenant/constants' ;
18+
1019import { Loader } from '../../../components/Loader' ;
1120
12- import { TopQueries } from './TopQueries' ;
13- //@ts -ignore
14- import DetailedOverview from './DetailedOverview/DetailedOverview' ;
15- import { TopShards } from './TopShards' ;
16- //@ts -ignore
17- import Storage from '../../Storage/Storage' ;
18- //@ts -ignore
19- import Network from './Network/Network' ;
20- //@ts -ignore
21- import Describe from './Describe/Describe' ;
22- //@ts -ignore
23- import HotKeys from './HotKeys/HotKeys' ;
24- //@ts -ignore
2521import { Heatmap } from '../../Heatmap' ;
2622import { Nodes } from '../../Nodes' ;
27- // @ts -ignore
23+ import Storage from '../../Storage/Storage' ;
2824import { Tablets } from '../../Tablets' ;
29- import { Consumers } from './Consumers' ;
25+
26+ import Describe from './Describe/Describe' ;
27+ import HotKeys from './HotKeys/HotKeys' ;
28+ import Network from './Network/Network' ;
3029import { Partitions } from './Partitions/Partitions' ;
30+ import { Consumers } from './Consumers' ;
31+ import { TopQueries } from './TopQueries' ;
32+ import { TopShards } from './TopShards' ;
33+ import DetailedOverview from './DetailedOverview/DetailedOverview' ;
3134
32- import routes , { createHref } from '../../../routes' ;
33- import type { EPathType } from '../../../types/api/schema' ;
34- import { TenantGeneralTabsIds , TenantTabsGroups } from '../TenantPages' ;
35- import { GeneralPagesIds , DATABASE_PAGES , getPagesByType } from './DiagnosticsPages' ;
36- //@ts -ignore
37- import { enableAutorefresh , disableAutorefresh } from '../../../store/reducers/schema' ;
38- import { setTopLevelTab , setDiagnosticsTab } from '../../../store/reducers/tenant' ;
3935import { isDatabaseEntityType } from '../utils/schema' ;
4036
37+ import { TenantTabsGroups } from '../TenantPages' ;
38+ import { DATABASE_PAGES , getPagesByType } from './DiagnosticsPages' ;
39+
4140import './Diagnostics.scss' ;
4241
4342interface DiagnosticsProps {
@@ -51,8 +50,8 @@ const b = cn('kv-tenant-diagnostics');
5150function Diagnostics ( props : DiagnosticsProps ) {
5251 const dispatch = useDispatch ( ) ;
5352 const { currentSchemaPath, autorefresh} = useSelector ( ( state : any ) => state . schema ) ;
54- const { diagnosticsTab = GeneralPagesIds . overview , wasLoaded} = useSelector (
55- ( state : any ) => state . tenant ,
53+ const { diagnosticsTab = TENANT_DIAGNOSTICS_TABS_IDS . overview , wasLoaded} = useTypedSelector (
54+ ( state ) => state . tenant ,
5655 ) ;
5756
5857 const location = useLocation ( ) ;
@@ -73,7 +72,7 @@ function Diagnostics(props: DiagnosticsProps) {
7372 return getPagesByType ( props . type ) ;
7473 } , [ props . type , isDatabase ] ) ;
7574
76- const forwardToDiagnosticTab = ( tab : GeneralPagesIds ) => {
75+ const forwardToDiagnosticTab = ( tab : TenantDiagnosticsTab ) => {
7776 dispatch ( setDiagnosticsTab ( tab ) ) ;
7877 } ;
7978 const activeTab = useMemo ( ( ) => {
@@ -97,7 +96,7 @@ function Diagnostics(props: DiagnosticsProps) {
9796 }
9897 } ;
9998
100- const forwardToGeneralTab = ( tab : TenantGeneralTabsIds ) => {
99+ const forwardToGeneralTab = ( tab : TenantGeneralTab ) => {
101100 dispatch ( setTopLevelTab ( tab ) ) ;
102101 } ;
103102
@@ -107,7 +106,7 @@ function Diagnostics(props: DiagnosticsProps) {
107106 const tenantNameString = tenantName as string ;
108107
109108 switch ( diagnosticsTab ) {
110- case GeneralPagesIds . overview : {
109+ case TENANT_DIAGNOSTICS_TABS_IDS . overview : {
111110 return (
112111 < DetailedOverview
113112 type = { type }
@@ -116,7 +115,7 @@ function Diagnostics(props: DiagnosticsProps) {
116115 />
117116 ) ;
118117 }
119- case GeneralPagesIds . topQueries : {
118+ case TENANT_DIAGNOSTICS_TABS_IDS . topQueries : {
120119 return (
121120 < TopQueries
122121 path = { tenantNameString }
@@ -125,10 +124,10 @@ function Diagnostics(props: DiagnosticsProps) {
125124 />
126125 ) ;
127126 }
128- case GeneralPagesIds . topShards : {
127+ case TENANT_DIAGNOSTICS_TABS_IDS . topShards : {
129128 return < TopShards tenantPath = { tenantNameString } type = { type } /> ;
130129 }
131- case GeneralPagesIds . nodes : {
130+ case TENANT_DIAGNOSTICS_TABS_IDS . nodes : {
132131 return (
133132 < Nodes
134133 path = { currentSchemaPath }
@@ -137,28 +136,28 @@ function Diagnostics(props: DiagnosticsProps) {
137136 />
138137 ) ;
139138 }
140- case GeneralPagesIds . tablets : {
139+ case TENANT_DIAGNOSTICS_TABS_IDS . tablets : {
141140 return < Tablets path = { currentSchemaPath } /> ;
142141 }
143- case GeneralPagesIds . storage : {
142+ case TENANT_DIAGNOSTICS_TABS_IDS . storage : {
144143 return < Storage tenant = { tenantNameString } database = { true } /> ;
145144 }
146- case GeneralPagesIds . network : {
145+ case TENANT_DIAGNOSTICS_TABS_IDS . network : {
147146 return < Network path = { tenantNameString } /> ;
148147 }
149- case GeneralPagesIds . describe : {
148+ case TENANT_DIAGNOSTICS_TABS_IDS . describe : {
150149 return < Describe tenant = { tenantNameString } type = { type } /> ;
151150 }
152- case GeneralPagesIds . hotKeys : {
151+ case TENANT_DIAGNOSTICS_TABS_IDS . hotKeys : {
153152 return < HotKeys type = { type } /> ;
154153 }
155- case GeneralPagesIds . graph : {
154+ case TENANT_DIAGNOSTICS_TABS_IDS . graph : {
156155 return < Heatmap path = { currentSchemaPath } /> ;
157156 }
158- case GeneralPagesIds . consumers : {
157+ case TENANT_DIAGNOSTICS_TABS_IDS . consumers : {
159158 return < Consumers path = { currentSchemaPath } type = { type } /> ;
160159 }
161- case GeneralPagesIds . partitions : {
160+ case TENANT_DIAGNOSTICS_TABS_IDS . partitions : {
162161 return < Partitions path = { currentSchemaPath } /> ;
163162 }
164163 default : {
0 commit comments