ydb-embedded-ui 5.0.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. package/dist/components/BasicNodeViewer/BasicNodeViewer.d.ts +2 -2
  2. package/dist/components/BasicNodeViewer/BasicNodeViewer.js +1 -1
  3. package/dist/components/ComponentsProvider/ComponentsProvider.d.ts +4 -0
  4. package/dist/components/ComponentsProvider/componentsRegistry.d.ts +3 -0
  5. package/dist/components/ComponentsProvider/componentsRegistry.js +3 -1
  6. package/dist/components/EntityStatus/EntityStatus.scss +1 -1
  7. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +11 -1
  8. package/dist/components/ErrorBoundary/ErrorBoundary.js +11 -3
  9. package/dist/components/FullNodeViewer/FullNodeViewer.d.ts +2 -2
  10. package/dist/components/FullNodeViewer/FullNodeViewer.js +1 -1
  11. package/dist/components/LagImages/LagImages.js +2 -2
  12. package/dist/components/ProgressViewer/ProgressViewer.js +6 -5
  13. package/dist/components/ProgressViewer/ProgressViewer.scss +33 -17
  14. package/dist/components/TabletsOverall/TabletsOverall.js +6 -6
  15. package/dist/containers/App/App.js +2 -1
  16. package/dist/containers/App/Content.js +6 -12
  17. package/dist/containers/App/Providers.js +2 -1
  18. package/dist/containers/App/appSlots.d.ts +7 -7
  19. package/dist/containers/AppIcons/AppIcons.js +1 -1
  20. package/dist/containers/Cluster/Cluster.js +45 -27
  21. package/dist/containers/Cluster/Cluster.scss +15 -0
  22. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +4 -18
  23. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +0 -40
  24. package/dist/containers/Cluster/utils.d.ts +6 -1
  25. package/dist/containers/Cluster/utils.js +11 -3
  26. package/dist/containers/ClusterModeGuard/ClusterModeGuard.d.ts +6 -0
  27. package/dist/containers/ClusterModeGuard/ClusterModeGuard.js +6 -0
  28. package/dist/containers/ClusterModeGuard/index.d.ts +1 -0
  29. package/dist/containers/ClusterModeGuard/index.js +1 -0
  30. package/dist/containers/Clusters/Clusters.js +4 -3
  31. package/dist/containers/Clusters/columns.js +1 -1
  32. package/dist/containers/Clusters/constants.d.ts +1 -1
  33. package/dist/containers/Clusters/i18n/en.json +2 -1
  34. package/dist/containers/Clusters/i18n/index.d.ts +1 -1
  35. package/dist/containers/Clusters/i18n/index.js +2 -4
  36. package/dist/containers/Clusters/i18n/ru.json +2 -1
  37. package/dist/containers/Node/Node.js +11 -13
  38. package/dist/containers/Node/NodePages.js +4 -1
  39. package/dist/containers/Node/i18n/index.d.ts +1 -1
  40. package/dist/containers/Node/i18n/index.js +2 -4
  41. package/dist/containers/Nodes/getNodesColumns.js +2 -1
  42. package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +1 -1
  43. package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.d.ts +1 -1
  44. package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.js +2 -1
  45. package/dist/containers/Tablet/Tablet.js +24 -20
  46. package/dist/containers/Tablet/i18n/index.d.ts +1 -1
  47. package/dist/containers/Tablet/i18n/index.js +2 -4
  48. package/dist/containers/TabletsFilters/TabletsFilters.d.ts +2 -0
  49. package/dist/containers/TabletsFilters/TabletsFilters.js +25 -19
  50. package/dist/containers/TabletsFilters/i18n/en.json +3 -0
  51. package/dist/containers/TabletsFilters/i18n/index.d.ts +2 -0
  52. package/dist/containers/TabletsFilters/i18n/index.js +5 -0
  53. package/dist/containers/TabletsFilters/i18n/ru.json +3 -0
  54. package/dist/containers/Tenant/Diagnostics/Diagnostics.js +12 -11
  55. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.d.ts +19 -0
  56. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.js +2 -1
  57. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.d.ts +7 -25
  58. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +88 -92
  59. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.scss +1 -33
  60. package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/en.json +4 -0
  61. package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/index.d.ts +2 -0
  62. package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/index.js +5 -0
  63. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.js +4 -1
  64. package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.js +3 -4
  65. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +12 -5
  66. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.d.ts +2 -2
  67. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.js +7 -10
  68. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +7 -5
  69. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.js +0 -2
  70. package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.js +10 -0
  71. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.d.ts +1 -1
  72. package/dist/containers/Tenant/Query/Query.d.ts +2 -2
  73. package/dist/containers/Tenant/Query/Query.js +5 -2
  74. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +29 -31
  75. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +150 -167
  76. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +2 -2
  77. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +3 -3
  78. package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.d.ts +10 -0
  79. package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.js +1 -1
  80. package/dist/containers/Tenant/Query/utils/getPreparedResult.d.ts +1 -1
  81. package/dist/containers/Tenant/Query/utils/getPreparedResult.js +18 -16
  82. package/dist/containers/Tenant/Tenant.js +4 -1
  83. package/dist/containers/Tenant/i18n/en.json +1 -0
  84. package/dist/containers/Tenant/i18n/index.d.ts +1 -1
  85. package/dist/containers/Tenant/i18n/index.js +2 -4
  86. package/dist/containers/Tenant/i18n/ru.json +1 -0
  87. package/dist/containers/UserSettings/Setting.d.ts +2 -1
  88. package/dist/containers/UserSettings/Setting.js +2 -2
  89. package/dist/containers/UserSettings/i18n/en.json +2 -0
  90. package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
  91. package/dist/containers/UserSettings/i18n/index.js +2 -6
  92. package/dist/containers/UserSettings/settings.d.ts +1 -0
  93. package/dist/containers/UserSettings/settings.js +9 -2
  94. package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +1 -1
  95. package/dist/lib.d.ts +2 -1
  96. package/dist/lib.js +2 -1
  97. package/dist/routes.d.ts +5 -0
  98. package/dist/routes.js +4 -0
  99. package/dist/services/api.d.ts +2 -1
  100. package/dist/services/api.js +10 -3
  101. package/dist/services/settings.d.ts +0 -1
  102. package/dist/services/settings.js +2 -14
  103. package/dist/store/index.d.ts +1 -1
  104. package/dist/store/reducers/cluster/cluster.d.ts +8 -2
  105. package/dist/store/reducers/cluster/cluster.js +29 -1
  106. package/dist/store/reducers/cluster/types.d.ts +4 -2
  107. package/dist/store/reducers/executeQuery.d.ts +1 -10
  108. package/dist/store/reducers/executeQuery.js +26 -29
  109. package/dist/store/reducers/executeTopQueries/executeTopQueries.js +2 -1
  110. package/dist/store/reducers/executeTopQueries/utils.js +7 -4
  111. package/dist/store/reducers/hotKeys/hotKeys.d.ts +25 -0
  112. package/dist/store/reducers/hotKeys/hotKeys.js +49 -0
  113. package/dist/store/reducers/hotKeys/types.d.ts +10 -0
  114. package/dist/store/reducers/hotKeys/types.js +1 -0
  115. package/dist/store/reducers/index.d.ts +2 -6
  116. package/dist/store/reducers/index.js +1 -1
  117. package/dist/store/reducers/node/node.d.ts +1 -1
  118. package/dist/store/reducers/node/node.js +2 -0
  119. package/dist/store/reducers/node/selectors.js +1 -1
  120. package/dist/store/reducers/node/types.d.ts +7 -3
  121. package/dist/store/reducers/node/utils.d.ts +3 -0
  122. package/dist/store/reducers/node/utils.js +8 -0
  123. package/dist/store/reducers/nodes/types.d.ts +1 -1
  124. package/dist/store/reducers/nodes/utils.js +3 -3
  125. package/dist/store/reducers/storage/types.d.ts +2 -0
  126. package/dist/store/reducers/storage/utils.js +3 -3
  127. package/dist/store/reducers/tenants/utils.d.ts +4 -3
  128. package/dist/store/reducers/tenants/utils.js +17 -12
  129. package/dist/store/reducers/tooltip.d.ts +1 -1
  130. package/dist/types/api/hotkeys.d.ts +7 -0
  131. package/dist/types/api/hotkeys.js +1 -0
  132. package/dist/types/api/nodes.d.ts +2 -1
  133. package/dist/types/store/executeQuery.d.ts +3 -6
  134. package/dist/types/store/explainQuery.d.ts +1 -0
  135. package/dist/utils/constants.d.ts +2 -1
  136. package/dist/utils/constants.js +2 -1
  137. package/dist/utils/diagnostics.d.ts +1 -0
  138. package/dist/utils/diagnostics.js +1 -0
  139. package/dist/utils/i18n/i18n.d.ts +2 -1
  140. package/dist/utils/i18n/i18n.js +15 -2
  141. package/dist/utils/monitoring.js +1 -3
  142. package/dist/utils/versions/getVersionsColors.js +1 -1
  143. package/package.json +9 -8
  144. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/ru.json +0 -26
  145. package/dist/containers/UserSettings/i18n/ru.json +0 -20
  146. package/dist/store/reducers/hotKeys.d.ts +0 -11
  147. package/dist/store/reducers/hotKeys.js +0 -34
