ydb-embedded-ui 4.3.0 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/containers/App/Content.js +2 -8
  3. package/dist/containers/AsideNavigation/AsideNavigation.tsx +1 -1
  4. package/dist/containers/Cluster/Cluster.scss +4 -0
  5. package/dist/containers/Cluster/Cluster.tsx +14 -8
  6. package/dist/{components → containers}/ClusterInfo/ClusterInfo.scss +39 -0
  7. package/dist/containers/ClusterInfo/ClusterInfo.tsx +207 -0
  8. package/dist/containers/ClusterInfo/utils.ts +13 -0
  9. package/dist/containers/Header/Header.tsx +9 -16
  10. package/dist/containers/Nodes/Nodes.tsx +4 -6
  11. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +2 -3
  12. package/dist/containers/Tenant/Diagnostics/Partitions/Headers/Headers.tsx +4 -4
  13. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.scss +4 -0
  14. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.tsx +2 -2
  15. package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.tsx +20 -26
  16. package/dist/containers/Tenant/Diagnostics/Partitions/i18n/en.json +1 -1
  17. package/dist/containers/Tenant/Diagnostics/Partitions/i18n/ru.json +1 -1
  18. package/dist/containers/UserSettings/Setting.tsx +82 -0
  19. package/dist/containers/UserSettings/UserSettings.tsx +61 -99
  20. package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.scss +59 -0
  21. package/dist/containers/Versions/GroupedNodesTree/GroupedNodesTree.tsx +98 -0
  22. package/dist/containers/Versions/NodesTable/NodesTable.tsx +150 -0
  23. package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +55 -0
  24. package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.tsx +62 -0
  25. package/dist/containers/Versions/Versions.scss +32 -0
  26. package/dist/containers/Versions/Versions.tsx +121 -0
  27. package/dist/containers/Versions/groupNodes.ts +124 -0
  28. package/dist/containers/Versions/types.ts +16 -0
  29. package/dist/routes.ts +0 -6
  30. package/dist/services/api.ts +3 -0
  31. package/dist/store/reducers/cluster/cluster.ts +4 -0
  32. package/dist/store/reducers/cluster/types.ts +3 -2
  33. package/dist/store/reducers/clusterNodes/clusterNodes.tsx +64 -0
  34. package/dist/store/reducers/clusterNodes/types.ts +22 -0
  35. package/dist/store/reducers/index.ts +2 -8
  36. package/dist/store/reducers/partitions/partitions.ts +2 -2
  37. package/dist/store/reducers/partitions/types.ts +1 -1
  38. package/dist/types/additionalProps.ts +5 -0
  39. package/dist/types/versions.ts +9 -0
  40. package/dist/utils/constants.ts +0 -11
  41. package/dist/utils/hooks/useSetting.ts +5 -3
  42. package/dist/utils/versions/getVersionsColors.ts +98 -0
  43. package/dist/utils/versions/index.ts +3 -0
  44. package/dist/utils/versions/parseNodesToVersionsValues.ts +28 -0
  45. package/dist/utils/versions/parseVersion.ts +23 -0
  46. package/package.json +1 -1
  47. package/dist/components/ClusterInfo/ClusterInfo.tsx +0 -239
  48. package/dist/components/FullGroupViewer/FullGroupViewer.js +0 -147
  49. package/dist/components/FullGroupViewer/FullGroupViewer.scss +0 -35
  50. package/dist/components/GroupTreeViewer/GroupTreeViewer.js +0 -87
  51. package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +0 -16
  52. package/dist/components/GroupViewer/GroupViewer.js +0 -100
  53. package/dist/components/GroupViewer/GroupViewer.scss +0 -45
  54. package/dist/components/PDiskViewer/PDiskViewer.js +0 -79
  55. package/dist/components/PDiskViewer/PDiskViewer.scss +0 -46
  56. package/dist/components/TabletsViewer/TabletsViewer.js +0 -44
  57. package/dist/components/TabletsViewer/TabletsViewer.scss +0 -40
  58. package/dist/components/VerticalBars/VerticalBars.scss +0 -15
  59. package/dist/components/VerticalBars/VerticalBars.tsx +0 -38
  60. package/dist/components/VerticalBars/index.ts +0 -1
  61. package/dist/containers/Group/Group.js +0 -97
  62. package/dist/containers/Group/Group.scss +0 -6
  63. package/dist/containers/Header/Host/Host.js +0 -66
  64. package/dist/containers/Header/Host/Host.scss +0 -50
  65. package/dist/containers/Pdisk/Pdisk.js +0 -156
  66. package/dist/containers/Pdisk/Pdisk.scss +0 -42
  67. package/dist/containers/Pool/Pool.js +0 -170
  68. package/dist/containers/Pool/Pool.scss +0 -35
  69. package/dist/containers/Vdisk/Vdisk.js +0 -158
  70. package/dist/containers/Vdisk/Vdisk.scss +0 -42
  71. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +0 -526
  72. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +0 -60
  73. package/dist/store/reducers/group.js +0 -49
  74. package/dist/store/reducers/pdisk.js +0 -51
  75. package/dist/store/reducers/pool.js +0 -42
  76. package/dist/store/reducers/vdisk.js +0 -49
