ydb-embedded-ui 3.3.2 → 3.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/Errors/ResponseError/ResponseError.tsx +17 -0
  3. package/dist/components/Errors/ResponseError/index.ts +1 -0
  4. package/dist/components/Errors/i18n/en.json +2 -1
  5. package/dist/components/Errors/i18n/ru.json +2 -1
  6. package/dist/components/FullGroupViewer/FullGroupViewer.js +1 -1
  7. package/dist/components/InfoViewer/InfoViewer.scss +1 -1
  8. package/dist/components/InfoViewer/InfoViewer.tsx +29 -21
  9. package/dist/components/InfoViewer/formatters/index.ts +1 -0
  10. package/dist/components/InfoViewer/formatters/table.ts +40 -0
  11. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.tsx +26 -8
  12. package/dist/components/QueryExecutionStatus/index.ts +1 -0
  13. package/dist/components/QueryResultTable/QueryResultTable.tsx +2 -2
  14. package/dist/containers/App/Content.js +12 -5
  15. package/dist/containers/AsideNavigation/AsideNavigation.tsx +10 -13
  16. package/dist/containers/Authentication/Authentication.scss +6 -0
  17. package/dist/containers/Authentication/Authentication.tsx +34 -15
  18. package/dist/containers/Node/NodeStructure/Pdisk.tsx +7 -10
  19. package/dist/containers/Nodes/Nodes.tsx +1 -1
  20. package/dist/containers/Nodes/getNodesColumns.tsx +4 -4
  21. package/dist/containers/Storage/PDisk/PDisk.tsx +25 -17
  22. package/dist/containers/Storage/PDisk/__tests__/colors.tsx +64 -1
  23. package/dist/containers/Storage/Storage.js +1 -1
  24. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +12 -3
  25. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +1 -1
  26. package/dist/containers/Storage/utils/index.ts +26 -10
  27. package/dist/containers/Tablet/Tablet.js +1 -1
  28. package/dist/containers/Tenant/Acl/Acl.js +1 -1
  29. package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.tsx +2 -2
  30. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +3 -3
  31. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +7 -7
  32. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +1 -1
  33. package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +10 -21
  34. package/dist/containers/Tenant/{Schema/SchemaInfoViewer/SchemaInfoViewer.scss → Diagnostics/Overview/TableInfo/TableInfo.scss} +8 -10
  35. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.tsx +71 -0
  36. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/en.json +5 -0
  37. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/index.ts +11 -0
  38. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/i18n/ru.json +5 -0
  39. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/index.ts +1 -0
  40. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +96 -0
  41. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +7 -1
  42. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/Filters.scss +8 -0
  43. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/Filters.tsx +56 -0
  44. package/dist/containers/Tenant/Diagnostics/TopShards/Filters/index.ts +1 -0
  45. package/dist/containers/Tenant/Diagnostics/{OverloadedShards/OverloadedShards.scss → TopShards/TopShards.scss} +2 -10
  46. package/dist/containers/Tenant/Diagnostics/{OverloadedShards/OverloadedShards.tsx → TopShards/TopShards.tsx} +64 -29
  47. package/dist/containers/Tenant/Diagnostics/TopShards/i18n/en.json +6 -0
  48. package/dist/containers/Tenant/Diagnostics/{OverloadedShards → TopShards}/i18n/index.ts +1 -1
  49. package/dist/containers/Tenant/Diagnostics/TopShards/i18n/ru.json +6 -0
  50. package/dist/containers/Tenant/Diagnostics/TopShards/index.ts +1 -0
  51. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +3 -1
  52. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +16 -11
  53. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +37 -23
  54. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +4 -0
  55. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +1 -1
  56. package/dist/containers/Tenants/Tenants.js +4 -3
  57. package/dist/routes.ts +1 -0
  58. package/dist/services/api.js +4 -1
  59. package/dist/store/reducers/authentication.js +0 -15
  60. package/dist/store/reducers/shardsWorkload.ts +30 -3
  61. package/dist/store/reducers/storage.js +1 -1
  62. package/dist/store/state-url-mapping.js +3 -0
  63. package/dist/types/store/shardsWorkload.ts +6 -0
  64. package/dist/utils/constants.ts +1 -1
  65. package/dist/utils/index.js +3 -1
  66. package/dist/utils/prepareQueryExplain.ts +1 -1
  67. package/dist/utils/typecheckers.ts +5 -0
  68. package/package.json +5 -3
  69. package/dist/containers/Tenant/Diagnostics/OverloadedShards/i18n/en.json +0 -4
  70. package/dist/containers/Tenant/Diagnostics/OverloadedShards/i18n/ru.json +0 -4
  71. package/dist/containers/Tenant/Diagnostics/OverloadedShards/index.ts +0 -1
  72. package/dist/containers/Tenant/Diagnostics/Overview/Overview.scss +0 -13
  73. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +0 -201
