ydb-embedded-ui 4.8.2 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +2 -2
  3. package/dist/containers/Nodes/Nodes.tsx +1 -1
  4. package/dist/containers/Nodes/getNodesColumns.tsx +2 -2
  5. package/dist/containers/Storage/PDisk/PDisk.tsx +1 -1
  6. package/dist/containers/Storage/Storage.js +26 -48
  7. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +16 -19
  8. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +12 -10
  9. package/dist/containers/Storage/StorageTypeFilter/StorageTypeFilter.tsx +27 -0
  10. package/dist/containers/Storage/StorageVisibleEntityFilter/StorageVisibleEntityFilter.tsx +31 -0
  11. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +17 -43
  12. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.scss +20 -15
  13. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.tsx +74 -27
  14. package/dist/containers/Tenant/Query/i18n/en.json +1 -1
  15. package/dist/containers/Tenant/Query/i18n/ru.json +1 -1
  16. package/dist/containers/UserSettings/i18n/en.json +1 -1
  17. package/dist/containers/UserSettings/i18n/ru.json +1 -1
  18. package/dist/services/api.ts +6 -13
  19. package/dist/store/reducers/executeQuery.ts +2 -3
  20. package/dist/store/reducers/explainQuery.ts +2 -2
  21. package/dist/store/reducers/index.ts +2 -2
  22. package/dist/store/reducers/{nodes.ts → nodes/nodes.ts} +31 -30
  23. package/dist/{types/store/nodes.ts → store/reducers/nodes/types.ts} +24 -27
  24. package/dist/store/reducers/settings/settings.ts +10 -2
  25. package/dist/store/reducers/storage/constants.ts +10 -0
  26. package/dist/store/reducers/{storage.js → storage/storage.js} +19 -53
  27. package/dist/store/reducers/storage/types.ts +12 -0
  28. package/dist/types/store/query.ts +5 -6
  29. package/dist/utils/constants.ts +1 -0
  30. package/dist/utils/nodes.ts +2 -2
  31. package/dist/utils/query.ts +12 -0
  32. package/package.json +1 -1
  33. package/dist/containers/Tenant/Query/QueryEditorControls/OldQueryEditorControls.tsx +0 -90
  34. package/dist/containers/Tenant/Query/QueryEditorControls/shared.ts +0 -18
@@ -15,12 +15,6 @@
15
15
  }
16
16
 
17
17
  &__run {
18
- display: flex;
19
- align-items: center;
20
- .yc-select__option-text {
21
- display: none;
22
- }
23
-
24
18
  .yc-button__text {
25
19
  display: flex;
26
20
  justify-content: center;
@@ -29,17 +23,11 @@
29
23
  }
30
24
  }
31
25
 
32
- &__select-query-action {
33
- margin-left: 2px;
34
- }
35
-
36
26
  &__mode-selector {
37
- &__popup {
38
- width: 120px;
39
- }
27
+ $b: &;
40
28
 
41
29
  &__button {
42
- width: 120px;
30
+ width: 189px;
43
31
  margin-left: 2px;
44
32
  }
45
33
 
@@ -48,7 +36,24 @@
48
36
  justify-content: space-between;
49
37
  align-items: center;
50
38
 
51
- width: 100px;
39
+ width: 163px;
40
+ }
41
+
42
+ &__popup {
43
+ width: 189px;
44
+
45
+ &_extended {
46
+ width: 241px;
47
+ }
48
+ }
49
+
50
+ &_extended {
51
+ #{$b}__button {
52
+ width: 241px;
53
+ }
54
+ #{$b}__button-content {
55
+ width: 215px;
56
+ }
52
57
  }
53
58
  }
54
59
  }
@@ -1,24 +1,49 @@
1
- import {Button, DropdownMenu} from '@gravity-ui/uikit';
1
+ import block from 'bem-cn-lite';
2
+
3
+ import {Button, ButtonView, DropdownMenu} from '@gravity-ui/uikit';
2
4
  import {useMemo} from 'react';
3
5
 
4
- import {QueryModes} from '../../../../types/store/query';
6
+ import type {QueryAction, QueryMode} from '../../../../types/store/query';
7
+ import {QUERY_MODES} from '../../../../utils/query';
5
8
  import {Icon} from '../../../../components/Icon';
6
9
 
