Skip to content

Commit 2b6470d

Browse files
committed
fix(Node): show structure tab if new disk pages is not available
1 parent b53487e commit 2b6470d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/containers/Node/Node.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {ResponseError} from '../../components/Errors/ResponseError';
1010
import {FullNodeViewer} from '../../components/FullNodeViewer/FullNodeViewer';
1111
import {Loader} from '../../components/Loader';
1212
import routes, {createHref, parseQuery} from '../../routes';
13+
import {useDiskPagesAvailable} from '../../store/reducers/capabilities/hooks';
1314
import {setHeaderBreadcrumbs} from '../../store/reducers/header/header';
1415
import {nodeApi} from '../../store/reducers/node/node';
1516
import type {AdditionalNodesProps} from '../../types/additionalProps';
@@ -18,7 +19,8 @@ import {useAutoRefreshInterval, useTypedDispatch} from '../../utils/hooks';
1819
import {StorageWrapper} from '../Storage/StorageWrapper';
1920
import {Tablets} from '../Tablets';
2021

21-
import {NODE_PAGES, OVERVIEW, STORAGE, TABLETS} from './NodePages';
22+
import {NODE_PAGES, OVERVIEW, STORAGE, STRUCTURE, TABLETS} from './NodePages';
23+
import NodeStructure from './NodeStructure/NodeStructure';
2224

2325
import './Node.scss';
2426

@@ -50,11 +52,15 @@ export function Node(props: NodeProps) {
5052
);
5153
const loading = isFetching && currentData === undefined;
5254
const node = currentData;
55+
const isDiskPagesAvailable = useDiskPagesAvailable();
5356

5457
const {activeTabVerified, nodeTabs} = React.useMemo(() => {
5558
const hasStorage = node?.Roles?.find((el) => el === STORAGE_ROLE);
5659

57-
const nodePages = hasStorage ? NODE_PAGES : NODE_PAGES.filter((el) => el.id !== STORAGE);
60+
let nodePages = hasStorage ? NODE_PAGES : NODE_PAGES.filter((el) => el.id !== STORAGE);
61+
if (isDiskPagesAvailable) {
62+
nodePages = nodePages.filter((el) => el.id !== STRUCTURE);
63+
}
5864

5965
const actualNodeTabs = nodePages.map((page) => {
6066
return {
@@ -69,7 +75,7 @@ export function Node(props: NodeProps) {
6975
}
7076

7177
return {activeTabVerified: actualActiveTab, nodeTabs: actualNodeTabs};
72-
}, [activeTab, node]);
78+
}, [activeTab, node, isDiskPagesAvailable]);
7379

7480
const tenantName = node?.Tenants?.[0] || tenantNameFromQuery?.toString();
7581

@@ -131,6 +137,9 @@ export function Node(props: NodeProps) {
131137
);
132138
}
133139

140+
case STRUCTURE: {
141+
return <NodeStructure className={b('node-page-wrapper')} nodeId={nodeId} />;
142+
}
134143
case OVERVIEW: {
135144
return <FullNodeViewer node={node} className={b('overview-wrapper')} />;
136145
}

src/containers/Node/NodePages.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ export const NODE_PAGES = [
1717
id: STORAGE,
1818
name: 'Storage',
1919
},
20-
// TODO: remove Node Structure component
21-
// {
22-
// id: STRUCTURE,
23-
// name: 'Structure',
24-
// },
20+
{
21+
id: STRUCTURE,
22+
name: 'Structure',
23+
},
2524
{
2625
id: TABLETS,
2726
name: 'Tablets',

0 commit comments

Comments
 (0)