@@ -3,11 +3,17 @@ import type {ApiRequestAction} from '../../store/utils';
3
3
  import type {IResponseError} from '../api/error';
4
4
  import type {IQueryResult} from './query';
5
5
 
6
+ export enum EShardsWorkloadMode {
7
+ Immediate = 'immediate',
8
+ History = 'history',
9
+ }
10
+
6
11
  export interface IShardsWorkloadFilters {
7
12
  /** ms from epoch */
8
13
  from?: number;
9
14
  /** ms from epoch */
10
15
  to?: number;
16
+ mode?: EShardsWorkloadMode;
11
17
  }
12
18
 
13
19
  export interface IShardsWorkloadState {
@@ -1,4 +1,4 @@
1
- import DataTable from '@yandex-cloud/react-data-table';
1
+ import DataTable from '@gravity-ui/react-data-table';
2
2
 
3
3
  const SECOND = 1000;
4
4
 
@@ -1,6 +1,8 @@
1
1
  import numeral from 'numeral';
2
2
  import locales from 'numeral/locales'; // eslint-disable-line no-unused-vars
3
3
 
4
+ import {dateTimeParse} from '@gravity-ui/date-utils';
5
+
4
6
  import {i18n} from './i18n';
5
7
  import {MEGABYTE, TERABYTE, GIGABYTE, DAY_IN_SECONDS} from './constants';
6
8
  import {isNumeric} from './utils';
@@ -76,7 +78,7 @@ export const formatDateTime = (value) => {
76
78
  return '';
77
79
  }
78
80
 
79
- return value > 0 ? new Date(Number(value)).toUTCString() : 'N/A';
81
+ return value > 0 ? dateTimeParse(Number(value)).format('YYYY-MM-DD HH:mm') : 'N/A';
80
82
  };
81
83
 
82
84
  export const calcUptimeInSeconds = (milliseconds) => {
@@ -5,7 +5,7 @@ import {
5
5
  TopologyNodeDataStatsSection,
6
6
  ExplainPlanNodeData,
7
7
  TopologyNodeDataStatsItem,
8
- } from '@yandex-cloud/paranoid';
8
+ } from '@gravity-ui/paranoid';
9
9
 
