ydb-embedded-ui 1.10.3 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/components/IndexInfoViewer/IndexInfoViewer.tsx +2 -2
  3. package/dist/components/InfoViewer/InfoViewer.scss +32 -7
  4. package/dist/components/InfoViewer/InfoViewer.tsx +43 -0
  5. package/dist/components/InfoViewer/index.ts +1 -0
  6. package/dist/components/InfoViewer/utils.ts +6 -4
  7. package/dist/components/Stack/Stack.scss +55 -0
  8. package/dist/components/Stack/Stack.tsx +35 -0
  9. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +2 -0
  10. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +5 -0
  11. package/dist/containers/Storage/Pdisk/Pdisk.scss +2 -19
  12. package/dist/containers/Storage/Pdisk/Pdisk.tsx +30 -33
  13. package/dist/containers/Storage/Pdisk/__tests__/colors.tsx +40 -0
  14. package/dist/containers/Storage/StorageGroups/StorageGroups.scss +31 -3
  15. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +72 -33
  16. package/dist/containers/Storage/Vdisk/Vdisk.js +63 -64
  17. package/dist/containers/Storage/Vdisk/Vdisk.scss +9 -28
  18. package/dist/containers/Storage/Vdisk/__tests__/colors.tsx +163 -0
  19. package/dist/containers/Storage/utils/index.ts +49 -0
  20. package/dist/services/api.d.ts +9 -0
  21. package/dist/setupTests.js +8 -0
  22. package/dist/types/api/schema.ts +6 -14
  23. package/dist/types/api/storage.ts +164 -0
  24. package/dist/types/index.ts +1 -0
  25. package/dist/types/store/storage.ts +11 -0
  26. package/package.json +28 -5
  27. package/dist/components/InfoViewer/InfoViewer.js +0 -47
  28. package/dist/index.test.js +0 -5
@@ -3,3 +3,11 @@
3
3
  // expect(element).toHaveTextContent(/react/i)
4
4
  // learn more: https://github.com/testing-library/jest-dom
5
5
  import '@testing-library/jest-dom';