@@ -1,105 +1,101 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useMemo } from 'react';
3
- import cn from 'bem-cn-lite';
4
- import { connect } from 'react-redux';
5
- import { Loader } from '@gravity-ui/uikit';
2
+ import { useEffect, useMemo, useRef } from 'react';
3
+ import { useDispatch } from 'react-redux';
6
4
  import DataTable from '@gravity-ui/react-data-table';
7
5
  import { Icon } from '../../../../components/Icon';
8
6
  import { ResponseError } from '../../../../components/Errors/ResponseError';
9
- import { AutoFetcher } from '../../../../utils/autofetcher';
10
- import { getHotKeys, setHotKeysOptions } from '../../../../store/reducers/hotKeys';
11
- import { isColumnEntityType, isTableType } from '../../utils/schema';
7
+ import { useTypedSelector } from '../../../../utils/hooks';
8
+ import { cn } from '../../../../utils/cn';
9
+ import { DEFAULT_TABLE_SETTINGS } from '../../../../utils/constants';
10
+ import { setHotKeysData, setHotKeysDataWasNotLoaded, setHotKeysError, setHotKeysLoading, } from '../../../../store/reducers/hotKeys/hotKeys';
12
11
  import './HotKeys.scss';
13
- const b = cn('hot-keys');
14
- const TABLE_SETTINGS = {
15
- displayIndices: false,
16
- syncHeadOnResize: true,
17
- stickyHead: DataTable.MOVING,
18
- stickyTop: 0,
19
- };
12
+ import i18n from './i18n';
13
+ const b = cn('ydb-hot-keys');
20
14
  const tableColumnsIds = {
21
15
  accessSample: 'accessSample',
22
16
  keyValues: 'keyValues',
23
17
  };
