ydb-embedded-ui 4.20.4 → 4.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/EmptyState/EmptyState.scss +0 -1
  3. package/dist/components/ProgressViewer/ProgressViewer.scss +1 -0
  4. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +4 -0
  5. package/dist/components/VirtualTable/TableChunk.tsx +84 -0
  6. package/dist/components/VirtualTable/TableHead.tsx +139 -0
  7. package/dist/components/VirtualTable/TableRow.tsx +91 -0
  8. package/dist/components/VirtualTable/VirtualTable.scss +146 -0
  9. package/dist/components/VirtualTable/VirtualTable.tsx +277 -0
  10. package/dist/components/VirtualTable/constants.ts +17 -0
  11. package/dist/components/VirtualTable/i18n/en.json +3 -0
  12. package/dist/components/VirtualTable/i18n/index.ts +11 -0
  13. package/dist/components/VirtualTable/i18n/ru.json +3 -0
  14. package/dist/components/VirtualTable/index.ts +3 -0
  15. package/dist/components/VirtualTable/reducer.ts +143 -0
  16. package/dist/components/VirtualTable/shared.ts +3 -0
  17. package/dist/components/VirtualTable/types.ts +60 -0
  18. package/dist/components/VirtualTable/useIntersectionObserver.ts +42 -0
  19. package/dist/components/VirtualTable/utils.ts +3 -0
  20. package/dist/containers/App/App.scss +2 -1
  21. package/dist/containers/Cluster/Cluster.tsx +17 -4
  22. package/dist/containers/Nodes/Nodes.tsx +4 -20
  23. package/dist/containers/Nodes/VirtualNodes.tsx +146 -0
  24. package/dist/containers/Nodes/getNodes.ts +26 -0
  25. package/dist/containers/Nodes/getNodesColumns.tsx +49 -39
  26. package/dist/containers/UserSettings/i18n/en.json +2 -2
  27. package/dist/containers/UserSettings/i18n/ru.json +2 -2
  28. package/dist/utils/hooks/useNodesRequestParams.ts +4 -8
  29. package/dist/utils/nodes.ts +12 -0
  30. package/package.json +1 -1
@@ -19,13 +19,7 @@ import {TableWithControlsLayout} from '../../components/TableWithControlsLayout/
19
19
  import {ResponseError} from '../../components/Errors/ResponseError';
20
20
 
21
21
  import {DEFAULT_TABLE_SETTINGS, USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY} from '../../utils/constants';
