ydb-embedded-ui 4.16.2 → 4.17.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +15 -0
- package/dist/components/CircularProgressBar/CircularProgressBar.scss +42 -0
- package/dist/components/CircularProgressBar/CircularProgressBar.tsx +59 -0
- package/dist/components/DiagnosticCard/DiagnosticCard.scss +20 -3
- package/dist/components/DiagnosticCard/DiagnosticCard.tsx +5 -6
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -5
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +40 -17
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Details/Details.tsx +3 -3
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Healthcheck.scss +27 -14
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Healthcheck.tsx +6 -6
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Preview/Preview.tsx +15 -16
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/Healthcheck.scss +108 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckDetails.tsx +45 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/Healthcheck/HealthcheckPreview.tsx +83 -0
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTree.scss +1 -3
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTree.tsx +1 -1
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/IssueTreeItem.tsx +1 -1
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/en.json +2 -1
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/index.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/i18n/ru.json +2 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.scss +52 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.tsx +48 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.scss +12 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.tsx +134 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/OldTenantOverview.tsx +155 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.scss +3 -5
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +76 -86
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +3 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/ru.json +3 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/useHealthcheck.ts +53 -0
- package/dist/containers/Tenant/TenantPages.tsx +1 -0
- package/dist/containers/UserSettings/i18n/en.json +4 -1
- package/dist/containers/UserSettings/i18n/ru.json +4 -1
- package/dist/containers/UserSettings/settings.ts +7 -0
- package/dist/services/api.ts +6 -4
- package/dist/store/reducers/healthcheckInfo.ts +20 -12
- package/dist/store/reducers/settings/settings.ts +5 -0
- package/dist/store/reducers/tenant/constants.ts +7 -0
- package/dist/store/reducers/tenant/tenant.ts +15 -0
- package/dist/store/reducers/tenant/types.ts +5 -0
- package/dist/store/reducers/tenants/contants.ts +6 -0
- package/dist/store/reducers/tenants/types.ts +4 -0
- package/dist/store/reducers/tenants/utils.ts +114 -7
- package/dist/store/state-url-mapping.js +3 -0
- package/dist/styles/constants.scss +2 -0
- package/dist/types/api/tenant.ts +3 -0
- package/dist/utils/constants.ts +1 -0
- package/dist/utils/formatCPU/formatCPU.ts +20 -0
- package/dist/utils/formatCPU/i18n/en.json +3 -0
- package/dist/utils/formatCPU/i18n/index.ts +11 -0
- package/dist/utils/formatCPU/i18n/ru.json +3 -0
- package/package.json +1 -1
- /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Details/index.ts +0 -0
- /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/Preview/index.ts +0 -0
- /package/dist/containers/Tenant/Diagnostics/{Healthcheck → OldHealthcheck}/index.ts +0 -0
- /package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/IssueTreeItem.scss +0 -0
- /package/dist/containers/Tenant/Diagnostics/{Healthcheck → TenantOverview/Healthcheck}/IssuesViewer/IssueTreeItem/index.ts +0 -0
@@ -1,5 +1,8 @@
|
|
1
1
|
import type {TTenant} from '../../../types/api/tenant';
|
2
|
+
import {formatBytes} from '../../../utils/bytesParsers';
|
3
|
+
import {formatCPU} from '../../../utils/formatCPU/formatCPU';
|
2
4
|
import {isNumeric} from '../../../utils/utils';
|
5
|
+
import {METRIC_STATUS} from './contants';
|
3
6
|
|
4
7
|
const getControlPlaneValue = (tenant: TTenant) => {
|
5
8
|
const parts = tenant.Name?.split('/');
|
@@ -18,21 +21,40 @@ const getTenantBackend = (tenant: TTenant) => {
|
|
18
21
|
return node.Host ? `${node.Host}${address ? address : ''}` : undefined;
|
19
22
|
};
|
20
23
|
|
21
|
-
const calculateTenantMetrics = (tenant
|
22
|
-
const {
|
24
|
+
export const calculateTenantMetrics = (tenant?: TTenant) => {
|
25
|
+
const {
|
26
|
+
CoresUsed,
|
27
|
+
MemoryUsed,
|
28
|
+
StorageAllocatedSize,
|
29
|
+
CoresLimit,
|
30
|
+
MemoryLimit,
|
31
|
+
StorageLimit,
|
32
|
+
Metrics = {},
|
33
|
+
} = tenant || {};
|
23
34
|
|
24
35
|
const cpuFromCores = isNumeric(CoresUsed) ? Number(CoresUsed) * 1_000_000 : undefined;
|
25
36
|
const cpuFromMetrics = isNumeric(Metrics.CPU) ? Number(Metrics.CPU) : undefined;
|
26
37
|
|
27
|
-
const cpu = cpuFromCores ?? cpuFromMetrics ??
|
38
|
+
const cpu = cpuFromCores ?? cpuFromMetrics ?? undefined;
|
28
39
|
|
29
40
|
const rawMemory = MemoryUsed ?? Metrics.Memory;
|
30
|
-
const rawStorage = StorageAllocatedSize ?? Metrics.Storage;
|
31
41
|
|
32
|
-
const memory = isNumeric(rawMemory) ? Number(rawMemory) :
|
33
|
-
const storage = isNumeric(rawStorage) ? Number(rawStorage) : 0;
|
42
|
+
const memory = isNumeric(rawMemory) ? Number(rawMemory) : undefined;
|
34
43
|
|
35
|
-
|
44
|
+
// Blob storage - actual database size
|
45
|
+
const storage = isNumeric(StorageAllocatedSize) ? Number(StorageAllocatedSize) : undefined;
|
46
|
+
const cpuLimit = isNumeric(CoresLimit) ? Number(CoresLimit) : undefined;
|
47
|
+
const memoryLimit = isNumeric(MemoryLimit) ? Number(MemoryLimit) : undefined;
|
48
|
+
const storageLimit = isNumeric(StorageLimit) ? Number(StorageLimit) : undefined;
|
49
|
+
|
50
|
+
return {
|
51
|
+
cpu,
|
52
|
+
memory,
|
53
|
+
storage,
|
54
|
+
cpuLimit,
|
55
|
+
memoryLimit,
|
56
|
+
storageLimit,
|
57
|
+
};
|
36
58
|
};
|
37
59
|
|
38
60
|
const calculateTenantEntities = (tenant: TTenant) => {
|
@@ -66,3 +88,88 @@ export const prepareTenants = (tenants: TTenant[], useNodeAsBackend: boolean) =>
|
|
66
88
|
};
|
67
89
|
});
|
68
90
|
};
|
91
|
+
|
92
|
+
export const calculateUsage = (valueUsed?: number, valueLimit?: number): number | undefined => {
|
93
|
+
if (valueUsed && valueLimit) {
|
94
|
+
return (valueUsed * 100) / valueLimit;
|
95
|
+
}
|
96
|
+
|
97
|
+
return undefined;
|
98
|
+
};
|
99
|
+
|
100
|
+
export const formatUsage = (usage?: number) => {
|
101
|
+
if (usage) {
|
102
|
+
return `${usage.toFixed()}%`;
|
103
|
+
}
|
104
|
+
|
105
|
+
return undefined;
|
106
|
+
};
|
107
|
+
|
108
|
+
export const cpuUsageToStatus = (usage?: number) => {
|
109
|
+
if (!usage) {
|
110
|
+
return METRIC_STATUS.Unspecified;
|
111
|
+
}
|
112
|
+
|
113
|
+
if (usage > 70) {
|
114
|
+
return METRIC_STATUS.Danger;
|
115
|
+
}
|
116
|
+
if (usage > 60) {
|
117
|
+
return METRIC_STATUS.Warning;
|
118
|
+
}
|
119
|
+
|
120
|
+
return METRIC_STATUS.Good;
|
121
|
+
};
|
122
|
+
export const storageUsageToStatus = (usage?: number) => {
|
123
|
+
if (!usage) {
|
124
|
+
return METRIC_STATUS.Unspecified;
|
125
|
+
}
|
126
|
+
|
127
|
+
if (usage > 85) {
|
128
|
+
return METRIC_STATUS.Danger;
|
129
|
+
}
|
130
|
+
if (usage > 75) {
|
131
|
+
return METRIC_STATUS.Warning;
|
132
|
+
}
|
133
|
+
|
134
|
+
return METRIC_STATUS.Good;
|
135
|
+
};
|
136
|
+
|
137
|
+
export const memoryUsageToStatus = (usage?: number) => {
|
138
|
+
if (!usage) {
|
139
|
+
return METRIC_STATUS.Unspecified;
|
140
|
+
}
|
141
|
+
|
142
|
+
if (usage > 70) {
|
143
|
+
return METRIC_STATUS.Danger;
|
144
|
+
}
|
145
|
+
if (usage > 60) {
|
146
|
+
return METRIC_STATUS.Warning;
|
147
|
+
}
|
148
|
+
|
149
|
+
return METRIC_STATUS.Good;
|
150
|
+
};
|
151
|
+
|
152
|
+
export const formatTenantMetrics = ({
|
153
|
+
cpu,
|
154
|
+
storage,
|
155
|
+
memory,
|
156
|
+
}: {
|
157
|
+
cpu?: number;
|
158
|
+
storage?: number;
|
159
|
+
memory?: number;
|
160
|
+
}) => ({
|
161
|
+
cpu: formatCPU(cpu),
|
162
|
+
storage: formatBytes({value: storage, significantDigits: 2}) || undefined,
|
163
|
+
memory: formatBytes({value: memory, significantDigits: 2}) || undefined,
|
164
|
+
});
|
165
|
+
|
166
|
+
export const normalizeProgress = (progress: number) => {
|
167
|
+
if (progress >= 100) {
|
168
|
+
return 100;
|
169
|
+
}
|
170
|
+
if (progress <= 0) {
|
171
|
+
return 0;
|
172
|
+
}
|
173
|
+
|
174
|
+
return progress;
|
175
|
+
};
|
package/dist/types/api/tenant.ts
CHANGED
@@ -57,6 +57,9 @@ export interface TTenant {
|
|
57
57
|
|
58
58
|
MonitoringEndpoint?: string; // additional
|
59
59
|
ControlPlane?: ControlPlane; // additional
|
60
|
+
|
61
|
+
CoresLimit?: string; // TODO: check correctness in backend protos when fully supported
|
62
|
+
StorageLimit?: string; // TODO: check correctness in backend protos when fully supported
|
60
63
|
}
|
61
64
|
|
62
65
|
interface THiveDomainStatsStateCount {
|
package/dist/utils/constants.ts
CHANGED
@@ -88,6 +88,7 @@ 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
|
+
export const ENABLE_NEW_TENANT_DIAGNOSTICS_DESIGN = 'enableNewTenantDiagnosticsDesign';
|
91
92
|
export const SAVED_QUERIES_KEY = 'saved_queries';
|
92
93
|
export const ASIDE_HEADER_COMPACT_KEY = 'asideHeaderCompact';
|
93
94
|
export const QUERIES_HISTORY_KEY = 'queries_history';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import {configuredNumeral} from '../numeral';
|
2
|
+
import i18n from './i18n';
|
3
|
+
|
4
|
+
export const formatCPU = (value?: number) => {
|
5
|
+
if (value === undefined) {
|
6
|
+
return undefined;
|
7
|
+
}
|
8
|
+
|
9
|
+
const rawCores = value / 1000000;
|
10
|
+
let cores = rawCores.toPrecision(3);
|
11
|
+
if (rawCores >= 1000) {
|
12
|
+
cores = rawCores.toFixed();
|
13
|
+
}
|
14
|
+
if (rawCores < 0.001) {
|
15
|
+
cores = '0';
|
16
|
+
}
|
17
|
+
const localizedCores = configuredNumeral(Number(cores)).format('0.[000]');
|
18
|
+
|
19
|
+
return `${localizedCores} ${i18n('cores', {count: cores})}`;
|
20
|
+
};
|
@@ -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);
|
package/package.json
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|