24
- const autofetcher = new AutoFetcher();
25
- function HotKeys({ getHotKeys, currentSchemaPath, loading, wasLoaded, error, data, autorefresh, setHotKeysOptions, currentSchema, type, }) {
26
- const fetchData = () => {
27
- if (isTableType(type) && !isColumnEntityType(type)) {
28
- getHotKeys(currentSchemaPath);
29
- }
30
- };
18
+ const getHotKeysColumns = (keyColumnsIds = []) => {
19
+ const keysColumns = keyColumnsIds.map((col, index) => ({
20
+ name: col,
21
+ header: (_jsxs("div", Object.assign({ className: b('primary-key-column') }, { children: [_jsx(Icon, { name: "key", viewBox: "0 0 12 7", width: 12, height: 7 }), col] }))),
22
+ render: ({ row }) => row.keyValues[index],
23
+ align: DataTable.RIGHT,
24
+ sortable: false,
25
+ }));
26
+ return [
27
+ {
28
+ name: tableColumnsIds.accessSample,
29
+ header: 'Samples',
30
+ render: ({ row }) => row.accessSample,
31
+ align: DataTable.RIGHT,
32
+ sortable: false,
33
+ },
34
+ ...keysColumns,
35
+ ];
36
+ };
37
+ export function HotKeys({ path }) {
38
+ var _a, _b, _c;
39
+ const dispatch = useDispatch();
40
+ const collectSamplesTimerRef = useRef();
41
+ const { loading, wasLoaded, data, error } = useTypedSelector((state) => state.hotKeys);
42
+ const { loading: schemaLoading, data: schemaData } = useTypedSelector((state) => state.schema);
43
+ const keyColumnsIds = (_c = (_b = (_a = schemaData[path]) === null || _a === void 0 ? void 0 : _a.PathDescription) === null || _b === void 0 ? void 0 : _b.Table) === null || _c === void 0 ? void 0 : _c.KeyColumnNames;
44
+ const tableColumns = useMemo(() => {
45
+ return getHotKeysColumns(keyColumnsIds);
46
+ }, [keyColumnsIds]);
31
47
  useEffect(() => {
32
- if (autorefresh) {
33
- fetchData();
34
- autofetcher.start();
35
- autofetcher.fetch(() => fetchData());
36
- }
37
- else {
38
- autofetcher.stop();
39
- }
40
- return () => {
41
- autofetcher.stop();
48
+ const fetchHotkeys = async (enableSampling) => {
49
+ // Set hotkeys error, but not data, since data is set conditionally
50
+ try {
51
+ const response = await window.api.getHotKeys(path, enableSampling);
52
+ return response;
53
+ }
54
+ catch (err) {
55
+ dispatch(setHotKeysError(err));
56
+ return undefined;
57
+ }
58
+ };
59
+ const fetchData = async () => {
60
+ // If there is previous pending request for samples, cancel it
61
+ if (collectSamplesTimerRef.current !== undefined) {
62
+ window.clearInterval(collectSamplesTimerRef.current);
63
+ }
64
+ dispatch(setHotKeysDataWasNotLoaded());
65
+ dispatch(setHotKeysLoading());
66
+ // Send request that will trigger hot keys sampling (enable_sampling = true)
67
+ const initialResponse = await fetchHotkeys(true);
68
+ // If there are hotkeys in the initial request (hotkeys was collected before)
69
+ // we could just use colleted samples (collected hotkeys are stored only for 30 seconds)
70
+ if (initialResponse && initialResponse.hotkeys) {
71
+ dispatch(setHotKeysData(initialResponse));
72
+ }
73
+ else if (initialResponse) {
74
+ // Else wait for 5 seconds, while hot keys are being collected
75
+ // And request these samples (enable_sampling = false)
76
+ const timer = setTimeout(async () => {
77
+ const responseWithSamples = await fetchHotkeys(false);
78
+ if (responseWithSamples) {
79
+ dispatch(setHotKeysData(responseWithSamples));
80
+ }
81
+ }, 5000);
82
+ collectSamplesTimerRef.current = timer;
83
+ }
42
84
  };
43
- }, [autorefresh]);
44
- useEffect(() => {
45
85
  fetchData();
46
- setHotKeysOptions({
47
- wasLoaded: false,
48
- data: undefined,
49
- });
50
- }, [currentSchemaPath]);
51
- const renderLoader = () => {
52
- return (_jsx("div", Object.assign({ className: b('loader') }, { children: _jsx(Loader, { size: "l" }) })));
53
- };
54
- const tableColumns = useMemo(() => {
55
- var _a, _b, _c;
56
- const keyColumnsIds = (_c = (_b = (_a = currentSchema === null || currentSchema === void 0 ? void 0 : currentSchema.PathDescription) === null || _a === void 0 ? void 0 : _a.Table) === null || _b === void 0 ? void 0 : _b.KeyColumnNames) !== null && _c !== void 0 ? _c : [];
57
- return [
58
- {
59
- name: tableColumnsIds.accessSample,
60
- header: 'Samples',
61
- sortable: false,
62
- align: DataTable.RIGHT,
63
- },
64
- ...keyColumnsIds.map((col, index) => ({
65
- name: col,
66
- header: (_jsxs("div", Object.assign({ className: b('primary-key-column') }, { children: [_jsx(Icon, { name: "key", viewBox: "0 0 12 7", width: 12, height: 7 }), col] }))),
67
- render: ({ row }) => row[tableColumnsIds.keyValues][index],
68
- align: DataTable.RIGHT,
69
- sortable: false,
70
- })),
71
- ];
72
- }, [currentSchema]);
73
- const renderStub = () => {
74
- return _jsx("div", Object.assign({ className: b('stub') }, { children: "Cluster version does not support hot keys viewing" }));
75
- };
76
- const renderContent = () => {
77
- if (error) {
78
- return _jsx(ResponseError, { error: error });
79
- }
80
- return data !== null ? (_jsx("div", Object.assign({ className: b('table-content') }, { children: _jsx(DataTable, { columns: tableColumns, data: data, settings: TABLE_SETTINGS, theme: "yandex-cloud", initialSortOrder: {
81
- columnId: tableColumnsIds.accessSample,
82
- order: DataTable.DESCENDING,
83
- } }) }))) : (_jsx("div", Object.assign({ className: b('stub') }, { children: "No information about hot keys" })));
84
- };
85
- return !loading && data === undefined ? (renderStub()) : (_jsx("div", Object.assign({ className: b() }, { children: loading && !wasLoaded ? renderLoader() : renderContent() })));
86
+ }, [dispatch, path]);
87
+ // It takes a while to collect hot keys. Display explicit status message, while collecting
88
+ if ((loading && !wasLoaded) || schemaLoading) {
89
+ return _jsx("div", { children: i18n('hot-keys-collecting') });
90
+ }
91
+ if (error) {
92
+ return _jsx(ResponseError, { error: error });
93
+ }
94
+ if (!data) {
95
+ return _jsx("div", { children: i18n('no-data') });
96
+ }
97
+ return (_jsx("div", Object.assign({ className: b('table-content') }, { children: _jsx(DataTable, { columns: tableColumns, data: data, settings: DEFAULT_TABLE_SETTINGS, theme: "yandex-cloud", initialSortOrder: {
98
+ columnId: tableColumnsIds.accessSample,
99
+ order: DataTable.DESCENDING,
100
+ } }) })));
86
101
  }
