Skip to content

Commit 5cf5dd3

Browse files
committed
feat: new Node Structure view
1 parent 20f1acc commit 5cf5dd3

File tree

31 files changed

+836
-93
lines changed

31 files changed

+836
-93
lines changed

src/assets/icons/question.svg

Lines changed: 1 addition & 0 deletions
Loading

src/components/FullNodeViewer/FullNodeViewer.scss

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
.full-node-viewer {
44
font-size: var(--yc-text-body2-font-size);
55
line-height: var(--yc-text-body2-line-height);
6-
@include container-fluid();
76

87
&__title {
98
margin: 0 20px 0 0;
109

1110
font-size: var(--yc-text-body2-font-size);
12-
font-weight: 500;
11+
font-weight: 600;
1312
line-height: var(--yc-text-body2-line-height);
1413
text-transform: uppercase;
1514
}
@@ -27,23 +26,19 @@
2726

2827
&__common-info {
2928
display: flex;
29+
flex-direction: column;
3030
justify-content: flex-start;
3131
align-items: stretch;
3232
}
3333

3434
&__section {
35-
margin-right: 20px;
36-
padding: 15px;
37-
3835
border-radius: 10px;
3936

4037
&_pools {
4138
display: grid;
4239
grid-gap: 7px 20px;
4340

4441
grid-template-columns: 110px 110px;
45-
46-
padding: 15px 15px 15px 0;
4742
}
4843
}
4944

@@ -72,10 +67,10 @@
7267
}
7368

7469
&__section-title {
75-
margin: 15px 0 0;
70+
margin: 15px 0 10px;
7671

7772
font-size: var(--yc-text-body2-font-size);
78-
font-weight: 500;
73+
font-weight: 600;
7974
line-height: var(--yc-text-body2-line-height);
8075
}
8176

src/components/InfoViewer/InfoViewer.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
font-size: var(--yc-text-body2-font-size);
33
line-height: var(--yc-text-body2-line-height);
44
&__title {
5-
margin: 0 0 16px;
5+
margin: 15px 0 10px;
66

77
font-size: var(--yc-text-body2-font-size);
8-
font-weight: 500;
8+
font-weight: 600;
99
line-height: var(--yc-text-body2-line-height);
1010
}
1111

src/containers/App/App.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,7 @@ body,
171171
.app_embedded {
172172
font-family: 'Rubik', sans-serif;
173173
}
174+
175+
.yc-popup {
176+
max-width: 500px;
177+
}

