ydb-embedded-ui 4.5.2 → 4.6.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +13 -0
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +1 -1
- package/dist/containers/App/Content.js +3 -2
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +4 -50
- package/dist/containers/Cluster/Cluster.scss +7 -48
- package/dist/containers/Cluster/Cluster.tsx +136 -20
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +34 -17
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +57 -91
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.scss +48 -0
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx +34 -0
- package/dist/containers/Cluster/utils.ts +34 -0
- package/dist/containers/Header/Header.scss +0 -24
- package/dist/containers/Header/Header.tsx +14 -44
- package/dist/containers/Node/Node.tsx +22 -20
- package/dist/containers/Nodes/Nodes.tsx +0 -16
- package/dist/containers/Nodes/getNodesColumns.tsx +1 -1
- package/dist/containers/Storage/Storage.js +1 -11
- package/dist/containers/Tablet/Tablet.tsx +28 -0
- package/dist/containers/TabletsFilters/TabletsFilters.js +16 -1
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.tsx +1 -1
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +3 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +3 -3
- package/dist/containers/Tenant/Diagnostics/Overview/ChangefeedInfo/ChangefeedInfo.tsx +4 -6
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +56 -53
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.tsx +1 -1
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +1 -1
- package/dist/containers/Tenant/Preview/Preview.js +1 -1
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +26 -22
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/OldQueryEditorControls.tsx +10 -3
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/QueryEditorControls.tsx +8 -1
- package/dist/containers/Tenant/QueryEditor/QueryEditorControls/shared.ts +1 -6
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.tsx +1 -1
- package/dist/containers/Tenant/Tenant.tsx +7 -12
- package/dist/containers/Tenant/utils/schemaActions.ts +1 -1
- package/dist/containers/Tenants/Tenants.js +18 -28
- package/dist/containers/Tenants/Tenants.scss +2 -4
- package/dist/containers/UserSettings/i18n/en.json +2 -2
- package/dist/containers/UserSettings/i18n/ru.json +2 -2
- package/dist/containers/UserSettings/settings.ts +4 -4
- package/dist/containers/Versions/Versions.scss +0 -4
- package/dist/containers/Versions/Versions.tsx +74 -66
- package/dist/routes.ts +0 -7
- package/dist/services/api.ts +6 -2
- package/dist/store/reducers/clusterNodes/clusterNodes.tsx +4 -0
- package/dist/store/reducers/index.ts +3 -1
- package/dist/store/reducers/overview/overview.ts +109 -0
- package/dist/store/reducers/overview/types.ts +24 -0
- package/dist/store/reducers/{schema.ts → schema/schema.ts} +24 -50
- package/dist/{types/store/schema.ts → store/reducers/schema/types.ts} +16 -15
- package/dist/store/reducers/settings/settings.ts +5 -3
- package/dist/types/api/query.ts +78 -44
- package/dist/types/store/explainQuery.ts +2 -2
- package/dist/types/store/query.ts +4 -2
- package/dist/utils/constants.ts +3 -1
- package/dist/utils/nodes.ts +1 -1
- package/dist/utils/query.ts +3 -3
- package/package.json +1 -1
@@ -1,10 +1,14 @@
|
|
1
1
|
import {useState} from 'react';
|
2
|
+
import {useDispatch} from 'react-redux';
|
2
3
|
import block from 'bem-cn-lite';
|
3
4
|
|
4
5
|
import {Checkbox, RadioButton} from '@gravity-ui/uikit';
|
5
6
|
|
6
|
-
import type {PreparedClusterNode} from '../../store/reducers/clusterNodes/types';
|
7
7
|
import type {VersionToColorMap} from '../../types/versions';
|
8
|
+
import {useAutofetcher, useTypedSelector} from '../../utils/hooks';
|
9
|
+
import {getClusterNodes} from '../../store/reducers/clusterNodes/clusterNodes';
|
10
|
+
import {Loader} from '../../components/Loader';
|
11
|
+
|
8
12
|
import {getGroupedStorageNodes, getGroupedTenantNodes, getOtherNodes} from './groupNodes';
|
9
13
|
import {GroupedNodesTree} from './GroupedNodesTree/GroupedNodesTree';
|
10
14
|
import {GroupByValue} from './types';
|
@@ -14,11 +18,16 @@ import './Versions.scss';
|
|
14
18
|
const b = block('ydb-versions');
|
15
19
|
|
16
20
|
interface VersionsProps {
|
17
|
-
nodes?: PreparedClusterNode[];
|
18
21
|
versionToColor?: VersionToColorMap;
|
19
22
|
}
|
20
23
|
|
21
|
-
export const Versions = ({
|
24
|
+
export const Versions = ({versionToColor}: VersionsProps) => {
|
25
|
+
const dispatch = useDispatch();
|
26
|
+
|
27
|
+
const {nodes = [], loading, wasLoaded} = useTypedSelector((state) => state.clusterNodes);
|
28
|
+
|
29
|
+
useAutofetcher(() => dispatch(getClusterNodes()), [dispatch], true);
|
30
|
+
|
22
31
|
const [groupByValue, setGroupByValue] = useState<GroupByValue>(GroupByValue.VERSION);
|
23
32
|
const [expanded, setExpanded] = useState(false);
|
24
33
|
|
@@ -55,67 +64,66 @@ export const Versions = ({nodes = [], versionToColor}: VersionsProps) => {
|
|
55
64
|
</div>
|
56
65
|
);
|
57
66
|
};
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
return <div className={b('content')}>{renderGroupedNodes()}</div>;
|
67
|
+
|
68
|
+
if (loading && !wasLoaded) {
|
69
|
+
return <Loader />;
|
70
|
+
}
|
71
|
+
|
72
|
+
const tenantNodes = getGroupedTenantNodes(nodes, versionToColor, groupByValue);
|
73
|
+
const storageNodes = getGroupedStorageNodes(nodes, versionToColor);
|
74
|
+
const otherNodes = getOtherNodes(nodes, versionToColor);
|
75
|
+
const storageNodesContent = storageNodes?.length ? (
|
76
|
+
<>
|
77
|
+
<h3>Storage nodes</h3>
|
78
|
+
{storageNodes.map(({title, nodes: itemNodes, items, versionColor}) => (
|
79
|
+
<GroupedNodesTree
|
80
|
+
key={`storage-nodes-${title}`}
|
81
|
+
title={title}
|
82
|
+
nodes={itemNodes}
|
83
|
+
items={items}
|
84
|
+
versionColor={versionColor}
|
85
|
+
/>
|
86
|
+
))}
|
87
|
+
</>
|
88
|
+
) : null;
|
89
|
+
const tenantNodesContent = tenantNodes?.length ? (
|
90
|
+
<>
|
91
|
+
<h3>Database nodes</h3>
|
92
|
+
{renderControls()}
|
93
|
+
{tenantNodes.map(({title, nodes: itemNodes, items, versionColor, versionsValues}) => (
|
94
|
+
<GroupedNodesTree
|
95
|
+
key={`tenant-nodes-${title}`}
|
96
|
+
title={title}
|
97
|
+
nodes={itemNodes}
|
98
|
+
items={items}
|
99
|
+
expanded={expanded}
|
100
|
+
versionColor={versionColor}
|
101
|
+
versionsValues={versionsValues}
|
102
|
+
/>
|
103
|
+
))}
|
104
|
+
</>
|
105
|
+
) : null;
|
106
|
+
const otherNodesContent = otherNodes?.length ? (
|
107
|
+
<>
|
108
|
+
<h3>Other nodes</h3>
|
109
|
+
{otherNodes.map(({title, nodes: itemNodes, items, versionColor, versionsValues}) => (
|
110
|
+
<GroupedNodesTree
|
111
|
+
key={`other-nodes-${title}`}
|
112
|
+
title={title}
|
113
|
+
nodes={itemNodes}
|
114
|
+
items={items}
|
115
|
+
versionColor={versionColor}
|
116
|
+
versionsValues={versionsValues}
|
117
|
+
/>
|
118
|
+
))}
|
119
|
+
</>
|
120
|
+
) : null;
|
121
|
+
|
122
|
+
return (
|
123
|
+
<div className={b('versions')}>
|
124
|
+
{storageNodesContent}
|
125
|
+
{tenantNodesContent}
|
126
|
+
{otherNodesContent}
|
127
|
+
</div>
|
128
|
+
);
|
121
129
|
};
|
package/dist/routes.ts
CHANGED
@@ -13,13 +13,6 @@ const routes = {
|
|
13
13
|
auth: '/auth',
|
14
14
|
};
|
15
15
|
|
16
|
-
export const CLUSTER_PAGES = {
|
17
|
-
tenants: {id: 'tenants', name: 'Databases', title: 'Database list'},
|
18
|
-
nodes: {id: 'nodes', name: 'Nodes', title: 'Nodes'},
|
19
|
-
storage: {id: 'storage', name: 'Storage', title: 'Storage'},
|
20
|
-
cluster: {id: 'cluster', name: 'Cluster', title: 'Cluster'},
|
21
|
-
};
|
22
|
-
|
23
16
|
export function createHref(
|
24
17
|
route: string,
|
25
18
|
params?: Record<string, string | number>,
|
package/dist/services/api.ts
CHANGED
@@ -50,8 +50,12 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
|
|
50
50
|
tablets: true,
|
51
51
|
});
|
52
52
|
}
|
53
|
-
getClusterNodes() {
|
54
|
-
return this.get<TEvSystemStateResponse>(
|
53
|
+
getClusterNodes({concurrentId}: AxiosOptions = {}) {
|
54
|
+
return this.get<TEvSystemStateResponse>(
|
55
|
+
this.getPath('/viewer/json/sysinfo'),
|
56
|
+
{},
|
57
|
+
{concurrentId: concurrentId || `getClusterNodes`},
|
58
|
+
);
|
55
59
|
}
|
56
60
|
getNodeInfo(id?: string) {
|
57
61
|
return this.get<TEvSystemStateResponse>(this.getPath('/viewer/json/sysinfo?enums=true'), {
|
@@ -9,7 +9,8 @@ import node from './node/node';
|
|
9
9
|
import tooltip from './tooltip';
|
10
10
|
import tablets from './tablets';
|
11
11
|
import heatmap from './heatmap';
|
12
|
-
import schema from './schema';
|
12
|
+
import schema from './schema/schema';
|
13
|
+
import overview from './overview/overview';
|
13
14
|
import host from './host';
|
14
15
|
import network from './network/network';
|
15
16
|
import tenants from './tenants/tenants';
|
@@ -46,6 +47,7 @@ export const rootReducer = {
|
|
46
47
|
tooltip,
|
47
48
|
tablets,
|
48
49
|
schema,
|
50
|
+
overview,
|
49
51
|
olapStats,
|
50
52
|
host,
|
51
53
|
network,
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import type {Reducer} from 'redux';
|
2
|
+
|
3
|
+
import type {OverviewState, OverviewAction, OverviewHandledResponse} from './types';
|
4
|
+
|
5
|
+
import '../../../services/api';
|
6
|
+
import {createRequestActionTypes, createApiRequest} from '../../utils';
|
7
|
+
|
8
|
+
export const FETCH_OVERVIEW = createRequestActionTypes('overview', 'FETCH_OVERVIEW');
|
9
|
+
const SET_CURRENT_OVERVIEW_PATH = 'overview/SET_CURRENT_OVERVIEW_PATH';
|
10
|
+
const SET_DATA_WAS_NOT_LOADED = 'overview/SET_DATA_WAS_NOT_LOADED';
|
11
|
+
|
12
|
+
export const initialState = {
|
13
|
+
loading: true,
|
14
|
+
wasLoaded: false,
|
15
|
+
};
|
16
|
+
|
17
|
+
const schema: Reducer<OverviewState, OverviewAction> = (state = initialState, action) => {
|
18
|
+
switch (action.type) {
|
19
|
+
case FETCH_OVERVIEW.REQUEST: {
|
20
|
+
return {
|
21
|
+
...state,
|
22
|
+
loading: true,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
case FETCH_OVERVIEW.SUCCESS: {
|
26
|
+
if (action.data.data.Path !== state.currentOverviewPath) {
|
27
|
+
return state;
|
28
|
+
}
|
29
|
+
|
30
|
+
return {
|
31
|
+
...state,
|
32
|
+
error: undefined,
|
33
|
+
data: action.data.data,
|
34
|
+
additionalData: action.data.additionalData,
|
35
|
+
loading: false,
|
36
|
+
wasLoaded: true,
|
37
|
+
};
|
38
|
+
}
|
39
|
+
case FETCH_OVERVIEW.FAILURE: {
|
40
|
+
if (action.error?.isCancelled) {
|
41
|
+
return state;
|
42
|
+
}
|
43
|
+
|
44
|
+
return {
|
45
|
+
...state,
|
46
|
+
error: action.error,
|
47
|
+
loading: false,
|
48
|
+
};
|
49
|
+
}
|
50
|
+
case SET_CURRENT_OVERVIEW_PATH: {
|
51
|
+
return {
|
52
|
+
...state,
|
53
|
+
currentOverviewPath: action.data,
|
54
|
+
};
|
55
|
+
}
|
56
|
+
case SET_DATA_WAS_NOT_LOADED: {
|
57
|
+
return {
|
58
|
+
...state,
|
59
|
+
wasLoaded: false,
|
60
|
+
};
|
61
|
+
}
|
62
|
+
default:
|
63
|
+
return state;
|
64
|
+
}
|
65
|
+
};
|
66
|
+
|
67
|
+
export function getOverview({path}: {path: string}) {
|
68
|
+
const request = window.api.getDescribe({path}, {concurrentId: 'getOverview'});
|
69
|
+
return createApiRequest({
|
70
|
+
request,
|
71
|
+
actions: FETCH_OVERVIEW,
|
72
|
+
dataHandler: (data): OverviewHandledResponse => {
|
73
|
+
return {data};
|
74
|
+
},
|
75
|
+
});
|
76
|
+
}
|
77
|
+
|
78
|
+
export function getOverviewBatched(paths: string[]) {
|
79
|
+
const requestArray = paths.map((p) =>
|
80
|
+
window.api.getDescribe({path: p}, {concurrentId: `getOverviewBatched|${p}`}),
|
81
|
+
);
|
82
|
+
const request = Promise.all(requestArray);
|
83
|
+
|
84
|
+
return createApiRequest({
|
85
|
+
request,
|
86
|
+
actions: FETCH_OVERVIEW,
|
87
|
+
dataHandler: ([item, ...rest]): OverviewHandledResponse => {
|
88
|
+
return {
|
89
|
+
data: item,
|
90
|
+
additionalData: rest,
|
91
|
+
};
|
92
|
+
},
|
93
|
+
});
|
94
|
+
}
|
95
|
+
|
96
|
+
export function setDataWasNotLoaded() {
|
97
|
+
return {
|
98
|
+
type: SET_DATA_WAS_NOT_LOADED,
|
99
|
+
} as const;
|
100
|
+
}
|
101
|
+
|
102
|
+
export const setCurrentOverviewPath = (path?: string) => {
|
103
|
+
return {
|
104
|
+
type: SET_CURRENT_OVERVIEW_PATH,
|
105
|
+
data: path,
|
106
|
+
} as const;
|
107
|
+
};
|
108
|
+
|
109
|
+
export default schema;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type {ApiRequestAction} from '../../utils';
|
2
|
+
import type {IResponseError} from '../../../types/api/error';
|
3
|
+
import type {TEvDescribeSchemeResult} from '../../../types/api/schema';
|
4
|
+
|
5
|
+
import {FETCH_OVERVIEW, setDataWasNotLoaded, setCurrentOverviewPath} from './overview';
|
6
|
+
|
7
|
+
export interface OverviewState {
|
8
|
+
loading: boolean;
|
9
|
+
wasLoaded: boolean;
|
10
|
+
currentOverviewPath?: string;
|
11
|
+
data?: TEvDescribeSchemeResult;
|
12
|
+
additionalData?: TEvDescribeSchemeResult[];
|
13
|
+
error?: IResponseError;
|
14
|
+
}
|
15
|
+
|
16
|
+
export interface OverviewHandledResponse {
|
17
|
+
data: TEvDescribeSchemeResult;
|
18
|
+
additionalData?: TEvDescribeSchemeResult[];
|
19
|
+
}
|
20
|
+
|
21
|
+
export type OverviewAction =
|
22
|
+
| ApiRequestAction<typeof FETCH_OVERVIEW, OverviewHandledResponse, IResponseError>
|
23
|
+
| ReturnType<typeof setCurrentOverviewPath>
|
24
|
+
| ReturnType<typeof setDataWasNotLoaded>;
|
@@ -1,18 +1,20 @@
|
|
1
|
-
import {Reducer} from 'redux';
|
2
|
-
import {
|
3
|
-
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
import
|
1
|
+
import type {Reducer} from 'redux';
|
2
|
+
import type {Selector} from 'reselect';
|
3
|
+
|
4
|
+
import {createSelector} from 'reselect';
|
5
|
+
|
6
|
+
import type {EPathType} from '../../../types/api/schema';
|
7
|
+
import type {
|
8
|
+
SchemaAction,
|
9
|
+
SchemaData,
|
10
|
+
SchemaHandledResponse,
|
11
|
+
SchemaStateSlice,
|
12
|
+
SchemaState,
|
13
|
+
} from './types';
|
14
|
+
|
15
|
+
import '../../../services/api';
|
16
|
+
import {isEntityWithMergedImplementation} from '../../../containers/Tenant/utils/schema';
|
17
|
+
import {createRequestActionTypes, createApiRequest} from '../../utils';
|
16
18
|
|
17
19
|
export const FETCH_SCHEMA = createRequestActionTypes('schema', 'FETCH_SCHEMA');
|
18
20
|
const PRELOAD_SCHEMAS = 'schema/PRELOAD_SCHEMAS';
|
@@ -31,7 +33,7 @@ export const initialState = {
|
|
31
33
|
showPreview: false,
|
32
34
|
};
|
33
35
|
|
34
|
-
const schema: Reducer<
|
36
|
+
const schema: Reducer<SchemaState, SchemaAction> = (state = initialState, action) => {
|
35
37
|
switch (action.type) {
|
36
38
|
case FETCH_SCHEMA.REQUEST: {
|
37
39
|
return {
|
@@ -87,7 +89,6 @@ const schema: Reducer<ISchemaState, ISchemaAction> = (state = initialState, acti
|
|
87
89
|
return {
|
88
90
|
...state,
|
89
91
|
currentSchemaPath: action.data,
|
90
|
-
wasLoaded: false,
|
91
92
|
};
|
92
93
|
}
|
93
94
|
case ENABLE_AUTOREFRESH: {
|
@@ -124,8 +125,8 @@ export function getSchema({path}: {path: string}) {
|
|
124
125
|
return createApiRequest({
|
125
126
|
request,
|
126
127
|
actions: FETCH_SCHEMA,
|
127
|
-
dataHandler: (data):
|
128
|
-
const newData:
|
128
|
+
dataHandler: (data): SchemaHandledResponse => {
|
129
|
+
const newData: SchemaData = {};
|
129
130
|
if (data.Path) {
|
130
131
|
newData[data.Path] = data;
|
131
132
|
}
|
@@ -138,33 +139,6 @@ export function getSchema({path}: {path: string}) {
|
|
138
139
|
});
|
139
140
|
}
|
140
141
|
|
141
|
-
export function getSchemaBatched(paths: string[]) {
|
142
|
-
const requestArray = paths.map((p) =>
|
143
|
-
window.api.getSchema({path: p}, {concurrentId: `getSchemaBatched|${p}`}),
|
144
|
-
);
|
145
|
-
const request = Promise.all(requestArray);
|
146
|
-
|
147
|
-
return createApiRequest({
|
148
|
-
request,
|
149
|
-
actions: FETCH_SCHEMA,
|
150
|
-
dataHandler: (data): ISchemaHandledResponse => {
|
151
|
-
const newData: ISchemaData = {};
|
152
|
-
|
153
|
-
data.forEach((dataItem) => {
|
154
|
-
if (dataItem.Path) {
|
155
|
-
newData[dataItem.Path] = dataItem;
|
156
|
-
}
|
157
|
-
});
|
158
|
-
|
159
|
-
return {
|
160
|
-
path: data[0].Path,
|
161
|
-
currentSchema: data[0],
|
162
|
-
data: newData,
|
163
|
-
};
|
164
|
-
},
|
165
|
-
});
|
166
|
-
}
|
167
|
-
|
168
142
|
export function setCurrentSchemaPath(currentSchemaPath: string) {
|
169
143
|
return {
|
170
144
|
type: SET_SCHEMA,
|
@@ -190,7 +164,7 @@ export function setShowPreview(value: boolean) {
|
|
190
164
|
|
191
165
|
// only stores data for paths that are not in the store yet
|
192
166
|
// existing paths are ignored
|
193
|
-
export function preloadSchemas(data:
|
167
|
+
export function preloadSchemas(data: SchemaData) {
|
194
168
|
return {
|
195
169
|
type: PRELOAD_SCHEMAS,
|
196
170
|
data,
|
@@ -203,14 +177,14 @@ export function resetLoadingState() {
|
|
203
177
|
} as const;
|
204
178
|
}
|
205
179
|
|
206
|
-
|
180
|
+
const selectSchemaChildren = (state: SchemaStateSlice, path?: string) =>
|
207
181
|
path ? state.schema.data[path]?.PathDescription?.Children : undefined;
|
208
182
|
|
209
|
-
export const selectSchemaData = (state:
|
183
|
+
export const selectSchemaData = (state: SchemaStateSlice, path?: string) =>
|
210
184
|
path ? state.schema.data[path] : undefined;
|
211
185
|
|
212
186
|
export const selectSchemaMergedChildrenPaths: Selector<
|
213
|
-
|
187
|
+
SchemaStateSlice,
|
214
188
|
string[] | undefined,
|
215
189
|
[string | undefined, EPathType | undefined]
|
216
190
|
> = createSelector(
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import type {ApiRequestAction} from '../../utils';
|
2
|
+
import type {IResponseError} from '../../../types/api/error';
|
3
|
+
import type {TEvDescribeSchemeResult} from '../../../types/api/schema';
|
4
|
+
|
1
5
|
import {
|
2
6
|
disableAutorefresh,
|
3
7
|
enableAutorefresh,
|
@@ -6,17 +10,14 @@ import {
|
|
6
10
|
resetLoadingState,
|
7
11
|
setCurrentSchemaPath,
|
8
12
|
setShowPreview,
|
9
|
-
} from '
|
10
|
-
import {ApiRequestAction} from '../../store/utils';
|
11
|
-
import {IResponseError} from '../api/error';
|
12
|
-
import {TEvDescribeSchemeResult} from '../api/schema';
|
13
|
+
} from './schema';
|
13
14
|
|
14
|
-
export type
|
15
|
+
export type SchemaData = Record<string, TEvDescribeSchemeResult>;
|
15
16
|
|
16
|
-
export interface
|
17
|
+
export interface SchemaState {
|
17
18
|
loading: boolean;
|
18
19
|
wasLoaded: boolean;
|
19
|
-
data:
|
20
|
+
data: SchemaData;
|
20
21
|
currentSchema?: TEvDescribeSchemeResult;
|
21
22
|
currentSchemaPath?: string;
|
22
23
|
autorefresh: boolean;
|
@@ -24,20 +25,20 @@ export interface ISchemaState {
|
|
24
25
|
error?: IResponseError;
|
25
26
|
}
|
26
27
|
|
27
|
-
export interface
|
28
|
+
export interface SchemaHandledResponse {
|
28
29
|
path?: string;
|
29
30
|
currentSchema?: TEvDescribeSchemeResult;
|
30
|
-
data?:
|
31
|
+
data?: SchemaData;
|
31
32
|
}
|
32
33
|
|
33
|
-
type
|
34
|
+
type SchemaApiRequestAction = ApiRequestAction<
|
34
35
|
typeof FETCH_SCHEMA,
|
35
|
-
|
36
|
+
SchemaHandledResponse,
|
36
37
|
IResponseError
|
37
38
|
>;
|
38
39
|
|
39
|
-
export type
|
40
|
-
|
|
40
|
+
export type SchemaAction =
|
41
|
+
| SchemaApiRequestAction
|
41
42
|
| (
|
42
43
|
| ReturnType<typeof setCurrentSchemaPath>
|
43
44
|
| ReturnType<typeof enableAutorefresh>
|
@@ -47,6 +48,6 @@ export type ISchemaAction =
|
|
47
48
|
| ReturnType<typeof resetLoadingState>
|
48
49
|
);
|
49
50
|
|
50
|
-
export interface
|
51
|
-
schema:
|
51
|
+
export interface SchemaStateSlice {
|
52
|
+
schema: SchemaState;
|
52
53
|
}
|
@@ -11,7 +11,8 @@ import {
|
|
11
11
|
USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
|
12
12
|
PARTITIONS_HIDDEN_COLUMNS_KEY,
|
13
13
|
QUERY_INITIAL_MODE_KEY,
|
14
|
-
|
14
|
+
ENABLE_ADDITIONAL_QUERY_MODES,
|
15
|
+
CLUSTER_INFO_HIDDEN_KEY,
|
15
16
|
} from '../../../utils/constants';
|
16
17
|
import '../../../services/api';
|
17
18
|
import {getValueFromLS, parseJson} from '../../../utils/utils';
|
@@ -52,8 +53,8 @@ export const initialState = {
|
|
52
53
|
USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
|
53
54
|
'false',
|
54
55
|
),
|
55
|
-
[
|
56
|
-
|
56
|
+
[ENABLE_ADDITIONAL_QUERY_MODES]: readSavedSettingsValue(
|
57
|
+
ENABLE_ADDITIONAL_QUERY_MODES,
|
57
58
|
'false',
|
58
59
|
),
|
59
60
|
[SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
|
@@ -61,6 +62,7 @@ export const initialState = {
|
|
61
62
|
[QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(QUERY_INITIAL_MODE_KEY, QueryModes.script),
|
62
63
|
[ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
|
63
64
|
[PARTITIONS_HIDDEN_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_HIDDEN_COLUMNS_KEY),
|
65
|
+
[CLUSTER_INFO_HIDDEN_KEY]: readSavedSettingsValue(CLUSTER_INFO_HIDDEN_KEY, 'false'),
|
64
66
|
},
|
65
67
|
systemSettings,
|
66
68
|
};
|