ydb-embedded-ui 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/assets/icons/question.svg +1 -0
  3. package/dist/components/ClusterInfo/ClusterInfo.tsx +8 -4
  4. package/dist/components/FullNodeViewer/FullNodeViewer.scss +4 -9
  5. package/dist/components/InfoViewer/InfoViewer.scss +3 -2
  6. package/dist/components/InternalLink/InternalLink.js +8 -0
  7. package/dist/components/Loader/Loader.scss +5 -0
  8. package/dist/components/Loader/Loader.tsx +16 -0
  9. package/dist/components/PDiskViewer/PDiskViewer.js +3 -4
  10. package/dist/containers/App/App.scss +4 -0
  11. package/dist/containers/App/Content.js +0 -2
  12. package/dist/containers/AppIcons/AppIcons.js +4 -0
  13. package/dist/containers/Authentication/Authentication.tsx +1 -1
  14. package/dist/containers/Cluster/Cluster.tsx +1 -1
  15. package/dist/containers/Header/Header.tsx +6 -1
  16. package/dist/containers/Heatmap/Heatmap.js +0 -1
  17. package/dist/containers/Node/Node.scss +12 -1
  18. package/dist/containers/Node/Node.tsx +187 -0
  19. package/dist/containers/Node/NodeOverview/NodeOverview.scss +0 -0
  20. package/dist/containers/Node/NodeOverview/NodeOverview.tsx +23 -0
  21. package/dist/containers/Node/NodePages.js +16 -0
  22. package/dist/containers/Node/NodeStructure/NodeStructure.scss +148 -0
  23. package/dist/containers/Node/NodeStructure/NodeStructure.tsx +153 -0
  24. package/dist/containers/Node/NodeStructure/Pdisk.tsx +299 -0
  25. package/dist/containers/Node/NodeStructure/Vdisk.tsx +153 -0
  26. package/dist/containers/Pdisk/Pdisk.js +2 -5
  27. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +10 -3
  28. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +20 -15
  29. package/dist/containers/Storage/Pdisk/Pdisk.scss +1 -0
  30. package/dist/containers/Storage/Pdisk/Pdisk.tsx +7 -5
  31. package/dist/containers/Storage/Storage.js +12 -9
  32. package/dist/containers/Storage/StorageGroups/StorageGroups.scss +2 -1
  33. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +5 -2
  34. package/dist/containers/Storage/StorageNodes/StorageNodes.scss +3 -2
  35. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +7 -2
  36. package/dist/containers/Storage/Vdisk/Vdisk.js +7 -6
  37. package/dist/containers/Storage/Vdisk/Vdisk.scss +1 -0
  38. package/dist/containers/Tablet/Tablet.js +2 -7
  39. package/dist/containers/Tablets/Tablets.js +4 -12
  40. package/dist/containers/Tenant/Acl/Acl.js +0 -3
  41. package/dist/containers/Tenant/Diagnostics/Compute/Compute.js +1 -3
  42. package/dist/containers/Tenant/Diagnostics/Network/Network.js +3 -6
  43. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +1 -0
  44. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +1 -1
  45. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +26 -33
  46. package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +4 -0
  47. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +29 -22
  48. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +1 -0
  49. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +2 -0
  50. package/dist/containers/Vdisk/Vdisk.js +2 -4
  51. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +4 -6
  52. package/dist/services/api.js +0 -1
  53. package/dist/store/reducers/executeQuery.js +5 -2
  54. package/dist/store/reducers/header.ts +1 -1
  55. package/dist/store/reducers/node.js +98 -3
  56. package/dist/store/reducers/nodes.js +0 -3
  57. package/dist/store/reducers/storage.js +6 -0
  58. package/dist/store/reducers/tablets.js +0 -3
  59. package/dist/utils/constants.js +0 -6
  60. package/dist/utils/getNodesColumns.js +2 -9
  61. package/dist/utils/utils.js +10 -1
  62. package/package.json +44 -33
  63. package/dist/containers/Node/Node.js +0 -184
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -9,38 +9,38 @@
9
9
  "url": "git@github.com:ydb-platform/ydb-embedded-ui.git"
10
10
  },