src/containers/AppIcons/AppIcons.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/containers/Heatmap/Heatmap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class Heatmap extends React.Component {
3535
hideTooltip: PropTypes.func,
3636
getTabletsInfo: PropTypes.func,
3737
nodeId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
38-
timeoutForRequest: PropTypes.number,
3938
path: PropTypes.string,
4039
clearWasLoadingFlag: PropTypes.func,
4140
metrics: PropTypes.array,

src/containers/Node/Node.js

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

10-
import FullNodeViewer from '../../components/FullNodeViewer/FullNodeViewer';
11-
import {TABLETS, STORAGE, NODE_PAGES, OVERVIEW} from './NodePages';
10+
import {TABLETS, STORAGE, NODE_PAGES, OVERVIEW, STRUCTURE} from './NodePages';
1211
import Tablets from '../Tablets/Tablets';
1312
import Storage from '../Storage/Storage';
13+
import NodeOverview from './NodeOverview/NodeOverview';
14+
import NodeStructure from './NodeStructure/NodeStructure';
1415

15-
import {getNodeInfo} from '../../store/reducers/node';
16-
import {NODE_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
17-
import routes, {createHref} from '../../routes';
18-
import {backend} from '../../store';
16+
import {getNodeInfo, resetNode} from '../../store/reducers/node';
17+
import routes, {CLUSTER_PAGES, createHref} from '../../routes';
18+
import {setHeader} from '../../store/reducers/header';
19+
import {AutoFetcher} from '../../utils/autofetcher';
1920

2021
import './Node.scss';
2122

2223
const b = cn('node');
2324

2425
export const STORAGE_ROLE = 'Storage';
2526

27+
const headerNodes = {
28+
text: CLUSTER_PAGES.nodes.title,
29+
link: createHref(routes.cluster, {activeTab: CLUSTER_PAGES.nodes.id}),
30+
};
31+
2632
class Node extends React.Component {
2733
static renderLoader() {
2834
return (
@@ -54,17 +60,26 @@ class Node extends React.Component {
5460
};
5561

5662
componentDidMount() {
57-
const {id} = this.props.match.params;
63+
const {setHeader} = this.props;
5864
this.setState({activeTab: this.props.activeTab});
59-
this.props.getNodeInfo(id);
60-
this.reloadDescriptor = setInterval(
61-
() => this.props.getNodeInfo(id),
62-
NODE_AUTO_RELOAD_INTERVAL,
63-
);
65+
this.fetchData();
66+
this.autofetcher = new AutoFetcher();
67+
this.autofetcher.fetch(() => this.fetchData());
68+
setHeader([headerNodes]);
6469
}
6570

66-
componentDidUpdate() {
67-
const {node} = this.props;
71+
componentDidUpdate(prevProps) {
72+
const prevId = prevProps.match.params.id;
73+
const {id} = this.props.match.params;
74+
const {resetNode} = this.props;
75+
if (prevId !== id) {
76+
resetNode();
77+
this.fetchData();
78+
this.autofetcher.stop();
79+
this.autofetcher.start();
80+
this.autofetcher.fetch(() => this.fetchData());
81+
}
82+
const {node, setHeader} = this.props;
6883
let {activeTab} = this.props;
6984
if (node) {
7085
const hasStorage = _.find(node.Roles, (el) => el === STORAGE_ROLE);
@@ -76,13 +91,25 @@ class Node extends React.Component {
7691
return {activeTab};
7792
}
7893
});
94+
setHeader([
95+
headerNodes,
96+
{
97+
text: node.Host,
98+
},
99+
]);
79100
}
80101
}
81102

82103
componentWillUnmount() {
83-
clearInterval(this.reloadDescriptor);
104+
this.autofetcher.stop();
84105
}
85106

107+
fetchData = () => {
108+
const {id} = this.props.match.params;
109+
const {getNodeInfo} = this.props;
110+
getNodeInfo(id);
111+
};
112+
86113
renderTabs() {
87114
const {node} = this.props;
88115
const {id} = this.props.match.params;
@@ -116,6 +143,7 @@ class Node extends React.Component {
116143
renderTabContent() {
117144
const {activeTab} = this.state;
118145
const {id} = this.props.match.params;
146+
const {additionalNodesInfo, node} = this.props;
119147

120148
switch (activeTab) {
121149
case STORAGE: {
@@ -126,15 +154,35 @@ class Node extends React.Component {
126154
);
127155
}
128156
case TABLETS: {
129-
return <Tablets nodeId={id} />;
157+
return <Tablets nodeId={id} className={b('node-page-wrapper')} />;
158+
}
159+
160+
case OVERVIEW: {
161+
return (
162+
<NodeOverview
163+
additionalNodesInfo={additionalNodesInfo}
164+
node={node}
165+
className={b('overview-wrapper')}
166+
/>
167+
);
168+
}
169+
170+
case STRUCTURE: {
171+
return (
172+
<NodeStructure
173+
className={b('node-page-wrapper')}
174+
nodeId={id}
175+
additionalNodesInfo={additionalNodesInfo}
176+
/>
177+
);
130178
}
131179
default:
132180
return false;
133181
}
134182
}
135183

136184
render() {
137-
const {className, loading, wasLoaded, error, node, additionalNodesInfo} = this.props;
185+
const {className, loading, wasLoaded, error, node} = this.props;
138186

139187
if (loading && !wasLoaded) {
140188
return Node.renderLoader();
@@ -144,11 +192,6 @@ class Node extends React.Component {
144192
if (node) {
145193
return (
146194
<div className={`${b()} ${className}`}>
147-
<FullNodeViewer
148-
node={node}
149-
backend={backend}
150-
additionalNodesInfo={additionalNodesInfo}
151-
/>
152195
{this.renderTabs()}
153196

154197
<div className={b('content')}>{this.renderTabContent()}</div>
@@ -179,6 +222,8 @@ const mapStateToProps = (state, ownProps) => {
179222

180223
const mapDispatchToProps = {
181224
getNodeInfo,
225+
setHeader,
226+
resetNode,
182227
};
183228

184229
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Node));

src/containers/Node/Node.scss

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@include flex-container();
66

77
&__content {
8+
position: relative;
9+
810
overflow: auto;
911
@include flex-container();
1012
}
@@ -17,7 +19,8 @@
1719
}
1820

1921
&__tabs {
20-
padding: 0 15px;
22+
padding: 16px 20px 0;
23+
@include body2-typography();
2124
}
2225

2326
&__tab {
@@ -33,4 +36,12 @@
3336
text-transform: uppercase;
3437
}
3538
}
39+
40+
&__overview-wrapper {
41+
padding: 0 20px;
42+
}
43+
44+
&__node-page-wrapper {
45+
padding: 20px;
46+
}
3647
}

src/containers/Node/NodeOverview/NodeOverview.scss

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
//@ts-ignore
3+
import FullNodeViewer from '../../../components/FullNodeViewer/FullNodeViewer';
4+
import {backend} from '../../../store';
5+
6+
interface NodeOverviewProps {
7+
node: any;
8+
additionalNodesInfo: any;
9+
className?: string;
10+
}
11+
12+
function NodeOverview({node, additionalNodesInfo, className}: NodeOverviewProps) {
13+
return (
14+
<FullNodeViewer
15+
node={node}
16+
backend={backend}
17+
additionalNodesInfo={additionalNodesInfo}
18+
className={className}
19+
/>
20+
);
21+
}
22+
23+
export default NodeOverview;

0 commit comments

Comments
 (0)