ydb-embedded-ui 4.16.2 → 4.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/components/CircularProgressBar/CircularProgressBar.scss +42 -0
  3. package/dist/components/CircularProgressBar/CircularProgressBar.tsx +59 -0
  4. package/dist/components/DiagnosticCard/DiagnosticCard.scss +20 -3
  5. package/dist/components/DiagnosticCard/DiagnosticCard.tsx +5 -6
  6. package/dist/components/FullNodeViewer/FullNodeViewer.tsx +2 -2
  7. package/dist/components/InfoViewer/formatters/common.ts +1 -1
  8. package/dist/components/InfoViewer/formatters/pqGroup.ts +1 -1
  9. package/dist/components/InfoViewer/formatters/table.ts +6 -1
  10. package/dist/components/ProgressViewer/ProgressViewer.tsx +99 -0
  11. package/dist/components/TooltipsContent/TabletTooltipContent/TabletTooltipContent.tsx +1 -1
  12. package/dist/containers/AsideNavigation/AsideNavigation.tsx +3 -1
  13. package/dist/containers/Authentication/Authentication.tsx +14 -4
  14. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +2 -2
  15. package/dist/containers/Heatmap/Heatmap.tsx +1 -1
  16. package/dist/containers/Heatmap/Histogram/Histogram.js +1 -1
  17. package/dist/containers/Node/NodeStructure/Pdisk.tsx +2 -2
  18. package/dist/containers/Node/NodeStructure/Vdisk.tsx +5 -2
  19. package/dist/containers/Nodes/getNodesColumns.tsx +2 -2
  20. package/dist/containers/Storage/PDisk/PDisk.tsx +1 -1
  21. package/dist/containers/Storage/PDiskPopup/PDiskPopup.tsx +1 -1
  22. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +1 -1
  23. package/dist/containers/Storage/VDisk/VDisk.tsx +1 -1
  24. package/dist/containers/Storage/VDiskPopup/VDiskPopup.tsx +1 -1
  25. package/dist/containers/Tablet/TabletInfo/TabletInfo.tsx +1 -1
  26. package/dist/containers/Tablet/TabletTable/TabletTable.tsx +1 -1
  27. package/dist/containers/Tenant/Diagnostics/Consumers/TopicStats/ConsumersTopicStats.tsx +1 -1
  28. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.tsx +1 -1
  29. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -5
  30. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +40 -17
  31. package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Details/Details.tsx +3 -3
  32. package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Healthcheck.scss +27 -14
  33. package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Healthcheck.tsx +6 -6
  34. package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Preview/Preview.tsx +15 -16
  35. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +1 -1
  36. package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.tsx +1 -1
  37. package/dist/containers/Tenant/Diagnostics/Partitions/columns/columns.tsx +1 -1
  38. package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/Healthcheck.scss +108 -0
  39. package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckDetails.tsx +45 -0
  40. package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckPreview.tsx +83 -0
  41. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTree.scss +1 -3
  42. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTree.tsx +1 -1
  43. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/IssueTreeItem.tsx +1 -1
  44. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/en.json +2 -1
  45. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/index.ts +1 -1
  46. package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/ru.json +2 -1
  47. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.scss +52 -0
  48. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.tsx +48 -0
  49. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.scss +12 -0
  50. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.tsx +134 -0
  51. package/dist/containers/Tenant/Diagnostics/TenantOverview/OldTenantOverview.tsx +155 -0
  52. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.scss +3 -5
  53. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +76 -86
  54. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +3 -1
  55. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/ru.json +3 -1
  56. package/dist/containers/Tenant/Diagnostics/TenantOverview/useHealthcheck.ts +53 -0
  57. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +1 -1
  58. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.tsx +1 -1
  59. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +1 -1
  60. package/dist/containers/Tenant/TenantPages.tsx +1 -0
  61. package/dist/containers/Tenants/Tenants.tsx +5 -1
  62. package/dist/containers/UserSettings/i18n/en.json +4 -1
  63. package/dist/containers/UserSettings/i18n/ru.json +4 -1
  64. package/dist/containers/UserSettings/settings.ts +7 -0
  65. package/dist/containers/Versions/NodesTable/NodesTable.tsx +2 -2
  66. package/dist/services/api.ts +6 -4
  67. package/dist/store/reducers/clusterNodes/clusterNodes.tsx +1 -1
  68. package/dist/store/reducers/healthcheckInfo.ts +20 -12
  69. package/dist/store/reducers/node/selectors.ts +1 -1
  70. package/dist/store/reducers/nodes/selectors.ts +1 -1
  71. package/dist/store/reducers/nodes/types.ts +1 -1
  72. package/dist/store/reducers/nodes/utils.ts +1 -1
  73. package/dist/store/reducers/settings/settings.ts +6 -1
  74. package/dist/store/reducers/storage/types.ts +1 -1
  75. package/dist/store/reducers/storage/utils.ts +1 -1
  76. package/dist/store/reducers/tenant/constants.ts +7 -0
  77. package/dist/store/reducers/tenant/tenant.ts +15 -0
  78. package/dist/store/reducers/tenant/types.ts +5 -0
  79. package/dist/store/reducers/tenants/contants.ts +6 -0
  80. package/dist/store/reducers/tenants/types.ts +4 -0
  81. package/dist/store/reducers/tenants/utils.ts +114 -7
  82. package/dist/store/state-url-mapping.js +3 -0
  83. package/dist/styles/constants.scss +2 -0
  84. package/dist/types/api/tenant.ts +3 -0
  85. package/dist/types/api/vdisk.ts +1 -1
  86. package/dist/utils/bytesParsers/formatBytes.ts +1 -1
  87. package/dist/utils/constants.ts +2 -0
  88. package/dist/utils/dataFormatters/dataFormatters.ts +128 -0
  89. package/dist/utils/dataFormatters/i18n/en.json +3 -0
  90. package/dist/utils/dataFormatters/i18n/index.ts +11 -0
  91. package/dist/utils/dataFormatters/i18n/ru.json +3 -0
  92. package/dist/utils/index.js +0 -102
  93. package/package.json +1 -1
  94. package/dist/components/ProgressViewer/ProgressViewer.js +0 -92
  95. /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Details/index.ts +0 -0
  96. /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Preview/index.ts +0 -0
  97. /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/index.ts +0 -0
  98. /package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/IssueTreeItem.scss +0 -0
  99. /package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/index.ts +0 -0
