Skip to content

Commit ac4add6

Browse files
committed
fix(Nodes): default path to node should be Overview
1 parent 431f77f commit ac4add6

File tree

9 files changed

+32
-40
lines changed

9 files changed

+32
-40
lines changed

src/components/PDiskViewer/PDiskViewer.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import EntityStatus from '../EntityStatus/EntityStatus';
88
import {formatStorageValues} from '../../utils';
99
import routes, {createHref} from '../../routes';
1010

11+
import {getDefaultNodePath} from '../../containers/Node/NodePages';
12+
1113
import './PDiskViewer.scss';
1214

1315
const b = cn('pdisk-viewer');
@@ -48,10 +50,7 @@ class PDiskViewer extends React.Component {
4850
<EntityStatus
4951
status={'green'}
5052
label="NodeID"
51-
path={createHref(routes.node, {
52-
id: disk.NodeId,
53-
activeTab: 'storage',
54-
})}
53+
path={getDefaultNodePath(disk.NodeId)}
5554
name={disk.NodeId}
5655
/>
5756
</div>

src/containers/Node/Node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Loader, Tabs} from '@yandex-cloud/uikit';
88
import {withRouter, Link} from 'react-router-dom';
99

1010
import FullNodeViewer from '../../components/FullNodeViewer/FullNodeViewer';
11-
import {TABLETS, STORAGE, NODE_PAGES} from './NodePages';
11+
import {TABLETS, STORAGE, NODE_PAGES, OVERVIEW} from './NodePages';
1212
import Tablets from '../Tablets/Tablets';
1313
import Storage from '../Storage/Storage';
1414

