ydb-embedded-ui 4.5.1 → 4.6.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.
- package/CHANGELOG.md +20 -0
- package/dist/components/FullNodeViewer/FullNodeViewer.js +1 -1
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +1 -1
- package/dist/components/PoolUsage/PoolUsage.scss +1 -1
- package/dist/components/PoolUsage/PoolUsage.tsx +50 -0
- 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 +23 -21
- package/dist/containers/Node/NodeStructure/NodeStructure.tsx +19 -17
- 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/Network/Network.js +2 -2
- 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/TenantOverview/TenantOverview.js +1 -1
- 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 +8 -13
- 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/GroupedNodesTree/GroupedNodesTree.scss +1 -0
- package/dist/containers/Versions/NodesTable/NodesTable.tsx +2 -3
- 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 +8 -4
- package/dist/store/reducers/clusterNodes/clusterNodes.tsx +4 -0
- package/dist/store/reducers/index.ts +6 -4
- package/dist/store/reducers/{network.js → network/network.ts} +11 -8
- package/dist/store/reducers/network/types.ts +16 -0
- package/dist/store/reducers/node/node.ts +102 -0
- package/dist/store/reducers/node/selectors.ts +59 -0
- package/dist/store/reducers/node/types.ts +44 -0
- 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/{schemaAcl.js → schemaAcl/schemaAcl.ts} +20 -9
- package/dist/store/reducers/schemaAcl/types.ts +15 -0
- package/dist/store/reducers/settings/settings.ts +5 -3
- package/dist/types/api/acl.ts +1 -1
- 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
- package/dist/components/PoolUsage/PoolUsage.js +0 -54
- package/dist/store/reducers/node.js +0 -141
@@ -0,0 +1,102 @@
|
|
1
|
+
import {Reducer} from 'redux';
|
2
|
+
|
3
|
+
import '../../../services/api';
|
4
|
+
import {createRequestActionTypes, createApiRequest} from '../../utils';
|
5
|
+
|
6
|
+
import type {NodeAction, NodeState} from './types';
|
7
|
+
|
8
|
+
export const FETCH_NODE = createRequestActionTypes('node', 'FETCH_NODE');
|
9
|
+
export const FETCH_NODE_STRUCTURE = createRequestActionTypes('node', 'FETCH_NODE_STRUCTURE');
|
10
|
+
|
11
|
+
const RESET_NODE = 'node/RESET_NODE';
|
12
|
+
|
13
|
+
const initialState = {
|
14
|
+
data: {},
|
15
|
+
loading: true,
|
16
|
+
wasLoaded: false,
|
17
|
+
nodeStructure: {},
|
18
|
+
loadingStructure: true,
|
19
|
+
wasLoadedStructure: false,
|
20
|
+
};
|
21
|
+
|
22
|
+
const node: Reducer<NodeState, NodeAction> = (state = initialState, action) => {
|
23
|
+
switch (action.type) {
|
24
|
+
case FETCH_NODE.REQUEST: {
|
25
|
+
return {
|
26
|
+
...state,
|
27
|
+
loading: true,
|
28
|
+
};
|
29
|
+
}
|
30
|
+
case FETCH_NODE.SUCCESS: {
|
31
|
+
return {
|
32
|
+
...state,
|
33
|
+
data: action.data,
|
34
|
+
loading: false,
|
35
|
+
wasLoaded: true,
|
36
|
+
error: undefined,
|
37
|
+
};
|
38
|
+
}
|
39
|
+
case FETCH_NODE.FAILURE: {
|
40
|
+
return {
|
41
|
+
...state,
|
42
|
+
error: action.error,
|
43
|
+
loading: false,
|
44
|
+
};
|
45
|
+
}
|
46
|
+
case FETCH_NODE_STRUCTURE.REQUEST: {
|
47
|
+
return {
|
48
|
+
...state,
|
49
|
+
loadingStructure: true,
|
50
|
+
};
|
51
|
+
}
|
52
|
+
case FETCH_NODE_STRUCTURE.SUCCESS: {
|
53
|
+
return {
|
54
|
+
...state,
|
55
|
+
nodeStructure: action.data,
|
56
|
+
loadingStructure: false,
|
57
|
+
wasLoadedStructure: true,
|
58
|
+
errorStructure: undefined,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
case FETCH_NODE_STRUCTURE.FAILURE: {
|
62
|
+
return {
|
63
|
+
...state,
|
64
|
+
errorStructure: action.error,
|
65
|
+
loadingStructure: false,
|
66
|
+
};
|
67
|
+
}
|
68
|
+
case RESET_NODE: {
|
69
|
+
return {
|
70
|
+
...state,
|
71
|
+
data: {},
|
72
|
+
wasLoaded: false,
|
73
|
+
nodeStructure: {},
|
74
|
+
wasLoadedStructure: false,
|
75
|
+
};
|
76
|
+
}
|
77
|
+
default:
|
78
|
+
return state;
|
79
|
+
}
|
80
|
+
};
|
81
|
+
|
82
|
+
export const getNodeInfo = (id: string) => {
|
83
|
+
return createApiRequest({
|
84
|
+
request: window.api.getNodeInfo(id),
|
85
|
+
actions: FETCH_NODE,
|
86
|
+
});
|
87
|
+
};
|
88
|
+
|
89
|
+
export const getNodeStructure = (nodeId: string) => {
|
90
|
+
return createApiRequest({
|
91
|
+
request: window.api.getStorageInfo({nodeId}, {concurrentId: 'getNodeStructure'}),
|
92
|
+
actions: FETCH_NODE_STRUCTURE,
|
93
|
+
});
|
94
|
+
};
|
95
|
+
|
96
|
+
export function resetNode() {
|
97
|
+
return {
|
98
|
+
type: RESET_NODE,
|
99
|
+
} as const;
|
100
|
+
}
|
101
|
+
|
102
|
+
export default node;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type {Selector} from 'reselect';
|
2
|
+
import {createSelector} from 'reselect';
|
3
|
+
|
4
|
+
import {stringifyVdiskId} from '../../../utils';
|
5
|
+
|
6
|
+
import type {
|
7
|
+
NodeStateSlice,
|
8
|
+
PreparedNodeStructure,
|
9
|
+
PreparedStructureVDisk,
|
10
|
+
RawNodeStructure,
|
11
|
+
} from './types';
|
12
|
+
|
13
|
+
const selectNodeId = (state: NodeStateSlice) => state.node?.data?.SystemStateInfo?.[0].NodeId;
|
14
|
+
|
15
|
+
const selectRawNodeStructure = (state: NodeStateSlice) => state.node?.nodeStructure;
|
16
|
+
|
17
|
+
export const selectNodeStructure: Selector<NodeStateSlice, PreparedNodeStructure> = createSelector(
|
18
|
+
[selectNodeId, selectRawNodeStructure],
|
19
|
+
(nodeId, storageInfo) => {
|
20
|
+
const pools = storageInfo?.StoragePools;
|
21
|
+
const structure: RawNodeStructure = {};
|
22
|
+
|
23
|
+
pools?.forEach((pool) => {
|
24
|
+
const groups = pool.Groups;
|
25
|
+
groups?.forEach((group) => {
|
26
|
+
const vDisks = group.VDisks?.filter((el) => el.NodeId === nodeId);
|
27
|
+
vDisks?.forEach((vd) => {
|
28
|
+
const vDiskId = stringifyVdiskId(vd.VDiskId);
|
29
|
+
const pDiskId = vd.PDisk?.PDiskId;
|
30
|
+
if (!structure[String(pDiskId)]) {
|
31
|
+
structure[String(pDiskId)] = {vDisks: {}, ...vd.PDisk};
|
32
|
+
}
|
33
|
+
structure[String(pDiskId)].vDisks[vDiskId] = {
|
34
|
+
...vd,
|
35
|
+
// VDisk doesn't have its own StoragePoolName when located inside StoragePool data
|
36
|
+
StoragePoolName: pool.Name,
|
37
|
+
};
|
38
|
+
});
|
39
|
+
});
|
40
|
+
});
|
41
|
+
|
42
|
+
const structureWithVdisksArray = Object.keys(structure).reduce<PreparedNodeStructure>(
|
43
|
+
(preparedStructure, el) => {
|
44
|
+
const vDisks = structure[el].vDisks;
|
45
|
+
const vDisksArray = Object.keys(vDisks).reduce<PreparedStructureVDisk[]>(
|
46
|
+
(acc, key, index) => {
|
47
|
+
acc.push({...vDisks[key], id: key, order: index});
|
48
|
+
return acc;
|
49
|
+
},
|
50
|
+
[],
|
51
|
+
);
|
52
|
+
preparedStructure[el] = {...structure[el], vDisks: vDisksArray};
|
53
|
+
return preparedStructure;
|
54
|
+
},
|
55
|
+
{},
|
56
|
+
);
|
57
|
+
return structureWithVdisksArray;
|
58
|
+
},
|
59
|
+
);
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import type {IResponseError} from '../../../types/api/error';
|
2
|
+
import type {TPDiskStateInfo} from '../../../types/api/pdisk';
|
3
|
+
import type {TStorageInfo} from '../../../types/api/storage';
|
4
|
+
import type {TEvSystemStateResponse} from '../../../types/api/systemState';
|
5
|
+
import type {TVDiskStateInfo} from '../../../types/api/vdisk';
|
6
|
+
import type {ApiRequestAction} from '../../utils';
|
7
|
+
|
8
|
+
import {FETCH_NODE, FETCH_NODE_STRUCTURE, resetNode} from './node';
|
9
|
+
|
10
|
+
interface RawStructurePDisk extends TPDiskStateInfo {
|
11
|
+
vDisks: Record<string, TVDiskStateInfo>;
|
12
|
+
}
|
13
|
+
|
14
|
+
export type RawNodeStructure = Record<string, RawStructurePDisk>;
|
15
|
+
|
16
|
+
export interface PreparedStructureVDisk extends TVDiskStateInfo {
|
17
|
+
id: string;
|
18
|
+
order: number;
|
19
|
+
}
|
20
|
+
|
21
|
+
export interface PreparedStructurePDisk extends TPDiskStateInfo {
|
22
|
+
vDisks: PreparedStructureVDisk[];
|
23
|
+
}
|
24
|
+
|
25
|
+
export type PreparedNodeStructure = Record<string, PreparedStructurePDisk>;
|
26
|
+
|
27
|
+
export interface NodeState {
|
28
|
+
data: TEvSystemStateResponse;
|
29
|
+
loading: boolean;
|
30
|
+
wasLoaded: boolean;
|
31
|
+
|
32
|
+
nodeStructure: TStorageInfo;
|
33
|
+
loadingStructure: boolean;
|
34
|
+
wasLoadedStructure: boolean;
|
35
|
+
}
|
36
|
+
|
37
|
+
export type NodeAction =
|
38
|
+
| ApiRequestAction<typeof FETCH_NODE, TEvSystemStateResponse, IResponseError>
|
39
|
+
| ApiRequestAction<typeof FETCH_NODE_STRUCTURE, TStorageInfo, IResponseError>
|
40
|
+
| ReturnType<typeof resetNode>;
|
41
|
+
|
42
|
+
export interface NodeStateSlice {
|
43
|
+
node: NodeState;
|
44
|
+
}
|
@@ -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
|
}
|
@@ -1,10 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import '../../services/api';
|
3
|
-
import _ from 'lodash';
|
1
|
+
import type {Reducer} from 'redux';
|
4
2
|
|
5
|
-
|
3
|
+
import '../../../services/api';
|
4
|
+
import {createRequestActionTypes, createApiRequest} from '../../utils';
|
6
5
|
|
7
|
-
|
6
|
+
import type {SchemaAclAction, SchemaAclState} from './types';
|
7
|
+
|
8
|
+
export const FETCH_SCHEMA_ACL = createRequestActionTypes('schemaAcl', 'FETCH_SCHEMA_ACL');
|
9
|
+
|
10
|
+
const initialState = {
|
11
|
+
loading: false,
|
12
|
+
wasLoaded: false,
|
13
|
+
};
|
14
|
+
|
15
|
+
const schemaAcl: Reducer<SchemaAclState, SchemaAclAction> = (state = initialState, action) => {
|
8
16
|
switch (action.type) {
|
9
17
|
case FETCH_SCHEMA_ACL.REQUEST: {
|
10
18
|
return {
|
@@ -13,13 +21,16 @@ const schemaAcl = function z(state = {loading: false, wasLoaded: false, acl: und
|
|
13
21
|
};
|
14
22
|
}
|
15
23
|
case FETCH_SCHEMA_ACL.SUCCESS: {
|
24
|
+
const acl = action.data.Common?.ACL;
|
25
|
+
const owner = action.data.Common?.Owner;
|
26
|
+
|
16
27
|
return {
|
17
28
|
...state,
|
18
|
-
|
19
|
-
|
20
|
-
owner: _.get(action.data, 'Common.Owner'),
|
29
|
+
acl,
|
30
|
+
owner,
|
21
31
|
loading: false,
|
22
32
|
wasLoaded: true,
|
33
|
+
error: undefined,
|
23
34
|
};
|
24
35
|
}
|
25
36
|
case FETCH_SCHEMA_ACL.FAILURE: {
|
@@ -34,7 +45,7 @@ const schemaAcl = function z(state = {loading: false, wasLoaded: false, acl: und
|
|
34
45
|
}
|
35
46
|
};
|
36
47
|
|
37
|
-
export function getSchemaAcl({path}) {
|
48
|
+
export function getSchemaAcl({path}: {path: string}) {
|
38
49
|
return createApiRequest({
|
39
50
|
request: window.api.getSchemaAcl({path}),
|
40
51
|
actions: FETCH_SCHEMA_ACL,
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type {TACE, TMetaInfo} from '../../../types/api/acl';
|
2
|
+
import type {IResponseError} from '../../../types/api/error';
|
3
|
+
import type {ApiRequestAction} from '../../utils';
|
4
|
+
|
5
|
+
import {FETCH_SCHEMA_ACL} from './schemaAcl';
|
6
|
+
|
7
|
+
export interface SchemaAclState {
|
8
|
+
loading: boolean
|
9
|
+
wasLoaded: boolean
|
10
|
+
acl?: TACE[]
|
11
|
+
owner?: string
|
12
|
+
error?: IResponseError
|
13
|
+
}
|
14
|
+
|
15
|
+
export type SchemaAclAction = ApiRequestAction<typeof FETCH_SCHEMA_ACL, TMetaInfo, IResponseError>;
|
@@ -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
|
};
|