ydb-embedded-ui 4.9.0 → 4.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/components/BasicNodeViewer/BasicNodeViewer.tsx +7 -4
  3. package/dist/components/EntityStatus/EntityStatus.js +3 -1
  4. package/dist/components/FormattedBytes/FormattedBytes.tsx +10 -0
  5. package/dist/components/FormattedBytes/utils.tsx +13 -0
  6. package/dist/components/FullNodeViewer/FullNodeViewer.tsx +73 -0
  7. package/dist/components/InfoViewer/formatters/schema.ts +3 -1
  8. package/dist/components/InfoViewer/formatters/table.ts +6 -5
  9. package/dist/components/ProblemFilter/ProblemFilter.tsx +2 -2
  10. package/dist/components/SpeedMultiMeter/SpeedMultiMeter.tsx +4 -4
  11. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +32 -0
  12. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.tsx +43 -0
  13. package/dist/components/TruncatedQuery/{TruncatedQuery.js → TruncatedQuery.tsx} +10 -8
  14. package/dist/containers/AsideNavigation/AsideNavigation.tsx +8 -8
  15. package/dist/containers/Cluster/Cluster.scss +4 -5
  16. package/dist/containers/Cluster/Cluster.tsx +13 -28
  17. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +4 -0
  18. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +7 -0
  19. package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx +1 -1
  20. package/dist/containers/Cluster/utils.tsx +0 -11
  21. package/dist/containers/Header/Header.scss +1 -5
  22. package/dist/containers/Node/Node.tsx +3 -3
  23. package/dist/containers/Nodes/Nodes.scss +1 -24
  24. package/dist/containers/Nodes/Nodes.tsx +30 -40
  25. package/dist/containers/Storage/PDisk/PDisk.tsx +2 -7
  26. package/dist/containers/Storage/Storage.scss +1 -14
  27. package/dist/containers/Storage/Storage.tsx +237 -0
  28. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +45 -40
  29. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +12 -16
  30. package/dist/containers/Storage/StorageTypeFilter/StorageTypeFilter.tsx +3 -1
  31. package/dist/containers/Storage/{StorageVisibleEntityFilter/StorageVisibleEntityFilter.tsx → StorageVisibleEntitiesFilter/StorageVisibleEntitiesFilter.tsx} +4 -2
  32. package/dist/containers/Storage/UsageFilter/UsageFilter.scss +1 -0
  33. package/dist/containers/Storage/UsageFilter/UsageFilter.tsx +17 -17
  34. package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +6 -2
  35. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +3 -3
  36. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +7 -4
  37. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.scss +0 -15
  38. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +10 -3
  39. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +3 -12
  40. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +2 -7
  41. package/dist/containers/Tenant/{Preview → Query/Preview}/Preview.scss +1 -1
  42. package/dist/containers/Tenant/Query/Preview/Preview.tsx +121 -0
  43. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.tsx +1 -1
  44. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +6 -8
  45. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.tsx +1 -1
  46. package/dist/containers/Tenant/Query/i18n/en.json +9 -2
  47. package/dist/containers/Tenant/Query/i18n/ru.json +9 -2
  48. package/dist/containers/Tenants/Tenants.scss +1 -13
  49. package/dist/containers/Tenants/Tenants.tsx +262 -0
  50. package/dist/services/api.ts +8 -3
  51. package/dist/store/reducers/nodes/nodes.ts +4 -112
  52. package/dist/store/reducers/nodes/selectors.ts +74 -0
  53. package/dist/store/reducers/nodes/utils.ts +46 -0
  54. package/dist/store/reducers/partitions/types.ts +3 -3
  55. package/dist/store/reducers/settings/settings.ts +4 -2
  56. package/dist/store/reducers/settings/types.ts +3 -1
  57. package/dist/store/reducers/storage/selectors.ts +279 -0
  58. package/dist/store/reducers/storage/storage.ts +191 -0
  59. package/dist/store/reducers/storage/types.ts +80 -0
  60. package/dist/store/reducers/tenants/selectors.ts +46 -0
  61. package/dist/store/reducers/tenants/tenants.ts +21 -14
  62. package/dist/store/reducers/tenants/types.ts +20 -5
  63. package/dist/store/reducers/tenants/utils.ts +68 -0
  64. package/dist/types/additionalProps.ts +8 -0
  65. package/dist/types/api/compute.ts +27 -2
  66. package/dist/types/api/nodes.ts +12 -1
  67. package/dist/types/api/schema/cdcStream.ts +32 -0
  68. package/dist/types/api/schema/columnEntity.ts +138 -0
  69. package/dist/types/api/schema/externalDataSource.ts +24 -0
  70. package/dist/types/api/schema/externalTable.ts +14 -0
  71. package/dist/types/api/schema/index.ts +10 -0
  72. package/dist/types/api/schema/persQueueGroup.ts +191 -0
  73. package/dist/types/api/schema/schema.ts +299 -0
  74. package/dist/types/api/schema/shared.ts +42 -0
  75. package/dist/types/api/schema/table.ts +616 -0
  76. package/dist/types/api/schema/tableIndex.ts +33 -0
  77. package/dist/types/api/storage.ts +1 -1
  78. package/dist/types/store/topic.ts +3 -3
  79. package/dist/utils/bytesParsers/__test__/formatBytes.test.ts +38 -0
  80. package/dist/utils/bytesParsers/convertBytesObjectToSpeed.ts +2 -2
  81. package/dist/utils/bytesParsers/formatBytes.ts +132 -0
  82. package/dist/utils/bytesParsers/i18n/en.json +1 -0
  83. package/dist/utils/bytesParsers/i18n/ru.json +1 -0
  84. package/dist/utils/bytesParsers/index.ts +1 -1
  85. package/dist/utils/index.js +5 -10
  86. package/dist/utils/numeral.ts +8 -0
  87. package/package.json +1 -1
  88. package/dist/assets/icons/versions.svg +0 -3
  89. package/dist/components/FullNodeViewer/FullNodeViewer.js +0 -89
  90. package/dist/containers/Node/NodeOverview/NodeOverview.scss +0 -0
  91. package/dist/containers/Node/NodeOverview/NodeOverview.tsx +0 -21
  92. package/dist/containers/Storage/Storage.js +0 -350
  93. package/dist/containers/Tenant/Preview/Preview.js +0 -168
  94. package/dist/containers/Tenants/Tenants.js +0 -363
  95. package/dist/store/reducers/storage/storage.js +0 -404
  96. package/dist/types/api/schema.ts +0 -1326
  97. package/dist/utils/bytesParsers/formatBytesCustom.ts +0 -57
