ydb-embedded-ui 4.5.2 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +33 -0
- package/dist/assets/icons/versions.svg +3 -0
- package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +7 -2
- package/dist/components/Tablet/Tablet.tsx +17 -3
- package/dist/components/TabletsStatistic/TabletsStatistic.tsx +23 -16
- package/dist/containers/App/Content.js +8 -4
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +4 -50
- package/dist/containers/Cluster/Cluster.scss +7 -48
- package/dist/containers/Cluster/Cluster.tsx +129 -20
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +34 -17
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +58 -92
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.scss +48 -0
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx +34 -0
- package/dist/containers/Cluster/utils.tsx +45 -0
- package/dist/containers/Header/Header.scss +4 -19
- package/dist/containers/Header/Header.tsx +72 -46
- package/dist/containers/Header/breadcrumbs.ts +146 -0
- package/dist/containers/Node/Node.tsx +25 -29
- package/dist/containers/Node/NodePages.ts +10 -6
- 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/Storage/StorageGroups/StorageGroups.tsx +11 -3
- package/dist/containers/Tablet/Tablet.tsx +40 -4
- package/dist/containers/Tablet/TabletInfo/TabletInfo.tsx +2 -2
- package/dist/containers/TabletsFilters/TabletsFilters.js +15 -2
- package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.tsx +1 -1
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.tsx +1 -1
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +7 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +4 -4
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +5 -3
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.tsx +1 -1
- 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 +2 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +11 -13
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.tsx +1 -1
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +2 -2
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +7 -3
- package/dist/containers/Tenant/Preview/Preview.js +1 -1
- package/dist/containers/Tenant/{QueryEditor/QueryResult/QueryResult.js → Query/ExecuteResult/ExecuteResult.js} +3 -5
- package/dist/containers/Tenant/{QueryEditor/QueryResult/QueryResult.scss → Query/ExecuteResult/ExecuteResult.scss} +1 -1
- package/dist/containers/Tenant/{QueryEditor/QueryExplain/QueryExplain.js → Query/ExplainResult/ExplainResult.js} +3 -5
- package/dist/containers/Tenant/{QueryEditor/QueryExplain/QueryExplain.scss → Query/ExplainResult/ExplainResult.scss} +1 -1
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.scss +20 -0
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.tsx +60 -0
- package/dist/containers/Tenant/Query/Query.scss +16 -0
- package/dist/containers/Tenant/Query/Query.tsx +73 -0
- package/dist/containers/Tenant/{QueryEditor → Query/QueryEditor}/QueryEditor.js +43 -100
- package/dist/containers/Tenant/{QueryEditor → Query/QueryEditor}/QueryEditor.scss +7 -23
- package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/OldQueryEditorControls.tsx +10 -3
- package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/QueryEditorControls.scss +1 -4
- package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/QueryEditorControls.tsx +8 -1
- package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/shared.ts +1 -6
- package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.tsx +59 -0
- package/dist/containers/Tenant/{QueryEditor → Query}/SaveQuery/SaveQuery.js +5 -5
- package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.scss +55 -0
- package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.tsx +150 -0
- package/dist/containers/Tenant/Query/i18n/en.json +12 -0
- package/dist/containers/Tenant/Query/i18n/ru.json +12 -0
- package/dist/containers/Tenant/Query/utils/getPreparedResult.ts +30 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.tsx +1 -1
- package/dist/containers/Tenant/Tenant.tsx +4 -25
- package/dist/containers/Tenant/TenantPages.tsx +8 -2
- package/dist/containers/Tenant/utils/constants.ts +10 -0
- package/dist/containers/Tenant/utils/schemaActions.ts +8 -3
- package/dist/containers/Tenants/Tenants.js +39 -37
- 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 +8 -6
- package/dist/services/api.ts +15 -7
- package/dist/store/reducers/clusterNodes/clusterNodes.tsx +4 -0
- package/dist/store/reducers/executeQuery.ts +1 -1
- package/dist/store/reducers/header/header.ts +31 -0
- package/dist/store/reducers/header/types.ts +54 -0
- package/dist/store/reducers/index.ts +4 -2
- package/dist/store/reducers/node/types.ts +2 -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/settings/settings.ts +5 -3
- package/dist/store/reducers/tablet.ts +18 -1
- package/dist/store/reducers/tenant/constants.ts +6 -0
- package/dist/store/reducers/tenant/tenant.ts +21 -2
- package/dist/store/reducers/tenant/types.ts +9 -2
- package/dist/store/reducers/topic.ts +1 -1
- package/dist/store/state-url-mapping.js +4 -1
- package/dist/types/api/query.ts +78 -44
- package/dist/types/store/explainQuery.ts +2 -2
- package/dist/types/store/query.ts +9 -2
- package/dist/types/store/tablet.ts +7 -4
- package/dist/utils/constants.ts +5 -1
- package/dist/utils/nodes.ts +1 -1
- package/dist/utils/query.ts +3 -3
- package/package.json +2 -1
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.scss +0 -85
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +0 -95
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +0 -161
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +0 -93
- package/dist/containers/Tenant/QueryEditor/i18n/en.json +0 -3
- package/dist/containers/Tenant/QueryEditor/i18n/ru.json +0 -3
- package/dist/store/reducers/header.ts +0 -26
- /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/Issues.scss +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/Issues.tsx +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/models.ts +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/QueryDuration/QueryDuration.scss +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/QueryDuration/QueryDuration.tsx +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/SaveQuery/SaveQuery.scss +0 -0
- /package/dist/containers/Tenant/{QueryEditor → Query}/i18n/index.ts +0 -0
package/dist/services/api.ts
CHANGED
@@ -44,14 +44,22 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
|
|
44
44
|
getPath(path: string) {
|
45
45
|
return `${BACKEND}${path}`;
|
46
46
|
}
|
47
|
-
getClusterInfo(clusterName?: string) {
|
48
|
-
return this.get<TClusterInfo>(
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
getClusterInfo(clusterName?: string, {concurrentId}: AxiosOptions = {}) {
|
48
|
+
return this.get<TClusterInfo>(
|
49
|
+
this.getPath('/viewer/json/cluster'),
|
50
|
+
{
|
51
|
+
name: clusterName,
|
52
|
+
tablets: true,
|
53
|
+
},
|
54
|
+
{concurrentId: concurrentId || `getClusterInfo`},
|
55
|
+
);
|
52
56
|
}
|
53
|
-
getClusterNodes() {
|
54
|
-
return this.get<TEvSystemStateResponse>(
|
57
|
+
getClusterNodes({concurrentId}: AxiosOptions = {}) {
|
58
|
+
return this.get<TEvSystemStateResponse>(
|
59
|
+
this.getPath('/viewer/json/sysinfo'),
|
60
|
+
{},
|
61
|
+
{concurrentId: concurrentId || `getClusterNodes`},
|
62
|
+
);
|
55
63
|
}
|
56
64
|
getNodeInfo(id?: string) {
|
57
65
|
return this.get<TEvSystemStateResponse>(this.getPath('/viewer/json/sysinfo?enums=true'), {
|
@@ -186,7 +186,7 @@ export const changeUserInput = ({input}: {input: string}) => {
|
|
186
186
|
} as const;
|
187
187
|
};
|
188
188
|
|
189
|
-
export const setMonacoHotKey = (value: MonacoHotKeyAction) => {
|
189
|
+
export const setMonacoHotKey = (value: MonacoHotKeyAction | null) => {
|
190
190
|
return {
|
191
191
|
type: MONACO_HOT_KEY,
|
192
192
|
data: value,
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import type {Reducer} from 'redux';
|
2
|
+
|
3
|
+
import type {HeaderAction, HeaderState, Page, PageBreadcrumbsOptions} from './types';
|
4
|
+
|
5
|
+
const SET_HEADER_BREADCRUMBS = 'header/SET_HEADER_BREADCRUMBS';
|
6
|
+
|
7
|
+
const initialState = {
|
8
|
+
pageBreadcrumbsOptions: {},
|
9
|
+
};
|
10
|
+
|
11
|
+
const header: Reducer<HeaderState, HeaderAction> = (state = initialState, action) => {
|
12
|
+
switch (action.type) {
|
13
|
+
case SET_HEADER_BREADCRUMBS:
|
14
|
+
return {
|
15
|
+
page: action.page,
|
16
|
+
pageBreadcrumbsOptions: action.options,
|
17
|
+
};
|
18
|
+
default:
|
19
|
+
return state;
|
20
|
+
}
|
21
|
+
};
|
22
|
+
|
23
|
+
export function setHeaderBreadcrumbs<T extends Page>(page: T, options: PageBreadcrumbsOptions<T>) {
|
24
|
+
return {
|
25
|
+
type: SET_HEADER_BREADCRUMBS,
|
26
|
+
page,
|
27
|
+
options,
|
28
|
+
} as const;
|
29
|
+
}
|
30
|
+
|
31
|
+
export default header;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import type {ClusterTab} from '../../../containers/Cluster/utils';
|
2
|
+
|
3
|
+
import {setHeaderBreadcrumbs} from './header';
|
4
|
+
|
5
|
+
export type Page = 'cluster' | 'tenant' | 'node' | 'tablets' | 'tablet' | undefined;
|
6
|
+
|
7
|
+
export interface ClusterBreadcrumbsOptions {
|
8
|
+
clusterName?: string;
|
9
|
+
clusterTab?: ClusterTab;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface TenantBreadcrumbsOptions extends ClusterBreadcrumbsOptions {
|
13
|
+
tenantName?: string;
|
14
|
+
}
|
15
|
+
|
16
|
+
export interface NodeBreadcrumbsOptions extends TenantBreadcrumbsOptions {
|
17
|
+
nodeId?: string | number;
|
18
|
+
}
|
19
|
+
|
20
|
+
export interface TabletsBreadcrumbsOptions extends TenantBreadcrumbsOptions {
|
21
|
+
nodeIds?: string[] | number[];
|
22
|
+
state?: string;
|
23
|
+
type?: string;
|
24
|
+
}
|
25
|
+
|
26
|
+
export interface TabletBreadcrumbsOptions extends TabletsBreadcrumbsOptions {
|
27
|
+
tabletId?: string;
|
28
|
+
}
|
29
|
+
|
30
|
+
export type BreadcrumbsOptions =
|
31
|
+
| ClusterBreadcrumbsOptions
|
32
|
+
| TenantBreadcrumbsOptions
|
33
|
+
| NodeBreadcrumbsOptions
|
34
|
+
| TabletsBreadcrumbsOptions
|
35
|
+
| TabletBreadcrumbsOptions;
|
36
|
+
|
37
|
+
export type PageBreadcrumbsOptions<T extends Page = undefined> = T extends 'cluster'
|
38
|
+
? ClusterBreadcrumbsOptions
|
39
|
+
: T extends 'tenant'
|
40
|
+
? TenantBreadcrumbsOptions
|
41
|
+
: T extends 'node'
|
42
|
+
? NodeBreadcrumbsOptions
|
43
|
+
: T extends 'tablets'
|
44
|
+
? TabletsBreadcrumbsOptions
|
45
|
+
: T extends 'tablet'
|
46
|
+
? TabletBreadcrumbsOptions
|
47
|
+
: {};
|
48
|
+
|
49
|
+
export interface HeaderState {
|
50
|
+
page?: Page;
|
51
|
+
pageBreadcrumbsOptions: BreadcrumbsOptions;
|
52
|
+
}
|
53
|
+
|
54
|
+
export type HeaderAction = ReturnType<typeof setHeaderBreadcrumbs>;
|
@@ -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';
|
@@ -30,7 +31,7 @@ import shardsWorkload from './shardsWorkload';
|
|
30
31
|
import hotKeys from './hotKeys';
|
31
32
|
import olapStats from './olapStats';
|
32
33
|
import authentication from './authentication';
|
33
|
-
import header from './header';
|
34
|
+
import header from './header/header';
|
34
35
|
import saveQuery from './saveQuery';
|
35
36
|
import fullscreen from './fullscreen';
|
36
37
|
import singleClusterMode from './singleClusterMode';
|
@@ -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,
|
@@ -28,10 +28,12 @@ export interface NodeState {
|
|
28
28
|
data: TEvSystemStateResponse;
|
29
29
|
loading: boolean;
|
30
30
|
wasLoaded: boolean;
|
31
|
+
error?: IResponseError;
|
31
32
|
|
32
33
|
nodeStructure: TStorageInfo;
|
33
34
|
loadingStructure: boolean;
|
34
35
|
wasLoadedStructure: boolean;
|
36
|
+
errorStructure?: IResponseError;
|
35
37
|
}
|
36
38
|
|
37
39
|
export type NodeAction =
|
@@ -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, 'true'),
|
64
66
|
},
|
65
67
|
systemSettings,
|
66
68
|
};
|
@@ -16,9 +16,11 @@ import {prepareNodesMap} from '../../utils/nodes';
|
|
16
16
|
export const FETCH_TABLET = createRequestActionTypes('TABLET', 'FETCH_TABLET');
|
17
17
|
export const FETCH_TABLET_DESCRIBE = createRequestActionTypes('TABLET', 'FETCH_TABLET_DESCRIBE');
|
18
18
|
|
19
|
+
const CLEAR_TABLET_DATA = 'tablet/CLEAR_TABLET_DATA';
|
20
|
+
|
19
21
|
const initialState = {
|
20
22
|
loading: false,
|
21
|
-
tenantPath:
|
23
|
+
tenantPath: undefined,
|
22
24
|
};
|
23
25
|
|
24
26
|
const tablet: Reducer<ITabletState, ITabletAction> = (state = initialState, action) => {
|
@@ -57,6 +59,15 @@ const tablet: Reducer<ITabletState, ITabletAction> = (state = initialState, acti
|
|
57
59
|
error: undefined,
|
58
60
|
};
|
59
61
|
}
|
62
|
+
case CLEAR_TABLET_DATA: {
|
63
|
+
return {
|
64
|
+
...state,
|
65
|
+
id: undefined,
|
66
|
+
tenantPath: undefined,
|
67
|
+
data: undefined,
|
68
|
+
history: undefined,
|
69
|
+
};
|
70
|
+
}
|
60
71
|
default:
|
61
72
|
return state;
|
62
73
|
}
|
@@ -122,4 +133,10 @@ export const getTabletDescribe = (tenantId: TDomainKey = {}) => {
|
|
122
133
|
});
|
123
134
|
};
|
124
135
|
|
136
|
+
export const clearTabletData = () => {
|
137
|
+
return {
|
138
|
+
type: CLEAR_TABLET_DATA,
|
139
|
+
} as const;
|
140
|
+
};
|
141
|
+
|
125
142
|
export default tablet;
|
@@ -3,6 +3,12 @@ export const TENANT_GENERAL_TABS_IDS = {
|
|
3
3
|
diagnostics: 'diagnostics',
|
4
4
|
} as const;
|
5
5
|
|
6
|
+
export const TENANT_QUERY_TABS_ID = {
|
7
|
+
newQuery: 'newQuery',
|
8
|
+
history: 'history',
|
9
|
+
saved: 'saved',
|
10
|
+
} as const;
|
11
|
+
|
6
12
|
export const TENANT_DIAGNOSTICS_TABS_IDS = {
|
7
13
|
overview: 'overview',
|
8
14
|
topQueries: 'topQueries',
|
@@ -1,7 +1,13 @@
|
|
1
1
|
import type {Reducer} from 'redux';
|
2
2
|
|
3
3
|
import type {TTenant} from '../../../types/api/tenant';
|
4
|
-
import type {
|
4
|
+
import type {
|
5
|
+
TenantAction,
|
6
|
+
TenantDiagnosticsTab,
|
7
|
+
TenantGeneralTab,
|
8
|
+
TenantQueryTab,
|
9
|
+
TenantState,
|
10
|
+
} from './types';
|
5
11
|
|
6
12
|
import '../../../services/api';
|
7
13
|
import {createRequestActionTypes, createApiRequest} from '../../utils';
|
@@ -9,6 +15,7 @@ import {createRequestActionTypes, createApiRequest} from '../../utils';
|
|
9
15
|
export const FETCH_TENANT = createRequestActionTypes('tenant', 'FETCH_TENANT');
|
10
16
|
|
11
17
|
const SET_TOP_LEVEL_TAB = 'tenant/SET_TOP_LEVEL_TAB';
|
18
|
+
const SET_QUERY_TAB = 'tenant/SET_QUERY_TAB';
|
12
19
|
const SET_DIAGNOSTICS_TAB = 'tenant/SET_DIAGNOSTICS_TAB';
|
13
20
|
const CLEAR_TENANT = 'tenant/CLEAR_TENANT';
|
14
21
|
|
@@ -56,7 +63,12 @@ const tenantReducer: Reducer<TenantState, TenantAction> = (state = initialState,
|
|
56
63
|
topLevelTab: action.data,
|
57
64
|
};
|
58
65
|
}
|
59
|
-
|
66
|
+
case SET_QUERY_TAB: {
|
67
|
+
return {
|
68
|
+
...state,
|
69
|
+
queryTab: action.data,
|
70
|
+
};
|
71
|
+
}
|
60
72
|
case SET_DIAGNOSTICS_TAB: {
|
61
73
|
return {
|
62
74
|
...state,
|
@@ -90,6 +102,13 @@ export function setTopLevelTab(tab: TenantGeneralTab) {
|
|
90
102
|
} as const;
|
91
103
|
}
|
92
104
|
|
105
|
+
export function setQueryTab(tab: TenantQueryTab) {
|
106
|
+
return {
|
107
|
+
type: SET_QUERY_TAB,
|
108
|
+
data: tab,
|
109
|
+
} as const;
|
110
|
+
}
|
111
|
+
|
93
112
|
export function setDiagnosticsTab(tab: TenantDiagnosticsTab) {
|
94
113
|
return {
|
95
114
|
type: SET_DIAGNOSTICS_TAB,
|
@@ -3,16 +3,22 @@ import type {TTenant} from '../../../types/api/tenant';
|
|
3
3
|
import type {ValueOf} from '../../../types/common';
|
4
4
|
import type {ApiRequestAction} from '../../utils';
|
5
5
|
|
6
|
-
import {
|
7
|
-
|
6
|
+
import {
|
7
|
+
TENANT_QUERY_TABS_ID,
|
8
|
+
TENANT_DIAGNOSTICS_TABS_IDS,
|
9
|
+
TENANT_GENERAL_TABS_IDS,
|
10
|
+
} from './constants';
|
11
|
+
import {FETCH_TENANT, clearTenant, setDiagnosticsTab, setQueryTab, setTopLevelTab} from './tenant';
|
8
12
|
|
9
13
|
export type TenantGeneralTab = ValueOf<typeof TENANT_GENERAL_TABS_IDS>;
|
14
|
+
export type TenantQueryTab = ValueOf<typeof TENANT_QUERY_TABS_ID>;
|
10
15
|
export type TenantDiagnosticsTab = ValueOf<typeof TENANT_DIAGNOSTICS_TABS_IDS>;
|
11
16
|
|
12
17
|
export interface TenantState {
|
13
18
|
loading: boolean;
|
14
19
|
wasLoaded: boolean;
|
15
20
|
topLevelTab?: TenantGeneralTab;
|
21
|
+
queryTab?: TenantQueryTab;
|
16
22
|
diagnosticsTab?: TenantDiagnosticsTab;
|
17
23
|
tenant?: TTenant;
|
18
24
|
error?: IResponseError;
|
@@ -22,4 +28,5 @@ export type TenantAction =
|
|
22
28
|
| ApiRequestAction<typeof FETCH_TENANT, TTenant | undefined, IResponseError>
|
23
29
|
| ReturnType<typeof clearTenant>
|
24
30
|
| ReturnType<typeof setTopLevelTab>
|
31
|
+
| ReturnType<typeof setQueryTab>
|
25
32
|
| ReturnType<typeof setDiagnosticsTab>;
|
@@ -35,7 +35,7 @@ const topic: Reducer<ITopicState, ITopicAction> = (state = initialState, action)
|
|
35
35
|
};
|
36
36
|
}
|
37
37
|
case FETCH_TOPIC.SUCCESS: {
|
38
|
-
// On older version it can return HTML page of
|
38
|
+
// On older version it can return HTML page of Developer UI with an error
|
39
39
|
if (typeof action.data !== 'object') {
|
40
40
|
return {...state, loading: false, error: {}};
|
41
41
|
}
|