@@ -88,6 +88,8 @@ export const LANGUAGE_KEY = 'language';
88
88
  export const INVERTED_DISKS_KEY = 'invertedDisks';
89
89
  export const USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY = 'useNodesEndpointInDiagnostics';
90
90
  export const ENABLE_ADDITIONAL_QUERY_MODES = 'enableAdditionalQueryModes';
91
+ // Remain key name "enableNewTenantDiagnosticsDesign" for backward compatibility
92
+ export const DISPLAY_METRICS_CARDS_FOR_TENANT_DIAGNOSTICS = 'enableNewTenantDiagnosticsDesign';
91
93
  export const SAVED_QUERIES_KEY = 'saved_queries';
92
94
  export const ASIDE_HEADER_COMPACT_KEY = 'asideHeaderCompact';
93
95
  export const QUERIES_HISTORY_KEY = 'queries_history';
@@ -0,0 +1,128 @@
1
+ import {dateTimeParse} from '@gravity-ui/date-utils';
2
+
3
+ import type {TVDiskID, TVSlotId} from '../../types/api/vdisk';
4
+ import {DAY_IN_SECONDS, GIGABYTE, TERABYTE} from '../constants';
5
+ import {configuredNumeral} from '../numeral';
6
+ import {isNumeric} from '../utils';
7
+
8
+ import i18n from './i18n';
9
+
10
+ // Here you can't control displayed size and precision
11
+ // If you need more custom format, use formatBytesCustom instead
12
+ export const formatBytes = (bytes?: string | number) => {
13
+ if (!isNumeric(bytes)) {
14
+ return '';
15
+ }
16
+
17
+ // by agreement, display byte values in decimal scale
18
+ return configuredNumeral(bytes).format('0 b');
19
+ };
20
+
21
+ export const formatBps = (bytes?: string | number) => {
22
+ const formattedBytes = formatBytes(bytes);
23
+
24
+ if (!formattedBytes) {
25
+ return '';
26
+ }
27
+
28
+ return formattedBytes + '/s';
29
+ };
30
+
31
+ export const formatBytesToGigabyte = (bytes: number | string) => {
32
+ return `${Math.floor(Number(bytes) / GIGABYTE)} GB`;
33
+ };
34
+
35
+ export const stringifyVdiskId = (id?: TVDiskID | TVSlotId) => {
36
+ return id ? Object.values(id).join('-') : '';
37
+ };
38
+
39
+ export const getPDiskId = (info: {NodeId?: number; PDiskId?: number}) => {
40
+ return info.NodeId && info.PDiskId ? `${info.NodeId}-${info.PDiskId}` : undefined;
41
+ };
42
+
43
+ export const formatUptime = (seconds: number) => {
44
+ const days = Math.floor(seconds / DAY_IN_SECONDS);
45
+ const remain = seconds % DAY_IN_SECONDS;
46
+
47
+ const uptime = [days && `${days}d`, configuredNumeral(remain).format('00:00:00')]
48
+ .filter(Boolean)
49
+ .join(' ');
50
+
51
+ return uptime;
52
+ };
53
+
54
+ export const formatMsToUptime = (ms?: number) => {
55
+ return ms && formatUptime(ms / 1000);
56
+ };
57
+
58
+ export const formatStorageValues = (value?: number, total?: number) => {
59
+ return [
60
+ value ? String(Math.floor(value / TERABYTE)) : undefined,
61
+ total ? `${Math.floor(total / TERABYTE)} TB` : undefined,
62
+ ];
63
+ };
64
+ export const formatStorageValuesToGb = (value?: number, total?: number): (string | undefined)[] => {
65
+ return [
66
+ value ? String(Math.floor(value / 1000000000)) : undefined,
67
+ total ? `${Math.floor(total / 1000000000)} GB` : undefined,
68
+ ];
69
+ };
70
+
71
+ export const formatNumber = (number?: unknown) => {
72
+ if (!isNumeric(number)) {
73
+ return '';
74
+ }
75
+
76
+ return configuredNumeral(number).format();
77
+ };
78
+
79
+ const normalizeCPU = (value: number | string) => {
80
+ const rawCores = Number(value) / 1000000;
81
+ let cores = rawCores.toPrecision(3);
82
+ if (rawCores >= 1000) {
83
+ cores = rawCores.toFixed();
84
+ }
85
+ if (rawCores < 0.001) {
86
+ cores = '0';
87
+ }
88
+
89
+ return Number(cores);
90
+ };
91
+
92
+ export const formatCPU = (value?: number | string) => {
93
+ if (value === undefined) {
94
+ return undefined;
95
+ }
96
+
97
+ return configuredNumeral(normalizeCPU(value)).format('0.[000]');
98
+ };
99
+
100
+ export const formatCPUWithLabel = (value?: number) => {
101
+ if (value === undefined) {
102
+ return undefined;
103
+ }
104
+ const cores = normalizeCPU(value);
105
+ const localizedCores = configuredNumeral(cores).format('0.[000]');
106
+
107
+ return `${localizedCores} ${i18n('format-cpu.cores', {count: cores})}`;
108
+ };
109
+
110
+ export const formatDateTime = (value?: number | string) => {
111
+ if (!isNumeric(value)) {
112
+ return '';
113
+ }
114
+
115
+ const formattedData = dateTimeParse(Number(value))?.format('YYYY-MM-DD HH:mm');
116
+
117
+ return Number(value) > 0 && formattedData ? formattedData : 'N/A';
118
+ };
119
+
120
+ export const calcUptimeInSeconds = (milliseconds: number | string) => {
121
+ const currentDate = new Date();
122
+ const diff = currentDate.getTime() - Number(milliseconds);
123
+ return diff <= 0 ? 0 : diff / 1000;
124
+ };
125
+
126
+ export const calcUptime = (milliseconds?: number | string) => {
127
+ return formatUptime(calcUptimeInSeconds(Number(milliseconds)));
128
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "format-cpu.cores": ["core", "cores", "cores", "cores"]
3
+ }
@@ -0,0 +1,11 @@
1
+ import {i18n, Lang} from '../../i18n';
2
+
3
+ import en from './en.json';
4
+ import ru from './ru.json';
5
+
6
+ const COMPONENT = 'ydb-format-cpu';
7
+
8
+ i18n.registerKeyset(Lang.En, COMPONENT, en);
9
+ i18n.registerKeyset(Lang.Ru, COMPONENT, ru);
10
+
11
+ export default i18n.keyset(COMPONENT);
@@ -0,0 +1,3 @@
1
+ {
2
+ "format-cpu.cores": ["ядро", "ядра", "ядер", "ядер"]
3
+ }
@@ -1,105 +1,3 @@
1
- import {dateTimeParse} from '@gravity-ui/date-utils';
2
-
3
- import {MEGABYTE, TERABYTE, GIGABYTE, DAY_IN_SECONDS} from './constants';
4
- import {isNumeric} from './utils';
5
- import {configuredNumeral} from './numeral';
6
-
7
- // Here you can't control displayed size and precision
8
- // If you need more custom format, use formatBytesCustom instead
9
- export const formatBytes = (bytes) => {
10
- if (!isNumeric(bytes)) {
11
- return '';
12
- }
13
-
14
- // by agreement, display byte values in decimal scale
15
- return configuredNumeral(bytes).format('0 b');
16
- };
17
-
18
- export const formatBps = (bytes) => {
19
- const formattedBytes = formatBytes(bytes);
20
-
21
- if (!formattedBytes) {
22
- return '';
23
- }
24
-
25
- return formattedBytes + '/s';
26
- };
27
-
28
- export const formatBytesToGigabyte = (bytes) => {
29
- return `${Math.floor(bytes / GIGABYTE)} GB`;
30
- };
31
-
32
- export const stringifyVdiskId = (id) => {
33
- return Object.values(id).join('-');
34
- };
35
- export const getPDiskId = (info) => {
36
- return `${info.NodeId}-${info.PDiskId}`;
37
- };
38
-
39
- export const formatUptime = (seconds) => {
40
- const days = Math.floor(seconds / DAY_IN_SECONDS);
41
- const remain = seconds % DAY_IN_SECONDS;
42
-
43
- const uptime = [days && `${days}d`, configuredNumeral(remain).format('00:00:00')]
44
- .filter(Boolean)
45
- .join(' ');
46
-
47
- return uptime;
48
- };
49
-
50
- export const formatMsToUptime = (ms) => {
51
- return formatUptime(ms / 1000);
52
- };
53
-
54
- export const formatIOPS = (value, capacity) => {
55
- return [Math.floor(value), Math.floor(capacity) + ' IOPS'];
56
- };
57
-
58
- export const formatStorageValues = (value, total) => {
59
- return [Math.floor(value / TERABYTE), `${Math.floor(total / TERABYTE)} TB`];
60
- };
61
- export const formatStorageValuesToGb = (value, total) => {
62
- return [Math.floor(value / 1000000000), `${Math.floor(total / 1000000000)} GB`];
63
- };
64
-
65
- export const formatThroughput = (value, total) => {
66
- return [(value / MEGABYTE).toFixed(2), (total / MEGABYTE).toFixed(1) + ' MB/s'];
67
- };
68
-
69
- export const formatNumber = (number) => {
70
- if (!isNumeric(number)) {
71
- return '';
72
- }
73
-
74
- return configuredNumeral(number).format();
75
- };
76
-
77
- export const formatCPU = (value) => {
78
- if (!isNumeric(value)) {
79
- return '';
80
- }
81
-
82
- return configuredNumeral(value / 1000000).format('0.00');
83
- };
84
-
85
- export const formatDateTime = (value) => {
86
- if (!isNumeric(value)) {
87
- return '';
88
- }
89
-
90
- return value > 0 ? dateTimeParse(Number(value)).format('YYYY-MM-DD HH:mm') : 'N/A';
91
- };
92
-
93
- export const calcUptimeInSeconds = (milliseconds) => {
94
- const currentDate = new Date();
95
- const diff = currentDate - Number(milliseconds);
96
- return diff <= 0 ? 0 : diff / 1000;
97
- };
98
-
99
- export const calcUptime = (milliseconds) => {
100
- return formatUptime(calcUptimeInSeconds(milliseconds));
101
- };
102
-
103
1
  // determine how many nodes have status Connected "true"
