ydb-embedded-ui 3.4.4 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/Icon/Icon.tsx +6 -0
  3. package/dist/components/InfoViewer/InfoViewer.tsx +2 -2
  4. package/dist/components/InfoViewer/formatters/index.ts +0 -1
  5. package/dist/components/InfoViewer/formatters/table.ts +6 -0
  6. package/dist/components/LabelWithPopover/LabelWithPopover.tsx +3 -7
  7. package/dist/components/LagPopoverContent/LagPopoverContent.scss +13 -0
  8. package/dist/components/LagPopoverContent/LagPopoverContent.tsx +19 -0
  9. package/dist/components/LagPopoverContent/index.ts +1 -0
  10. package/dist/components/Tooltips/NodeEndpointsTooltip/NodeEndpointsTooltip.scss +5 -0
  11. package/dist/components/Tooltips/NodeEndpointsTooltip/NodeEndpointsTooltip.tsx +31 -0
  12. package/dist/components/TruncatedQuery/TruncatedQuery.js +1 -1
  13. package/dist/components/TruncatedQuery/TruncatedQuery.scss +7 -3
  14. package/dist/containers/Node/{NodePages.js → NodePages.ts} +1 -1
  15. package/dist/containers/Nodes/Nodes.tsx +2 -6
  16. package/dist/containers/Nodes/NodesTable.scss +11 -10
  17. package/dist/containers/Nodes/getNodesColumns.tsx +29 -24
  18. package/dist/containers/Storage/PDisk/PDisk.scss +2 -0
  19. package/dist/containers/Storage/PDiskPopup/PDiskPopup.tsx +6 -9
  20. package/dist/containers/Storage/Storage.js +12 -5
  21. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +3 -1
  22. package/dist/containers/Storage/StorageNodes/StorageNodes.scss +20 -7
  23. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +43 -7
  24. package/dist/containers/Storage/VDisk/VDisk.tsx +3 -2
  25. package/dist/containers/Storage/VDiskPopup/VDiskPopup.tsx +4 -2
  26. package/dist/containers/Tablet/TabletControls/TabletControls.tsx +2 -2
  27. package/dist/containers/Tenant/Diagnostics/Consumers/Headers/Headers.scss +0 -8
  28. package/dist/containers/Tenant/Diagnostics/Consumers/Headers/Headers.tsx +3 -10
  29. package/dist/containers/Tenant/Diagnostics/Consumers/i18n/ru.json +1 -1
  30. package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +11 -43
  31. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/TableInfo.tsx +19 -17
  32. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +192 -37
  33. package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.tsx +51 -32
  34. package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/i18n/en.json +2 -1
  35. package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/i18n/ru.json +2 -1
  36. package/dist/containers/Tenant/Diagnostics/Partitions/Headers/Headers.scss +0 -8
  37. package/dist/containers/Tenant/Diagnostics/Partitions/Headers/Headers.tsx +7 -21
  38. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.scss +20 -14
  39. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +49 -12
  40. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.tsx +37 -18
  41. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +1 -0
  42. package/dist/routes.ts +1 -1
  43. package/dist/services/api.d.ts +4 -0
  44. package/dist/services/api.js +3 -3
  45. package/dist/store/reducers/{executeQuery.js → executeQuery.ts} +51 -21
  46. package/dist/store/reducers/executeTopQueries.ts +5 -1
  47. package/dist/store/reducers/{nodesList.js → nodesList.ts} +19 -7
  48. package/dist/store/reducers/{olapStats.js → olapStats.ts} +8 -18
  49. package/dist/store/reducers/settings.js +1 -1
  50. package/dist/store/reducers/storage.js +8 -18
  51. package/dist/types/api/nodesList.ts +25 -0
  52. package/dist/types/api/query.ts +4 -1
  53. package/dist/types/api/schema.ts +523 -3
  54. package/dist/types/common.ts +1 -0
  55. package/dist/types/store/executeQuery.ts +42 -0
  56. package/dist/types/store/nodesList.ts +24 -0
  57. package/dist/types/store/olapStats.ts +14 -0
  58. package/dist/utils/index.js +9 -1
  59. package/dist/utils/nodes.ts +4 -0
  60. package/dist/utils/query.test.ts +42 -29
  61. package/dist/utils/query.ts +34 -22
  62. package/dist/utils/timeParsers/formatDuration.ts +30 -12
  63. package/dist/utils/timeParsers/i18n/en.json +4 -0
  64. package/dist/utils/timeParsers/i18n/ru.json +4 -0
  65. package/dist/utils/tooltip.js +2 -28
  66. package/package.json +1 -1
  67. package/dist/components/InfoViewer/formatters/topicStats.tsx +0 -29