10
10
  interface PlanOperator {
11
11
  Name: string;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Intended to typecheck enums, but also checks if the value is any of the arbitrary object values
3
+ */
4
+ export const isEnumMember = <T extends Object>(object: T, value: any): value is T[keyof T] =>
5
+ Object.values(object).includes(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -10,10 +10,11 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@gravity-ui/axios-wrapper": "^1.3.0",
13
+ "@gravity-ui/date-utils": "^1.1.1",
13
14
  "@gravity-ui/i18n": "^1.0.0",
14
15
  "@gravity-ui/navigation": "^0.3.1",
15
- "@yandex-cloud/paranoid": "^1.3.0",
16
- "@yandex-cloud/react-data-table": "^1.0.2",
16
+ "@gravity-ui/paranoid": "^1.4.0",
17
+ "@gravity-ui/react-data-table": "^1.0.3",
17
18
  "axios": "0.19.2",
18
19
  "bem-cn-lite": "4.0.0",
19
20
  "history": "4.10.1",
@@ -107,6 +108,7 @@
107
108
  "@testing-library/react": "^11.2.7",
108
109
  "@testing-library/user-event": "^12.8.3",
109
110
  "@types/lodash": "^4.14.178",
111
+ "@types/numeral": "^2.0.2",
110
112
  "@types/qs": "^6.9.7",
111
113
  "@types/react": "^17.0.44",
112
114
  "@types/react-dom": "^17.0.11",
@@ -1,4 +0,0 @@
1
- {
2
- "no-data": "No data",
3
- "description": "Shards with CPU load over 70% are listed"
4
- }
@@ -1,4 +0,0 @@
1
- {
2
- "no-data": "Нет данных",
3
- "description": "Отображаются шарды с загрузкой CPU выше 70%"
4
- }
@@ -1 +0,0 @@
1
- export * from './OverloadedShards';
@@ -1,13 +0,0 @@
1
- .kv-tenant-overview {
2
- &__title {
3
- margin: 0;
4
- margin-bottom: 15px;
5
-
6
- font-weight: 600;
7
- }
8
- &__loader {
9
- display: flex;
10
- flex-grow: 1;
11
- justify-content: center;
12
- }
13
- }
@@ -1,201 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
-
5
- import {formatCPU, formatBytes, formatNumber, formatBps, formatDateTime} from '../../../../utils';
6
-
7
- import {InfoViewer, createInfoFormatter} from '../../../../components/InfoViewer';
8
-
9
- import {getEntityName} from '../../utils';
10
-
11
- import './SchemaInfoViewer.scss';
12
-
13
- const b = cn('schema-info-viewer');
14
-
15
- const formatTabletMetricsItem = createInfoFormatter({
16
- values: {
17
- CPU: formatCPU,
18
- Memory: formatBytes,
19
- Storage: formatBytes,
20
- Network: formatBps,
21
- ReadThroughput: formatBps,
22
- WriteThroughput: formatBps,
23
- },
24
- defaultValueFormatter: formatNumber,
25
- });
26
-
27
- const formatFollowerGroupItem = createInfoFormatter({
28
- values: {
29
- FollowerCount: formatNumber,
30
- },
31
- });
32
-
33
- const formatPartitionConfigItem = createInfoFormatter({
34
- values: {
35
- FollowerCount: formatNumber,
36
- CrossDataCenterFollowerCount: formatNumber,
37
- },
38
- });
39
-
40
- const formatTableStatsItem = createInfoFormatter({
41
- values: {
42
- DataSize: formatBytes,
43
- IndexSize: formatBytes,
44
- LastAccessTime: formatDateTime,
45
- LastUpdateTime: formatDateTime,
46
- },
47
- defaultValueFormatter: formatNumber,
48
- });
49
-
50
- const formatTableStats = (fields) =>
51
- Object.entries(fields)
52
- .map(([label, value]) => formatTableStatsItem(label, value))
53
- .filter(({value}) => Boolean(value));
54
-
55
- class SchemaInfoViewer extends React.Component {
56
- static propTypes = {
57
- data: PropTypes.object.isRequired,
58
- };
59
-
60
- renderItem(itemData, title) {
61
- if (!Array.isArray(itemData) || !itemData.length) {
62
- return null;
63
- }
64
-
65
- return (
66
- <div className={b('item')}>
67
- <InfoViewer title={title} info={itemData} />
68
- </div>
69
- );
70
- }
71
-
72
- renderContent(data) {
73
- const {PathDescription = {}} = data;
74
- const entityName = getEntityName(PathDescription);
75
-
76
- const {
77
- TableStats = {},
78
- TabletMetrics = {},
79
- Table: {PartitionConfig = {}} = {},
80
- } = PathDescription;
81
- const {
82
- PartCount,
83
- RowCount,
84
- DataSize,
85
- IndexSize,
86
-
87
- LastAccessTime,
88
- LastUpdateTime,
89
-
90
- ImmediateTxCompleted,
91
- PlannedTxCompleted,
92
- TxRejectedByOverload,
93
- TxRejectedBySpace,
94
- TxCompleteLagMsec,
95
- InFlightTxCount,
96
-
97
- RowUpdates,
98
- RowDeletes,
99
- RowReads,
100
- RangeReads,
101
- RangeReadRows,
102
-
103
- ...restTableStats
104
- } = TableStats;
105
- const {FollowerGroups, FollowerCount, CrossDataCenterFollowerCount} = PartitionConfig;
106
-
107
- const generalTableInfo = formatTableStats({
108
- PartCount,
109
- RowCount,
110
- DataSize,
111
- IndexSize,
112
- ...restTableStats,
113
- });
114
-
115
- const tableStatsInfo = [
116
- formatTableStats({
117
- LastAccessTime,
118
- LastUpdateTime,
119
- }),
120
- formatTableStats({
121
- ImmediateTxCompleted,
122
- PlannedTxCompleted,
123
- TxRejectedByOverload,
124
- TxRejectedBySpace,
125
- TxCompleteLagMsec,
126
- InFlightTxCount,
127
- }),
128
- formatTableStats({
129
- RowUpdates,
130
- RowDeletes,
131
- RowReads,
132
- RangeReads,
133
- RangeReadRows,
134
- }),
135
- ];
136
-
137
- const tabletMetricsInfo = Object.keys(TabletMetrics).map((key) =>
138
- formatTabletMetricsItem(key, TabletMetrics[key]),
139
- );
140
-
141
- const partitionConfigInfo = [];
142
-
143
- if (Array.isArray(FollowerGroups) && FollowerGroups.length > 0) {
144
- partitionConfigInfo.push(
145
- ...Object.keys(FollowerGroups[0]).map((key) =>
146
- formatFollowerGroupItem(key, FollowerGroups[0][key]),
147
- ),
148
- );
149
- } else if (FollowerCount !== undefined) {
150
- partitionConfigInfo.push(formatPartitionConfigItem('FollowerCount', FollowerCount));
151
- } else if (CrossDataCenterFollowerCount !== undefined) {
152
- partitionConfigInfo.push(
153
- formatPartitionConfigItem(
154
- 'CrossDataCenterFollowerCount',
155
- CrossDataCenterFollowerCount,
156
- ),
157
- );
158
- }
159
-
160
- if (
161
- [generalTableInfo, tabletMetricsInfo, partitionConfigInfo, tableStatsInfo.flat()].flat()
162
- .length === 0
163
- ) {
164
- return <div className={b('title')}>{entityName}</div>;
165
- }
166
-
167
- return (
168
- <div>
169
- <div>{this.renderItem(generalTableInfo, entityName)}</div>
170
- <div className={b('row')}>
171
- {tabletMetricsInfo.length > 0 || partitionConfigInfo.length > 0 ? (
172
- <div className={b('col')}>
173
- {this.renderItem(tabletMetricsInfo, 'Tablet Metrics')}
174
- {this.renderItem(partitionConfigInfo, 'Partition Config')}
175
- </div>
176
- ) : null}
177
- <div className={b('col')}>
178
- {tableStatsInfo.map((info, index) => (
179
- <React.Fragment key={index}>
180
- {this.renderItem(info, index === 0 ? 'Table Stats' : undefined)}
181
- </React.Fragment>
182
- ))}
183
- </div>
184
- </div>
185
- </div>
186
- );
187
- }
188
-
189
- render() {
190
- const {data} = this.props;
191
- const entityName = getEntityName(data?.PathDescription);
192
-
193
- if (data) {
194
- return <div className={b()}>{this.renderContent(data)}</div>;
195
- } else {
196
- return <div className="error">No {entityName} data</div>;
197
- }
198
- }
199
- }
200
-
201
- export default SchemaInfoViewer;