11
11
  "dependencies": {
12
- "@testing-library/jest-dom": "^5.15.0",
13
- "@testing-library/react": "^11.2.7",
14
- "@testing-library/user-event": "^12.8.3",
15
- "@types/qs": "^6.9.7",
16
- "@yandex-cloud/i18n": "^0.2.0",
17
- "@yandex-cloud/paranoid": "^1.0.0",
18
- "@yandex-cloud/react-data-table": "^0.2.1",
19
- "axios": "^0.19.2",
20
- "bem-cn-lite": "^4.0.0",
21
- "history": "^4.9.0",
22
- "js-cookie": "^2.2.1",
23
- "keymaster": "^1.6.2",
24
- "lodash": "^4.17.11",
25
- "monaco-editor": "^0.24.0",
26
- "numeral": "^2.0.6",
27
- "path-to-regexp": "^3.0.0",
28
- "react-json-inspector": "^7.1.1",
29
- "react-list": "^0.8.11",
30
- "react-monaco-editor": "^0.30.1",
31
- "react-redux": "^7.0.3",
32
- "react-router": "^5.0.1",
33
- "react-router-dom": "^5.0.1",
12
+ "@testing-library/jest-dom": "5.15.0",
13
+ "@testing-library/react": "11.2.7",
14
+ "@testing-library/user-event": "12.8.3",
15
+ "@types/qs": "6.9.7",
16
+ "@yandex-cloud/i18n": "0.2.0",
17
+ "@yandex-cloud/paranoid": "1.0.0",
18
+ "@yandex-cloud/react-data-table": "0.2.1",
19
+ "axios": "0.19.2",
20
+ "bem-cn-lite": "4.0.0",
21
+ "history": "4.10.1",
22
+ "js-cookie": "2.2.1",
23
+ "keymaster": "1.6.2",
24
+ "lodash": "4.17.11",
25
+ "monaco-editor": "0.24.0",
26
+ "numeral": "2.0.6",
27
+ "path-to-regexp": "3.0.0",
28
+ "react-json-inspector": "7.1.1",
29
+ "react-list": "0.8.11",
30
+ "react-monaco-editor": "0.30.1",
31
+ "react-redux": "7.2.6",
32
+ "react-router": "5.2.1",
33
+ "react-router-dom": "5.3.0",
34
34
  "react-scripts": "4.0.3",
35
- "react-split": "^2.0.14",
36
- "react-transition-group": "^4.4.2",
37
- "react-treeview": "^0.4.7",
38
- "redux": "^4.0.1",
39
- "redux-location-state": "^2.6.0",
40
- "redux-thunk": "^2.3.0",
41
- "reselect": "^4.0.0",
42
- "sass": "^1.32.8",
43
- "web-vitals": "^1.1.2"
35
+ "react-split": "2.0.14",
36
+ "react-transition-group": "4.4.2",
37
+ "react-treeview": "0.4.7",
38
+ "redux": "4.0.1",
39
+ "redux-location-state": "2.6.0",
40
+ "redux-thunk": "2.3.0",
41
+ "reselect": "4.0.0",
42
+ "sass": "1.32.8",
43
+ "web-vitals": "1.1.2"
44
44
  },
45
45
  "scripts": {
46
46
  "start": "react-app-rewired start",
@@ -51,7 +51,16 @@
51
51
  "package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",
52
52
  "test": "react-app-rewired test",
53
53
  "eject": "react-scripts eject",
54
- "prepublishOnly": "npm run package"
54
+ "prepublishOnly": "npm run package",
55
+ "prepare": "husky install"
56
+ },
57
+ "lint-staged": {
58
+ "*.{scss}": [
59
+ "stylelint --fix --quiet"
60
+ ],
61
+ "*.{js,jsx,ts,tsx}": [
62
+ "eslint --fix --quiet"
63
+ ]
55
64
  },