22
- import {
23
- useAutofetcher,
24
- useSetting,
25
- useTypedSelector,
26
- useNodesRequestParams,
27
- useTableSort,
28
- } from '../../utils/hooks';
22
+ import {useAutofetcher, useSetting, useTypedSelector, useTableSort} from '../../utils/hooks';
29
23
  import {
30
24
  isSortableNodesProperty,
31
25
  isUnavailableNode,
@@ -90,31 +84,21 @@ export const Nodes = ({path, type, additionalNodesProps = {}}: NodesProps) => {
90
84
 
91
85
  const [useNodesEndpoint] = useSetting(USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY);
92
86
 
93
- const requestParams = useNodesRequestParams({
94
- filter: searchValue,
95
- problemFilter,
96
- nodesUptimeFilter,
97
- sortOrder,
98
- sortValue,
99
- });
100
-
101
87
  const fetchNodes = useCallback(
102
88
  (isBackground) => {
103
89
  if (!isBackground) {
104
90
  dispatch(setDataWasNotLoaded());
105
91
  }
106
92
 
107
- const params = requestParams || {};
108
-
109
93
  // For not DB entities we always use /compute endpoint instead of /nodes
110
94
  // since /nodes can return data only for tenants
111
95
  if (path && (!useNodesEndpoint || !isDatabaseEntityType(type))) {
112
- dispatch(getComputeNodes({path, ...params}));
96
+ dispatch(getComputeNodes({path}));
113
97
  } else {
114
- dispatch(getNodes({tenant: path, ...params}));
98
+ dispatch(getNodes({tenant: path}));
115
99
  }
116
100
  },
117
- [dispatch, path, type, useNodesEndpoint, requestParams],
101
+ [dispatch, path, type, useNodesEndpoint],
118
102
  );
119
103
 
120
104
  useAutofetcher(fetchNodes, [fetchNodes], isClusterNodes ? true : autorefresh);
@@ -0,0 +1,146 @@
1
+ import {useCallback, useMemo, useState} from 'react';
2
+ import cn from 'bem-cn-lite';
3
+
4
+ import type {AdditionalNodesProps} from '../../types/additionalProps';
5
+ import type {ProblemFilterValue} from '../../store/reducers/settings/types';
6
+ import type {NodesPreparedEntity} from '../../store/reducers/nodes/types';
7
+ import {ProblemFilterValues} from '../../store/reducers/settings/settings';
8
+ import {
9
+ NodesSortValue,
10
+ NodesUptimeFilterValues,
11
+ getProblemParamValue,
12
+ getUptimeParamValue,
13
+ isSortableNodesProperty,
14
+ isUnavailableNode,
15
+ } from '../../utils/nodes';
16
+
17
+ import {Search} from '../../components/Search';
18
+ import {ProblemFilter} from '../../components/ProblemFilter';
19
+ import {UptimeFilter} from '../../components/UptimeFIlter';
20
+ import {EntitiesCount} from '../../components/EntitiesCount';
21
+ import {AccessDenied} from '../../components/Errors/403';
22
+ import {ResponseError} from '../../components/Errors/ResponseError';
23
+ import {Illustration} from '../../components/Illustration';
24
+ import {
25
+ type FetchData,
26
+ type RenderControls,
27
+ type RenderErrorMessage,
28
+ VirtualTable,
29
+ GetRowClassName,
30
+ } from '../../components/VirtualTable';
31
+
32
+ import {getNodesColumns} from './getNodesColumns';
33
+ import {getNodes} from './getNodes';
34
+ import i18n from './i18n';
35
+
36
+ import './Nodes.scss';
37
+
38
+ const b = cn('ydb-nodes');
39
+
40
+ interface NodesProps {
41
+ parentContainer?: Element | null;
42
+ additionalNodesProps?: AdditionalNodesProps;
43
+ }
44
+
45
+ export const VirtualNodes = ({parentContainer, additionalNodesProps}: NodesProps) => {
46
+ const [searchValue, setSearchValue] = useState('');
47
+ const [problemFilter, setProblemFilter] = useState<ProblemFilterValue>(ProblemFilterValues.ALL);
48
+ const [uptimeFilter, setUptimeFilter] = useState<NodesUptimeFilterValues>(
49
+ NodesUptimeFilterValues.All,
50
+ );
51
+
52
+ const filters = useMemo(() => {
53
+ return [searchValue, problemFilter, uptimeFilter];
54
+ }, [searchValue, problemFilter, uptimeFilter]);
55
+
56
+ const fetchData = useCallback<FetchData<NodesPreparedEntity>>(
57
+ async (limit, offset, {sortOrder, columnId} = {}) => {
58
+ return await getNodes({
59
+ limit,
60
+ offset,
61
+ filter: searchValue,
62
+ problems_only: getProblemParamValue(problemFilter),
63
+ uptime: getUptimeParamValue(uptimeFilter),
64
+ sortOrder,
65
+ sortValue: columnId as NodesSortValue,
66
+ });
67
+ },
68
+ [problemFilter, searchValue, uptimeFilter],
69
+ );
70
+
71
+ const getRowClassName: GetRowClassName<NodesPreparedEntity> = (row) => {
72
+ return b('node', {unavailable: isUnavailableNode(row)});
73
+ };
74
+
75
+ const handleSearchQueryChange = (value: string) => {
76
+ setSearchValue(value);
77
+ };
78
+ const handleProblemFilterChange = (value: string) => {
79
+ setProblemFilter(value as ProblemFilterValue);
80
+ };
81
+ const handleUptimeFilterChange = (value: string) => {
82
+ setUptimeFilter(value as NodesUptimeFilterValues);
83
+ };
84
+
85
+ const renderControls: RenderControls = ({totalEntities, foundEntities, inited}) => {
86
+ return (
87
+ <>
88
+ <Search
89
+ onChange={handleSearchQueryChange}
90
+ placeholder="Host name"
91
+ className={b('search')}
92
+ value={searchValue}
93
+ />
94
+ <ProblemFilter value={problemFilter} onChange={handleProblemFilterChange} />
95
+ <UptimeFilter value={uptimeFilter} onChange={handleUptimeFilterChange} />
96
+ <EntitiesCount
97
+ total={totalEntities}
98
+ current={foundEntities}
99
+ label={'Nodes'}
100
+ loading={!inited}
101
+ />
102
+ </>
103
+ );
104
+ };
105
+
106
+ const renderEmptyDataMessage = () => {
107
+ if (
108
+ problemFilter !== ProblemFilterValues.ALL ||
109
+ uptimeFilter !== NodesUptimeFilterValues.All
110
+ ) {
111
+ return <Illustration name="thumbsUp" width="200" />;
112
+ }
113
+
114
+ return i18n('empty.default');
115
+ };
116
+
117
+ const renderErrorMessage: RenderErrorMessage = (error) => {
118
+ if (error && error.status === 403) {
119
+ return <AccessDenied />;
120
+ }
121
+
122
+ return <ResponseError error={error} />;
123
+ };
124
+
125
+ const rawColumns = getNodesColumns({
126
+ getNodeRef: additionalNodesProps?.getNodeRef,
127
+ });
128
+
129
+ const columns = rawColumns.map((column) => {
130
+ return {...column, sortable: isSortableNodesProperty(column.name)};
131
+ });
132
+
133
+ return (
134
+ <VirtualTable
135
+ parentContainer={parentContainer}
136
+ columns={columns}
137
+ fetchData={fetchData}
138
+ limit={50}
139
+ renderControls={renderControls}
140
+ renderErrorMessage={renderErrorMessage}
141
+ renderEmptyDataMessage={renderEmptyDataMessage}
142
+ dependencyArray={filters}
143
+ getRowClassName={getRowClassName}
144
+ />
145
+ );
146
+ };
@@ -0,0 +1,26 @@
1
+ import type {NodesApiRequestParams} from '../../store/reducers/nodes/types';
2
+ import {prepareNodesData} from '../../store/reducers/nodes/utils';
3
+
4
+ const getConcurrentId = (limit?: number, offset?: number) => {
5
+ return `getNodes|offset${offset}|limit${limit}`;
6
+ };
7
+
8
+ export const getNodes = async ({
9
+ type = 'any',
10
+ storage = false,
11
+ limit,
12
+ offset,
13
+ ...params
14
+ }: NodesApiRequestParams) => {
15
+ const response = await window.api.getNodes(
16
+ {type, storage, limit, offset, ...params},
17
+ {concurrentId: getConcurrentId(limit, offset)},
18
+ );
19
+ const preparedResponse = prepareNodesData(response);
20
+
21
+ return {
22
+ data: preparedResponse.Nodes || [],
23
+ found: preparedResponse.FoundNodes || 0,
24
+ total: preparedResponse.TotalNodes || 0,
25
+ };
26
+ };
@@ -1,5 +1,6 @@
1
- import DataTable, {type Column} from '@gravity-ui/react-data-table';
1
+ import DataTable, {type Column as DataTableColumn} from '@gravity-ui/react-data-table';
2
2
 
3
+ import type {Column as VirtualTableColumn} from '../../components/VirtualTable';
3
4
  import {PoolsGraph} from '../../components/PoolsGraph/PoolsGraph';
4
5
  import {ProgressViewer} from '../../components/ProgressViewer/ProgressViewer';
5
6
  import {TabletsStatistic} from '../../components/TabletsStatistic';
@@ -34,46 +35,52 @@ interface GetNodesColumnsProps {
34
35
  getNodeRef?: GetNodeRefFunc;
35
36
  }
36
37
 
37
- const nodeIdColumn: Column<NodesPreparedEntity> = {
38
+ type NodesColumn = VirtualTableColumn<NodesPreparedEntity> & DataTableColumn<NodesPreparedEntity>;
39
+
40
+ const nodeIdColumn: NodesColumn = {
38
41
  name: NODES_COLUMNS_IDS.NodeId,
39
42
  header: '#',
40
- width: '80px',
43
+ width: 80,
44
+ render: ({row}) => row.NodeId,
41
45
  align: DataTable.RIGHT,
42
46
  sortable: false,
43
47
  };
44
48
 
45
- const getHostColumn = (
46
- getNodeRef?: GetNodeRefFunc,
47
- fixedWidth = false,
48
- ): Column<NodesPreparedEntity> => ({
49
+ const getHostColumn = (getNodeRef?: GetNodeRefFunc): NodesColumn => ({
49
50
  name: NODES_COLUMNS_IDS.Host,
50
51
  render: ({row}) => {
51
52
  return <NodeHostWrapper node={row} getNodeRef={getNodeRef} />;
52
53
  },
53
- width: fixedWidth ? '350px' : undefined,
54
+ width: 350,
54
55
  align: DataTable.LEFT,
55
56
  sortable: false,
56
57
  });
57
58
 
58
- const dataCenterColumn: Column<NodesPreparedEntity> = {
59
+ const getHostColumnWithUndefinedWidth = (
60
+ getNodeRef?: GetNodeRefFunc,
61
+ ): DataTableColumn<NodesPreparedEntity> => {
62
+ return {...getHostColumn(getNodeRef), width: undefined};
63
+ };
64
+
65
+ const dataCenterColumn: NodesColumn = {
59
66
  name: NODES_COLUMNS_IDS.DC,
60
67
  header: 'DC',
61
68
  align: DataTable.LEFT,
62
69
  render: ({row}) => (row.DataCenter ? row.DataCenter : '—'),
63
- width: '60px',
70
+ width: 60,
64
71
  };
65
72
 
66
- const rackColumn: Column<NodesPreparedEntity> = {
73
+ const rackColumn: NodesColumn = {
67
74
  name: NODES_COLUMNS_IDS.Rack,
68
75
  header: 'Rack',
69
76
  align: DataTable.LEFT,
70
77
  render: ({row}) => (row.Rack ? row.Rack : '—'),
71
- width: '80px',
78
+ width: 80,
72
79
  };
73
80
 
74
- const versionColumn: Column<NodesPreparedEntity> = {
81
+ const versionColumn: NodesColumn = {
75
82
  name: NODES_COLUMNS_IDS.Version,
76
- width: '200px',
83
+ width: 200,
77
84
  align: DataTable.LEFT,
78
85
  render: ({row}) => {
79
86
  return <CellWithPopover content={row.Version}>{row.Version}</CellWithPopover>;
@@ -81,16 +88,17 @@ const versionColumn: Column<NodesPreparedEntity> = {
81
88
  sortable: false,
82
89
  };
83
90
 
84
- const uptimeColumn: Column<NodesPreparedEntity> = {
91
+ const uptimeColumn: NodesColumn = {
85
92
  name: NODES_COLUMNS_IDS.Uptime,
86
93
  header: 'Uptime',
87
94
  sortAccessor: ({StartTime}) => StartTime && -StartTime,
95
+ render: ({row}) => row.Uptime,
88
96
  align: DataTable.RIGHT,
89
- width: '110px',
97
+ width: 110,
90
98
  sortable: false,
91
99
  };
92
100
 
93
- const memoryColumn: Column<NodesPreparedEntity> = {
101
+ const memoryColumn: NodesColumn = {
94
102
  name: NODES_COLUMNS_IDS.Memory,
95
103
  header: 'Memory',
96
104
  sortAccessor: ({MemoryUsed = 0}) => Number(MemoryUsed),
@@ -103,21 +111,21 @@ const memoryColumn: Column<NodesPreparedEntity> = {
103
111
  }
104
112
  },
105
113
  align: DataTable.RIGHT,
106
- width: '120px',
114
+ width: 120,
107
115
  };
108
116
 
109
- const cpuColumn: Column<NodesPreparedEntity> = {
117
+ const cpuColumn: NodesColumn = {
110
118
  name: NODES_COLUMNS_IDS.CPU,
111
119
  header: 'CPU',
112
120
  sortAccessor: ({PoolStats = []}) => Math.max(...PoolStats.map(({Usage}) => Number(Usage))),
113
121
  defaultOrder: DataTable.DESCENDING,
114
122
  render: ({row}) => (row.PoolStats ? <PoolsGraph pools={row.PoolStats} /> : '—'),
115
123
  align: DataTable.LEFT,
116
- width: '80px',
124
+ width: 80,
117
125
  sortable: false,
118
126
  };
119
127
 
120
- const loadAverageColumn: Column<NodesPreparedEntity> = {
128
+ const loadAverageColumn: NodesColumn = {
121
129
  name: NODES_COLUMNS_IDS.LoadAverage,
122
130
  header: 'Load average',
123
131
  sortAccessor: ({LoadAverage = []}) =>
@@ -135,13 +143,13 @@ const loadAverageColumn: Column<NodesPreparedEntity> = {
135
143
  '—'
136
144
  ),
137
145
  align: DataTable.LEFT,
138
- width: '140px',
146
+ width: 140,
139
147
  sortable: false,
140
148
  };
141
149
 
142
- const getTabletsColumn = (tabletsPath?: string): Column<NodesPreparedEntity> => ({
150
+ const getTabletsColumn = (tabletsPath?: string): NodesColumn => ({
143
151
  name: NODES_COLUMNS_IDS.Tablets,
144
- width: '430px',
152
+ width: 430,
145
153
  render: ({row}) => {
146
154
  return row.Tablets ? (
147
155
  <TabletsStatistic
@@ -157,7 +165,7 @@ const getTabletsColumn = (tabletsPath?: string): Column<NodesPreparedEntity> =>
157
165
  sortable: false,
158
166
  });
159
167
 
160
- const topNodesLoadAverageColumn: Column<NodesPreparedEntity> = {
168
+ const topNodesLoadAverageColumn: NodesColumn = {
161
169
  name: NODES_COLUMNS_IDS.TopNodesLoadAverage,
162
170
  header: 'Load',
163
171
  render: ({row}) =>
@@ -170,11 +178,11 @@ const topNodesLoadAverageColumn: Column<NodesPreparedEntity> = {
170
178
  '—'
171
179
  ),
172
180
  align: DataTable.LEFT,
173
- width: '80px',
181
+ width: 80,
174
182
  sortable: false,
175
183
  };
176
184
 
177
- const topNodesMemoryColumn: Column<NodesPreparedEntity> = {
185
+ const topNodesMemoryColumn: NodesColumn = {
178
186
  name: NODES_COLUMNS_IDS.TopNodesMemory,
179
187
  header: 'Memory',
180
188
  render: ({row}) =>
@@ -189,17 +197,14 @@ const topNodesMemoryColumn: Column<NodesPreparedEntity> = {
189
197
  '—'
190
198
  ),
191
199
  align: DataTable.LEFT,
192
- width: '140px',
200
+ width: 140,
193
201
  sortable: false,
194
202
  };
195
203
 
196
- export function getNodesColumns({
197
- tabletsPath,
198
- getNodeRef,
199
- }: GetNodesColumnsProps): Column<NodesPreparedEntity>[] {
204
+ export function getNodesColumns({tabletsPath, getNodeRef}: GetNodesColumnsProps): NodesColumn[] {
200
205
  return [
201
206
  nodeIdColumn,
202
- getHostColumn(getNodeRef, true),
207
+ getHostColumn(getNodeRef),
203
208
  dataCenterColumn,
204
209
  rackColumn,
205
210
  versionColumn,
@@ -213,23 +218,28 @@ export function getNodesColumns({
213
218
 
214
219
  export function getTopNodesByLoadColumns(
215
220
  getNodeRef?: GetNodeRefFunc,
216
- ): Column<NodesPreparedEntity>[] {
217
- return [topNodesLoadAverageColumn, nodeIdColumn, getHostColumn(getNodeRef), versionColumn];
221
+ ): DataTableColumn<NodesPreparedEntity>[] {
222
+ return [
223
+ topNodesLoadAverageColumn,
224
+ nodeIdColumn,
225
+ getHostColumnWithUndefinedWidth(getNodeRef),
226
+ versionColumn,
227
+ ];
218
228
  }
219
229
 
220
230
  export function getTopNodesByCpuColumns(
221
231
  getNodeRef?: GetNodeRefFunc,
222
- ): Column<NodesPreparedEntity>[] {
223
- return [cpuColumn, nodeIdColumn, getHostColumn(getNodeRef)];
232
+ ): DataTableColumn<NodesPreparedEntity>[] {
233
+ return [cpuColumn, nodeIdColumn, getHostColumnWithUndefinedWidth(getNodeRef)];
224
234
  }
225
235
 
226
236
  export function getTopNodesByMemoryColumns({
227
237
  tabletsPath,
228
238
  getNodeRef,
229
- }: GetNodesColumnsProps): Column<NodesPreparedEntity>[] {
239
+ }: GetNodesColumnsProps): NodesColumn[] {
230
240
  return [
231
241
  nodeIdColumn,
232
- getHostColumn(getNodeRef, true),
242
+ getHostColumn(getNodeRef),
233
243
  uptimeColumn,
234
244
  topNodesMemoryColumn,
235
245
  topNodesLoadAverageColumn,
@@ -19,8 +19,8 @@
19
19
  "settings.useNodesEndpoint.title": "Break the Nodes tab in Diagnostics",
20
20
  "settings.useNodesEndpoint.popover": "Use /viewer/json/nodes endpoint for Nodes Tab in diagnostics. It returns incorrect data on versions before 23-1",
21
21
 
22
- "settings.useBackendParamsForTables.title": "Offload tables filters and sorting to backend",
23
- "settings.useBackendParamsForTables.popover": "Filter and sort Nodes and Storage tables with request params. May increase performance, but could causes additional fetches and longer loading time on older versions",
22
+ "settings.useBackendParamsForTables.title": "Use virtual table for cluster Nodes tab",
23
+ "settings.useBackendParamsForTables.popover": "Use table with data load on scroll. It will increase performance, but could work unstable",
24
24
 
25
25
  "settings.enableAdditionalQueryModes.title": "Enable additional query modes",
26
26
  "settings.enableAdditionalQueryModes.popover": "Adds 'Data', 'YQL - QueryService' and 'PostgreSQL' modes. May not work on some versions",
@@ -19,8 +19,8 @@
19
19
  "settings.useNodesEndpoint.title": "Сломать вкладку Nodes в диагностике",
20
20
  "settings.useNodesEndpoint.popover": "Использовать эндпоинт /viewer/json/nodes для вкладки Nodes в диагностике. Может возвращать некорректные данные на версиях до 23-1",
21
21
 
22
- "settings.useBackendParamsForTables.title": "Перенести фильтры и сортировку таблиц на бэкенд",
23
- "settings.useBackendParamsForTables.popover": "Добавляет фильтрацию и сортировку таблиц Nodes и Storage с использованием параметров запроса. Может улушить производительность, но на старых версиях может привести к дополнительным запросам и большему времени ожидания загрузки",
22
+ "settings.useBackendParamsForTables.title": "Использовать виртуализированную таблицу для вкладки Nodes кластера",
23
+ "settings.useBackendParamsForTables.popover": "Использовать таблицу с загрузкой данных по скроллу. Это улучшит производительность, но может работать нестабильно",
24
24
 
25
25
  "settings.enableAdditionalQueryModes.title": "Включить дополнительные режимы выполнения запросов",
26
26
  "settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'Data', 'YQL - QueryService' и 'PostgreSQL'. Может работать некорректно на некоторых версиях",
@@ -2,10 +2,9 @@ import {useMemo} from 'react';
2
2
 
3
3
  import type {NodesGeneralRequestParams} from '../../store/reducers/nodes/types';
4
4
  import type {ProblemFilterValue} from '../../store/reducers/settings/types';
5
- import {ProblemFilterValues} from '../../store/reducers/settings/settings';
6
5
 
7
- import {HOUR_IN_SECONDS, USE_BACKEND_PARAMS_FOR_TABLES_KEY} from '../constants';
8
- import {NodesUptimeFilterValues} from '../nodes';
6
+ import {USE_BACKEND_PARAMS_FOR_TABLES_KEY} from '../constants';
7
+ import {NodesUptimeFilterValues, getProblemParamValue, getUptimeParamValue} from '../nodes';
9
8
  import {useSetting} from './useSetting';
10
9
 
11
10
  interface NodesRawRequestParams
@@ -27,11 +26,8 @@ export const useNodesRequestParams = ({
27
26
  // Otherwise no params will be updated, no hooks that depend on requestParams will be triggered
28
27
  return useMemo(() => {
29
28
  if (useBackendParamsForTables) {
30
- const problemsOnly = problemFilter === ProblemFilterValues.PROBLEMS;
31
- const uptime =
32
- nodesUptimeFilter === NodesUptimeFilterValues.SmallUptime
33
- ? HOUR_IN_SECONDS
34
- : undefined;
29
+ const problemsOnly = getProblemParamValue(problemFilter);
30
+ const uptime = getUptimeParamValue(nodesUptimeFilter);
35
31
 
36
32
  return {
37
33
  filter,
@@ -3,8 +3,12 @@ import type {TNodeInfo} from '../types/api/nodesList';
3
3
  import type {NodesPreparedEntity} from '../store/reducers/nodes/types';
4
4
  import type {NodesMap} from '../types/store/nodesList';
5
5
  import type {ValueOf} from '../types/common';
6
+ import type {ProblemFilterValue} from '../store/reducers/settings/types';
7
+ import {ProblemFilterValues} from '../store/reducers/settings/settings';
6
8
  import {EFlag} from '../types/api/enums';
7
9
 
10
+ import {HOUR_IN_SECONDS} from './constants';
11
+
8
12
  export enum NodesUptimeFilterValues {
9
13
  'All' = 'All',
10
14
  'SmallUptime' = 'SmallUptime',
@@ -27,6 +31,14 @@ export const prepareNodesMap = (nodesList?: TNodeInfo[]) => {
27
31
  }, new Map());
28
32
  };
29
33
 
34
+ export const getProblemParamValue = (problemFilter: ProblemFilterValue | undefined) => {
35
+ return problemFilter === ProblemFilterValues.PROBLEMS;
36
+ };
37
+
38
+ export const getUptimeParamValue = (nodesUptimeFilter: NodesUptimeFilterValues | undefined) => {
39
+ return nodesUptimeFilter === NodesUptimeFilterValues.SmallUptime ? HOUR_IN_SECONDS : undefined;
40
+ };
41
+
30
42
  /**
31
43
  * Values to sort /compute v2 and /nodes responses
32
44
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.20.4",
3
+ "version": "4.21.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],