7
10
  import SaveQuery from '../SaveQuery/SaveQuery';
8
11
 
9
12
  import i18n from '../i18n';
10
13
 
11
- import {QueryEditorControlsProps, b} from './shared';
12
-
13
14
  import './QueryEditorControls.scss';
14
15
 
15
- export const QueryModeSelectorTitles = {
16
- [QueryModes.script]: 'Script',
17
- [QueryModes.scan]: 'Scan',
18
- [QueryModes.data]: 'Data',
19
- [QueryModes.query]: 'Query',
16
+ const queryModeSelectorQa = 'query-mode-selector';
17
+ const queryModeSelectorPopupQa = 'query-mode-selector-popup';
18
+
19
+ const b = block('ydb-query-editor-controls');
20
+
21
+ const OldQueryModeSelectorTitles = {
22
+ [QUERY_MODES.script]: 'YQL Script',
23
+ [QUERY_MODES.scan]: 'Scan',
24
+ } as const;
25
+
26
+ const QueryModeSelectorTitles = {
27
+ [QUERY_MODES.script]: 'YQL Script',
28
+ [QUERY_MODES.scan]: 'Scan',
29
+ [QUERY_MODES.data]: 'Data',
30
+ [QUERY_MODES.query]: 'YQL - QueryService',
20
31
  } as const;
21
32
 
33
+ interface QueryEditorControlsProps {
34
+ onRunButtonClick: (mode?: QueryMode) => void;
35
+ runIsLoading: boolean;
36
+ onExplainButtonClick: (mode?: QueryMode) => void;
37
+ explainIsLoading: boolean;
38
+ onSaveQueryClick: (queryName: string) => void;
39
+ savedQueries: unknown;
40
+ disabled: boolean;
41
+ onUpdateQueryMode: (mode: QueryMode) => void;
42
+ queryMode: QueryMode;
43
+ enableAdditionalQueryModes: boolean;
44
+ highlitedAction: QueryAction;
45
+ }
46
+
22
47
  export const QueryEditorControls = ({
23
48
  onRunButtonClick,
24
49
  runIsLoading,
@@ -29,17 +54,27 @@ export const QueryEditorControls = ({
29
54
  disabled,
30
55
  onUpdateQueryMode,
31
56
  queryMode,
57
+ highlitedAction,
58
+ enableAdditionalQueryModes,
32
59
  }: QueryEditorControlsProps) => {
33
60
  const querySelectorMenuItems = useMemo(() => {
34
- return Object.entries(QueryModeSelectorTitles).map(([mode, title]) => {
61
+ const titles = enableAdditionalQueryModes
62
+ ? QueryModeSelectorTitles
63
+ : OldQueryModeSelectorTitles;
64
+
65
+ return Object.entries(titles).map(([mode, title]) => {
35
66
  return {
36
67
  text: title,
37
68
  action: () => {
38
- onUpdateQueryMode(mode as QueryModes);
69
+ onUpdateQueryMode(mode as QueryMode);
39
70
  },
40
71
  };
41
72
  });
42
- }, [onUpdateQueryMode]);
73
+ }, [onUpdateQueryMode, enableAdditionalQueryModes]);
74
+
75
+ const runView: ButtonView | undefined = highlitedAction === 'execute' ? 'action' : undefined;
76
+ const explainView: ButtonView | undefined =
77
+ highlitedAction === 'explain' ? 'action' : undefined;
43
78
 
44
79
  return (
45
80
  <div className={b()}>
@@ -49,9 +84,9 @@ export const QueryEditorControls = ({
49
84
  onClick={() => {
50
85
  onRunButtonClick(queryMode);
51
86
  }}
52
- view="action"
53
87
  disabled={disabled}
54
88
  loading={runIsLoading}
89
+ view={runView}
55
90
  >
56
91
  <Icon name="startPlay" viewBox="0 0 16 16" width={16} height={16} />
57
92
  {'Run'}
@@ -63,23 +98,35 @@ export const QueryEditorControls = ({
63
98
  }}
64
99
  disabled={disabled}
65
100
  loading={explainIsLoading}
101
+ view={explainView}
66
102
  >
67
103
  Explain
68
104
  </Button>
69
- <DropdownMenu
70
- items={querySelectorMenuItems}
71
- popupProps={{className: b('mode-selector__popup')}}
72
- switcher={
73
- <Button className={b('mode-selector__button')}>
74
- <span className={b('mode-selector__button-content')}>
75
- {`${i18n('controls.query-mode-selector_type')} ${
76
- QueryModeSelectorTitles[queryMode]
77
- }`}
78
- <Icon name="chevron-down" width={16} height={16} />
79
- </span>
80
- </Button>
81
- }
82
- />
105
+ <div
106
+ className={b('mode-selector', {
107
+ extended: enableAdditionalQueryModes,
108
+ })}
109
+ >
110
+ <DropdownMenu
111
+ items={querySelectorMenuItems}
112
+ popupProps={{
113
+ className: b('mode-selector__popup', {
114
+ extended: enableAdditionalQueryModes,
115
+ }),
116
+ qa: queryModeSelectorPopupQa,
117
+ }}
118
+ switcher={
119
+ <Button className={b('mode-selector__button')} qa={queryModeSelectorQa}>
120
+ <span className={b('mode-selector__button-content')}>
121
+ {`${i18n('controls.query-mode-selector_type')} ${
122
+ QueryModeSelectorTitles[queryMode]
123
+ }`}
124
+ <Icon name="chevron-down" width={16} height={16} />
125
+ </span>
126
+ </Button>
127
+ }
128
+ />
129
+ </div>
83
130
  </div>
84
131
  <SaveQuery
85
132
  savedQueries={savedQueries}
@@ -1,5 +1,5 @@
1
1
  {
2
- "controls.query-mode-selector_type": "Type:",
2
+ "controls.query-mode-selector_type": "Query type:",
3
3
  "tabs.newQuery": "New query",
4
4
  "tabs.history": "History",
5
5
  "tabs.saved": "Saved",
@@ -1,5 +1,5 @@
1
1
  {
2
- "controls.query-mode-selector_type": "Тип:",
2
+ "controls.query-mode-selector_type": "Тип запроса:",
3
3
  "tabs.newQuery": "Новый запрос",
4
4
  "tabs.history": "История",
5
5
  "tabs.saved": "Сохраненные",
@@ -16,5 +16,5 @@
16
16
  "settings.useNodesEndpoint.popover": "Use /viewer/json/nodes endpoint for Nodes Tab in diagnostics. It returns incorrect data on versions before 23-1",
17
17
 
18
18
  "settings.enableAdditionalQueryModes.title": "Enable additional query modes",
19
- "settings.enableAdditionalQueryModes.popover": "Adds 'data' and 'query' modes for run. Enables query modes for explain. May not work on some versions"
19
+ "settings.enableAdditionalQueryModes.popover": "Adds 'Data' and 'YQL - QueryService' modes. May not work on some versions"
20
20
  }
@@ -16,5 +16,5 @@
16
16
  "settings.useNodesEndpoint.popover": "Использовать эндпоинт /viewer/json/nodes для вкладки Nodes в диагностике. Может возвращать некорректные данные на версиях до 23-1",
17
17
 
18
18
  "settings.enableAdditionalQueryModes.title": "Включить дополнительные режимы выполнения запросов",
19
- "settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'data' и 'query' для run. Включает возможность выбрать режим выполнения запроса для explain. Может работать некорректно на некоторых версиях"
19
+ "settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'Data' и 'YQL - QueryService'. Может работать некорректно на некоторых версиях"
20
20
  }
@@ -28,7 +28,8 @@ import type {DescribeTopicResult} from '../types/api/topic';
28
28
  import type {TEvPDiskStateResponse} from '../types/api/pdisk';
29
29
  import type {TEvVDiskStateResponse} from '../types/api/vdisk';
30
30
  import type {TUserToken} from '../types/api/whoami';
31
- import type {INodesApiRequestParams} from '../types/store/nodes';
31
+ import type {NodesApiRequestParams} from '../store/reducers/nodes/types';
32
+ import type {StorageApiRequestParams} from '../store/reducers/storage/types';
32
33
 
33
34
  import {backend as BACKEND} from '../store';
34
35
 
@@ -81,14 +82,14 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
81
82
  });
82
83
  }
83
84
  getNodes(
84
- {tenant, filter, storage, type = 'any', tablets = true}: INodesApiRequestParams,
85
+ {tenant, visibleEntities, storage, type = 'any', tablets = true}: NodesApiRequestParams,
85
86
  {concurrentId}: AxiosOptions = {},
86
87
  ) {
87
88
  return this.get<TNodesInfo>(
88
89
  this.getPath('/viewer/json/nodes?enums=true'),
89
90
  {
90
91
  tenant,
91
- with: filter,
92
+ with: visibleEntities,
92
93
  storage,
93
94
  type,
94
95
  tablets,
@@ -102,15 +103,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
102
103
  return this.get<TComputeInfo>(this.getPath('/viewer/json/compute?enums=true'), {path});
103
104
  }
104
105
  getStorageInfo(
105
- {
106
- tenant,
107
- filter,
108
- nodeId,
109
- }: {
110
- tenant?: string;
111
- filter?: string;
112
- nodeId: string;
113
- },
106
+ {tenant, visibleEntities, nodeId}: StorageApiRequestParams,
114
107
  {concurrentId}: AxiosOptions = {},
115
108
  ) {
116
109
  return this.get<TStorageInfo>(
@@ -118,7 +111,7 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
118
111
  {
119
112
  tenant,
120
113
  node_id: nodeId,
121
- with: filter,
114
+ with: visibleEntities,
122
115
  },
123
116
  {
124
117
  concurrentId,
@@ -6,7 +6,7 @@ import type {
6
6
  ExecuteQueryState,
7
7
  MonacoHotKeyAction,
8
8
  } from '../../types/store/executeQuery';
9
- import type {QueryRequestParams, QueryModes} from '../../types/store/query';
9
+ import type {QueryRequestParams, QueryMode} from '../../types/store/query';
10
10
  import {getValueFromLS, parseJson} from '../../utils/utils';
11
11
  import {QUERIES_HISTORY_KEY} from '../../utils/constants';
12
12
  import {parseQueryAPIExecuteResponse} from '../../utils/query';
@@ -34,7 +34,6 @@ export const MONACO_HOT_KEY_ACTIONS = {
34
34
  sendQuery: 'sendQuery',
35
35
  goPrev: 'goPrev',
36
36
  goNext: 'goNext',
37
- getExplain: 'getExplain',
38
37
  } as const;
39
38
 
40
39
  const initialState = {
@@ -148,7 +147,7 @@ const executeQuery: Reducer<ExecuteQueryState, ExecuteQueryAction> = (
148
147
  };
149
148
 
150
149
  interface SendQueryParams extends QueryRequestParams {
151
- mode?: QueryModes;
150
+ mode?: QueryMode;
152
151
  }
153
152
 
154
153
  export const sendExecuteQuery = ({query, database, mode}: SendQueryParams) => {
@@ -9,7 +9,7 @@ import type {
9
9
  ExplainQueryState,
10
10
  PreparedExplainResponse,
11
11
  } from '../../types/store/explainQuery';
12
- import type {QueryRequestParams, QueryModes} from '../../types/store/query';
12
+ import type {QueryRequestParams, QueryMode} from '../../types/store/query';
13
13
 
14
14
  import {preparePlan} from '../../utils/prepareQueryExplain';
15
15
  import {parseQueryAPIExplainResponse, parseQueryExplainPlan} from '../../utils/query';
@@ -99,7 +99,7 @@ export const explainVersions = {
99
99
  const supportedExplainQueryVersions = Object.values(explainVersions);
100
100
 
101
101
  interface ExplainQueryParams extends QueryRequestParams {
102
- mode?: QueryModes;
102
+ mode?: QueryMode;
103
103
  }
104
104
 
105
105
  export const getExplainQuery = ({query, database, mode}: ExplainQueryParams) => {
@@ -1,10 +1,10 @@
1
1
  import {combineReducers} from 'redux';
2
2
 
3
- import nodes from './nodes';
3
+ import nodes from './nodes/nodes';
4
4
  import cluster from './cluster/cluster';
5
5
  import clusterNodes from './clusterNodes/clusterNodes';
6
6
  import tenant from './tenant/tenant';
7
- import storage from './storage';
7
+ import storage from './storage/storage';
8
8
  import node from './node/node';
9
9
  import tooltip from './tooltip';
10
10
  import tablets from './tablets';
@@ -2,23 +2,24 @@ import type {Reducer} from 'redux';
2
2
  import {createSelector, Selector} from 'reselect';
3
3
  import {escapeRegExp} from 'lodash/fp';
4
4
 
5
- import '../../services/api';
6
- import {HOUR_IN_SECONDS} from '../../utils/constants';
7
- import {calcUptime, calcUptimeInSeconds} from '../../utils';
8
- import {NodesUptimeFilterValues} from '../../utils/nodes';
5
+ import type {ValueOf} from '../../../types/common';
6
+ import '../../../services/api';
7
+ import {HOUR_IN_SECONDS} from '../../../utils/constants';
8
+ import {calcUptime, calcUptimeInSeconds} from '../../../utils';
9
+ import {NodesUptimeFilterValues} from '../../../utils/nodes';
10
+ import {EFlag} from '../../../types/api/enums';
11
+
12
+ import {createRequestActionTypes, createApiRequest} from '../../utils';
13
+ import {ProblemFilterValues} from '../settings/settings';
14
+
9
15
  import type {
10
- INodesAction,
11
- INodesApiRequestParams,
12
- INodesHandledResponse,
13
- INodesPreparedEntity,
14
- INodesRootStateSlice,
15
- INodesState,
16
- } from '../../types/store/nodes';
17
- import type {ValueOf} from '../../types/common';
18
- import {EFlag} from '../../types/api/enums';
19
-
20
- import {createRequestActionTypes, createApiRequest} from '../utils';
21
- import {ProblemFilterValues} from './settings/settings';
16
+ NodesAction,
17
+ NodesApiRequestParams,
18
+ NodesHandledResponse,
19
+ NodesPreparedEntity,
20
+ NodesStateSlice,
21
+ NodesState,
22
+ } from './types';
22
23
 
23
24
  export const FETCH_NODES = createRequestActionTypes('nodes', 'FETCH_NODES');
24
25
 
@@ -34,7 +35,7 @@ const initialState = {
34
35
  searchValue: '',
35
36
  };
36
37
 
37
- const nodes: Reducer<INodesState, INodesAction> = (state = initialState, action) => {
38
+ const nodes: Reducer<NodesState, NodesAction> = (state = initialState, action) => {
38
39
  switch (action.type) {
39
40
  case FETCH_NODES.REQUEST: {
40
41
  return {
@@ -92,11 +93,11 @@ const nodes: Reducer<INodesState, INodesAction> = (state = initialState, action)
92
93
  }
93
94
  };
94
95
 
95
- export function getNodes({tenant, filter, type = 'any'}: INodesApiRequestParams) {
96
+ export function getNodes({tenant, visibleEntities, type = 'any'}: NodesApiRequestParams) {
96
97
  return createApiRequest({
97
- request: window.api.getNodes({tenant, filter, type}),
98
+ request: window.api.getNodes({tenant, visibleEntities, type}),
98
99
  actions: FETCH_NODES,
99
- dataHandler: (data): INodesHandledResponse => {
100
+ dataHandler: (data): NodesHandledResponse => {
100
101
  const rawNodes = data.Nodes || [];
101
102
 
102
103
  const preparedNodes = rawNodes.map((node) => {
@@ -121,8 +122,8 @@ export function getComputeNodes(path: string) {
121
122
  return createApiRequest({
122
123
  request: window.api.getCompute(path),
123
124
  actions: FETCH_NODES,
124
- dataHandler: (data): INodesHandledResponse => {
125
- const preparedNodes: INodesPreparedEntity[] = [];
125
+ dataHandler: (data): NodesHandledResponse => {
126
+ const preparedNodes: NodesPreparedEntity[] = [];
126
127
 
127
128
  if (data.Tenants) {
128
129
  for (const tenant of data.Tenants) {
@@ -174,12 +175,12 @@ export const setSearchValue = (value: string) => {
174
175
  } as const;
175
176
  };
176
177
 
177
- const getNodesUptimeFilter = (state: INodesRootStateSlice) => state.nodes.nodesUptimeFilter;
178
- const getSearchValue = (state: INodesRootStateSlice) => state.nodes.searchValue;
179
- const getNodesList = (state: INodesRootStateSlice) => state.nodes.data;
178
+ const getNodesUptimeFilter = (state: NodesStateSlice) => state.nodes.nodesUptimeFilter;
179
+ const getSearchValue = (state: NodesStateSlice) => state.nodes.searchValue;
180
+ const getNodesList = (state: NodesStateSlice) => state.nodes.data;
180
181
 
181
182
  const filterNodesByProblemsStatus = (
182
- nodesList: INodesPreparedEntity[] = [],
183
+ nodesList: NodesPreparedEntity[] = [],
183
184
  problemFilter: ValueOf<typeof ProblemFilterValues>,
184
185
  ) => {
185
186
  if (problemFilter === ProblemFilterValues.ALL) {
@@ -192,7 +193,7 @@ const filterNodesByProblemsStatus = (
192
193
  };
193
194
 
194
195
  export const filterNodesByUptime = (
195
- nodesList: INodesPreparedEntity[] = [],
196
+ nodesList: NodesPreparedEntity[] = [],
196
197
  nodesUptimeFilter: NodesUptimeFilterValues,
197
198
  ) => {
198
199
  if (nodesUptimeFilter === NodesUptimeFilterValues.All) {
@@ -203,7 +204,7 @@ export const filterNodesByUptime = (
203
204
  });
204
205
  };
205
206
 
206
- const filterNodesBySearchValue = (nodesList: INodesPreparedEntity[] = [], searchValue: string) => {
207
+ const filterNodesBySearchValue = (nodesList: NodesPreparedEntity[] = [], searchValue: string) => {
207
208
  if (!searchValue) {
208
209
  return nodesList;
209
210
  }
@@ -215,8 +216,8 @@ const filterNodesBySearchValue = (nodesList: INodesPreparedEntity[] = [], search
215
216
  };
216
217
 
217
218
  export const getFilteredPreparedNodesList: Selector<
218
- INodesRootStateSlice,
219
- INodesPreparedEntity[] | undefined
219
+ NodesStateSlice,
220
+ NodesPreparedEntity[] | undefined
220
221
  > = createSelector(
221
222
  [getNodesList, getNodesUptimeFilter, getSearchValue, (state) => state.settings.problemFilter],
222
223
  (nodesList, uptimeFilter, searchValue, problemFilter) => {
@@ -1,22 +1,23 @@
1
- import type {IResponseError} from '../api/error';
2
- import type {TEndpoint, TPoolStats} from '../api/nodes';
3
- import type {TTabletStateInfo as TComputeTabletStateInfo} from '../api/compute';
4
- import type {TTabletStateInfo as TFullTabletStateInfo} from '../api/tablet';
5
- import type {EFlag} from '../api/enums';
1
+ import type {IResponseError} from '../../../types/api/error';
2
+ import type {TEndpoint, TPoolStats} from '../../../types/api/nodes';
3
+ import type {TTabletStateInfo as TComputeTabletStateInfo} from '../../../types/api/compute';
4
+ import type {TTabletStateInfo as TFullTabletStateInfo} from '../../../types/api/tablet';
5
+ import type {EFlag} from '../../../types/api/enums';
6
+ import type {ApiRequestAction} from '../../utils';
7
+ import type {VisibleEntities} from '../storage/types';
6
8
 
7
- import {NodesUptimeFilterValues} from '../../utils/nodes';
9
+ import {NodesUptimeFilterValues} from '../../../utils/nodes';
8
10
  import {
9
11
  FETCH_NODES,
10
12
  resetNodesState,
11
13
  setDataWasNotLoaded,
12
14
  setNodesUptimeFilter,
13
15
  setSearchValue,
14
- } from '../../store/reducers/nodes';
15
- import {ApiRequestAction} from '../../store/utils';
16
+ } from './nodes';
16
17
 
17
18
  // Since nodes from different endpoints can have different types,
18
19
  // This type describes fields, that are expected by tables with nodes
19
- export interface INodesPreparedEntity {
20
+ export interface NodesPreparedEntity {
20
21
  NodeId: number;
21
22
  Host?: string;
22
23
  SystemState?: EFlag;
@@ -33,43 +34,39 @@ export interface INodesPreparedEntity {
33
34
  Endpoints?: TEndpoint[];
34
35
  }
35
36
 
36
- export interface INodesState {
37
+ export interface NodesState {
37
38
  loading: boolean;
38
39
  wasLoaded: boolean;
39
40
  nodesUptimeFilter: NodesUptimeFilterValues;
40
41
  searchValue: string;
41
- data?: INodesPreparedEntity[];
42
+ data?: NodesPreparedEntity[];
42
43
  totalNodes?: number;
43
44
  error?: IResponseError;
44
45
  }
45
46
 
46
- type INodesApiRequestNodeType = 'static' | 'dynamic' | 'any';
47
+ export type NodeType = 'static' | 'dynamic' | 'any';
47
48
 
48
- // Space - out of space nodes
49
- // Missing - nodes with missing disks
50
- type INodesApiRequestProblemType = 'missing' | 'space';
51
-
52
- export interface INodesApiRequestParams {
49
+ export interface NodesApiRequestParams {
53
50
  tenant?: string;
54
- type?: INodesApiRequestNodeType;
55
- filter?: INodesApiRequestProblemType;
51
+ type?: NodeType;
52
+ visibleEntities?: VisibleEntities;
56
53
  storage?: boolean;
57
54
  tablets?: boolean;
58
55
  }
59
56
 
60
- export interface INodesHandledResponse {
61
- Nodes?: INodesPreparedEntity[];
57
+ export interface NodesHandledResponse {
58
+ Nodes?: NodesPreparedEntity[];
62
59
  TotalNodes: number;
63
60
  }
64
61
 
65
- type INodesApiRequestAction = ApiRequestAction<
62
+ type NodesApiRequestAction = ApiRequestAction<
66
63
  typeof FETCH_NODES,
67
- INodesHandledResponse,
64
+ NodesHandledResponse,
68
65
  IResponseError
69
66
  >;
70
67
 
71
- export type INodesAction =
72
- | INodesApiRequestAction
68
+ export type NodesAction =
69
+ | NodesApiRequestAction
73
70
  | (
74
71
  | ReturnType<typeof setDataWasNotLoaded>
75
72
  | ReturnType<typeof setNodesUptimeFilter>
@@ -77,6 +74,6 @@ export type INodesAction =
77
74
  | ReturnType<typeof resetNodesState>
78
75
  );
79
76
 
80
- export interface INodesRootStateSlice {
81
- nodes: INodesState;
77
+ export interface NodesStateSlice {
78
+ nodes: NodesState;
82
79
  }
@@ -13,10 +13,11 @@ import {
13
13
  QUERY_INITIAL_MODE_KEY,
14
14
  ENABLE_ADDITIONAL_QUERY_MODES,
15
15
  CLUSTER_INFO_HIDDEN_KEY,
16
+ LAST_USED_QUERY_ACTION_KEY,
16
17
  } from '../../../utils/constants';
17
18
  import '../../../services/api';
18
19
  import {getValueFromLS, parseJson} from '../../../utils/utils';
19
- import {QueryModes} from '../../../types/store/query';
20
+ import {QUERY_ACTIONS, QUERY_MODES} from '../../../utils/query';
20
21
 
21
22
  import {TENANT_PAGES_IDS} from '../tenant/constants';
22
23
 
@@ -64,7 +65,14 @@ export const initialState = {
64
65
  TENANT_INITIAL_PAGE_KEY,
65
66
  TENANT_PAGES_IDS.query,
66
67
  ),
67
- [QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(QUERY_INITIAL_MODE_KEY, QueryModes.script),
68
+ [QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(
69
+ QUERY_INITIAL_MODE_KEY,
70
+ QUERY_MODES.script,
71
+ ),
72
+ [LAST_USED_QUERY_ACTION_KEY]: readSavedSettingsValue(
73
+ LAST_USED_QUERY_ACTION_KEY,
74
+ QUERY_ACTIONS.execute,
75
+ ),
68
76
  [ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
69
77
  [PARTITIONS_HIDDEN_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_HIDDEN_COLUMNS_KEY),
70
78
  [CLUSTER_INFO_HIDDEN_KEY]: readSavedSettingsValue(CLUSTER_INFO_HIDDEN_KEY, 'true'),
@@ -0,0 +1,10 @@
1
+ export const VISIBLE_ENTITIES = {
2
+ all: 'all',
3
+ missing: 'missing',
4
+ space: 'space',
5
+ } as const;
6
+
7
+ export const STORAGE_TYPES = {
8
+ groups: 'groups',
9
+ nodes: 'nodes',
10
+ } as const;