ydb-embedded-ui 6.12.0 → 6.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.d.ts +3 -2
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.js +9 -5
- package/dist/components/CriticalActionDialog/CriticalActionDialog.d.ts +5 -3
- package/dist/components/CriticalActionDialog/CriticalActionDialog.js +8 -7
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +1 -1
- package/dist/components/CriticalActionDialog/i18n/en.json +1 -0
- package/dist/components/CriticalActionDialog/i18n/index.d.ts +1 -1
- package/dist/components/Errors/PageError/PageError.d.ts +11 -0
- package/dist/components/Errors/PageError/PageError.js +19 -0
- package/dist/components/Errors/i18n/en.json +2 -1
- package/dist/components/Errors/i18n/index.d.ts +1 -1
- package/dist/components/Errors/i18n/ru.json +2 -1
- package/dist/components/Fullscreen/Fullscreen.d.ts +1 -1
- package/dist/components/Fullscreen/Fullscreen.js +34 -27
- package/dist/components/Fullscreen/Fullscreen.scss +16 -8
- package/dist/components/Graph/Graph.d.ts +13 -0
- package/dist/components/Graph/Graph.js +41 -0
- package/dist/components/LabelWithPopover/LabelWithPopover.d.ts +4 -1
- package/dist/components/LabelWithPopover/LabelWithPopover.js +1 -1
- package/dist/components/Loader/Loader.d.ts +2 -1
- package/dist/components/Loader/Loader.js +6 -1
- package/dist/components/LoaderWrapper/LoaderWrapper.d.ts +10 -0
- package/dist/components/LoaderWrapper/LoaderWrapper.js +8 -0
- package/dist/components/MetricChart/reducer.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.js +9 -6
- package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
- package/dist/components/ProgressViewer/ProgressViewer.js +3 -0
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.js +13 -3
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +4 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.d.ts +7 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.js +8 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.scss +8 -0
- package/dist/components/QuerySettingsDescription/index.d.ts +1 -0
- package/dist/components/QuerySettingsDescription/index.js +1 -0
- package/dist/components/VDisk/VDisk.js +3 -4
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +2 -2
- package/dist/components/VDiskInfo/VDiskInfo.js +4 -2
- package/dist/containers/App/Content.js +15 -19
- package/dist/containers/AsideNavigation/AsideNavigation.js +2 -1
- package/dist/containers/AsideNavigation/YdbInternalUser/YdbInternalUser.js +4 -4
- package/dist/containers/Authentication/Authentication.js +8 -10
- package/dist/containers/Authentication/utils.d.ts +8 -0
- package/dist/containers/Authentication/utils.js +15 -0
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +6 -6
- package/dist/containers/Clusters/constants.d.ts +1 -1
- package/dist/containers/Heatmap/Heatmap.js +5 -4
- package/dist/containers/Node/Node.js +5 -7
- package/dist/containers/Node/Node.scss +4 -0
- package/dist/containers/Node/NodeStructure/NodeStructure.js +4 -4
- package/dist/containers/Node/NodeStructure/NodeStructure.scss +4 -0
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/Nodes/Nodes.js +6 -8
- package/dist/containers/Nodes/getNodesColumns.js +6 -21
- package/dist/containers/PDiskPage/PDiskPage.js +19 -8
- package/dist/containers/PDiskPage/i18n/en.json +1 -0
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
- package/dist/containers/Storage/PDisk/PDisk.js +3 -4
- package/dist/containers/Storage/Storage.js +4 -6
- package/dist/containers/Tablet/Tablet.js +2 -2
- package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
- package/dist/containers/Tablets/Tablets.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +2 -5
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +10 -13
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Network/Network.js +8 -11
- package/dist/containers/Tenant/Diagnostics/Network/Network.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.d.ts +1 -2
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.js +3 -4
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -4
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.js +3 -3
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +4 -3
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +4 -3
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.d.ts +2 -2
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.js +56 -20
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +10 -6
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/en.json +7 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.d.ts +18 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.js +36 -0
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.d.ts +23 -1
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +56 -111
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +1 -30
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.js +18 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.scss +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.js +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.d.ts +13 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.js +48 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.js +66 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.js +100 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.scss +128 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.js +59 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/en.json +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/Preview/Preview.js +2 -3
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.js +1 -19
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.js +1 -1
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.scss +11 -0
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +1 -1
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +91 -95
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +4 -6
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +18 -49
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.d.ts +2 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.js +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.js +42 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.d.ts +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.js +19 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.js +56 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.d.ts +2 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.js +12 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.scss +3 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.js +20 -23
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.d.ts +123 -7
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.js +32 -10
- package/dist/containers/Tenant/Query/i18n/en.json +3 -1
- package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -6
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +5 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.d.ts +2 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.js +13 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/en.json +1 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/prepareData.js +3 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/types.d.ts +1 -0
- package/dist/containers/Tenant/Tenant.js +4 -8
- package/dist/containers/Tenant/utils/schemaActions.d.ts +2 -2
- package/dist/containers/Tenant/utils/schemaActions.js +2 -2
- package/dist/containers/Tenants/Tenants.js +4 -7
- package/dist/containers/UserSettings/i18n/en.json +3 -5
- package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
- package/dist/containers/UserSettings/settings.d.ts +2 -3
- package/dist/containers/UserSettings/settings.js +17 -23
- package/dist/containers/VDiskPage/VDiskPage.js +27 -13
- package/dist/containers/VDiskPage/i18n/en.json +1 -0
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
- package/dist/services/api.d.ts +21 -8
- package/dist/services/api.js +29 -42
- package/dist/services/settings.d.ts +11 -4
- package/dist/services/settings.js +7 -6
- package/dist/store/configureStore.d.ts +7 -7
- package/dist/store/defaultStore.d.ts +3 -3
- package/dist/store/reducers/api.d.ts +1 -1
- package/dist/store/reducers/api.js +1 -1
- package/dist/store/reducers/authentication/authentication.d.ts +37 -24
- package/dist/store/reducers/authentication/authentication.js +77 -57
- package/dist/store/reducers/authentication/types.d.ts +0 -8
- package/dist/store/reducers/capabilities/capabilities.d.ts +106 -0
- package/dist/store/reducers/capabilities/capabilities.js +22 -0
- package/dist/store/reducers/capabilities/hooks.d.ts +2 -0
- package/dist/store/reducers/capabilities/hooks.js +13 -0
- package/dist/store/reducers/cluster/cluster.d.ts +2 -2
- package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +2 -2
- package/dist/store/reducers/clusters/clusters.d.ts +2 -2
- package/dist/store/reducers/describe.d.ts +2 -2
- package/dist/store/reducers/executeQuery.d.ts +7 -14
- package/dist/store/reducers/executeQuery.js +19 -14
- package/dist/store/reducers/executeTopQueries/executeTopQueries.d.ts +2 -2
- package/dist/store/reducers/explainQuery/explainQuery.d.ts +5 -4
- package/dist/store/reducers/explainQuery/explainQuery.js +14 -4
- package/dist/store/reducers/explainQuery/types.d.ts +13 -1
- package/dist/store/reducers/explainQuery/utils.js +7 -2
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +58 -58
- package/dist/store/reducers/heatmap.d.ts +2 -2
- package/dist/store/reducers/hotKeys/hotKeys.d.ts +2 -2
- package/dist/store/reducers/index.d.ts +6 -6
- package/dist/store/reducers/network/network.d.ts +2 -2
- package/dist/store/reducers/node/node.d.ts +3 -3
- package/dist/store/reducers/node/selectors.d.ts +1 -1
- package/dist/store/reducers/nodes/nodes.d.ts +3 -3
- package/dist/store/reducers/nodesList.d.ts +3 -3
- package/dist/store/reducers/overview/overview.d.ts +2 -2
- package/dist/store/reducers/partitions/partitions.d.ts +2 -2
- package/dist/store/reducers/pdisk/pdisk.d.ts +3 -3
- package/dist/store/reducers/preview.d.ts +2 -2
- package/dist/store/reducers/schema/schema.d.ts +3 -3
- package/dist/store/reducers/schema/schema.js +10 -3
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +2 -2
- package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +2 -2
- package/dist/store/reducers/storage/storage.d.ts +3 -3
- package/dist/store/reducers/tablet.d.ts +3 -3
- package/dist/store/reducers/tablets.d.ts +13 -13
- package/dist/store/reducers/tabletsFilters.d.ts +1 -1
- package/dist/store/reducers/tenant/tenant.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topNodes/topNodes.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +2 -2
- package/dist/store/reducers/tenants/selectors.d.ts +31 -30
- package/dist/store/reducers/tenants/selectors.js +8 -2
- package/dist/store/reducers/tenants/tenants.d.ts +2 -2
- package/dist/store/reducers/topic.d.ts +44 -44
- package/dist/store/reducers/vdisk/vdisk.d.ts +2 -2
- package/dist/store/reducers/viewSchema/viewSchema.d.ts +2 -2
- package/dist/styles/mixins.scss +2 -0
- package/dist/types/api/capabilities.d.ts +7 -0
- package/dist/types/api/capabilities.js +1 -0
- package/dist/types/api/modifyDisk.d.ts +8 -0
- package/dist/types/api/modifyDisk.js +1 -0
- package/dist/types/api/query.d.ts +39 -3
- package/dist/types/api/query.js +9 -1
- package/dist/types/api/schema/shared.d.ts +8 -0
- package/dist/types/store/query.d.ts +7 -0
- package/dist/utils/__test__/prepareQueryExplain.test.d.ts +1 -0
- package/dist/utils/__test__/prepareQueryExplain.test.js +115 -0
- package/dist/utils/constants.d.ts +13 -4
- package/dist/utils/constants.js +15 -4
- package/dist/utils/dataFormatters/dataFormatters.d.ts +0 -1
- package/dist/utils/dataFormatters/dataFormatters.js +1 -4
- package/dist/utils/hooks/index.d.ts +2 -1
- package/dist/utils/hooks/index.js +2 -1
- package/dist/utils/hooks/useChangedQuerySettings.d.ts +10 -0
- package/dist/utils/hooks/useChangedQuerySettings.js +46 -0
- package/dist/utils/hooks/useDelayed.d.ts +1 -0
- package/dist/utils/hooks/useDelayed.js +13 -0
- package/dist/utils/hooks/useEventHandler.d.ts +6 -0
- package/dist/utils/hooks/useEventHandler.js +17 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.js +5 -0
- package/dist/utils/hooks/useQueryExecutionSettings.d.ts +8 -0
- package/dist/utils/hooks/useQueryExecutionSettings.js +15 -0
- package/dist/utils/prepareQueryExplain.d.ts +3 -1
- package/dist/utils/prepareQueryExplain.js +54 -2
- package/dist/utils/query.js +1 -0
- package/dist/utils/query.test.js +3 -0
- package/dist/utils/utils.d.ts +8 -7
- package/dist/utils/utils.js +23 -11
- package/package.json +4 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.d.ts +0 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.js +0 -4
- package/dist/store/utils.d.ts +0 -23
- package/dist/store/utils.js +0 -49
- package/dist/types/api/restartPDisk.d.ts +0 -4
- package/dist/utils/hooks/useQueryModes.d.ts +0 -2
- package/dist/utils/hooks/useQueryModes.js +0 -5
- /package/dist/{types/api/restartPDisk.js → containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.js} +0 -0
@@ -1,62 +1,82 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
export const FETCH_USER = createRequestActionTypes('authentication', 'FETCH_USER');
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
2
|
+
import { isAxiosResponse } from '../../../utils/response';
|
3
|
+
import { api } from '../api';
|
5
4
|
const initialState = {
|
6
5
|
isAuthenticated: true,
|
7
6
|
user: '',
|
8
|
-
error: undefined,
|
9
7
|
};
|
10
|
-
const
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
case FETCH_USER.SUCCESS: {
|
22
|
-
const { user, isUserAllowedToMakeChanges } = action.data;
|
23
|
-
return {
|
24
|
-
...state,
|
25
|
-
user,
|
26
|
-
isUserAllowedToMakeChanges,
|
27
|
-
};
|
28
|
-
}
|
29
|
-
default:
|
30
|
-
return { ...state };
|
31
|
-
}
|
32
|
-
};
|
33
|
-
export const authenticate = (user, password) => {
|
34
|
-
return createApiRequest({
|
35
|
-
request: window.api.authenticate(user, password),
|
36
|
-
actions: SET_AUTHENTICATED,
|
37
|
-
});
|
38
|
-
};
|
39
|
-
export const logout = () => {
|
40
|
-
return createApiRequest({
|
41
|
-
request: window.api.logout(),
|
42
|
-
actions: SET_UNAUTHENTICATED,
|
43
|
-
});
|
44
|
-
};
|
45
|
-
export const getUser = () => {
|
46
|
-
return createApiRequest({
|
47
|
-
request: window.api.whoami(),
|
48
|
-
actions: FETCH_USER,
|
49
|
-
dataHandler: (data) => {
|
50
|
-
const { UserSID, AuthType, IsMonitoringAllowed } = data;
|
51
|
-
return {
|
52
|
-
user: AuthType === 'Login' ? UserSID : undefined,
|
53
|
-
// If ydb version supports this feature,
|
54
|
-
// There should be explicit flag in whoami response
|
55
|
-
// Otherwise every user is allowed to make changes
|
56
|
-
// Anyway there will be guards on backend
|
57
|
-
isUserAllowedToMakeChanges: IsMonitoringAllowed !== false,
|
58
|
-
};
|
8
|
+
export const slice = createSlice({
|
9
|
+
name: 'authentication',
|
10
|
+
initialState,
|
11
|
+
reducers: {
|
12
|
+
setIsAuthenticated: (state, action) => {
|
13
|
+
const isAuthenticated = action.payload;
|
14
|
+
state.isAuthenticated = isAuthenticated;
|
15
|
+
if (!isAuthenticated) {
|
16
|
+
state.user = '';
|
17
|
+
}
|
59
18
|
},
|
60
|
-
|
61
|
-
};
|
62
|
-
|
19
|
+
setUser: (state, action) => {
|
20
|
+
const { UserSID, AuthType, IsMonitoringAllowed } = action.payload;
|
21
|
+
state.user = AuthType === 'Login' ? UserSID : undefined;
|
22
|
+
// If ydb version supports this feature,
|
23
|
+
// There should be explicit flag in whoami response
|
24
|
+
// Otherwise every user is allowed to make changes
|
25
|
+
// Anyway there will be guards on backend
|
26
|
+
state.isUserAllowedToMakeChanges = IsMonitoringAllowed !== false;
|
27
|
+
},
|
28
|
+
},
|
29
|
+
selectors: {
|
30
|
+
selectIsUserAllowedToMakeChanges: (state) => state.isUserAllowedToMakeChanges,
|
31
|
+
selectUser: (state) => state.user,
|
32
|
+
},
|
33
|
+
});
|
34
|
+
export default slice.reducer;
|
35
|
+
export const { setIsAuthenticated, setUser } = slice.actions;
|
36
|
+
export const { selectIsUserAllowedToMakeChanges, selectUser } = slice.selectors;
|
37
|
+
export const authenticationApi = api.injectEndpoints({
|
38
|
+
endpoints: (build) => ({
|
39
|
+
whoami: build.query({
|
40
|
+
queryFn: async (_, { dispatch }) => {
|
41
|
+
try {
|
42
|
+
const data = await window.api.whoami();
|
43
|
+
dispatch(setUser(data));
|
44
|
+
return { data };
|
45
|
+
}
|
46
|
+
catch (error) {
|
47
|
+
if (isAxiosResponse(error) && error.status === 401) {
|
48
|
+
dispatch(setIsAuthenticated(false));
|
49
|
+
}
|
50
|
+
return { error };
|
51
|
+
}
|
52
|
+
},
|
53
|
+
providesTags: ['UserData'],
|
54
|
+
}),
|
55
|
+
authenticate: build.mutation({
|
56
|
+
queryFn: async (params, { dispatch }) => {
|
57
|
+
try {
|
58
|
+
const data = await window.api.authenticate(params);
|
59
|
+
dispatch(setIsAuthenticated(true));
|
60
|
+
return { data };
|
61
|
+
}
|
62
|
+
catch (error) {
|
63
|
+
return { error };
|
64
|
+
}
|
65
|
+
},
|
66
|
+
invalidatesTags: (_, error) => (error ? [] : ['UserData']),
|
67
|
+
}),
|
68
|
+
logout: build.mutation({
|
69
|
+
queryFn: async (_, { dispatch }) => {
|
70
|
+
try {
|
71
|
+
const data = await window.api.logout();
|
72
|
+
dispatch(setIsAuthenticated(false));
|
73
|
+
return { data };
|
74
|
+
}
|
75
|
+
catch (error) {
|
76
|
+
return { error };
|
77
|
+
}
|
78
|
+
},
|
79
|
+
}),
|
80
|
+
}),
|
81
|
+
overrideExisting: 'throw',
|
82
|
+
});
|
@@ -1,13 +1,5 @@
|
|
1
|
-
import type { AuthErrorResponse } from '../../../types/api/error';
|
2
|
-
import type { ApiRequestAction } from '../../utils';
|
3
|
-
import type { FETCH_USER, SET_AUTHENTICATED, SET_UNAUTHENTICATED } from './authentication';
|
4
1
|
export interface AuthenticationState {
|
5
2
|
isAuthenticated: boolean;
|
6
3
|
isUserAllowedToMakeChanges?: boolean;
|
7
4
|
user: string | undefined;
|
8
|
-
error: AuthErrorResponse | undefined;
|
9
5
|
}
|
10
|
-
export type AuthenticationAction = ApiRequestAction<typeof SET_UNAUTHENTICATED, unknown, unknown> | ApiRequestAction<typeof SET_AUTHENTICATED, unknown, AuthErrorResponse> | ApiRequestAction<typeof FETCH_USER, {
|
11
|
-
user: string | undefined;
|
12
|
-
isUserAllowedToMakeChanges: boolean;
|
13
|
-
}, unknown>;
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import type { Capability } from '../../../types/api/capabilities';
|
2
|
+
import type { RootState } from '../../defaultStore';
|
3
|
+
export declare const capabilitiesApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./../api")._NEVER, unknown, {}>, {
|
4
|
+
getClusterCapabilities: import("@reduxjs/toolkit/query").QueryDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", import("../../../types/api/capabilities").CapabilitiesResponse | undefined, "api">;
|
5
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
6
|
+
export declare const selectCapabilityVersion: ((state: {
|
7
|
+
api: import("@reduxjs/toolkit/query").CombinedState<{}, "All" | "PDiskData" | "UserData", "api">;
|
8
|
+
singleClusterMode: boolean;
|
9
|
+
cluster: import("../cluster/types").ClusterState;
|
10
|
+
tenant: import("../tenant/types").TenantState;
|
11
|
+
tooltip: import("../../../types/store/tooltip").ITooltipState;
|
12
|
+
tablets: import("../../../types/store/tablets").TabletsState;
|
13
|
+
schema: import("../schema/types").SchemaState;
|
14
|
+
tenants: import("../tenants/types").TenantsState;
|
15
|
+
partitions: import("../partitions/types").PartitionsState;
|
16
|
+
executeQuery: import("../../../types/store/executeQuery").ExecuteQueryState;
|
17
|
+
heatmap: import("../../../types/store/heatmap").IHeatmapState;
|
18
|
+
settings: import("../settings/types").SettingsState;
|
19
|
+
executeTopQueries: import("../executeTopQueries/types").TopQueriesFilters;
|
20
|
+
shardsWorkload: import("../shardsWorkload/types").ShardsWorkloadFilters;
|
21
|
+
authentication: import("../authentication/types").AuthenticationState;
|
22
|
+
header: import("../header/types").HeaderState;
|
23
|
+
queryActions: import("../queryActions/types").QueryActionsState;
|
24
|
+
fullscreen: boolean;
|
25
|
+
clusters: import("../clusters/types").ClustersFilters;
|
26
|
+
}, capability: Capability) => number | undefined) & {
|
27
|
+
clearCache: () => void;
|
28
|
+
resultsCount: () => number;
|
29
|
+
resetResultsCount: () => void;
|
30
|
+
} & {
|
31
|
+
resultFunc: (resultFuncArgs_0: {
|
32
|
+
api: import("@reduxjs/toolkit/query").CombinedState<{}, "All" | "PDiskData" | "UserData", "api">;
|
33
|
+
singleClusterMode: boolean;
|
34
|
+
cluster: import("../cluster/types").ClusterState;
|
35
|
+
tenant: import("../tenant/types").TenantState;
|
36
|
+
tooltip: import("../../../types/store/tooltip").ITooltipState;
|
37
|
+
tablets: import("../../../types/store/tablets").TabletsState;
|
38
|
+
schema: import("../schema/types").SchemaState;
|
39
|
+
tenants: import("../tenants/types").TenantsState;
|
40
|
+
partitions: import("../partitions/types").PartitionsState;
|
41
|
+
executeQuery: import("../../../types/store/executeQuery").ExecuteQueryState;
|
42
|
+
heatmap: import("../../../types/store/heatmap").IHeatmapState;
|
43
|
+
settings: import("../settings/types").SettingsState;
|
44
|
+
executeTopQueries: import("../executeTopQueries/types").TopQueriesFilters;
|
45
|
+
shardsWorkload: import("../shardsWorkload/types").ShardsWorkloadFilters;
|
46
|
+
authentication: import("../authentication/types").AuthenticationState;
|
47
|
+
header: import("../header/types").HeaderState;
|
48
|
+
queryActions: import("../queryActions/types").QueryActionsState;
|
49
|
+
fullscreen: boolean;
|
50
|
+
clusters: import("../clusters/types").ClustersFilters;
|
51
|
+
}, resultFuncArgs_1: Capability) => number | undefined;
|
52
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
53
|
+
api: import("@reduxjs/toolkit/query").CombinedState<{}, "All" | "PDiskData" | "UserData", "api">;
|
54
|
+
singleClusterMode: boolean;
|
55
|
+
cluster: import("../cluster/types").ClusterState;
|
56
|
+
tenant: import("../tenant/types").TenantState;
|
57
|
+
tooltip: import("../../../types/store/tooltip").ITooltipState;
|
58
|
+
tablets: import("../../../types/store/tablets").TabletsState;
|
59
|
+
schema: import("../schema/types").SchemaState;
|
60
|
+
tenants: import("../tenants/types").TenantsState;
|
61
|
+
partitions: import("../partitions/types").PartitionsState;
|
62
|
+
executeQuery: import("../../../types/store/executeQuery").ExecuteQueryState;
|
63
|
+
heatmap: import("../../../types/store/heatmap").IHeatmapState;
|
64
|
+
settings: import("../settings/types").SettingsState;
|
65
|
+
executeTopQueries: import("../executeTopQueries/types").TopQueriesFilters;
|
66
|
+
shardsWorkload: import("../shardsWorkload/types").ShardsWorkloadFilters;
|
67
|
+
authentication: import("../authentication/types").AuthenticationState;
|
68
|
+
header: import("../header/types").HeaderState;
|
69
|
+
queryActions: import("../queryActions/types").QueryActionsState;
|
70
|
+
fullscreen: boolean;
|
71
|
+
clusters: import("../clusters/types").ClustersFilters;
|
72
|
+
}, resultFuncArgs_1: Capability) => number | undefined) & {
|
73
|
+
clearCache: () => void;
|
74
|
+
resultsCount: () => number;
|
75
|
+
resetResultsCount: () => void;
|
76
|
+
};
|
77
|
+
lastResult: () => number | undefined;
|
78
|
+
dependencies: [(state: RootState) => {
|
79
|
+
api: import("@reduxjs/toolkit/query").CombinedState<{}, "All" | "PDiskData" | "UserData", "api">;
|
80
|
+
singleClusterMode: boolean;
|
81
|
+
cluster: import("../cluster/types").ClusterState;
|
82
|
+
tenant: import("../tenant/types").TenantState;
|
83
|
+
tooltip: import("../../../types/store/tooltip").ITooltipState;
|
84
|
+
tablets: import("../../../types/store/tablets").TabletsState;
|
85
|
+
schema: import("../schema/types").SchemaState;
|
86
|
+
tenants: import("../tenants/types").TenantsState;
|
87
|
+
partitions: import("../partitions/types").PartitionsState;
|
88
|
+
executeQuery: import("../../../types/store/executeQuery").ExecuteQueryState;
|
89
|
+
heatmap: import("../../../types/store/heatmap").IHeatmapState;
|
90
|
+
settings: import("../settings/types").SettingsState;
|
91
|
+
executeTopQueries: import("../executeTopQueries/types").TopQueriesFilters;
|
92
|
+
shardsWorkload: import("../shardsWorkload/types").ShardsWorkloadFilters;
|
93
|
+
authentication: import("../authentication/types").AuthenticationState;
|
94
|
+
header: import("../header/types").HeaderState;
|
95
|
+
queryActions: import("../queryActions/types").QueryActionsState;
|
96
|
+
fullscreen: boolean;
|
97
|
+
clusters: import("../clusters/types").ClustersFilters;
|
98
|
+
}, (_state: RootState, capability: Capability) => Capability];
|
99
|
+
recomputations: () => number;
|
100
|
+
resetRecomputations: () => void;
|
101
|
+
dependencyRecomputations: () => number;
|
102
|
+
resetDependencyRecomputations: () => void;
|
103
|
+
} & {
|
104
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
105
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
106
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { createSelector } from '@reduxjs/toolkit';
|
2
|
+
import { api } from './../api';
|
3
|
+
export const capabilitiesApi = api.injectEndpoints({
|
4
|
+
endpoints: (build) => ({
|
5
|
+
getClusterCapabilities: build.query({
|
6
|
+
queryFn: async () => {
|
7
|
+
try {
|
8
|
+
const data = await window.api.getClusterCapabilities();
|
9
|
+
return { data };
|
10
|
+
}
|
11
|
+
catch (error) {
|
12
|
+
// If capabilities endpoint is not available, there will be an error
|
13
|
+
// That means no new features are available
|
14
|
+
return { error };
|
15
|
+
}
|
16
|
+
},
|
17
|
+
}),
|
18
|
+
}),
|
19
|
+
overrideExisting: 'throw',
|
20
|
+
});
|
21
|
+
const selectCapabilities = capabilitiesApi.endpoints.getClusterCapabilities.select(undefined);
|
22
|
+
export const selectCapabilityVersion = createSelector((state) => state, (_state, capability) => capability, (state, capability) => { var _a, _b; return (_b = (_a = selectCapabilities(state).data) === null || _a === void 0 ? void 0 : _a.Capabilities) === null || _b === void 0 ? void 0 : _b[capability]; });
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { useTypedSelector } from '../../../utils/hooks';
|
2
|
+
import { selectCapabilityVersion } from './capabilities';
|
3
|
+
const useGetFeatureVersion = (feature) => {
|
4
|
+
return useTypedSelector((state) => selectCapabilityVersion(state, feature) || 0);
|
5
|
+
};
|
6
|
+
export const useCreateDirectoryFeatureAvailable = () => {
|
7
|
+
return useGetFeatureVersion('/scheme/directory') > 0;
|
8
|
+
};
|
9
|
+
export const useDiskPagesAvailable = () => {
|
10
|
+
// New PDisk (info, restart) and VDisk (evict) handlers was made at the same time
|
11
|
+
// It's enough to check only pdisk handler
|
12
|
+
return useGetFeatureVersion('/pdisk/info') > 0;
|
13
|
+
};
|
@@ -5,8 +5,8 @@ export declare function updateDefaultClusterTab(tab: string): (dispatch: Dispatc
|
|
5
5
|
declare const _default: import("redux").Reducer<ClusterState>;
|
6
6
|
export default _default;
|
7
7
|
export declare const clusterApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, {
|
8
|
-
getClusterInfo: import("@reduxjs/toolkit/query").QueryDefinition<string | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData", {
|
8
|
+
getClusterInfo: import("@reduxjs/toolkit/query").QueryDefinition<string | undefined, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", {
|
9
9
|
clusterData: TClusterInfo;
|
10
10
|
groupsStats?: ClusterGroupsStats;
|
11
11
|
}, "api">;
|
12
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
12
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PreparedNodeSystemState } from '../../../utils/nodes';
|
2
2
|
export type PreparedClusterNode = PreparedNodeSystemState;
|
3
3
|
export declare const clusterNodesApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, {
|
4
|
-
getClusterNodes: import("@reduxjs/toolkit/query").QueryDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData", PreparedNodeSystemState[] | undefined, "api">;
|
5
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
4
|
+
getClusterNodes: import("@reduxjs/toolkit/query").QueryDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", PreparedNodeSystemState[] | undefined, "api">;
|
5
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
@@ -3,5 +3,5 @@ declare const _default: import("redux").Reducer<ClustersFilters>;
|
|
3
3
|
export default _default;
|
4
4
|
export declare const changeClustersFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<ClustersFilters>, "clusters/changeClustersFilters">;
|
5
5
|
export declare const clustersApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, {
|
6
|
-
getClustersList: import("@reduxjs/toolkit/query").QueryDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData", import("./types").PreparedCluster[] | undefined, "api">;
|
7
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
6
|
+
getClustersList: import("@reduxjs/toolkit/query").QueryDefinition<any, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", import("./types").PreparedCluster[] | undefined, "api">;
|
7
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
@@ -3,5 +3,5 @@ export declare const describeApi: import("@reduxjs/toolkit/query").Api<import("@
|
|
3
3
|
getDescribe: import("@reduxjs/toolkit/query").QueryDefinition<{
|
4
4
|
paths: string[];
|
5
5
|
database: string;
|
6
|
-
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./api")._NEVER, unknown, {}>, "All" | "PDiskData", IDescribeData | undefined, "api">;
|
7
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
6
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", IDescribeData | undefined, "api">;
|
7
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
@@ -1,26 +1,19 @@
|
|
1
1
|
import type { Reducer } from '@reduxjs/toolkit';
|
2
2
|
import type { Schemas } from '../../types/api/query';
|
3
3
|
import type { ExecuteQueryAction, ExecuteQueryState, ExecuteQueryStateSlice, QueryInHistory } from '../../types/store/executeQuery';
|
4
|
-
import type { IQueryResult,
|
5
|
-
export declare const SEND_QUERY: {
|
6
|
-
readonly REQUEST: "query/SEND_QUERY_REQUEST";
|
7
|
-
readonly SUCCESS: "query/SEND_QUERY_SUCCESS";
|
8
|
-
readonly FAILURE: "query/SEND_QUERY_FAILURE";
|
9
|
-
};
|
4
|
+
import type { IQueryResult, QueryRequestParams, QuerySettings } from '../../types/store/query';
|
10
5
|
declare const executeQuery: Reducer<ExecuteQueryState, ExecuteQueryAction>;
|
11
6
|
interface SendQueryParams extends QueryRequestParams {
|
12
|
-
|
7
|
+
querySettings?: Partial<QuerySettings>;
|
13
8
|
schema?: Schemas;
|
9
|
+
enableTracingLevel?: boolean;
|
14
10
|
}
|
15
11
|
export declare const executeQueryApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./api")._NEVER, unknown, {}>, {
|
16
|
-
executeQuery: import("@reduxjs/toolkit/query").MutationDefinition<SendQueryParams, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./api")._NEVER, unknown, {}>, "All" | "PDiskData", IQueryResult, "api">;
|
17
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
18
|
-
export declare const saveQueryToHistory: (queryText: string
|
12
|
+
executeQuery: import("@reduxjs/toolkit/query").MutationDefinition<SendQueryParams, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("./api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", IQueryResult, "api">;
|
13
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
14
|
+
export declare const saveQueryToHistory: (queryText: string) => {
|
19
15
|
readonly type: "query/SAVE_QUERY_TO_HISTORY";
|
20
|
-
readonly data:
|
21
|
-
readonly queryText: string;
|
22
|
-
readonly mode: QueryMode;
|
23
|
-
};
|
16
|
+
readonly data: string;
|
24
17
|
};
|
25
18
|
export declare const goToPreviousQuery: () => {
|
26
19
|
readonly type: "query/GO_TO_PREVIOUS_QUERY";
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { settingsManager } from '../../services/settings';
|
2
|
+
import { TracingLevelNumber } from '../../types/api/query';
|
2
3
|
import { QUERIES_HISTORY_KEY } from '../../utils/constants';
|
3
|
-
import {
|
4
|
-
import {
|
4
|
+
import { QUERY_SYNTAX, isQueryErrorResponse, parseQueryAPIExecuteResponse } from '../../utils/query';
|
5
|
+
import { isNumeric } from '../../utils/utils';
|
5
6
|
import { api } from './api';
|
6
7
|
const MAXIMUM_QUERIES_IN_HISTORY = 20;
|
7
|
-
export const SEND_QUERY = createRequestActionTypes('query', 'SEND_QUERY');
|
8
8
|
const CHANGE_USER_INPUT = 'query/CHANGE_USER_INPUT';
|
9
9
|
const SAVE_QUERY_TO_HISTORY = 'query/SAVE_QUERY_TO_HISTORY';
|
10
10
|
const GO_TO_PREVIOUS_QUERY = 'query/GO_TO_PREVIOUS_QUERY';
|
@@ -33,10 +33,8 @@ const executeQuery = (state = initialState, action) => {
|
|
33
33
|
};
|
34
34
|
}
|
35
35
|
case SAVE_QUERY_TO_HISTORY: {
|
36
|
-
const queryText = action.data
|
37
|
-
|
38
|
-
const syntax = action.data.mode === QUERY_MODES.pg ? QUERY_SYNTAX.pg : undefined;
|
39
|
-
const newQueries = [...state.history.queries, { queryText, syntax }].slice(state.history.queries.length >= MAXIMUM_QUERIES_IN_HISTORY ? 1 : 0);
|
36
|
+
const queryText = action.data;
|
37
|
+
const newQueries = [...state.history.queries, { queryText }].slice(state.history.queries.length >= MAXIMUM_QUERIES_IN_HISTORY ? 1 : 0);
|
40
38
|
settingsManager.setUserSettingsValue(QUERIES_HISTORY_KEY, newQueries);
|
41
39
|
const currentIndex = newQueries.length - 1;
|
42
40
|
return {
|
@@ -93,15 +91,15 @@ const executeQuery = (state = initialState, action) => {
|
|
93
91
|
export const executeQueryApi = api.injectEndpoints({
|
94
92
|
endpoints: (build) => ({
|
95
93
|
executeQuery: build.mutation({
|
96
|
-
queryFn: async ({ query, database,
|
94
|
+
queryFn: async ({ query, database, querySettings = {}, schema = 'modern', enableTracingLevel, }) => {
|
97
95
|
let action = 'execute';
|
98
96
|
let syntax = QUERY_SYNTAX.yql;
|
99
|
-
if (
|
97
|
+
if (querySettings.queryMode === 'pg') {
|
100
98
|
action = 'execute-query';
|
101
99
|
syntax = QUERY_SYNTAX.pg;
|
102
100
|
}
|
103
|
-
else if (
|
104
|
-
action = `execute-${
|
101
|
+
else if (querySettings.queryMode) {
|
102
|
+
action = `execute-${querySettings.queryMode}`;
|
105
103
|
}
|
106
104
|
try {
|
107
105
|
const response = await window.api.sendQuery({
|
@@ -110,7 +108,14 @@ export const executeQueryApi = api.injectEndpoints({
|
|
110
108
|
database,
|
111
109
|
action,
|
112
110
|
syntax,
|
113
|
-
stats:
|
111
|
+
stats: querySettings.statisticsMode,
|
112
|
+
tracingLevel: querySettings.tracingLevel && enableTracingLevel
|
113
|
+
? TracingLevelNumber[querySettings.tracingLevel]
|
114
|
+
: undefined,
|
115
|
+
transaction_mode: querySettings.isolationLevel,
|
116
|
+
timeout: isNumeric(querySettings.timeout)
|
117
|
+
? Number(querySettings.timeout) * 1000
|
118
|
+
: undefined,
|
114
119
|
});
|
115
120
|
if (isQueryErrorResponse(response)) {
|
116
121
|
return { error: response };
|
@@ -126,10 +131,10 @@ export const executeQueryApi = api.injectEndpoints({
|
|
126
131
|
}),
|
127
132
|
overrideExisting: 'throw',
|
128
133
|
});
|
129
|
-
export const saveQueryToHistory = (queryText
|
134
|
+
export const saveQueryToHistory = (queryText) => {
|
130
135
|
return {
|
131
136
|
type: SAVE_QUERY_TO_HISTORY,
|
132
|
-
data:
|
137
|
+
data: queryText,
|
133
138
|
};
|
134
139
|
};
|
135
140
|
export const goToPreviousQuery = () => {
|
@@ -6,5 +6,5 @@ export declare const topQueriesApi: import("@reduxjs/toolkit/query").Api<import(
|
|
6
6
|
getTopQueries: import("@reduxjs/toolkit/query").QueryDefinition<{
|
7
7
|
database: string;
|
8
8
|
filters?: TopQueriesFilters;
|
9
|
-
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData", import("../../../types/store/query").IQueryResult | undefined, "api">;
|
10
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
9
|
+
}, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", import("../../../types/store/query").IQueryResult | undefined, "api">;
|
10
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import type {
|
1
|
+
import type { QueryRequestParams, QuerySettings } from '../../../types/store/query';
|
2
2
|
import type { PreparedExplainResponse } from './types';
|
3
3
|
interface ExplainQueryParams extends QueryRequestParams {
|
4
|
-
|
4
|
+
querySettings?: Partial<QuerySettings>;
|
5
|
+
enableTracingLevel?: boolean;
|
5
6
|
}
|
6
7
|
export declare const explainQueryApi: import("@reduxjs/toolkit/query").Api<import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, {
|
7
|
-
explainQuery: import("@reduxjs/toolkit/query").MutationDefinition<ExplainQueryParams, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData", PreparedExplainResponse, "api">;
|
8
|
-
}, "api", "All" | "PDiskData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
8
|
+
explainQuery: import("@reduxjs/toolkit/query").MutationDefinition<ExplainQueryParams, import("@reduxjs/toolkit/query").BaseQueryFn<void, typeof import("../api")._NEVER, unknown, {}>, "All" | "PDiskData" | "UserData", PreparedExplainResponse, "api">;
|
9
|
+
}, "api", "All" | "PDiskData" | "UserData", typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
|
9
10
|
export {};
|
@@ -1,18 +1,20 @@
|
|
1
|
+
import { TracingLevelNumber } from '../../../types/api/query';
|
1
2
|
import { QUERY_SYNTAX, isQueryErrorResponse } from '../../../utils/query';
|
3
|
+
import { isNumeric } from '../../../utils/utils';
|
2
4
|
import { api } from '../api';
|
3
5
|
import { prepareExplainResponse } from './utils';
|
4
6
|
export const explainQueryApi = api.injectEndpoints({
|
5
7
|
endpoints: (build) => ({
|
6
8
|
explainQuery: build.mutation({
|
7
|
-
queryFn: async ({ query, database,
|
9
|
+
queryFn: async ({ query, database, querySettings, enableTracingLevel }) => {
|
8
10
|
let action = 'explain';
|
9
11
|
let syntax = QUERY_SYNTAX.yql;
|
10
|
-
if (
|
12
|
+
if ((querySettings === null || querySettings === void 0 ? void 0 : querySettings.queryMode) === 'pg') {
|
11
13
|
action = 'explain-query';
|
12
14
|
syntax = QUERY_SYNTAX.pg;
|
13
15
|
}
|
14
|
-
else if (
|
15
|
-
action = `explain-${
|
16
|
+
else if (querySettings === null || querySettings === void 0 ? void 0 : querySettings.queryMode) {
|
17
|
+
action = `explain-${querySettings === null || querySettings === void 0 ? void 0 : querySettings.queryMode}`;
|
16
18
|
}
|
17
19
|
try {
|
18
20
|
const response = await window.api.sendQuery({
|
@@ -20,6 +22,14 @@ export const explainQueryApi = api.injectEndpoints({
|
|
20
22
|
database,
|
21
23
|
action,
|
22
24
|
syntax,
|
25
|
+
stats: querySettings === null || querySettings === void 0 ? void 0 : querySettings.statisticsMode,
|
26
|
+
tracingLevel: (querySettings === null || querySettings === void 0 ? void 0 : querySettings.tracingLevel) && enableTracingLevel
|
27
|
+
? TracingLevelNumber[querySettings === null || querySettings === void 0 ? void 0 : querySettings.tracingLevel]
|
28
|
+
: undefined,
|
29
|
+
transaction_mode: querySettings === null || querySettings === void 0 ? void 0 : querySettings.isolationLevel,
|
30
|
+
timeout: isNumeric(querySettings === null || querySettings === void 0 ? void 0 : querySettings.timeout)
|
31
|
+
? Number(querySettings === null || querySettings === void 0 ? void 0 : querySettings.timeout) * 1000
|
32
|
+
: undefined,
|
23
33
|
});
|
24
34
|
if (isQueryErrorResponse(response)) {
|
25
35
|
return { error: response };
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { ExplainPlanNodeData, GraphNode, Link } from '@gravity-ui/paranoid';
|
2
|
-
import type { PlanTable, QueryPlan, ScriptPlan } from '../../../types/api/query';
|
2
|
+
import type { PlanTable, QueryPlan, ScriptPlan, SimlifiedPlanOperatorOtherParams } from '../../../types/api/query';
|
3
3
|
export interface PreparedExplainResponse {
|
4
4
|
plan?: {
|
5
5
|
links?: Link[];
|
@@ -8,5 +8,17 @@ export interface PreparedExplainResponse {
|
|
8
8
|
version?: string;
|
9
9
|
pristine?: QueryPlan | ScriptPlan;
|
10
10
|
};
|
11
|
+
simplifiedPlan?: SimplifiedPlanItem[];
|
11
12
|
ast?: string;
|
12
13
|
}
|
14
|
+
export interface SimplifiedPlanItem {
|
15
|
+
parentId?: string;
|
16
|
+
name: string;
|
17
|
+
operationParams: SimlifiedPlanOperatorOtherParams;
|
18
|
+
aCpu?: number;
|
19
|
+
aRows?: number;
|
20
|
+
eCost?: string;
|
21
|
+
eRows?: string;
|
22
|
+
eSize?: string;
|
23
|
+
children?: SimplifiedPlanItem[];
|
24
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { preparePlan } from '../../../utils/prepareQueryExplain';
|
1
|
+
import { preparePlan, prepareSimplifiedPlan } from '../../../utils/prepareQueryExplain';
|
2
2
|
import { parseQueryAPIExplainResponse, parseQueryExplainPlan } from '../../../utils/query';
|
3
3
|
export const explainVersions = {
|
4
4
|
v2: '0.2',
|
@@ -9,7 +9,7 @@ export const prepareExplainResponse = (response) => {
|
|
9
9
|
if (!rawPlan) {
|
10
10
|
return { ast };
|
11
11
|
}
|
12
|
-
const { tables, meta, Plan } = parseQueryExplainPlan(rawPlan);
|
12
|
+
const { tables, meta, Plan, SimplifiedPlan } = parseQueryExplainPlan(rawPlan);
|
13
13
|
if (supportedExplainQueryVersions.indexOf(meta.version) === -1) {
|
14
14
|
// Do not prepare plan for not supported versions
|
15
15
|
return {
|
@@ -27,6 +27,10 @@ export const prepareExplainResponse = (response) => {
|
|
27
27
|
links = preparedPlan.links;
|
28
28
|
nodes = preparedPlan.nodes;
|
29
29
|
}
|
30
|
+
let preparedSimplifiedPlan;
|
31
|
+
if (SimplifiedPlan) {
|
32
|
+
preparedSimplifiedPlan = prepareSimplifiedPlan([SimplifiedPlan]);
|
33
|
+
}
|
30
34
|
return {
|
31
35
|
plan: {
|
32
36
|
links,
|
@@ -35,6 +39,7 @@ export const prepareExplainResponse = (response) => {
|
|
35
39
|
version: meta.version,
|
36
40
|
pristine: rawPlan,
|
37
41
|
},
|
42
|
+
simplifiedPlan: preparedSimplifiedPlan,
|
38
43
|
ast,
|
39
44
|
};
|
40
45
|
};
|