@@ -1,350 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {connect} from 'react-redux';
4
- import cn from 'bem-cn-lite';
5
- import DataTable from '@gravity-ui/react-data-table';
6
-
7
- import {Search} from '../../components/Search';
8
- import {UsageFilter} from './UsageFilter';
9
- import {AutoFetcher} from '../../utils/autofetcher';
10
- import {NodesUptimeFilterValues} from '../../utils/nodes';
11
- import {TableSkeleton} from '../../components/TableSkeleton/TableSkeleton';
12
- import {UptimeFilter} from '../../components/UptimeFIlter';
13
- import {AccessDenied} from '../../components/Errors/403';
14
- import {EntitiesCount} from '../../components/EntitiesCount';
15
-
16
- import {
17
- getStorageInfo,
18
- setInitialState,
19
- getFilteredEntities,
20
- setVisibleEntities,
21
- setStorageFilter,
22
- setUsageFilter,
23
- setStorageType,
24
- setNodesUptimeFilter,
25
- setDataWasNotLoaded,
26
- getStoragePoolsGroupsCount,
27
- getStorageNodesCount,
28
- getUsageFilterOptions,
29
- } from '../../store/reducers/storage/storage';
30
- import {VISIBLE_ENTITIES, STORAGE_TYPES} from '../../store/reducers/storage/constants';
31
- import {getNodesList, selectNodesMap} from '../../store/reducers/nodesList';
32
- import StorageGroups from './StorageGroups/StorageGroups';
33
- import StorageNodes from './StorageNodes/StorageNodes';
34
- import {DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
35
-
36
- import {StorageTypeFilter} from './StorageTypeFilter/StorageTypeFilter';
37
- import {StorageVisibleEntityFilter} from './StorageVisibleEntityFilter/StorageVisibleEntityFilter';
38
-
39
- import './Storage.scss';
40
-
41
- const b = cn('global-storage');
42
-
43
- const tableSettings = {
44
- ...DEFAULT_TABLE_SETTINGS,
45
- defaultOrder: DataTable.DESCENDING,
46
- };
47
-
48
- class Storage extends React.Component {
49
- static propTypes = {
50
- loading: PropTypes.bool,
51
- error: PropTypes.object,
52
- wasLoaded: PropTypes.bool,
53
- autorefresh: PropTypes.bool,
54
- database: PropTypes.bool,
55
- getStorageInfo: PropTypes.func,
56
- setInitialState: PropTypes.func,
57
- flatListStorageEntities: PropTypes.array,
58
- groupsCount: PropTypes.object,
59
- nodesCount: PropTypes.object,
60
- setStorageFilter: PropTypes.func,
61
- setVisibleEntities: PropTypes.func,
62
- visibleEntities: PropTypes.string,
63
- tenant: PropTypes.string,
64
- nodeId: PropTypes.string,
65
- nodesUptimeFilter: PropTypes.string,
66
- setNodesUptimeFilter: PropTypes.func,
67
- setDataWasNotLoaded: PropTypes.func,
68
- additionalNodesInfo: PropTypes.object,
69
- };
70
-
71
- componentDidMount() {
72
- const {tenant, nodeId, setVisibleEntities, storageType, getNodesList} = this.props;
73
-
74
- this.autofetcher = new AutoFetcher();
75
- getNodesList();
76
- if (tenant || nodeId) {
77
- setVisibleEntities(VISIBLE_ENTITIES.all);
78
- this.getStorageInfo({
79
- type: storageType,
80
- });
81
- } else {
82
- this.getStorageInfo({
83
- visibleEntities: VISIBLE_ENTITIES.missing,
84
- type: storageType,
85
- });
86
- this.autofetcher.fetch(() =>
87
- this.getStorageInfo({
88
- visibleEntities: VISIBLE_ENTITIES.missing,
89
- type: storageType,
90
- }),
91
- );
92
- }
93
- }
94
-
95
- componentDidUpdate(prevProps) {
96
- const {visibleEntities, storageType, autorefresh, database, tenant, setDataWasNotLoaded} =
97
- this.props;
98
-
99
- const startFetch = () => {
100
- this.getStorageInfo({
101
- visibleEntities,
102
- type: storageType,
103
- });
104
- };
105
-
106
- const restartAutorefresh = () => {
107
- this.autofetcher.stop();
108
- this.autofetcher.start();
109
- this.autofetcher.fetch(() =>
110
- this.getStorageInfo({
111
- visibleEntities,
112
- type: storageType,
113
- }),
114
- );
115
- };
116
-
117
- if (database && !autorefresh && prevProps.autorefresh) {
118
- this.autofetcher.stop();
119
- }
120
- if (database && autorefresh && !prevProps.autorefresh) {
121
- startFetch();
122
- restartAutorefresh();
123
- }
124
-
125
- if (
126
- storageType !== prevProps.storageType ||
127
- visibleEntities !== prevProps.visibleEntities
128
- ) {
129
- startFetch();
130
-
131
- if (!database || (database && autorefresh)) {
132
- restartAutorefresh();
133
- }
134
- }
135
-
136
- if (tenant !== prevProps.tenant) {
137
- setDataWasNotLoaded();
138
- startFetch();
139
- restartAutorefresh();
140
- }
141
- }
142
-
143
- componentWillUnmount() {
144
- this.autofetcher.stop();
145
- this.props.setInitialState();
146
- }
147
-
148
- getStorageInfo(data) {
149
- const {tenant, nodeId, getStorageInfo} = this.props;
150
-
151
- getStorageInfo(
152
- {
153
- tenant,
154
- nodeId,
155
- ...data,
156
- },
157
- {
158
- concurrentId: 'getStorageInfo',
159
- },
160
- );
161
- }
162
-
163
- renderLoader() {
164
- return <TableSkeleton className={b('loader')} />;
165
- }
166
-
167
- renderDataTable() {
168
- const {
169
- flatListStorageEntities,
170
- visibleEntities,
171
- nodesUptimeFilter,
172
- nodes,
173
- storageType,
174
- additionalNodesInfo,
175
- } = this.props;
176
-
177
- return (
178
- <div className={b('table-wrapper')}>
179
- {storageType === STORAGE_TYPES.groups && (
180
- <StorageGroups
181
- visibleEntities={visibleEntities}
182
- data={flatListStorageEntities}
183
- tableSettings={tableSettings}
184
- nodes={nodes}
185
- onShowAll={() => this.onGroupVisibilityChange(VISIBLE_ENTITIES.all)}
186
- />
187
- )}
188
- {storageType === STORAGE_TYPES.nodes && (
189
- <StorageNodes
190
- visibleEntities={visibleEntities}
191
- nodesUptimeFilter={nodesUptimeFilter}
192
- data={flatListStorageEntities}
193
- tableSettings={tableSettings}
194
- onShowAll={this.onShowAllNodes}
195
- additionalNodesInfo={additionalNodesInfo}
196
- />
197
- )}
198
- </div>
199
- );
200
- }
201
-
202
- onGroupVisibilityChange = (value) => {
203
- const {setVisibleEntities} = this.props;
204
- setVisibleEntities(value);
205
- };
206
-
207
- onStorageTypeChange = (value) => {
208
- const {setStorageType} = this.props;
209
- setStorageType(value);
210
- };
211
-
212
- onUptimeFilterChange = (value) => {
213
- this.props.setNodesUptimeFilter(value);
214
- };
215
-
216
- onShowAllNodes = () => {
217
- this.onGroupVisibilityChange(VISIBLE_ENTITIES.all);
218
- this.onUptimeFilterChange(NodesUptimeFilterValues.All);
219
- };
220
-
221
- renderEntitiesCount() {
222
- const {storageType, groupsCount, nodesCount, flatListStorageEntities, loading, wasLoaded} =
223
- this.props;
224
-
225
- const entityName = storageType === STORAGE_TYPES.groups ? 'Groups' : 'Nodes';
226
- const count = storageType === STORAGE_TYPES.groups ? groupsCount : nodesCount;
227
-
228
- return (
229
- <EntitiesCount
230
- label={entityName}
231
- loading={loading && !wasLoaded}
232
- total={count.total}
233
- current={flatListStorageEntities.length}
234
- />
235
- );
236
- }
237
-
238
- renderControls() {
239
- const {
240
- filter,
241
- setStorageFilter,
242
- visibleEntities,
243
- storageType,
244
- usageFilter,
245
- nodesUptimeFilter,
246
- setUsageFilter,
247
- usageFilterOptions,
248
- } = this.props;
249
-
250
- return (
251
- <div className={b('controls')}>
252
- <div className={b('search')}>
253
- <Search
254
- placeholder={
255
- storageType === STORAGE_TYPES.groups
256
- ? 'Group ID, Pool name'
257
- : 'Node ID, FQDN'
258
- }
259
- onChange={setStorageFilter}
260
- value={filter}
261
- />
262
- </div>
263
-
264
- <StorageTypeFilter value={storageType} onChange={this.onStorageTypeChange} />
265
- <StorageVisibleEntityFilter
266
- value={visibleEntities}
267
- onChange={this.onGroupVisibilityChange}
268
- />
269
-
270
- {storageType === STORAGE_TYPES.nodes && (
271
- <UptimeFilter value={nodesUptimeFilter} onChange={this.onUptimeFilterChange} />
272
- )}
273
-
274
- {storageType === STORAGE_TYPES.groups && (
275
- <UsageFilter
276
- value={usageFilter}
277
- onChange={setUsageFilter}
278
- groups={usageFilterOptions}
279
- disabled={usageFilterOptions.length === 0}
280
- />
281
- )}
282
- {this.renderEntitiesCount()}
283
- </div>
284
- );
285
- }
286
-
287
- render() {
288
- const {loading, wasLoaded, error} = this.props;
289
- const showLoader = loading && !wasLoaded;
290
-
291
- if (error) {
292
- if (error.status === 403) {
293
- return <AccessDenied />;
294
- }
295
-
296
- return <div className={b()}>{error.statusText}</div>;
297
- }
298
-
299
- return (
300
- <div className={b()}>
301
- {this.renderControls()}
302
- {showLoader ? this.renderLoader() : this.renderDataTable()}
303
- </div>
304
- );
305
- }
306
- }
307
-
308
- function mapStateToProps(state) {
309
- const {
310
- loading,
311
- wasLoaded,
312
- error,
313
- visible: visibleEntities,
314
- type: storageType,
315
- filter,
316
- usageFilter,
317
- nodesUptimeFilter,
318
- } = state.storage;
319
-
320
- return {
321
- flatListStorageEntities: getFilteredEntities(state),
322
- groupsCount: getStoragePoolsGroupsCount(state),
323
- autorefresh: state.schema.autorefresh,
324
- nodes: selectNodesMap(state),
325
- nodesCount: getStorageNodesCount(state),
326
- loading,
327
- wasLoaded,
328
- error,
329
- visibleEntities,
330
- storageType,
331
- filter,
332
- usageFilter,
333
- nodesUptimeFilter,
334
- usageFilterOptions: getUsageFilterOptions(state),
335
- };
336
- }
337
-
338
- const mapDispatchToProps = {
339
- getStorageInfo,
340
- setInitialState,
341
- setStorageFilter,
342
- setUsageFilter,
343
- setVisibleEntities: setVisibleEntities,
344
- setNodesUptimeFilter,
345
- getNodesList,
346
- setStorageType,
347
- setDataWasNotLoaded,
348
- };
349
-
350
- export default connect(mapStateToProps, mapDispatchToProps)(Storage);
@@ -1,168 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {connect} from 'react-redux';
4
- import cn from 'bem-cn-lite';
5
-
6
- import {Loader, Button} from '@gravity-ui/uikit';
7
-
8
- import {Icon} from '../../../components/Icon';
9
- import Fullscreen from '../../../components/Fullscreen/Fullscreen';
10
- import {QueryResultTable} from '../../../components/QueryResultTable';
11
-
12
- import {sendQuery, setQueryOptions} from '../../../store/reducers/preview';
13
- import {prepareQueryError} from '../../../utils/query';
14
-
15
- import {isTableType} from '../utils/schema';
16
- import {AutoFetcher} from '../../../utils/autofetcher';
17
- import EnableFullscreenButton from '../../../components/EnableFullscreenButton/EnableFullscreenButton';
18
- import {setShowPreview} from '../../../store/reducers/schema/schema';
19
-
20
- import './Preview.scss';
21
-
22
- const b = cn('kv-preview');
23
-
24
- class Preview extends React.Component {
25
- static propTypes = {
26
- sendQuery: PropTypes.func,
27
- database: PropTypes.string,
28
- table: PropTypes.string,
29
- error: PropTypes.string,
30
- data: PropTypes.array,
31
- loading: PropTypes.bool,
32
- type: PropTypes.string,
33
- partCount: PropTypes.string,
34
- };
35
-
36
- autofetcher;
37
-
38
- componentDidMount() {
39
- this.sendQueryForPreview();
40
- this.autofetcher = new AutoFetcher();
41
- if (this.props.autorefresh) {
42
- this.autofetcher.start();
43
- this.autofetcher.fetch(() => this.sendQueryForPreview());
44
- }
45
- }
46
-
47
- componentDidUpdate(prevProps) {
48
- const {table, autorefresh, setQueryOptions} = this.props;
49
-
50
- if (prevProps.table !== table) {
51
- this.sendQueryForPreview();
52
- setQueryOptions({
53
- wasLoaded: false,
54
- data: undefined,
55
- });
56
- }
57
-
58
- if (autorefresh && !prevProps.autorefresh) {
59
- this.sendQueryForPreview();
60
- this.autofetcher.start();
61
- this.autofetcher.fetch(() => this.sendQueryForPreview());
62
- }
63
- if (!autorefresh && prevProps.autorefresh) {
64
- this.autofetcher.stop();
65
- }
66
- }
67
-
68
- componentWillUnmount() {
69
- this.autofetcher.stop();
70
- }
71
-
72
- sendQueryForPreview = () => {
73
- const {sendQuery, database, table, type} = this.props;
74
-
75
- if (!isTableType(type)) {
76
- return;
77
- }
78
-
79
- const query = `--!syntax_v1\nselect * from \`${table}\` limit 32`;
80
- sendQuery({
81
- query,
82
- database: database,
83
- action: 'execute-scan',
84
- path: table,
85
- });
86
- };
87
-
88
- onClosePreview = () => {
89
- this.props.setShowPreview(false);
90
- };
91
-
92
- renderHeader = () => {
93
- const {currentSchemaPath, error} = this.props;
94
- return (
95
- <div className={b('header')}>
96
- <div className={b('title')}>
97
- Preview <div className={b('table-name')}>{currentSchemaPath}</div>
98
- </div>
99
- <div className={b('controls-left')}>
100
- <EnableFullscreenButton disabled={Boolean(error)} />
101
- <Button
102
- view="flat-secondary"
103
- onClick={this.onClosePreview}
104
- title="Close preview"
105
- >
106
- <Icon name="close" viewBox={'0 0 16 16'} width={16} height={16} />
107
- </Button>
108
- </div>
109
- </div>
110
- );
111
- };
112
-
113
- render() {
114
- const {error, loading, data, type, wasLoaded, isFullscreen} = this.props;
115
-
116
- if (loading && !wasLoaded) {
117
- return (
118
- <div className={b('loader-container')}>
119
- <Loader size="m" />
120
- </div>
121
- );
122
- }
123
-
124
- let message;
125
-
126
- if (!isTableType(type)) {
127
- message = <div className={b('message-container')}>Not available</div>;
128
- } else if (error) {
129
- message = <div className={b('message-container')}>{prepareQueryError(error)}</div>;
130
- }
131
-
132
- const content = message ?? (
133
- <div className={b('result')}>
134
- <QueryResultTable data={data.result} columns={data.columns} />
135
- </div>
136
- );
137
-
138
- return (
139
- <div className={b()}>
140
- {this.renderHeader()}
141
- {isFullscreen ? <Fullscreen>{content}</Fullscreen> : content}
142
- </div>
143
- );
144
- }
145
- }
146
-
147
- const mapStateToProps = (state) => {
148
- const {data = {}, loading, error, wasLoaded} = state.preview;
149
- const {autorefresh, currentSchemaPath} = state.schema;
150
-
151
- return {
152
- data,
153
- loading,
154
- error,
155
- autorefresh,
156
- wasLoaded,
157
- currentSchemaPath,
158
- isFullscreen: state.fullscreen,
159
- };
160
- };
161
-
162
- const mapDispatchToProps = {
163
- sendQuery,
164
- setQueryOptions,
165
- setShowPreview,
166
- };
167
-
168
- export default connect(mapStateToProps, mapDispatchToProps)(Preview);