@@ -1,11 +1,13 @@
1
- import '../../services/api';
1
+ import type {Reducer} from 'redux';
2
+
3
+ import type {OlapStatsAction, OlapStatsState} from '../../types/store/olapStats';
2
4
 
5
+ import '../../services/api';
3
6
  import {parseQueryAPIExecuteResponse} from '../../utils/query';
4
7
 
5
8
  import {createRequestActionTypes, createApiRequest} from '../utils';
6
9
 
7
- const FETCH_OLAP_STATS = createRequestActionTypes('query', 'SEND_OLAP_STATS_QUERY');
8
- const SET_OLAP_STATS_OPTIONS = createRequestActionTypes('query', 'SET_OLAP_STATS_OPTIONS');
10
+ export const FETCH_OLAP_STATS = createRequestActionTypes('query', 'SEND_OLAP_STATS_QUERY');
9
11
  const RESET_LOADING_STATE = 'olapStats/RESET_LOADING_STATE';
10
12
 
11
13
  const initialState = {
@@ -13,13 +15,13 @@ const initialState = {
13
15
  wasLoaded: false,
14
16
  };
15
17
 
16
- function createOlatStatsQuery(path) {
18
+ function createOlatStatsQuery(path: string) {
17
19
  return `SELECT * FROM \`${path}/.sys/primary_index_stats\``;
18
20
  }
19
21
 
20
22
  const queryAction = 'execute-scan';
21
23
 
22
- const olapStats = (state = initialState, action) => {
24
+ const olapStats: Reducer<OlapStatsState, OlapStatsAction> = (state = initialState, action) => {
23
25
  switch (action.type) {
24
26
  case FETCH_OLAP_STATS.REQUEST: {
25
27
  return {
@@ -44,11 +46,6 @@ const olapStats = (state = initialState, action) => {
44
46
  loading: false,
45
47
  };
46
48
  }
47
- case SET_OLAP_STATS_OPTIONS:
48
- return {
49
- ...state,
50
- ...action.data,
51
- };
52
49
  case RESET_LOADING_STATE: {
53
50
  return {
54
51
  ...state,
@@ -73,17 +70,10 @@ export const getOlapStats = ({path = ''}) => {
73
70
  });
74
71
  };
75
72
 
76
- export function setOlapStatsOptions(options) {
77
- return {
78
- type: SET_OLAP_STATS_OPTIONS,
79
- data: options,
80
- };
81
- }
82
-
83
73
  export function resetLoadingState() {
84
74
  return {
85
75
  type: RESET_LOADING_STATE,
86
- };
76
+ } as const;
87
77
  }
88
78
 
89
79
  export default olapStats;
@@ -38,7 +38,7 @@ export const initialState = {
38
38
  problemFilter: ALL,
39
39
  userSettings: {
40
40
  ...userSettings,
41
- [THEME_KEY]: readSavedSettingsValue(THEME_KEY, 'light'),
41
+ [THEME_KEY]: readSavedSettingsValue(THEME_KEY, 'system'),
42
42
  [INVERTED_DISKS_KEY]: readSavedSettingsValue(INVERTED_DISKS_KEY, 'false'),
43
43
  [USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY]: readSavedSettingsValue(
44
44
  USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
@@ -204,15 +204,6 @@ export const getUsageFilter = (state) => state.storage.usageFilter;
204
204
  export const getVisibleEntities = (state) => state.storage.visible;
205
205
  export const getNodesUptimeFilter = (state) => state.storage.nodesUptimeFilter;
206
206
  export const getStorageType = (state) => state.storage.type;
207
- export const getNodesObject = (state) =>
208
- _.reduce(
209
- state.nodesList?.data,
210
- (acc, el) => {
211
- acc[el.NodeId] = el.Host;
212
- return acc;
213
- },
214
- {},
215
- );
216
207
 
217
208
  const FLAGS_POINTS = {
218
209
  Green: 1,
@@ -252,13 +243,11 @@ export const getFlatListStorageGroups = createSelector([getStoragePools], (stora
252
243
  const limitSizeBytes = _.reduce(
253
244
  group.VDisks,
254
245
  (acc, vDisk) => {
255
- return (
256
- acc +
257
- (Number(vDisk.AvailableSize) ||
258
- Number(vDisk.PDisk?.AvailableSize) ||
259
- 0) +
260
- (Number(vDisk.AllocatedSize) || 0)
261
- );
246
+ const {AvailableSize, AllocatedSize, PDisk} = vDisk;
247
+ const available = (AvailableSize ?? PDisk?.AvailableSize) || 0;
248
+ const allocated = AllocatedSize || 0;
249
+
250
+ return acc + Number(available) + Number(allocated);
262
251
  },
263
252
  0,
264
253
  );
@@ -314,9 +303,10 @@ export const getFlatListStorageNodes = createSelector([getStorageNodes], (storag
314
303
  return {
315
304
  NodeId: node.NodeId,
316
305
  SystemState: systemState.SystemState,
317
- FQDN: systemState.Host,
318
306
  DataCenter: systemState.DataCenter,
319
307
  Rack: systemState.Rack,
308
+ Host: systemState.Host,
309
+ Endpoints: systemState.Endpoints,
320
310
  uptime: calcUptime(systemState.StartTime),
321
311
  StartTime: systemState.StartTime,
322
312
  PDisks: node.PDisks,
@@ -378,7 +368,7 @@ const filterByText = (entities, type, text) => {
378
368
 
379
369
  return (
380
370
  entity.NodeId.toString().includes(cleanedFilter) ||
381
- entity.FQDN.toLowerCase().includes(cleanedFilter)
371
+ entity.Host.toLowerCase().includes(cleanedFilter)
382
372
  );
383
373
  });
384
374
  };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * endpoint: /viewer/json/nodesList
3
+ *
4
+ * source: https://github.com/ydb-platform/ydb/blob/main/library/cpp/actors/core/interconnect.h
5
+ */
6
+ export type TEvNodesInfo = TNodeInfo[];
7
+
8
+ export interface TNodeInfo {
9
+ Id?: number;
10
+ Host?: string;
11
+ ResolveHost?: string;
12
+ Address?: string;
13
+ Port?: number;
14
+ PhysicalLocation?: TNodeLocation;
15
+ }
16
+
17
+ interface TNodeLocation {
18
+ DataCenter?: number;
19
+ Room?: number;
20
+ Rack?: number;
21
+ Body?: number;
22
+ DataCenterId?: string;
23
+ /** String with DC, Module, Rack and Unit ids */
24
+ Location?: string;
25
+ }
@@ -30,7 +30,7 @@ export type Schemas = 'classic' | 'modern' | 'ydb' | undefined;
30
30
 
31
31
  // common types
32
32
 
33
- type CellValue = string | number | null | undefined;
33
+ export type CellValue = string | number | null | undefined;
34
34
 
35
35
  export type KeyValueRow<T = CellValue> = {
36
36
  [key: string]: T;
@@ -63,6 +63,7 @@ export type ExecuteYdbResponse = {
63
63
  result: KeyValueRow[];
64
64
  } & CommonFields;
65
65
 
66
+ // prettier-ignore
66
67
  type ExecuteResponse<Schema extends Schemas> =
67
68
  | CommonFields // result can be undefined for queries like `insert into`
68
69
  | (Schema extends 'modern'
@@ -102,6 +103,7 @@ type ExplainResponse = CommonFields;
102
103
 
103
104
  // deprecated response from older versions, backward compatibility
104
105
 
106
+ // prettier-ignore
105
107
  type DeprecatedExplainResponse<Action extends ExplainActions> =
106
108
  Action extends 'explain-ast'
107
109
  ? ({result: {ast: AST}} & Required<DeprecatedCommonFields>) | {ast: AST}
@@ -121,6 +123,7 @@ export type QueryAPIExplainResponse<Action extends ExplainActions> =
121
123
  | DeprecatedExplainResponse<Action>
122
124
  | null;
123
125
 
126
+ // prettier-ignore
124
127
  export type QueryAPIResponse<Action extends Actions, Schema extends Schemas = undefined> =
125
128
  Action extends ExecuteActions
126
129
  ? QueryAPIExecuteResponse<Schema>