ydb-embedded-ui 1.10.2 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/components/IndexInfoViewer/IndexInfoViewer.tsx +2 -2
- package/dist/components/InfoViewer/InfoViewer.scss +32 -7
- package/dist/components/InfoViewer/InfoViewer.tsx +43 -0
- package/dist/components/InfoViewer/index.ts +1 -0
- package/dist/components/InfoViewer/utils.ts +6 -4
- package/dist/components/Stack/Stack.scss +55 -0
- package/dist/components/Stack/Stack.tsx +35 -0
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +2 -0
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.tsx +5 -0
- package/dist/containers/Storage/Pdisk/Pdisk.scss +2 -19
- package/dist/containers/Storage/Pdisk/Pdisk.tsx +30 -33
- package/dist/containers/Storage/Pdisk/__tests__/colors.tsx +40 -0
- package/dist/containers/Storage/StorageGroups/StorageGroups.scss +25 -3
- package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +39 -9
- package/dist/containers/Storage/Vdisk/Vdisk.js +63 -64
- package/dist/containers/Storage/Vdisk/Vdisk.scss +9 -28
- package/dist/containers/Storage/Vdisk/__tests__/colors.tsx +163 -0
- package/dist/containers/Storage/utils/index.ts +5 -0
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +3 -3
- package/dist/setupTests.js +8 -0
- package/dist/types/api/schema.ts +6 -14
- package/dist/types/api/storage.ts +118 -0
- package/dist/types/index.ts +1 -0
- package/dist/utils/index.js +22 -2
- package/package.json +28 -5
- package/dist/components/InfoViewer/InfoViewer.js +0 -47
- package/dist/index.test.js +0 -5
package/dist/utils/index.js
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
import numeral from 'numeral';
|
2
|
+
import locales from 'numeral/locales'; // eslint-disable-line no-unused-vars
|
2
3
|
import _ from 'lodash';
|
3
4
|
|
4
5
|
import {i18n} from './i18n';
|
5
6
|
import {MEGABYTE, TERABYTE, DAY_IN_SECONDS, GIGABYTE} from './constants';
|
6
|
-
|
7
|
-
import locales from 'numeral/locales'; // eslint-disable-line no-unused-vars
|
7
|
+
import {isNumeric} from './utils';
|
8
8
|
|
9
9
|
numeral.locale(i18n.lang);
|
10
10
|
|
11
11
|
export const formatBytes = (bytes) => {
|
12
|
+
if (!isNumeric(bytes)) {
|
13
|
+
return '';
|
14
|
+
}
|
15
|
+
|
12
16
|
// by agreement, display byte values in decimal scale
|
13
17
|
return numeral(bytes).format('0 b');
|
14
18
|
};
|
@@ -53,13 +57,29 @@ export const formatThroughput = (value, total) => {
|
|
53
57
|
};
|
54
58
|
|
55
59
|
export const formatNumber = (number) => {
|
60
|
+
if (!isNumeric(number)) {
|
61
|
+
return '';
|
62
|
+
}
|
63
|
+
|
56
64
|
return numeral(number).format();
|
57
65
|
};
|
58
66
|
|
59
67
|
export const formatCPU = (value) => {
|
68
|
+
if (!isNumeric(value)) {
|
69
|
+
return '';
|
70
|
+
}
|
71
|
+
|
60
72
|
return numeral(value / 1000000).format('0.00');
|
61
73
|
};
|
62
74
|
|
75
|
+
export const formatDateTime = (value) => {
|
76
|
+
if (!isNumeric(value)) {
|
77
|
+
return '';
|
78
|
+
}
|
79
|
+
|
80
|
+
return value > 0 ? new Date(Number(value)).toUTCString() : 'N/A';
|
81
|
+
};
|
82
|
+
|
63
83
|
export const calcUptime = (milliseconds) => {
|
64
84
|
const currentDate = new Date();
|
65
85
|
return formatUptime((currentDate - Number(milliseconds)) / 1000);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ydb-embedded-ui",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.11.1",
|
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;
|