@@ -69,7 +69,7 @@ class Node extends React.Component {
6969
if (node) {
7070
const hasStorage = _.find(node.Roles, (el) => el === STORAGE_ROLE);
7171
if (!hasStorage) {
72-
activeTab = TABLETS;
72+
activeTab = OVERVIEW;
7373
}
7474
this.setState((prev) => {
7575
if (prev.activeTab !== activeTab) {

src/containers/Node/NodePages.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
import routes, {createHref} from '../../routes';
2+
13
export const STORAGE = 'storage';
24
export const TABLETS = 'tablets';
5+
export const OVERVIEW = 'overview';
36

47
export const NODE_PAGES = [
8+
{
9+
id: OVERVIEW,
10+
name: 'Overview',
11+
},
512
{
613
id: STORAGE,
714
name: 'Storage',
@@ -11,3 +18,10 @@ export const NODE_PAGES = [
1118
name: 'Tablets',
1219
},
1320
];
21+
22+
export function getDefaultNodePath(nodeId) {
23+
return createHref(routes.node, {
24+
id: nodeId,
25+
activeTab: OVERVIEW,
26+
});
27+
}

src/containers/Pdisk/Pdisk.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import ProgressViewer from '../../components/ProgressViewer/ProgressViewer';
1414
import {getPdiskInfo, clearStore} from '../../store/reducers/pdisk';
1515
import {PDISK_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
1616
import {formatStorageValues, calcUptime} from '../../utils';
17-
import routes, {createHref} from '../../routes';
17+
import {getDefaultNodePath} from '../Node/NodePages';
1818

1919
import './Pdisk.scss';
2020

@@ -97,10 +97,7 @@ class Pdisk extends React.Component {
9797
{
9898
label: 'NodeId',
9999
value: (
100-
<Link
101-
className={b('link')}
102-
to={createHref(routes.node, {id: NodeId, activeTab: 'storage'})}
103-
>
100+
<Link className={b('link')} to={getDefaultNodePath(NodeId)}>
104101
{NodeId}
105102
</Link>
106103
),

src/containers/Tablet/Tablet.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {Link as ExternalLink, Button, Loader} from '@yandex-cloud/uikit';
1919
import DataTable from '@yandex-cloud/react-data-table';
2020
import CriticalActionDialog from '../../components/CriticalActionDialog/CriticalActionDialog';
2121
import routes, {createHref} from '../../routes';
22+
import { getDefaultNodePath } from '../Node/NodePages';
2223

2324
import './Tablet.scss';
2425

@@ -316,13 +317,7 @@ class Tablet extends React.Component {
316317
{
317318
label: 'Node',
318319
value: (
319-
<Link
320-
className={b('link')}
321-
to={createHref(routes.node, {
322-
id: String(tablet.NodeId),
323-
activeTab: 'storage',
324-
})}
325-
>
320+
<Link className={b('link')} to={getDefaultNodePath(String(tablet.NodeId))}>
326321
{tablet.NodeId}
327322
</Link>
328323
),

src/containers/Tenant/Diagnostics/Network/Network.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import ProblemFilter, {problemFilterType} from '../../../../components/ProblemFi
1414
import {getNetworkInfo} from '../../../../store/reducers/network';
1515
import {hideTooltip, showTooltip} from '../../../../store/reducers/tooltip';
1616
import {ALL, PROBLEMS} from '../../../../utils/constants';
17-
import routes, {createHref} from '../../../../routes';
1817
import {changeFilter} from '../../../../store/reducers/settings';
18+
import {AutoFetcher} from '../../../../utils/autofetcher';
19+
import {getDefaultNodePath} from '../../../Node/NodePages';
1920

2021
import './Network.scss';
21-
import {AutoFetcher} from '../../../../utils/autofetcher';
2222

2323
const b = cn('network');
2424

@@ -301,10 +301,7 @@ class Network extends React.Component {
301301
Connectivity of node{' '}
302302
<Link
303303
className={b('link')}
304-
to={createHref(routes.node, {
305-
id: clickedNode.NodeId,
306-
activeTab: 'storage',
307-
})}
304+
to={getDefaultNodePath(clickedNode.NodeId)}
308305
>
309306
{clickedNode.NodeId}
310307
</Link>{' '}

src/containers/Vdisk/Vdisk.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {getVdiskInfo, clearStore} from '../../store/reducers/vdisk';
1313
import {VDISK_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
1414
import {formatBytes, calcUptime, stringifyVdiskId} from '../../utils';
1515
import routes, {createHref} from '../../routes';
16+
import {getDefaultNodePath} from '../Node/NodePages';
1617

1718
import './Vdisk.scss';
1819

@@ -80,10 +81,7 @@ class Vdisk extends React.Component {
8081
{
8182
label: 'NodeId',
8283
value: (
83-
<Link
84-
className={b('link')}
85-
to={createHref(routes.node, {id: NodeId, activeTab: 'storage'})}
86-
>
84+
<Link className={b('link')} to={getDefaultNodePath(NodeId)}>
8785
{NodeId}
8886
</Link>
8987
),

src/containers/VdiskPdiskNode/VdiskPdiskNode.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {getNodeInfo} from '../../store/reducers/node';
2020
import {calcUptime, stringifyVdiskId, formatStorageValuesToGb} from '../../utils';
2121
import routes, {createHref} from '../../routes';
2222
import {bytesToSpeed, bytesToGB} from '../../utils/utils';
23+
import {getDefaultNodePath} from '../Node/NodePages';
2324

2425
import './VdiskPdiskNode.scss';
2526

@@ -329,10 +330,7 @@ class VdiskPdiskNode extends React.Component {
329330
{
330331
label: 'Node Id',
331332
value: (
332-
<Link
333-
className={b('link')}
334-
to={createHref(routes.node, {id: NodeId, activeTab: 'storage'})}
335-
>
333+
<Link className={b('link')} to={getDefaultNodePath(NodeId)}>
336334
{NodeId}
337335
</Link>
338336
),

src/utils/getNodesColumns.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ import {Button, Tooltip} from '@yandex-cloud/uikit';
66

77
import Icon from '../components/Icon/Icon';
88
import EntityStatus from '../components/EntityStatus/EntityStatus';
9-
import {STORAGE_ROLE} from '../containers/Node/Node';
109
import PoolsGraph from '../components/PoolsGraph/PoolsGraph';
1110
import ProgressViewer from '../components/ProgressViewer/ProgressViewer';
1211
import TabletsStatistic from '../components/TabletsStatistic/TabletsStatistic';
1312

14-
import routes, {createHref} from '../routes';
15-
import {STORAGE, TABLETS} from '../containers/Node/NodePages';
13+
import {getDefaultNodePath} from '../containers/Node/NodePages';
1614
import {formatBytes} from './index';
1715

1816
const b = cn('kv-nodes');
@@ -28,7 +26,6 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
2826
{
2927
name: 'Host',
3028
render: ({row, value}) => {
31-
const hasStorage = _.find(row?.Roles, (el) => el === STORAGE_ROLE);
3229
const nodeRef = getNodeRef ? getNodeRef(row) : undefined;
3330

3431
if (typeof value === 'undefined') {
@@ -39,10 +36,7 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
3936
<EntityStatus
4037
name={row.Host}
4138
status={row.Overall}
42-
path={createHref(routes.node, {
43-
id: row.NodeId,
44-
activeTab: hasStorage ? STORAGE : TABLETS,
45-
})}
39+
path={getDefaultNodePath(row.NodeId)}
4640
hasClipboardButton
4741
className={b('host-name')}
4842
/>

0 commit comments

Comments
 (0)