87
- const mapStateToProps = (state) => {
88
- const { loading, data, error, wasLoaded } = state.hotKeys;
89
- const { currentSchema = {}, autorefresh } = state.schema;
90
- const { Path } = currentSchema;
91
- return {
92
- loading,
93
- data,
94
- error,
95
- currentSchemaPath: Path,
96
- autorefresh,
97
- wasLoaded,
98
- currentSchema,
99
- };
100
- };
101
- const mapDispatchToProps = {
102
- getHotKeys,
103
- setHotKeysOptions,
104
- };
105
- export default connect(mapStateToProps, mapDispatchToProps)(HotKeys);
@@ -1,16 +1,6 @@
1
1
  @import '../../../../styles/mixins.scss';
2
2
 
3
- .hot-keys {
4
- display: flex;
5
- overflow: auto;
6
- flex-grow: 1;
7
- flex-direction: column;
8
- align-items: flex-start;
9
-
10
- max-height: 100%;
11
-
12
- background-color: var(--g-color-base-background);
13
-
3
+ .ydb-hot-keys {
14
4
  &__table-content {
15
5
  overflow: auto;
16
6
 
@@ -19,28 +9,6 @@
19
9
  @include freeze-nth-column(1);
20
10
  }
21
11
 
22
- &__header {
23
- position: sticky;
24
- z-index: 2;
25
- top: 0px;
26
- left: 0;
27
-
28
- width: 100%;
29
- padding: 10px 0;
30
-
31
- background-color: var(--g-color-base-background);
32
- }
33
- &__loader {
34
- display: flex;
35
- justify-content: center;
36
- align-items: center;
37
-
38
- width: 100%;
39
- height: 100%;
40
- }
41
- &__stub {
42
- margin: 10px;
43
- }
44
12
  &__primary-key-column {
45
13
  display: flex;
46
14
  gap: 5px;
@@ -0,0 +1,4 @@
1
+ {
2
+ "hot-keys-collecting": "Please wait a little while we are collecting hot keys samples...",
3
+ "no-data": "No information about hot keys"
4
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: (key: string, params?: import("@gravity-ui/i18n").Params | undefined) => string;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { i18n, Lang } from '../../../../../utils/i18n';
2
+ import en from './en.json';
3
+ const COMPONENT = 'ydb-hot-keys';
4
+ i18n.registerKeyset(Lang.En, COMPONENT, en);
5
+ export default i18n.keyset(COMPONENT);
@@ -8,7 +8,10 @@ import './MetricCard.scss';
8
8
  const b = cn('ydb-metrics-card');
9
9
  export function MetricCard({ active, progress, label, status, resourcesUsed }) {
10
10
  const renderContent = () => {
11
- return (_jsxs("div", Object.assign({ className: b('content') }, { children: [progress && _jsx("div", Object.assign({ className: b('progress') }, { children: formatUsage(progress) })), resourcesUsed ? (_jsx("div", Object.assign({ className: b('resources') }, { children: resourcesUsed }))) : (i18n('no-data'))] })));
11
+ if (progress === undefined && resourcesUsed === undefined) {
12
+ return _jsx("div", Object.assign({ className: b('content') }, { children: i18n('no-data') }));
13
+ }
14
+ return (_jsxs("div", Object.assign({ className: b('content') }, { children: [progress && _jsx("div", Object.assign({ className: b('progress') }, { children: formatUsage(progress) })), resourcesUsed && _jsx("div", Object.assign({ className: b('resources') }, { children: resourcesUsed }))] })));
12
15
  };
13
16
  return (_jsxs(DiagnosticCard, Object.assign({ className: b({ active }), active: active }, { children: [_jsx("div", Object.assign({ className: b('header') }, { children: label && _jsx("div", Object.assign({ className: b('label') }, { children: label })) })), _jsx(CircularProgressBar, { size: 172, strokeWidth: 11, progress: progress || 0, content: renderContent(), status: status, circleBgClassName: b('progress-bar-circle-bg') })] })));
14
17
  }
@@ -12,15 +12,14 @@ import './MetricsCards.scss';
12
12
  const b = cn('metrics-cards');
13
13
  export function MetricsCards({ metrics, issuesStatistics, selfCheckResult, fetchHealthcheck, healthcheckLoading, healthCheckWasLoaded, healthcheckError, }) {
14
14
  const location = useLocation();
15
- const { memoryUsed, memoryLimit, cpuUsed, cpuUsage, storageUsed, storageLimit } = metrics || {};
15
+ const { memoryUsed, memoryLimit, cpuUsage, storageUsed, storageLimit } = metrics || {};
16
16
  const { metricsTab } = useTypedSelector((state) => state.tenant);
17
17
  const storageUsage = calculateUsage(storageUsed, storageLimit);
18
18
  const memoryUsage = calculateUsage(memoryUsed, memoryLimit);
19
19
  const cpuStatus = cpuUsageToStatus(cpuUsage);
20
20
  const storageStatus = storageUsageToStatus(storageUsage);
21
21
  const memoryStatus = memoryUsageToStatus(memoryUsage);
22
- const { cpu, storage, memory } = formatTenantMetrics({
23
- cpu: cpuUsed,
22
+ const { storage, memory } = formatTenantMetrics({
24
23
  storage: storageUsed,
25
24
  memory: memoryUsed,
26
25
  });
@@ -38,5 +37,5 @@ export function MetricsCards({ metrics, issuesStatistics, selfCheckResult, fetch
38
37
  [TENANT_METRICS_TABS_IDS.memory]: getTenantPath(Object.assign(Object.assign({}, queryParams), { [TenantTabsGroups.metricsTab]: getTabIfNotActive(TENANT_METRICS_TABS_IDS.memory) })),
39
38
  [TENANT_METRICS_TABS_IDS.healthcheck]: getTenantPath(Object.assign(Object.assign({}, queryParams), { [TenantTabsGroups.metricsTab]: getTabIfNotActive(TENANT_METRICS_TABS_IDS.healthcheck) })),
40
39
  };
41
- return (_jsxs("div", Object.assign({ className: b() }, { children: [_jsx(Link, Object.assign({ to: tabLinks.cpu, className: b('tab') }, { children: _jsx(MetricCard, { label: "CPU", progress: cpuUsage, status: cpuStatus, resourcesUsed: cpu, active: metricsTab === TENANT_METRICS_TABS_IDS.cpu }) })), _jsx(Link, Object.assign({ to: tabLinks.storage, className: b('tab') }, { children: _jsx(MetricCard, { label: "Storage", progress: storageUsage, status: storageStatus, resourcesUsed: storage, active: metricsTab === TENANT_METRICS_TABS_IDS.storage }) })), _jsx(Link, Object.assign({ to: tabLinks.memory, className: b('tab') }, { children: _jsx(MetricCard, { label: "Memory", progress: memoryUsage, status: memoryStatus, resourcesUsed: memory, active: metricsTab === TENANT_METRICS_TABS_IDS.memory }) })), _jsx(Link, Object.assign({ to: tabLinks.healthcheck, className: b('tab') }, { children: _jsx(HealthcheckPreview, { selfCheckResult: selfCheckResult, issuesStatistics: issuesStatistics, onUpdate: fetchHealthcheck, loading: healthcheckLoading, wasLoaded: healthCheckWasLoaded, error: healthcheckError, active: metricsTab === TENANT_METRICS_TABS_IDS.healthcheck }) }))] })));
40
+ return (_jsxs("div", Object.assign({ className: b() }, { children: [_jsx(Link, Object.assign({ to: tabLinks.cpu, className: b('tab') }, { children: _jsx(MetricCard, { label: "CPU", progress: cpuUsage, status: cpuStatus, active: metricsTab === TENANT_METRICS_TABS_IDS.cpu }) })), _jsx(Link, Object.assign({ to: tabLinks.storage, className: b('tab') }, { children: _jsx(MetricCard, { label: "Storage", progress: storageUsage, status: storageStatus, resourcesUsed: storage, active: metricsTab === TENANT_METRICS_TABS_IDS.storage }) })), _jsx(Link, Object.assign({ to: tabLinks.memory, className: b('tab') }, { children: _jsx(MetricCard, { label: "Memory", progress: memoryUsage, status: memoryStatus, resourcesUsed: memory, active: metricsTab === TENANT_METRICS_TABS_IDS.memory }) })), _jsx(Link, Object.assign({ to: tabLinks.healthcheck, className: b('tab') }, { children: _jsx(HealthcheckPreview, { selfCheckResult: selfCheckResult, issuesStatistics: issuesStatistics, onUpdate: fetchHealthcheck, loading: healthcheckLoading, wasLoaded: healthCheckWasLoaded, error: healthcheckError, active: metricsTab === TENANT_METRICS_TABS_IDS.healthcheck }) }))] })));
42
41
  }
@@ -36,20 +36,27 @@ export function TenantOverview({ tenantName, additionalTenantProps, additionalNo
36
36
  }, [fetchTenant, fetchHealthcheck], autorefresh);
37
37
  const { Name, State, Type } = tenant || {};
38
38
  const tenantType = mapDatabaseTypeToDBName(Type);
39
- const { cpu, blobStorage, tableStorage, memory, cpuUsage, blobStorageLimit, tableStorageLimit, memoryLimit, } = calculateTenantMetrics(tenant);
39
+ const { cpu, blobStorage, tabletStorage, memory, cpuUsage, blobStorageLimit, tabletStorageLimit, memoryLimit, } = calculateTenantMetrics(tenant);
40
+ // If there is table storage limit (data_size_hard_quota),
41
+ // use it for metric card instead of blob storage limit
42
+ // When datasize exceeds or equals to quota
43
+ // all write operations to the database are finished with error
44
+ const isTabletStorageLimitSet = tabletStorageLimit && tabletStorageLimit > 0;
45
+ const storageUsed = isTabletStorageLimitSet ? tabletStorage : blobStorage;
46
+ const storageLimit = isTabletStorageLimitSet ? tabletStorageLimit : blobStorageLimit;
40
47
  const calculatedMetrics = {
41
48
  memoryUsed: memory,
42
49
  memoryLimit,
43
50
  cpuUsed: cpu,
44
51
  cpuUsage,
45
- storageUsed: blobStorage,
46
- storageLimit: blobStorageLimit,
52
+ storageUsed,
53
+ storageLimit,
47
54
  };
48
55
  const storageMetrics = {
49
56
  blobStorageUsed: blobStorage,
50
57
  blobStorageLimit,
51
- tableStorageUsed: tableStorage,
52
- tableStorageLimit,
58
+ tabletStorageUsed: tabletStorage,
59
+ tabletStorageLimit,
53
60
  };
54
61
  const renderName = () => {
55
62
  return (_jsx("div", Object.assign({ className: b('tenant-name-wrapper') }, { children: _jsx(EntityStatus, { status: State, name: Name || TENANT_DEFAULT_TITLE, withLeftTrim: true, hasClipboardButton: Boolean(tenant), clipboardButtonAlwaysVisible: true }) })));
@@ -3,8 +3,8 @@ import '../TenantOverview.scss';
3
3
  export interface TenantStorageMetrics {
4
4
  blobStorageUsed?: number;
5
5
  blobStorageLimit?: number;
6
- tableStorageUsed?: number;
7
- tableStorageLimit?: number;
6
+ tabletStorageUsed?: number;
7
+ tabletStorageLimit?: number;
8
8
  }
9
9
  interface TenantStorageProps {
10
10
  tenantName: string;
@@ -1,28 +1,25 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import InfoViewer from '../../../../../components/InfoViewer/InfoViewer';
3
3
  import { ProgressViewer } from '../../../../../components/ProgressViewer/ProgressViewer';
4
+ import { LabelWithPopover } from '../../../../../components/LabelWithPopover';
4
5
  import { formatStorageValues } from '../../../../../utils/dataFormatters/dataFormatters';
5
- import { getSizeWithSignificantDigits } from '../../../../../utils/bytesParsers';
6
6
  import { TenantDashboard } from '../TenantDashboard/TenantDashboard';
7
7
  import '../TenantOverview.scss';
8
8
  import { storageDashboardConfig } from './storageDashboardConfig';
9
9
  import { TopTables } from './TopTables';
10
10
  import { TopGroups } from './TopGroups';
11
11
  import { b } from '../utils';
12
+ import i18n from '../i18n';
12
13
  export function TenantStorage({ tenantName, metrics }) {
13
- const { blobStorageUsed, tableStorageUsed, blobStorageLimit, tableStorageLimit } = metrics;
14
- const formatValues = (value, total) => {
15
- const size = getSizeWithSignificantDigits(Number(blobStorageLimit || blobStorageUsed), 0);
16
- return formatStorageValues(value, total, size);
17
- };
14
+ const { blobStorageUsed, tabletStorageUsed, blobStorageLimit, tabletStorageLimit } = metrics;
18
15
  const info = [
19
16
  {
20
- label: 'Database storage',
21
- value: (_jsx(ProgressViewer, { value: blobStorageUsed, capacity: blobStorageLimit, formatValues: formatValues, colorizeProgress: true, warningThreshold: 75, dangerThreshold: 85 })),
17
+ label: (_jsx(LabelWithPopover, { text: i18n('storage.tablet-storage-title'), popoverContent: i18n('storage.tablet-storage-description') })),
18
+ value: (_jsx(ProgressViewer, { value: tabletStorageUsed, capacity: tabletStorageLimit, formatValues: formatStorageValues, colorizeProgress: true, warningThreshold: 75, dangerThreshold: 85 })),
22
19
  },
23
20
  {
24
- label: 'Table storage',
25
- value: (_jsx(ProgressViewer, { value: tableStorageUsed, capacity: tableStorageLimit, formatValues: formatValues, colorizeProgress: true, warningThreshold: 75, dangerThreshold: 85 })),
21
+ label: (_jsx(LabelWithPopover, { text: i18n('storage.db-storage-title'), popoverContent: i18n('storage.db-storage-description') })),
22
+ value: (_jsx(ProgressViewer, { value: blobStorageUsed, capacity: blobStorageLimit, formatValues: formatStorageValues, colorizeProgress: true, warningThreshold: 75, dangerThreshold: 85 })),
26
23
  },
27
24
  ];
28
25
  return (_jsxs(_Fragment, { children: [_jsx(TenantDashboard, { charts: storageDashboardConfig }), _jsx(InfoViewer, { className: b('storage-info'), title: "Storage details", info: info }), _jsx(TopTables, { path: tenantName }), _jsx(TopGroups, { tenant: tenantName })] }));
@@ -2,8 +2,6 @@
2
2
  "no-data": "No data",
3
3
  "no-pools-data": "No pools data",
4
4
  "top-nodes.empty-data": "No such nodes",
5
- "title.pools": "Pools",
6
- "title.metrics": "Metrics",
7
5
  "top-groups.empty-data": "No such groups",
8
6
  "top": "Top",
9
7
  "nodes": "nodes",
@@ -20,7 +18,11 @@
20
18
  "by-size": "by size",
21
19
  "charts.queries-per-second": "Queries per second",
22
20
  "charts.transaction-latency": "Transactions latencies {{percentile}}",
23
- "charts.cpu-usage": "CPU usage",
24
- "charts.storage-usage": "Storage usage",
25
- "charts.memory-usage": "Memory usage"
21
+ "charts.cpu-usage": "CPU cores used",
22
+ "charts.storage-usage": "Tablet storage usage",
23
+ "charts.memory-usage": "Memory usage",
24
+ "storage.tablet-storage-title": "Tablet storage",
25
+ "storage.tablet-storage-description": "Size of user data and indexes stored in schema objects (tables, topics, etc.)",
26
+ "storage.db-storage-title": "Database storage",
27
+ "storage.db-storage-description": "Size of data stored in distributed storage with all overheads for redundancy"
26
28
  }
@@ -1,7 +1,5 @@
1
1
  import { i18n, Lang } from '../../../../../utils/i18n';
2
2
  import en from './en.json';
3
- import ru from './ru.json';
4
3
  const COMPONENT = 'ydb-diagnostics-tenant-overview';
5
4
  i18n.registerKeyset(Lang.En, COMPONENT, en);
6
- i18n.registerKeyset(Lang.Ru, COMPONENT, ru);
7
5
  export default i18n.keyset(COMPONENT);
@@ -4,6 +4,7 @@ import DataTable from '@gravity-ui/react-data-table';
4
4
  import { formatDateTime, formatNumber } from '../../../../utils/dataFormatters/dataFormatters';
5
5
  import { generateHash } from '../../../../utils/generateHash';
6
6
  import { TruncatedQuery, OneLineQueryWithPopover, } from '../../../../components/TruncatedQuery/TruncatedQuery';
7
+ import { parseUsToMs } from '../../../../utils/timeParsers';
7
8
  import { MAX_QUERY_HEIGHT } from '../../utils/constants';
8
9
  import './TopQueries.scss';
9
10
  const b = cn('kv-top-queries');
@@ -16,6 +17,7 @@ const TOP_QUERIES_COLUMNS_IDS = {
16
17
  UserSID: 'UserSID',
17
18
  OneLineQueryText: 'OneLineQueryText',
18
19
  QueryHash: 'QueryHash',
20
+ Duration: 'Duration',
19
21
  };
20
22
  const cpuTimeUsColumn = {
21
23
  name: TOP_QUERIES_COLUMNS_IDS.CPUTimeUs,
@@ -68,11 +70,19 @@ const queryHashColumn = {
68
70
  width: 130,
69
71
  sortable: false,
70
72
  };
73
+ const durationColumn = {
74
+ name: TOP_QUERIES_COLUMNS_IDS.Duration,
75
+ header: 'Duration, ms',
76
+ render: ({ row }) => { var _a; return formatNumber(parseUsToMs((_a = row.Duration) !== null && _a !== void 0 ? _a : undefined)); },
77
+ sortAccessor: (row) => Number(row.Duration),
78
+ align: DataTable.RIGHT,
79
+ };
71
80
  export const getTopQueriesColumns = () => {
72
81
  return [
73
82
  cpuTimeUsColumn,
74
83
  queryTextColumn,
75
84
  endTimeColumn,
85
+ durationColumn,
76
86
  readRowsColumn,
77
87
  readBytesColumn,
78
88
  userSIDColumn,
@@ -3,7 +3,7 @@ import type { EPathType } from '../../../types/api/schema';
3
3
  import type { AdditionalTenantsProps, AdditionalNodesProps } from '../../../types/additionalProps';
4
4
  import './ObjectGeneral.scss';
5
5
  interface ObjectGeneralProps {
6
- type?: EPathType;
6
+ type: EPathType;
7
7
  additionalTenantProps?: AdditionalTenantsProps;
8
8
  additionalNodesProps?: AdditionalNodesProps;
9
9
  }
@@ -2,8 +2,8 @@ import type { EPathType } from '../../../types/api/schema';
2
2
  import './Query.scss';
3
3
  interface QueryProps {
4
4
  theme: string;
5
- path?: string;
6
- type?: EPathType;
5
+ path: string;
6
+ type: EPathType;
7
7
  }
8
8
  export declare const Query: (props: QueryProps) => JSX.Element;
9
9
  export {};
@@ -1,11 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { useDispatch } from 'react-redux';
4
+ import { Helmet } from 'react-helmet-async';
3
5
  import block from 'bem-cn-lite';
4
6
  import { changeUserInput } from '../../../store/reducers/executeQuery';
5
7
  import { TENANT_QUERY_TABS_ID } from '../../../store/reducers/tenant/constants';
6
8
  import { useSetting, useTypedSelector } from '../../../utils/hooks';
7
9
  import { SAVED_QUERIES_KEY } from '../../../utils/constants';
8
- import { QueryTabs } from './QueryTabs/QueryTabs';
10
+ import { QueryTabs, queryEditorTabs } from './QueryTabs/QueryTabs';
9
11
  import { SavedQueries } from './SavedQueries/SavedQueries';
10
12
  import QueriesHistory from './QueriesHistory/QueriesHistory';
11
13
  import QueryEditor from './QueryEditor/QueryEditor';
@@ -22,6 +24,7 @@ export const Query = (props) => {
22
24
  const handleUserInputChange = (value) => {
23
25
  dispatch(changeUserInput(value));
24
26
  };
27
+ const activeTab = React.useMemo(() => queryEditorTabs.find(({ id }) => id === queryTab), [queryTab]);
25
28
  const renderContent = () => {
26
29
  switch (queryTab) {
27
30
  case TENANT_QUERY_TABS_ID.newQuery: {
@@ -38,5 +41,5 @@ export const Query = (props) => {
38
41
  }
39
42
  }
40
43
  };
41
- return (_jsxs("div", Object.assign({ className: b() }, { children: [_jsx(QueryTabs, { className: b('tabs'), activeTab: queryTab }), _jsx("div", Object.assign({ className: b('content') }, { children: renderContent() }))] })));
44
+ return (_jsxs("div", Object.assign({ className: b() }, { children: [activeTab ? (_jsx(Helmet, { children: _jsx("title", { children: activeTab.title }) })) : null, _jsx(QueryTabs, { className: b('tabs'), activeTab: queryTab }), _jsx("div", Object.assign({ className: b('content') }, { children: renderContent() }))] })));
42
45
  };
@@ -1,32 +1,30 @@
1
- declare var _default: import("react-redux").ConnectedComponent<typeof QueryEditor, import("react-redux").Omit<PropTypes.InferProps<{
2
- sendExecuteQuery: PropTypes.Requireable<(...args: any[]) => any>;
3
- changeUserInput: PropTypes.Requireable<(...args: any[]) => any>;
4
- path: PropTypes.Requireable<string>;
5
- response: PropTypes.Requireable<boolean | any[]>;
6
- executeQuery: PropTypes.Requireable<object>;
7
- explainQuery: PropTypes.Requireable<object>;
8
- setMonacoHotKey: PropTypes.Requireable<(...args: any[]) => any>;
9
- theme: PropTypes.Requireable<string>;
10
- type: PropTypes.Requireable<string>;
11
- initialQueryMode: PropTypes.Requireable<string>;
12
- setTenantPath: PropTypes.Requireable<(...args: any[]) => any>;
13
- }>, "executeQuery" | "explainQuery" | "setTenantPath" | "sendExecuteQuery" | "setMonacoHotKey">>;
14
- export default _default;
15
- declare function QueryEditor(props: any): JSX.Element;
16
- declare namespace QueryEditor {
17
- export { propTypes };
18
- }
19
- import PropTypes from "prop-types";
20
- declare namespace propTypes {
21
- const sendExecuteQuery: PropTypes.Requireable<(...args: any[]) => any>;
22
- const changeUserInput: PropTypes.Requireable<(...args: any[]) => any>;
23
- const path: PropTypes.Requireable<string>;
24
- const response: PropTypes.Requireable<boolean | any[]>;
25
- const executeQuery: PropTypes.Requireable<object>;
26
- const explainQuery: PropTypes.Requireable<object>;
27
- const setMonacoHotKey: PropTypes.Requireable<(...args: any[]) => any>;
28
- const theme: PropTypes.Requireable<string>;
29
- const type: PropTypes.Requireable<string>;
30
- const initialQueryMode: PropTypes.Requireable<string>;
31
- const setTenantPath: PropTypes.Requireable<(...args: any[]) => any>;
1
+ /// <reference types="react" />
2
+ import { sendExecuteQuery, saveQueryToHistory, goToPreviousQuery, goToNextQuery, setTenantPath } from '../../../../store/reducers/executeQuery';
3
+ import { getExplainQuery, getExplainQueryAst } from '../../../../store/reducers/explainQuery';
4
+ import { setShowPreview } from '../../../../store/reducers/schema/schema';
5
+ import type { ExecuteQueryState } from '../../../../types/store/executeQuery';
6
+ import type { ExplainQueryState } from '../../../../types/store/explainQuery';
7
+ import type { EPathType } from '../../../../types/api/schema';
8
+ import './QueryEditor.scss';
9
+ interface QueryEditorProps {
10
+ path: string;
11
+ sendExecuteQuery: (...args: Parameters<typeof sendExecuteQuery>) => void;
12
+ getExplainQuery: (...args: Parameters<typeof getExplainQuery>) => void;
13
+ getExplainQueryAst: (...args: Parameters<typeof getExplainQueryAst>) => void;
14
+ changeUserInput: (arg: {
15
+ input: string;
16
+ }) => void;
17
+ goToNextQuery: (...args: Parameters<typeof goToNextQuery>) => void;
18
+ goToPreviousQuery: (...args: Parameters<typeof goToPreviousQuery>) => void;
19
+ setTenantPath: (...args: Parameters<typeof setTenantPath>) => void;
20
+ executeQuery: ExecuteQueryState;
21
+ explainQuery: ExplainQueryState;
22
+ theme: string;
23
+ type: EPathType;
24
+ showPreview: boolean;
25
+ setShowPreview: (...args: Parameters<typeof setShowPreview>) => void;
26
+ saveQueryToHistory: (...args: Parameters<typeof saveQueryToHistory>) => void;
32
27
  }
28
+ declare function QueryEditor(props: QueryEditorProps): JSX.Element;
29
+ declare const _default: import("react-redux").ConnectedComponent<typeof QueryEditor, import("react-redux").Omit<QueryEditorProps, "executeQuery" | "explainQuery" | "setTenantPath" | "showPreview" | "sendExecuteQuery" | "saveQueryToHistory" | "goToPreviousQuery" | "goToNextQuery" | "getExplainQuery" | "getExplainQueryAst" | "setShowPreview">>;
30
+ export default _default;