@@ -1,156 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
- import qs from 'qs';
5
- import {connect} from 'react-redux';
6
-
7
- import {Link} from 'react-router-dom';
8
- import {Loader} from '@gravity-ui/uikit';
9
-
10
- import InfoViewer from '../../components/InfoViewer/InfoViewer';
11
- import EntityStatus from '../../components/EntityStatus/EntityStatus';
12
- import ProgressViewer from '../../components/ProgressViewer/ProgressViewer';
13
-
14
- import {getPdiskInfo, clearStore} from '../../store/reducers/pdisk';
15
- import {PDISK_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
16
- import {formatStorageValues, calcUptime} from '../../utils';
17
- import {getDefaultNodePath} from '../Node/NodePages';
18
-
19
- import './Pdisk.scss';
20
-
21
- const b = cn('pdisk');
22
-
23
- class Pdisk extends React.Component {
24
- static renderLoader() {
25
- return (
26
- <div className={'loader'}>
27
- <Loader size="l" />
28
- </div>
29
- );
30
- }
31
-
32
- static propTypes = {
33
- className: PropTypes.string,
34
- loading: PropTypes.bool,
35
- wasLoaded: PropTypes.bool,
36
- error: PropTypes.bool,
37
- getPdiskInfo: PropTypes.func,
38
- clearStore: PropTypes.func,
39
- pdisk: PropTypes.object,
40
- location: PropTypes.object,
41
- };
42
-
43
- static defaultProps = {
44
- className: '',
45
- };
46
-
47
- componentDidMount() {
48
- const queryParams = qs.parse(this.props.location.search, {
49
- ignoreQueryPrefix: true,
50
- });
51
- const nodeId = queryParams.node_id;
52
- this.props.getPdiskInfo(nodeId);
53
- this.reloadDescriptor = setInterval(
54
- () => this.props.getPdiskInfo(nodeId),
55
- PDISK_AUTO_RELOAD_INTERVAL,
56
- );
57
- }
58
-
59
- componentWillUnmount() {
60
- this.props.clearStore();
61
- clearInterval(this.reloadDescriptor);
62
- }
63
-
64
- renderContent = () => {
65
- const {
66
- TotalSize,
67
- AvailableSize,
68
- ChangeTime,
69
- Device,
70
- Guid,
71
- NodeId,
72
- PDiskId,
73
- Path,
74
- Realtime,
75
- State,
76
- } = this.props.pdisk;
77
-
78
- const pdiskInfo = [
79
- {label: 'Device', value: <EntityStatus status={Device} />},
80
- {label: 'Realtime', value: <EntityStatus status={Realtime} />},
81
- {label: 'State', value: State},
82
- {
83
- label: 'Size',
84
- value: (
85
- <ProgressViewer
86
- value={TotalSize - AvailableSize || 0}
87
- capacity={TotalSize || 0}
88
- formatValues={formatStorageValues}
89
- colorizeProgress={true}
90
- className={b('size')}
91
- />
92
- ),
93
- },
94
- {label: 'ChangeTime', value: calcUptime(ChangeTime)},
95
- {label: 'Path', value: Path},
96
- {label: 'Guid', value: Guid},
97
- {
98
- label: 'NodeId',
99
- value: (
100
- <Link className={b('link')} to={getDefaultNodePath(NodeId)}>
101
- {NodeId}
102
- </Link>
103
- ),
104
- },
105
- ];
106
-
107
- return (
108
- <div className={b()}>
109
- <div className={b('row')}>
110
- <span className={b('title')}>PDisk </span>
111
- <EntityStatus status={Device} name={PDiskId} />
112
- </div>
113
-
114
- <div className={b('column')}>
115
- <InfoViewer className={b('section')} info={pdiskInfo} />
116
- </div>
117
- </div>
118
- );
119
- };
120
-
121
- render() {
122
- const {loading, wasLoaded, error} = this.props;
123
-
124
- if (loading && !wasLoaded) {
125
- return Pdisk.renderLoader();
126
- } else if (error) {
127
- return <div>{error.statusText}</div>;
128
- } else {
129
- return this.renderContent();
130
- }
131
- }
132
- }
133
-
134
- const mapStateToProps = (state, ownProps) => {
135
- const {data, wasLoaded, loading, error} = state.pdisk;
136
-
137
- const {id} = ownProps.match.params;
138
- let pdisk;
139
- if (data) {
140
- pdisk = data.PDiskStateInfo.filter((disk) => disk.PDiskId === Number(id))[0];
141
- }
142
-
143
- return {
144
- pdisk,
145
- wasLoaded,
146
- loading,
147
- error,
148
- };
149
- };
150
-
151
- const mapDispatchToProps = {
152
- getPdiskInfo,
153
- clearStore,
154
- };
155
-
156
- export default connect(mapStateToProps, mapDispatchToProps)(Pdisk);
@@ -1,42 +0,0 @@
1
- @import '../../styles/mixins.scss';
2
-
3
- .pdisk {
4
- padding: 20px;
5
- @include container-fluid();
6
-
7
- .info-viewer__items {
8
- grid-template-columns: auto;
9
- }
10
-
11
- &__row {
12
- display: flex;
13
- }
14
-
15
- &__column {
16
- display: flex;
17
- flex-direction: column;
18
- }
19
-
20
- &__title {
21
- margin-right: 16px;
22
-
23
- font-size: var(--yc-text-body-2-font-size);
24
- font-weight: 500;
25
- line-height: var(--yc-text-body-2-line-height);
26
- text-transform: uppercase;
27
- }
28
-
29
- &__section {
30
- padding: 15px 0;
31
- }
32
-
33
- &__size {
34
- margin-top: -8px;
35
- }
36
-
37
- &__link {
38
- text-decoration: none;
39
-
40
- color: var(--yc-color-base-special);
41
- }
42
- }
@@ -1,170 +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} from '@gravity-ui/uikit';
8
- import ReactList from 'react-list';
9
-
10
- import EntityStatus from '../../components/EntityStatus/EntityStatus';
11
- import GroupTreeViewer from '../../components/GroupTreeViewer/GroupTreeViewer';
12
- import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs';
13
- import {ProblemFilter} from '../../components/ProblemFilter/ProblemFilter';
14
- import {Illustration} from '../../components/Illustration';
15
-
16
- import {getPoolInfo} from '../../store/reducers/pool';
17
- import {AUTO_RELOAD_INTERVAL, ALL} from '../../utils/constants';
18
- import {changeFilter} from '../../store/reducers/settings';
19
-
20
- import './Pool.scss';
21
-
22
- const b = cn('pool');
23
-
24
- class Pool extends React.Component {
25
- static renderLoader() {
26
- return (
27
- <div className={'loader'}>
28
- <Loader size="l" />
29
- </div>
30
- );
31
- }
32
-
33
- static propTypes = {
34
- loading: PropTypes.bool,
35
- wasLoaded: PropTypes.bool,
36
- error: PropTypes.bool,
37
- getPoolInfo: PropTypes.func,
38
- pool: PropTypes.object,
39
- poolName: PropTypes.string,
40
- match: PropTypes.object,
41
- filter: PropTypes.string,
42
- changeFilter: PropTypes.func,
43
- };
44
-
45
- static defaultProps = {
46
- pool: {},
47
- };
48
-
49
- static filterGroups(groups, filter) {
50
- return _.filter(groups, (item) => {
51
- return filter === ALL || (item.Overall && item.Overall !== 'Green');
52
- });
53
- }
54
-
55
- componentDidMount() {
56
- const {poolName} = this.props.match.params;
57
- this.props.getPoolInfo(decodeURIComponent(poolName));
58
- this.reloadDescriptor = setInterval(
59
- () => this.props.getPoolInfo(decodeURIComponent(poolName)),
60
- AUTO_RELOAD_INTERVAL,
61
- );
62
- }
63
-
64
- componentWillUnmount() {
65
- clearInterval(this.reloadDescriptor);
66
- }
67
-
68
- state = {
69
- extendedGroups: new Set(),
70
- };
71
-
72
- makeHandleGroupClick = (groupIndex) => () => {
73
- const {extendedGroups} = this.state;
74
- const newExtendedGroups = new Set([...extendedGroups]);
75
-
76
- if (newExtendedGroups.has(groupIndex)) {
77
- newExtendedGroups.delete(groupIndex);
78
- } else {
79
- newExtendedGroups.add(groupIndex);
80
- }
81
-
82
- this.setState({extendedGroups: newExtendedGroups});
83
- };
84
-
85
- makeRenderGroups = (groups) => (index, key) => {
86
- const group = groups[index];
87
- const {extendedGroups} = this.state;
88
-
89
- return (
90
- <GroupTreeViewer
91
- key={key}
92
- group={group}
93
- collapsed={!extendedGroups.has(index)}
94
- onClick={this.makeHandleGroupClick(index)}
95
- />
96
- );
97
- };
98
-
99
- renderContent = () => {
100
- const {pool, filter, changeFilter} = this.props;
101
- const {extendedGroups} = this.state;
102
-
103
- const breadcrumbsItems = [{text: 'Database'}, {text: 'Storage Pool'}];
104
-
105
- if (pool && pool.StoragePools) {
106
- const poolInfo = pool.StoragePools[0];
107
- const filteredGroups = Pool.filterGroups(poolInfo.Groups, filter);
108
-
109
- return (
110
- <div className={b()}>
111
- <Breadcrumbs items={breadcrumbsItems} />
112
- <div className={b('row')}>
113
- <span className={b('title')}>Pool </span>
114
- <EntityStatus status={poolInfo.Overall} name={poolInfo.Name}></EntityStatus>
115
- </div>
116
-
117
- <div className={b('controls')}>
118
- <div className={b('title', {groups: true})}>Groups</div>
119
- <ProblemFilter value={filter} onChange={changeFilter} />
120
- </div>
121
-
122
- {filteredGroups.length === 0 ? (
123
- <Illustration name="thumbsUp" width="200" />
124
- ) : (
125
- <ReactList
126
- itemRenderer={this.makeRenderGroups(filteredGroups)}
127
- length={filteredGroups.length}
128
- itemSizeGetter={GroupTreeViewer.makeGetHeight(
129
- filteredGroups,
130
- extendedGroups,
131
- )}
132
- type="variable"
133
- />
134
- )}
135
- </div>
136
- );
137
- }
138
- };
139
-
140
- render() {
141
- const {loading, wasLoaded, error} = this.props;
142
-
143
- if (loading && !wasLoaded) {
144
- return Pool.renderLoader();
145
- } else if (error) {
146
- return <div>{error.statusText}</div>;
147
- } else {
148
- return this.renderContent();
149
- }
150
- }
151
- }
152
-
153
- const mapStateToProps = (state) => {
154
- const {data: pool, wasLoaded, loading, error} = state.pool;
155
-
156
- return {
157
- pool,
158
- wasLoaded,
159
- loading,
160
- error,
161
- filter: state.settings.problemFilter,
162
- };
163
- };
164
-
165
- const mapDispatchToProps = {
166
- getPoolInfo,
167
- changeFilter,
168
- };
169
-
170
- export default connect(mapStateToProps, mapDispatchToProps)(Pool);
@@ -1,35 +0,0 @@
1
- @import '../../styles/mixins.scss';
2
-
3
- .pool {
4
- @include container-fluid();
5
-
6
- &__row {
7
- display: flex;
8
- }
9
-
10
- &__title {
11
- margin-right: 16px;
12
-
13
- font-size: var(--yc-text-body-2-font-size);
14
- font-weight: 500;
15
- line-height: var(--yc-text-body-2-line-height);
16
- text-transform: uppercase;
17
-
18
- &_groups {
19
- margin-right: 32px;
20
- }
21
- }
22
-
23
- &__controls {
24
- display: flex;
25
- align-items: center;
26
-
27
- margin: 25px 0 10px;
28
- }
29
-
30
- &__breadcrumbs {
31
- padding: 20px 0;
32
-
33
- font-size: var(--yc-text-body-2-font-size);
34
- }
35
- }
@@ -1,158 +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
-
6
- import {Link} from 'react-router-dom';
7
- import {Loader} from '@gravity-ui/uikit';
8
-
9
- import InfoViewer from '../../components/InfoViewer/InfoViewer';
10
- import EntityStatus from '../../components/EntityStatus/EntityStatus';
11
-
12
- import {getVdiskInfo, clearStore} from '../../store/reducers/vdisk';
13
- import {VDISK_AUTO_RELOAD_INTERVAL} from '../../utils/constants';
14
- import {formatBytes, calcUptime, stringifyVdiskId} from '../../utils';
15
- import routes, {createHref} from '../../routes';
16
- import {getDefaultNodePath} from '../Node/NodePages';
17
-
18
- import './Vdisk.scss';
19
-
20
- const b = cn('vdisk');
21
-
22
- class Vdisk extends React.Component {
23
- static renderLoader() {
24
- return (
25
- <div className={'loader'}>
26
- <Loader size="l" />
27
- </div>
28
- );
29
- }
30
-
31
- static propTypes = {
32
- className: PropTypes.string,
33
- loading: PropTypes.bool,
34
- wasLoaded: PropTypes.bool,
35
- error: PropTypes.bool,
36
- getVdiskInfo: PropTypes.func,
37
- clearStore: PropTypes.func,
38
- vdisk: PropTypes.object,
39
- location: PropTypes.object,
40
- };
41
-
42
- static defaultProps = {
43
- className: '',
44
- };
45
-
46
- componentDidMount() {
47
- const {id} = this.props.match.params;
48
-
49
- this.props.getVdiskInfo(id);
50
- this.reloadDescriptor = setInterval(
51
- () => this.props.getVdiskInfo(id),
52
- VDISK_AUTO_RELOAD_INTERVAL,
53
- );
54
- }
55
-
56
- componentWillUnmount() {
57
- this.props.clearStore();
58
- clearInterval(this.reloadDescriptor);
59
- }
60
-
61
- renderContent = () => {
62
- const {
63
- AllocatedSize,
64
- ChangeTime,
65
- DiskSpace,
66
- FrontQueues,
67
- Guid,
68
- NodeId,
69
- PDiskId,
70
- Replicated,
71
- VDiskState,
72
- VDiskId,
73
- } = this.props.vdisk;
74
-
75
- const vdiskInfo = [
76
- {label: 'Allocated Size', value: formatBytes(AllocatedSize)},
77
- {label: 'Change Time', value: calcUptime(ChangeTime)},
78
- {label: 'Disk Space', value: <EntityStatus status={DiskSpace} />},
79
- {label: 'Front Queues', value: <EntityStatus status={FrontQueues} />},
80
- {label: 'Guid', value: Guid},
81
- {
82
- label: 'NodeId',
83
- value: (
84
- <Link className={b('link')} to={getDefaultNodePath(NodeId)}>
85
- {NodeId}
86
- </Link>
87
- ),
88
- },
89
- {
90
- label: 'PDiskId',
91
- value: (
92
- <Link
93
- className={b('link')}
94
- to={createHref(routes.pdisk, {id: PDiskId}, {node_id: NodeId})}
95
- >
96
- {PDiskId}
97
- </Link>
98
- ),
99
- },
100
- {label: 'Replicated', value: Replicated ? '✓' : '☓'},
101
- {
102
- label: 'VDiskState',
103
- value: VDiskState,
104
- },
105
- ];
106
-
107
- return (
108
- <div className={b()}>
109
- <div className={b('row')}>
110
- <span className={b('title')}>VDisk </span>
111
- <EntityStatus
112
- status={VDiskState === 'OK' ? 'green' : 'red'}
113
- name={stringifyVdiskId(VDiskId)}
114
- />
115
- </div>
116
-
117
- <div className={b('column')}>
118
- <InfoViewer className={b('section')} info={vdiskInfo} />
119
- </div>
120
- </div>
121
- );
122
- };
123
-
124
- render() {
125
- const {loading, wasLoaded, error} = this.props;
126
-
127
- if (loading && !wasLoaded) {
128
- return Vdisk.renderLoader();
129
- } else if (error) {
130
- return <div>{error.statusText}</div>;
131
- } else {
132
- return this.renderContent();
133
- }
134
- }
135
- }
136
-
137
- const mapStateToProps = (state) => {
138
- const {data, wasLoaded, loading, error} = state.vdisk;
139
-
140
- let vdisk;
141
- if (data) {
142
- vdisk = data.VDiskStateInfo[0];
143
- }
144
-
145
- return {
146
- vdisk,
147
- wasLoaded,
148
- loading,
149
- error,
150
- };
151
- };
152
-
153
- const mapDispatchToProps = {
154
- getVdiskInfo,
155
- clearStore,
156
- };
157
-
158
- export default connect(mapStateToProps, mapDispatchToProps)(Vdisk);
@@ -1,42 +0,0 @@
1
- @import '../../styles/mixins.scss';
2
-
3
- .vdisk {
4
- padding: 20px;
5
- @include container-fluid();
6
-
7
- .info-viewer__items {
8
- grid-template-columns: max-content;
9
- }
10
-
11
- &__row {
12
- display: flex;
13
- }
14
-
15
- &__column {
16
- display: flex;
17
- flex-direction: column;
18
- }
19
-
20
- &__title {
21
- margin-right: 16px;
22
-
23
- font-size: var(--yc-text-body-2-font-size);
24
- font-weight: 500;
25
- line-height: var(--yc-text-body-2-line-height);
26
- text-transform: uppercase;
27
- }
28
-
29
- &__section {
30
- padding: 15px 0;
31
-
32
- .info-viewer__label {
33
- min-width: 205px;
34
- }
35
- }
36
-
37
- &__link {
38
- text-decoration: none;
39
-
40
- color: var(--yc-color-base-special);
41
- }
42
- }