@@ -10,6 +10,10 @@ import {ResponseError} from '../../components/Errors/ResponseError';
10
10
import { FullNodeViewer } from '../../components/FullNodeViewer/FullNodeViewer' ;
11
11
import { Loader } from '../../components/Loader' ;
12
12
import routes , { createHref , parseQuery } from '../../routes' ;
13
+ import {
14
+ useCapabilitiesLoaded ,
15
+ useDiskPagesAvailable ,
16
+ } from '../../store/reducers/capabilities/hooks' ;
13
17
import { setHeaderBreadcrumbs } from '../../store/reducers/header/header' ;
14
18
import { nodeApi } from '../../store/reducers/node/node' ;
15
19
import type { AdditionalNodesProps } from '../../types/additionalProps' ;
@@ -18,7 +22,8 @@ import {useAutoRefreshInterval, useTypedDispatch} from '../../utils/hooks';
18
22
import { StorageWrapper } from '../Storage/StorageWrapper' ;
19
23
import { Tablets } from '../Tablets' ;
20
24
21
- import { NODE_PAGES , OVERVIEW , STORAGE , TABLETS } from './NodePages' ;
25
+ import { NODE_PAGES , OVERVIEW , STORAGE , STRUCTURE , TABLETS } from './NodePages' ;
26
+ import NodeStructure from './NodeStructure/NodeStructure' ;
22
27
23
28
import './Node.scss' ;
24
29
@@ -50,11 +55,16 @@ export function Node(props: NodeProps) {
50
55
) ;
51
56
const loading = isFetching && currentData === undefined ;
52
57
const node = currentData ;
58
+ const capabilitiesLoaded = useCapabilitiesLoaded ( ) ;
59
+ const isDiskPagesAvailable = useDiskPagesAvailable ( ) ;
53
60
54
61
const { activeTabVerified, nodeTabs} = React . useMemo ( ( ) => {
55
62
const hasStorage = node ?. Roles ?. find ( ( el ) => el === STORAGE_ROLE ) ;
56
63
57
- const nodePages = hasStorage ? NODE_PAGES : NODE_PAGES . filter ( ( el ) => el . id !== STORAGE ) ;
64
+ let nodePages = hasStorage ? NODE_PAGES : NODE_PAGES . filter ( ( el ) => el . id !== STORAGE ) ;
65
+ if ( isDiskPagesAvailable ) {
66
+ nodePages = nodePages . filter ( ( el ) => el . id !== STRUCTURE ) ;
67
+ }
58
68
59
69
const actualNodeTabs = nodePages . map ( ( page ) => {
60
70
return {
@@ -69,7 +79,7 @@ export function Node(props: NodeProps) {
69
79
}
70
80
71
81
return { activeTabVerified : actualActiveTab , nodeTabs : actualNodeTabs } ;
72
- } , [ activeTab , node ] ) ;
82
+ } , [ activeTab , node , isDiskPagesAvailable ] ) ;
73
83
74
84
const tenantName = node ?. Tenants ?. [ 0 ] || tenantNameFromQuery ?. toString ( ) ;
75
85
@@ -131,6 +141,9 @@ export function Node(props: NodeProps) {
131
141
) ;
132
142
}
133
143
144
+ case STRUCTURE : {
145
+ return < NodeStructure className = { b ( 'node-page-wrapper' ) } nodeId = { nodeId } /> ;
146
+ }
134
147
case OVERVIEW : {
135
148
return < FullNodeViewer node = { node } className = { b ( 'overview-wrapper' ) } /> ;
136
149
}
@@ -140,7 +153,7 @@ export function Node(props: NodeProps) {
140
153
}
141
154
} ;
142
155
143
- if ( loading ) {
156
+ if ( loading || ! capabilitiesLoaded ) {
144
157
return < Loader size = "l" /> ;
145
158
}
146
159
0 commit comments