104
2
  export const getConnectedNodesCount = (nodeStateInfo) => {
105
3
  return nodeStateInfo?.reduce((acc, item) => (item.Connected ? acc + 1 : acc), 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.16.2",
3
+ "version": "4.18.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,92 +0,0 @@
1
- import React from 'react';
2
- import cn from 'bem-cn-lite';
3
- import './ProgressViewer.scss';
4
- import PropTypes from 'prop-types';
5
- const b = cn('progress-viewer');
6
- /*
7
-
8
- Описание props:
9
- 1) value - величина прогресса
10
- 2) capacity - предельно возможный прогресс
11
- 3) formatValues - функция форматирования value и capacity
12
- 4) percents - отображать ли заполненость в виде процентов
13
- 5) className - кастомный класс
14
- 6) colorizeProgress - менять ли цвет полосы прогресса в зависимости от его величины
15
- 7) inverseColorize - инвертировать ли цвета при разукрашивании прогресса
16
- */
17
- export class ProgressViewer extends React.Component {
18
- static propTypes = {
19
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
20
- capacity: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
21
- formatValues: PropTypes.func,
22
- percents: PropTypes.bool,
23
- className: PropTypes.string,
24
- size: PropTypes.oneOf(['xs', 's', 'ns', 'm', 'n', 'l', 'head']),
25
- colorizeProgress: PropTypes.bool,
26
- inverseColorize: PropTypes.bool,
27
- };
28
-
29
- static defaultProps = {
30
- size: 'xs',
31
- colorizeProgress: false,
32
- capacity: 100,
33
- inverseColorize: false,
34
- };
35
-
36
- render() {
37
- const {
38
- value,
39
- capacity,
40
- formatValues,
41
- percents,
42
- size,
43
- className,
44
- colorizeProgress,
45
- inverseColorize,
46
- } = this.props;
47
-
48
- let fillWidth = Math.round((parseFloat(value) / parseFloat(capacity)) * 100);
49
- fillWidth = fillWidth > 100 ? 100 : fillWidth;
50
-
51
- let valueText = Math.round(value),
52
- capacityText = capacity,
53
- divider = '/';
54
- if (formatValues) {
55
- [valueText, capacityText] = formatValues(value, capacity);
56
- } else if (percents) {
57
- valueText = fillWidth + '%';
58
- capacityText = '';
59
- divider = '';
60
- }
61
-
62
- let bg = inverseColorize ? 'scarlet' : 'apple';
63
- if (colorizeProgress) {
64
- if (fillWidth > 60 && fillWidth <= 80) {
65
- bg = 'saffron';
66
- } else if (fillWidth > 80) {
67
- bg = inverseColorize ? 'apple' : 'scarlet';
68
- }
69
- }
70
-
71
- const lineStyle = {
72
- width: fillWidth + '%',
73
- };
74
-
75
- const text = fillWidth > 60 ? 'contrast0' : 'contrast70';
76
-
77
- if (!isNaN(fillWidth)) {
78
- return (
79
- <div className={b({size}, className)}>
80
- <div className={b('line', {bg})} style={lineStyle}></div>
81
- <span className={b('text', {text})}>
82
- {`${valueText} ${divider} ${capacityText}`}
83
- </span>
84
- </div>
85
- );
86
- }
87
-
88
- return <div className={`${b({size})} ${className} error`}>no data</div>;
89
- }
90
- }
91
-
92
- export default ProgressViewer;