6
+
7
+ import {configure as configureUiKit} from '@yandex-cloud/uikit';
8
+ import {configure as configureYdbUiComponents} from 'ydb-ui-components';
9
+ import {i18n, Lang} from '../src/utils/i18n';
10
+
11
+ i18n.setLang(Lang.En);
12
+ configureYdbUiComponents({lang: Lang.En});
13
+ configureUiKit({lang: Lang.En});
@@ -91,27 +91,19 @@ export interface TTableDescription {
91
91
  export interface TPartitionConfig {
92
92
  /** uint64 */
93
93
  FollowerCount?: string;
94
- /**
95
- * uint32
96
- * @deprecated use FollowerGroups
97
- */
98
- CrossDataCenterFollowerCount?: string;
94
+ /** @deprecated use FollowerGroups */
95
+ CrossDataCenterFollowerCount?: number;
99
96
  /** 0 or 1 items */
100
97
  FollowerGroups?: TFollowerGroup[];
101
98
  }
102
99
 
103
100
  export interface TFollowerGroup {
104
- /** uint32 */
105
- FollowerCount?: string;
101
+ FollowerCount?: number;
106
102
  AllowLeaderPromotion?: boolean;
107
103
  AllowClientRead?: boolean;
108
- /** uint32[] */
109
- AllowedNodeIDs?: string[];
110
- /**
111
- * uint32[]
112
- * @deprecated use AllowedDataCenters
113
- */
114
- AllowedDataCenterNumIDs?: string[];
104
+ AllowedNodeIDs?: number[];
105
+ /** @deprecated use AllowedDataCenters */
106
+ AllowedDataCenterNumIDs?: number[];
115
107
  RequireAllDataCenters?: boolean;
116
108
  LocalNodeOnly?: boolean;
117
109
  RequireDifferentNodes?: boolean;
@@ -52,3 +52,167 @@ export interface TPDiskStateInfo {
52
52
  Overall?: EFlag;
53
53
  SerialNumber?: string;
54
54
  }
55
+
56
+ export enum EVDiskState {
57
+ Initial = 'Initial',
58
+ LocalRecoveryError = 'LocalRecoveryError',
59
+ SyncGuidRecovery = 'SyncGuidRecovery',
60
+ SyncGuidRecoveryError = 'SyncGuidRecoveryError',
61
+ OK = 'OK',
62
+ PDiskError = 'PDiskError',
63
+ }
64
+
65
+ interface TRank {
66
+ /**
67
+ * Rank in percents; 0-100% is good; >100% is bad.
68
+ * Formula for rank calculation is the following:
69
+ * Rank = actual_value / max_allowed_value * 100
70
+ */
71
+ RankPercent?: number;
72
+
73
+ /**
74
+ * Flag is the Rank transformed to something simple
75
+ * to understand: Green, Yellow or Red
76
+ */
77
+ Flag?: EFlag;
78
+ }
79
+
80
+ interface TVDiskSatisfactionRank {
81
+ FreshRank?: TRank;
82
+ LevelRank?: TRank;
83
+ }
84
+
85
+ interface TVDiskID {
86
+ GroupID?: number;
87
+ GroupGeneration?: number;
88
+ Ring?: number;
89
+ Domain?: number;
90
+ VDisk?: number;
91
+ }
92
+
93
+ export interface TVSlotId {
94
+ NodeId?: number;
95
+ PDiskId?: number;
96
+ VSlotId?: number;
97
+ }
98
+
99
+ export interface TVDiskStateInfo {
100
+ VDiskId?: TVDiskID;
101
+ /** uint64 */
102
+ CreateTime?: string;
103
+ /** uint64 */
104
+ ChangeTime?: string;
105
+ PDisk?: TPDiskStateInfo;
106
+ VDiskSlotId?: number;
107
+ /** uint64 */
108
+ Guid?: string;
109
+ /** uint64 */
110
+ Kind?: string;
111
+ NodeId?: number;
112
+ Count?: number;
113
+
114
+ Overall?: EFlag;
115
+
116
+ /** Current state of VDisk */
117
+ VDiskState?: EVDiskState;
118
+ /** Disk space flags */
119
+ DiskSpace?: EFlag;
120
+ /** Compaction satisfaction rank */
121
+ SatisfactionRank?: TVDiskSatisfactionRank;
122
+ /** Is VDisk replicated? (i.e. contains all blobs it must have) */
123
+ Replicated?: boolean;
124
+ /** Does this VDisk has any yet unreplicated phantom-like blobs? */
125
+ UnreplicatedPhantoms?: boolean;
126
+ /** The same for the non-phantom-like blobs. */
127
+ UnreplicatedNonPhantoms?: boolean;
128
+ /**
129
+ * uint64
130
+ * How many unsynced VDisks from current BlobStorage group we see
131
+ */
132
+ UnsyncedVDisks?: string;
133
+ /**
134
+ * uint64
135
+ * How much this VDisk have allocated on corresponding PDisk
136
+ */
137
+ AllocatedSize?: string;
138
+ /**
139
+ * uint64
140
+ * How much space is available for VDisk corresponding to PDisk's hard space limits
141
+ */
142
+ AvailableSize?: string;
143
+ /** Does this disk has some unreadable but not yet restored blobs? */
144
+ HasUnreadableBlobs?: boolean;
145
+ /** fixed64 */
146
+ IncarnationGuid?: string;
147
+ DonorMode?: boolean;
148
+ /**
149
+ * fixed64
150
+ * VDisk actor instance guid
151
+ */
152
+ InstanceGuid?: string;
153
+ // in reality it is `Donors: TVDiskStateInfo[] | TVSlotId[]`, but this way it is more error-proof
154
+ Donors?: Array<TVDiskStateInfo | TVSlotId>;
155
+
156
+ /** VDisk (Skeleton) Front Queue Status */
157
+ FrontQueues?: EFlag;
158
+
159
+ /** VDisk storage pool label */
160
+ StoragePoolName?: string;
161
+
162
+ /**
163
+ * uint64
164
+ * Read bytes per second from PDisk for TEvVGet blobs only
165
+ */
166
+ ReadThroughput?: string;
167
+ /**
168
+ * uint64
169
+ * Write bytes per second to PDisk for TEvVPut blobs and replication bytes only
170
+ */
171
+ WriteThroughput?: string;
172
+ }
173
+
174
+ export interface TBSGroupStateInfo {
175
+ /** uint32 */
176
+ GroupID?: string;
177
+ ErasureSpecies?: string;
178
+ VDisks?: TVDiskStateInfo[];
179
+ /** uint64 */
180
+ ChangeTime?: string;
181
+ /** uint32 */
182
+ NodeId?: string; // filled during merge
183
+ /** uint32 */
184
+ GroupGeneration?: string;
185
+ Overall?: EFlag;
186
+ Latency?: EFlag;
187
+ /** uint32 */
188
+ Count?: string; // filled during group count
189
+ StoragePoolName?: string; // from BS_CONTROLLER
190
+ }
191
+
192
+ export interface TStoragePoolInfo {
193
+ Overall?: EFlag;
194
+ Name?: string;
195
+ Kind?: string;
196
+ Groups?: TBSGroupStateInfo[];
197
+ /** uint64 */
198
+ AcquiredUnits?: string;
199
+ AcquiredIOPS?: number;
200
+ /** uint64 */
201
+ AcquiredThroughput?: string;
202
+ /** uint64 */
203
+ AcquiredSize?: string;
204
+ MaximumIOPS?: number;
205
+ /** uint64 */
206
+ MaximumThroughput?: string;
207
+ /** uint64 */
208
+ MaximumSize?: string;
209
+ }
210
+
211
+ export interface TStorageInfo {
212
+ Overall?: EFlag;
213
+ StoragePools?: TStoragePoolInfo[];
214
+ /** uint64 */
215
+ TotalGroups?: string;
216
+ /** uint64 */
217
+ FoundGroups?: string;
218
+ }
@@ -0,0 +1 @@
1
+ export type RequiredField<Src, Fields extends keyof Src> = Src & Required<Pick<Src, Fields>>;
@@ -0,0 +1,11 @@
1
+ import type {TBSGroupStateInfo} from '../api/storage';
2
+
3
+ export interface IStoragePoolGroup extends TBSGroupStateInfo {
4
+ Read: number;
5
+ Write: number;
6
+ PoolName?: string;
7
+ Used: number;
8
+ Limit: number;
9
+ Missing: number;
10
+ UsedSpaceFlag: number;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "1.10.3",
3
+ "version": "1.12.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -9,10 +9,6 @@
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
12
  "@yandex-cloud/i18n": "0.6.0",
17
13
  "@yandex-cloud/paranoid": "1.0.0",
18
14
  "@yandex-cloud/react-data-table": "0.2.1",
@@ -63,6 +59,27 @@
63
59
  "eslint --fix --quiet"
64
60
  ]
65
61
  },
62
+ "jest": {
63
+ "verbose": true,
64
+ "moduleFileExtensions": [
65
+ "js",
66
+ "json",
67
+ "ts",
68
+ "tsx"
69
+ ],
70
+ "rootDir": ".",
71
+ "transform": {
72
+ "^.+\\.[jt]sx?$": "ts-jest"
73
+ },
74
+ "coverageDirectory": "./coverage",
75
+ "collectCoverageFrom": [
76
+ "src/**/*.{ts,tsx,js,jsx}"
77
+ ],
78
+ "testEnvironment": "jsdom",
79
+ "moduleNameMapper": {
80
+ "\\.(css|less|scss|sass)$": "jest-transform-css"
81
+ }
82
+ },
66
83
  "browserslist": {
67
84
  "production": [
68
85
  ">0.2%",
@@ -78,7 +95,11 @@
78
95
  "devDependencies": {
79
96
  "@commitlint/cli": "^15.0.0",
80
97
  "@commitlint/config-conventional": "^15.0.0",
98
+ "@testing-library/jest-dom": "^5.15.0",
99
+ "@testing-library/react": "^11.2.7",
100
+ "@testing-library/user-event": "^12.8.3",
81
101
  "@types/lodash": "^4.14.178",
102
+ "@types/qs": "^6.9.7",
82
103
  "@types/react": "^17.0.44",
83
104
  "@types/react-dom": "^17.0.11",
84
105
  "@types/react-router": "^5.1.17",
@@ -95,6 +116,7 @@
95
116
  "copyfiles": "^2.4.1",
96
117
  "eslint-config-prettier": "^8.3.0",
97
118
  "husky": "^7.0.4",
119
+ "jest-transform-css": "^4.0.1",
98
120
  "lint-staged": "^12.3.7",
99
121
  "postcss": "^8.4.6",
100
122
  "prettier": "^2.5.1",
@@ -102,6 +124,7 @@
102
124
  "react-app-rewired": "^2.1.11",
103
125
  "react-dom": "^17.0.2",
104
126
  "stylelint": "^14.3.0",
127
+ "ts-jest": "^28.0.7",
105
128
  "typescript": "^4.5.5"
106
129
  },
107
130
  "peerDependencies": {
@@ -1,47 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
- import './InfoViewer.scss';
5
-
6
- const b = cn('info-viewer');
7
-
8
- class InfoViewer extends React.Component {
9
- render() {
10
- const {info, className, title} = this.props;
11
-
12
- return (
13
- <div className={`${b()} ${className}`}>
14
- {title && <div className={b('title')}>{title}</div>}
15
- {info && info.length > 0 ? (
16
- <div className={b('items')}>
17
- {info.map((data, infoIndex) => (
18
- <div className={b('row')} key={infoIndex}>
19
- <div className={b('label')}>
20
- {data.label}
21
- <div className={b('dots')}></div>
22
- </div>
23
-
24
- <div className={b('value')}>{data.value}</div>
25
- </div>
26
- ))}
27
- </div>
28
- ) : (
29
- <div>no {title} data</div>
30
- )}
31
- </div>
32
- );
33
- }
34
- }
35
-
36
- InfoViewer.propTypes = {
37
- className: PropTypes.string,
38
- info: PropTypes.array.isRequired,
39
- title: PropTypes.string,
40
- dots: PropTypes.bool,
41
- };
42
-
43
- InfoViewer.defaultProps = {
44
- className: '',
45
- };
46
-
47
- export default InfoViewer;
@@ -1,5 +0,0 @@
1
- describe('Fake tests', () => {
2
- it('A fake test', () => {
3
- expect(true).toBe(true);
4
- });
5
- });