56
65
  "browserslist": {
57
66
  "production": [
@@ -82,6 +91,8 @@
82
91
  "@yandex-cloud/uikit": "^1.7.0",
83
92
  "copyfiles": "^2.4.1",
84
93
  "eslint-config-prettier": "^8.3.0",
94
+ "husky": "^7.0.4",
95
+ "lint-staged": "^12.3.7",
85
96
  "postcss": "^8.4.6",
86
97
  "prettier": "^2.5.1",
87
98
  "react": "^17.0.2",
@@ -1,184 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
- import {connect} from 'react-redux';
5
- import _ from 'lodash';
6
-
7
- import {Loader, Tabs} from '@yandex-cloud/uikit';
8
- import {withRouter, Link} from 'react-router-dom';
9
-
10
- import FullNodeViewer from '../../components/FullNodeViewer/FullNodeViewer';
11
- import {TABLETS, STORAGE, NODE_PAGES} from './NodePages';
12
- import Tablets from '../Tablets/Tablets';
13
- import Storage from '../Storage/Storage';
14
-
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';
19
-
20
- import './Node.scss';
21
-
22
- const b = cn('node');
23
-
24
- export const STORAGE_ROLE = 'Storage';
25
-
26
- class Node extends React.Component {
27
- static renderLoader() {
28
- return (
29
- <div className={'loader'}>
30
- <Loader size="l" />
31
- </div>
32
- );
33
- }
34
-
35
- static propTypes = {
36
- className: PropTypes.string,
37
- getNodeInfo: PropTypes.func,
38
- match: PropTypes.object,
39
- loading: PropTypes.bool,
40
- wasLoaded: PropTypes.bool,
41
- error: PropTypes.bool,
42
- node: PropTypes.object,
43
- activeTab: PropTypes.string,
44
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
45
- additionalNodesInfo: PropTypes.object,
46
- };
47
-
48
- static defaultProps = {
49
- className: '',
50
- };
51
-
52
- state = {
53
- activeTab: '',
54
- };
55
-
56
- componentDidMount() {
57
- const {id} = this.props.match.params;
58
- 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
- );
64
- }
65
-
66
- componentDidUpdate() {
67
- const {node} = this.props;
68
- let {activeTab} = this.props;
69
- if (node) {
70
- const hasStorage = _.find(node.Roles, (el) => el === STORAGE_ROLE);
71
- if (!hasStorage) {
72
- activeTab = TABLETS;
73
- }
74
- this.setState((prev) => {
75
- if (prev.activeTab !== activeTab) {
76
- return {activeTab};
77
- }
78
- });
79
- }
80
- }
81
-
82
- componentWillUnmount() {
83
- clearInterval(this.reloadDescriptor);
84
- }
85
-
86
- renderTabs() {
87
- const {node} = this.props;
88
- const {id} = this.props.match.params;
89
- const hasStorage = _.find(node?.Roles, (el) => el === STORAGE_ROLE);
90
-
91
- const filteredNodesPages = hasStorage
92
- ? NODE_PAGES
93
- : NODE_PAGES.filter((el) => el.id !== STORAGE);
94
- const pages = filteredNodesPages.map((page) => {
95
- return {
96
- ...page,
97
- path: createHref(routes.node, {id, activeTab: page.id}),
98
- };
99
- });
100
-
101
- return (
102
- <div className={b('tabs')}>
103
- <Tabs
104
- items={pages}
105
- activeTab={this.state.activeTab}
106
- wrapTo={({path, id}, node) => (
107
- <Link to={path} key={id} className={b('tab')}>
108
- {node}
109
- </Link>
110
- )}
111
- allowNotSelected={true}
112
- />
113
- </div>
114
- );
115
- }
116
- renderTabContent() {
117
- const {activeTab} = this.state;
118
- const {id} = this.props.match.params;
119
-
120
- switch (activeTab) {
121
- case STORAGE: {
122
- return (
123
- <div className={b('storage')}>
124
- <Storage nodeId={id} />
125
- </div>
126
- );
127
- }
128
- case TABLETS: {
129
- return <Tablets nodeId={id} />;
130
- }
131
- default:
132
- return false;
133
- }
134
- }
135
-
136
- render() {
137
- const {className, loading, wasLoaded, error, node, additionalNodesInfo} = this.props;
138
-
139
- if (loading && !wasLoaded) {
140
- return Node.renderLoader();
141
- } else if (error) {
142
- return <div>{error.statusText}</div>;
143
- } else {
144
- if (node) {
145
- return (
146
- <div className={`${b()} ${className}`}>
147
- <FullNodeViewer
148
- node={node}
149
- backend={backend}
150
- additionalNodesInfo={additionalNodesInfo}
151
- />
152
- {this.renderTabs()}
153
-
154
- <div className={b('content')}>{this.renderTabContent()}</div>
155
- </div>
156
- );
157
- }
158
- return <div className="error">no node data</div>;
159
- }
160
- }
161
- }
162
-
163
- const mapStateToProps = (state, ownProps) => {
164
- const {wasLoaded, loading} = state.node;
165
- const {activeTab} = ownProps.match.params;
166
- let {data: node} = state.node;
167
-
168
- if (node) {
169
- node = node.SystemStateInfo ? node.SystemStateInfo[0] : undefined;
170
- }
171
-
172
- return {
173
- node,
174
- activeTab,
175
- wasLoaded,
176
- loading,
177
- };
178
- };
179
-
180
- const mapDispatchToProps = {
181
- getNodeInfo,
182
- };
183
-
184
- export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Node));