ydb-embedded-ui 4.8.1 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +22 -0
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +2 -2
- package/dist/components/Tablet/Tablet.tsx +2 -13
- package/dist/containers/Header/breadcrumbs.ts +22 -6
- package/dist/containers/Nodes/Nodes.tsx +1 -1
- package/dist/containers/Nodes/getNodesColumns.tsx +2 -2
- package/dist/containers/Storage/PDisk/PDisk.tsx +1 -1
- package/dist/containers/Storage/Storage.js +26 -48
- package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +16 -19
- package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +12 -10
- package/dist/containers/Storage/StorageTypeFilter/StorageTypeFilter.tsx +27 -0
- package/dist/containers/Storage/StorageVisibleEntityFilter/StorageVisibleEntityFilter.tsx +31 -0
- package/dist/containers/Tablet/Tablet.tsx +2 -11
- package/dist/containers/TabletsFilters/TabletsFilters.js +8 -3
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +17 -43
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.scss +20 -15
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.tsx +74 -27
- package/dist/containers/Tenant/Query/i18n/en.json +1 -1
- package/dist/containers/Tenant/Query/i18n/ru.json +1 -1
- package/dist/containers/UserSettings/i18n/en.json +1 -1
- package/dist/containers/UserSettings/i18n/ru.json +1 -1
- package/dist/services/api.ts +6 -13
- package/dist/store/reducers/executeQuery.ts +2 -3
- package/dist/store/reducers/explainQuery.ts +2 -2
- package/dist/store/reducers/header/types.ts +0 -2
- package/dist/store/reducers/index.ts +2 -2
- package/dist/store/reducers/{nodes.ts → nodes/nodes.ts} +31 -30
- package/dist/{types/store/nodes.ts → store/reducers/nodes/types.ts} +24 -27
- package/dist/store/reducers/settings/settings.ts +10 -2
- package/dist/store/reducers/storage/constants.ts +10 -0
- package/dist/store/reducers/{storage.js → storage/storage.js} +19 -53
- package/dist/store/reducers/storage/types.ts +12 -0
- package/dist/types/store/query.ts +5 -6
- package/dist/utils/constants.ts +1 -0
- package/dist/utils/nodes.ts +2 -2
- package/dist/utils/query.ts +12 -0
- package/package.json +1 -1
- package/dist/containers/Tenant/Query/QueryEditorControls/OldQueryEditorControls.tsx +0 -90
- package/dist/containers/Tenant/Query/QueryEditorControls/shared.ts +0 -18
@@ -26,9 +26,10 @@ import {
|
|
26
26
|
SAVED_QUERIES_KEY,
|
27
27
|
QUERY_INITIAL_MODE_KEY,
|
28
28
|
ENABLE_ADDITIONAL_QUERY_MODES,
|
29
|
+
LAST_USED_QUERY_ACTION_KEY,
|
29
30
|
} from '../../../../utils/constants';
|
30
31
|
import {useSetting} from '../../../../utils/hooks';
|
31
|
-
import {
|
32
|
+
import {QUERY_ACTIONS, QUERY_MODES} from '../../../../utils/query';
|
32
33
|
|
33
34
|
import {
|
34
35
|
PaneVisibilityActionTypes,
|
@@ -39,7 +40,6 @@ import Preview from '../../Preview/Preview';
|
|
39
40
|
import {ExecuteResult} from '../ExecuteResult/ExecuteResult';
|
40
41
|
import {ExplainResult} from '../ExplainResult/ExplainResult';
|
41
42
|
import {QueryEditorControls} from '../QueryEditorControls/QueryEditorControls';
|
42
|
-
import {OldQueryEditorControls} from '../QueryEditorControls/OldQueryEditorControls';
|
43
43
|
|
44
44
|
import {getPreparedResult} from '../utils/getPreparedResult';
|
45
45
|
|
@@ -93,11 +93,12 @@ function QueryEditor(props) {
|
|
93
93
|
const [isResultLoaded, setIsResultLoaded] = useState(false);
|
94
94
|
const [queryMode, setQueryMode] = useSetting(QUERY_INITIAL_MODE_KEY);
|
95
95
|
const [enableAdditionalQueryModes] = useSetting(ENABLE_ADDITIONAL_QUERY_MODES);
|
96
|
+
const [lastUsedQueryAction, setLastUsedQueryAction] = useSetting(LAST_USED_QUERY_ACTION_KEY);
|
96
97
|
|
97
98
|
useEffect(() => {
|
98
|
-
const isNewQueryMode = queryMode !==
|
99
|
+
const isNewQueryMode = queryMode !== QUERY_MODES.script && queryMode !== QUERY_MODES.scan;
|
99
100
|
if (!enableAdditionalQueryModes && isNewQueryMode) {
|
100
|
-
setQueryMode(
|
101
|
+
setQueryMode(QUERY_MODES.script);
|
101
102
|
}
|
102
103
|
}, [enableAdditionalQueryModes, queryMode, setQueryMode]);
|
103
104
|
|
@@ -170,7 +171,11 @@ function QueryEditor(props) {
|
|
170
171
|
setMonacoHotKey(null);
|
171
172
|
switch (monacoHotKey) {
|
172
173
|
case MONACO_HOT_KEY_ACTIONS.sendQuery: {
|
173
|
-
|
174
|
+
if (lastUsedQueryAction === QUERY_ACTIONS.explain) {
|
175
|
+
return handleGetExplainQueryClick(queryMode);
|
176
|
+
} else {
|
177
|
+
return handleSendExecuteClick(queryMode);
|
178
|
+
}
|
174
179
|
}
|
175
180
|
case MONACO_HOT_KEY_ACTIONS.goPrev: {
|
176
181
|
return handlePreviousHistoryClick();
|
@@ -178,9 +183,6 @@ function QueryEditor(props) {
|
|
178
183
|
case MONACO_HOT_KEY_ACTIONS.goNext: {
|
179
184
|
return handleNextHistoryClick();
|
180
185
|
}
|
181
|
-
case MONACO_HOT_KEY_ACTIONS.getExplain: {
|
182
|
-
return handleGetExplainQueryClick();
|
183
|
-
}
|
184
186
|
default: {
|
185
187
|
return;
|
186
188
|
}
|
@@ -201,8 +203,8 @@ function QueryEditor(props) {
|
|
201
203
|
editorRef.current = editor;
|
202
204
|
editor.focus();
|
203
205
|
editor.addAction({
|
204
|
-
id: '
|
205
|
-
label: '
|
206
|
+
id: 'sendQuery',
|
207
|
+
label: 'Send query',
|
206
208
|
keybindings: [
|
207
209
|
// eslint-disable-next-line no-bitwise
|
208
210
|
monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter,
|
@@ -240,22 +242,6 @@ function QueryEditor(props) {
|
|
240
242
|
contextMenuOrder: 3,
|
241
243
|
run: handleKeyBinding(MONACO_HOT_KEY_ACTIONS.goNext),
|
242
244
|
});
|
243
|
-
|
244
|
-
editor.addAction({
|
245
|
-
id: 'explain',
|
246
|
-
label: 'Explain',
|
247
|
-
keybindings: [
|
248
|
-
// eslint-disable-next-line no-bitwise
|
249
|
-
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_E,
|
250
|
-
],
|
251
|
-
// A precondition for this action.
|
252
|
-
precondition: null,
|
253
|
-
// A rule to evaluate on top of the precondition in order to dispatch the keybindings.
|
254
|
-
keybindingContext: null,
|
255
|
-
contextMenuGroupId: CONTEXT_MENU_GROUP_ID,
|
256
|
-
contextMenuOrder: 4,
|
257
|
-
run: handleKeyBinding(MONACO_HOT_KEY_ACTIONS.getExplain),
|
258
|
-
});
|
259
245
|
};
|
260
246
|
const onChange = (newValue) => {
|
261
247
|
props.changeUserInput({input: newValue});
|
@@ -270,6 +256,7 @@ function QueryEditor(props) {
|
|
270
256
|
setShowPreview,
|
271
257
|
} = props;
|
272
258
|
|
259
|
+
setLastUsedQueryAction(QUERY_ACTIONS.execute);
|
273
260
|
setResultType(RESULT_TYPES.EXECUTE);
|
274
261
|
sendExecuteQuery({query: input, database: path, mode});
|
275
262
|
setIsResultLoaded(true);
|
@@ -290,6 +277,7 @@ function QueryEditor(props) {
|
|
290
277
|
setShowPreview,
|
291
278
|
} = props;
|
292
279
|
|
280
|
+
setLastUsedQueryAction(QUERY_ACTIONS.explain);
|
293
281
|
setResultType(RESULT_TYPES.EXPLAIN);
|
294
282
|
getExplainQuery({
|
295
283
|
query: input,
|
@@ -488,24 +476,8 @@ function QueryEditor(props) {
|
|
488
476
|
const renderControls = () => {
|
489
477
|
const {executeQuery, explainQuery, savedQueries} = props;
|
490
478
|
|
491
|
-
if (enableAdditionalQueryModes) {
|
492
|
-
return (
|
493
|
-
<QueryEditorControls
|
494
|
-
onRunButtonClick={handleSendExecuteClick}
|
495
|
-
runIsLoading={executeQuery.loading}
|
496
|
-
onExplainButtonClick={handleGetExplainQueryClick}
|
497
|
-
explainIsLoading={explainQuery.loading}
|
498
|
-
onSaveQueryClick={onSaveQueryHandler}
|
499
|
-
savedQueries={savedQueries}
|
500
|
-
disabled={!executeQuery.input}
|
501
|
-
onUpdateQueryMode={setQueryMode}
|
502
|
-
queryMode={queryMode}
|
503
|
-
/>
|
504
|
-
);
|
505
|
-
}
|
506
|
-
|
507
479
|
return (
|
508
|
-
<
|
480
|
+
<QueryEditorControls
|
509
481
|
onRunButtonClick={handleSendExecuteClick}
|
510
482
|
runIsLoading={executeQuery.loading}
|
511
483
|
onExplainButtonClick={handleGetExplainQueryClick}
|
@@ -515,6 +487,8 @@ function QueryEditor(props) {
|
|
515
487
|
disabled={!executeQuery.input}
|
516
488
|
onUpdateQueryMode={setQueryMode}
|
517
489
|
queryMode={queryMode}
|
490
|
+
enableAdditionalQueryModes={enableAdditionalQueryModes}
|
491
|
+
highlitedAction={lastUsedQueryAction}
|
518
492
|
/>
|
519
493
|
);
|
520
494
|
};
|
@@ -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
|
-
|
38
|
-
width: 120px;
|
39
|
-
}
|
27
|
+
$b: &;
|
40
28
|
|
41
29
|
&__button {
|
42
|
-
width:
|
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:
|
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
|
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 {
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
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
|
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
|
-
<
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
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}
|
@@ -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 '
|
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": "Добавляет режимы '
|
19
|
+
"settings.enableAdditionalQueryModes.popover": "Добавляет режимы 'Data' и 'YQL - QueryService'. Может работать некорректно на некоторых версиях"
|
20
20
|
}
|
package/dist/services/api.ts
CHANGED
@@ -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 {
|
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,
|
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:
|
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:
|
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,
|
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?:
|
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,
|
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?:
|
102
|
+
mode?: QueryMode;
|
103
103
|
}
|
104
104
|
|
105
105
|
export const getExplainQuery = ({query, database, mode}: ExplainQueryParams) => {
|
@@ -19,8 +19,6 @@ export interface NodeBreadcrumbsOptions extends TenantBreadcrumbsOptions {
|
|
19
19
|
|
20
20
|
export interface TabletsBreadcrumbsOptions extends TenantBreadcrumbsOptions {
|
21
21
|
nodeIds?: string[] | number[];
|
22
|
-
state?: string;
|
23
|
-
type?: string;
|
24
22
|
}
|
25
23
|
|
26
24
|
export interface TabletBreadcrumbsOptions extends TabletsBreadcrumbsOptions {
|
@@ -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 '
|
6
|
-
import
|
7
|
-
import {
|
8
|
-
import {
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
} from '
|
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<
|
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,
|
96
|
+
export function getNodes({tenant, visibleEntities, type = 'any'}: NodesApiRequestParams) {
|
96
97
|
return createApiRequest({
|
97
|
-
request: window.api.getNodes({tenant,
|
98
|
+
request: window.api.getNodes({tenant, visibleEntities, type}),
|
98
99
|
actions: FETCH_NODES,
|
99
|
-
dataHandler: (data):
|
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):
|
125
|
-
const preparedNodes:
|
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:
|
178
|
-
const getSearchValue = (state:
|
179
|
-
const getNodesList = (state:
|
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:
|
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:
|
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:
|
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
|
-
|
219
|
-
|
219
|
+
NodesStateSlice,
|
220
|
+
NodesPreparedEntity[] | undefined
|
220
221
|
> = createSelector(
|
221
222
|
[getNodesList, getNodesUptimeFilter, getSearchValue, (state) => state.settings.problemFilter],
|
222
223
|
(nodesList, uptimeFilter, searchValue, problemFilter) => {
|