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.
Files changed (254) hide show
  1. package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
  2. package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.d.ts +3 -2
  3. package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.js +9 -5
  4. package/dist/components/CriticalActionDialog/CriticalActionDialog.d.ts +5 -3
  5. package/dist/components/CriticalActionDialog/CriticalActionDialog.js +8 -7
  6. package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +1 -1
  7. package/dist/components/CriticalActionDialog/i18n/en.json +1 -0
  8. package/dist/components/CriticalActionDialog/i18n/index.d.ts +1 -1
  9. package/dist/components/Errors/PageError/PageError.d.ts +11 -0
  10. package/dist/components/Errors/PageError/PageError.js +19 -0
  11. package/dist/components/Errors/i18n/en.json +2 -1
  12. package/dist/components/Errors/i18n/index.d.ts +1 -1
  13. package/dist/components/Errors/i18n/ru.json +2 -1
  14. package/dist/components/Fullscreen/Fullscreen.d.ts +1 -1
  15. package/dist/components/Fullscreen/Fullscreen.js +34 -27
  16. package/dist/components/Fullscreen/Fullscreen.scss +16 -8
  17. package/dist/components/Graph/Graph.d.ts +13 -0
  18. package/dist/components/Graph/Graph.js +41 -0
  19. package/dist/components/LabelWithPopover/LabelWithPopover.d.ts +4 -1
  20. package/dist/components/LabelWithPopover/LabelWithPopover.js +1 -1
  21. package/dist/components/Loader/Loader.d.ts +2 -1
  22. package/dist/components/Loader/Loader.js +6 -1
  23. package/dist/components/LoaderWrapper/LoaderWrapper.d.ts +10 -0
  24. package/dist/components/LoaderWrapper/LoaderWrapper.js +8 -0
  25. package/dist/components/MetricChart/reducer.d.ts +2 -2
  26. package/dist/components/PDiskInfo/PDiskInfo.d.ts +2 -2
  27. package/dist/components/PDiskInfo/PDiskInfo.js +9 -6
  28. package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
  29. package/dist/components/ProgressViewer/ProgressViewer.js +3 -0
  30. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.js +13 -3
  31. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +4 -0
  32. package/dist/components/QuerySettingsDescription/QuerySettingsDescription.d.ts +7 -0
  33. package/dist/components/QuerySettingsDescription/QuerySettingsDescription.js +8 -0
  34. package/dist/components/QuerySettingsDescription/QuerySettingsDescription.scss +8 -0
  35. package/dist/components/QuerySettingsDescription/index.d.ts +1 -0
  36. package/dist/components/QuerySettingsDescription/index.js +1 -0
  37. package/dist/components/VDisk/VDisk.js +3 -4
  38. package/dist/components/VDiskInfo/VDiskInfo.d.ts +2 -2
  39. package/dist/components/VDiskInfo/VDiskInfo.js +4 -2
  40. package/dist/containers/App/Content.js +15 -19
  41. package/dist/containers/AsideNavigation/AsideNavigation.js +2 -1
  42. package/dist/containers/AsideNavigation/YdbInternalUser/YdbInternalUser.js +4 -4
  43. package/dist/containers/Authentication/Authentication.js +8 -10
  44. package/dist/containers/Authentication/utils.d.ts +8 -0
  45. package/dist/containers/Authentication/utils.js +15 -0
  46. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +6 -6
  47. package/dist/containers/Clusters/constants.d.ts +1 -1
  48. package/dist/containers/Heatmap/Heatmap.js +5 -4
  49. package/dist/containers/Node/Node.js +5 -7
  50. package/dist/containers/Node/Node.scss +4 -0
  51. package/dist/containers/Node/NodeStructure/NodeStructure.js +4 -4
  52. package/dist/containers/Node/NodeStructure/NodeStructure.scss +4 -0
  53. package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
  54. package/dist/containers/Nodes/Nodes.js +6 -8
  55. package/dist/containers/Nodes/getNodesColumns.js +6 -21
  56. package/dist/containers/PDiskPage/PDiskPage.js +19 -8
  57. package/dist/containers/PDiskPage/i18n/en.json +1 -0
  58. package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
  59. package/dist/containers/Storage/PDisk/PDisk.js +3 -4
  60. package/dist/containers/Storage/Storage.js +4 -6
  61. package/dist/containers/Tablet/Tablet.js +2 -2
  62. package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
  63. package/dist/containers/Tablets/Tablets.js +3 -5
  64. package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +2 -5
  65. package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +10 -13
  66. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -0
  67. package/dist/containers/Tenant/Diagnostics/Network/Network.js +8 -11
  68. package/dist/containers/Tenant/Diagnostics/Network/Network.scss +1 -0
  69. package/dist/containers/Tenant/Diagnostics/Overview/Overview.d.ts +1 -2
  70. package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +3 -5
  71. package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.js +3 -4
  72. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -4
  73. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.js +3 -3
  74. package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
  75. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +4 -3
  76. package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +4 -3
  77. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.d.ts +2 -2
  78. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.js +56 -20
  79. package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +10 -6
  80. package/dist/containers/Tenant/Query/ExecuteResult/i18n/en.json +7 -0
  81. package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.d.ts +2 -0
  82. package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.js +4 -0
  83. package/dist/containers/Tenant/Query/ExecuteResult/utils.d.ts +18 -0
  84. package/dist/containers/Tenant/Query/ExecuteResult/utils.js +36 -0
  85. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.d.ts +23 -1
  86. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +56 -111
  87. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +1 -30
  88. package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.d.ts +7 -0
  89. package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.js +18 -0
  90. package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.scss +8 -0
  91. package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.d.ts +8 -0
  92. package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.js +14 -0
  93. package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.scss +14 -0
  94. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.d.ts +6 -0
  95. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.js +11 -0
  96. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.d.ts +13 -0
  97. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.js +48 -0
  98. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.d.ts +6 -0
  99. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.js +66 -0
  100. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.d.ts +7 -0
  101. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.js +100 -0
  102. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.scss +128 -0
  103. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.d.ts +5 -0
  104. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.d.ts +5 -0
  105. package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.js +59 -0
  106. package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.d.ts +8 -0
  107. package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.js +11 -0
  108. package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.scss +14 -0
  109. package/dist/containers/Tenant/Query/ExplainResult/i18n/en.json +8 -0
  110. package/dist/containers/Tenant/Query/ExplainResult/i18n/index.d.ts +2 -0
  111. package/dist/containers/Tenant/Query/ExplainResult/i18n/index.js +4 -0
  112. package/dist/containers/Tenant/Query/Preview/Preview.js +2 -3
  113. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.js +1 -19
  114. package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.js +1 -1
  115. package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.scss +11 -0
  116. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +1 -1
  117. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +91 -95
  118. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +4 -6
  119. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +18 -49
  120. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.d.ts +2 -0
  121. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.js +5 -0
  122. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.d.ts +1 -0
  123. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.js +42 -0
  124. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.d.ts +5 -0
  125. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.js +19 -0
  126. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.d.ts +1 -0
  127. package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.js +56 -0
  128. package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.d.ts +2 -0
  129. package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.js +12 -0
  130. package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.scss +3 -0
  131. package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.js +20 -23
  132. package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.d.ts +123 -7
  133. package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.js +32 -10
  134. package/dist/containers/Tenant/Query/i18n/en.json +3 -1
  135. package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
  136. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -6
  137. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +5 -2
  138. package/dist/containers/Tenant/Schema/SchemaViewer/columns.d.ts +2 -1
  139. package/dist/containers/Tenant/Schema/SchemaViewer/columns.js +13 -1
  140. package/dist/containers/Tenant/Schema/SchemaViewer/i18n/en.json +1 -0
  141. package/dist/containers/Tenant/Schema/SchemaViewer/i18n/index.d.ts +1 -1
  142. package/dist/containers/Tenant/Schema/SchemaViewer/prepareData.js +3 -2
  143. package/dist/containers/Tenant/Schema/SchemaViewer/types.d.ts +1 -0
  144. package/dist/containers/Tenant/Tenant.js +4 -8
  145. package/dist/containers/Tenant/utils/schemaActions.d.ts +2 -2
  146. package/dist/containers/Tenant/utils/schemaActions.js +2 -2
  147. package/dist/containers/Tenants/Tenants.js +4 -7
  148. package/dist/containers/UserSettings/i18n/en.json +3 -5
  149. package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
  150. package/dist/containers/UserSettings/settings.d.ts +2 -3
  151. package/dist/containers/UserSettings/settings.js +17 -23
  152. package/dist/containers/VDiskPage/VDiskPage.js +27 -13
  153. package/dist/containers/VDiskPage/i18n/en.json +1 -0
  154. package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
  155. package/dist/services/api.d.ts +21 -8
  156. package/dist/services/api.js +29 -42
  157. package/dist/services/settings.d.ts +11 -4
  158. package/dist/services/settings.js +7 -6
  159. package/dist/store/configureStore.d.ts +7 -7
  160. package/dist/store/defaultStore.d.ts +3 -3
  161. package/dist/store/reducers/api.d.ts +1 -1
  162. package/dist/store/reducers/api.js +1 -1
  163. package/dist/store/reducers/authentication/authentication.d.ts +37 -24
  164. package/dist/store/reducers/authentication/authentication.js +77 -57
  165. package/dist/store/reducers/authentication/types.d.ts +0 -8
  166. package/dist/store/reducers/capabilities/capabilities.d.ts +106 -0
  167. package/dist/store/reducers/capabilities/capabilities.js +22 -0
  168. package/dist/store/reducers/capabilities/hooks.d.ts +2 -0
  169. package/dist/store/reducers/capabilities/hooks.js +13 -0
  170. package/dist/store/reducers/cluster/cluster.d.ts +2 -2
  171. package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +2 -2
  172. package/dist/store/reducers/clusters/clusters.d.ts +2 -2
  173. package/dist/store/reducers/describe.d.ts +2 -2
  174. package/dist/store/reducers/executeQuery.d.ts +7 -14
  175. package/dist/store/reducers/executeQuery.js +19 -14
  176. package/dist/store/reducers/executeTopQueries/executeTopQueries.d.ts +2 -2
  177. package/dist/store/reducers/explainQuery/explainQuery.d.ts +5 -4
  178. package/dist/store/reducers/explainQuery/explainQuery.js +14 -4
  179. package/dist/store/reducers/explainQuery/types.d.ts +13 -1
  180. package/dist/store/reducers/explainQuery/utils.js +7 -2
  181. package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +58 -58
  182. package/dist/store/reducers/heatmap.d.ts +2 -2
  183. package/dist/store/reducers/hotKeys/hotKeys.d.ts +2 -2
  184. package/dist/store/reducers/index.d.ts +6 -6
  185. package/dist/store/reducers/network/network.d.ts +2 -2
  186. package/dist/store/reducers/node/node.d.ts +3 -3
  187. package/dist/store/reducers/node/selectors.d.ts +1 -1
  188. package/dist/store/reducers/nodes/nodes.d.ts +3 -3
  189. package/dist/store/reducers/nodesList.d.ts +3 -3
  190. package/dist/store/reducers/overview/overview.d.ts +2 -2
  191. package/dist/store/reducers/partitions/partitions.d.ts +2 -2
  192. package/dist/store/reducers/pdisk/pdisk.d.ts +3 -3
  193. package/dist/store/reducers/preview.d.ts +2 -2
  194. package/dist/store/reducers/schema/schema.d.ts +3 -3
  195. package/dist/store/reducers/schema/schema.js +10 -3
  196. package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +2 -2
  197. package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +2 -2
  198. package/dist/store/reducers/storage/storage.d.ts +3 -3
  199. package/dist/store/reducers/tablet.d.ts +3 -3
  200. package/dist/store/reducers/tablets.d.ts +13 -13
  201. package/dist/store/reducers/tabletsFilters.d.ts +1 -1
  202. package/dist/store/reducers/tenant/tenant.d.ts +2 -2
  203. package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +2 -2
  204. package/dist/store/reducers/tenantOverview/topNodes/topNodes.d.ts +2 -2
  205. package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +2 -2
  206. package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +2 -2
  207. package/dist/store/reducers/tenants/selectors.d.ts +31 -30
  208. package/dist/store/reducers/tenants/selectors.js +8 -2
  209. package/dist/store/reducers/tenants/tenants.d.ts +2 -2
  210. package/dist/store/reducers/topic.d.ts +44 -44
  211. package/dist/store/reducers/vdisk/vdisk.d.ts +2 -2
  212. package/dist/store/reducers/viewSchema/viewSchema.d.ts +2 -2
  213. package/dist/styles/mixins.scss +2 -0
  214. package/dist/types/api/capabilities.d.ts +7 -0
  215. package/dist/types/api/capabilities.js +1 -0
  216. package/dist/types/api/modifyDisk.d.ts +8 -0
  217. package/dist/types/api/modifyDisk.js +1 -0
  218. package/dist/types/api/query.d.ts +39 -3
  219. package/dist/types/api/query.js +9 -1
  220. package/dist/types/api/schema/shared.d.ts +8 -0
  221. package/dist/types/store/query.d.ts +7 -0
  222. package/dist/utils/__test__/prepareQueryExplain.test.d.ts +1 -0
  223. package/dist/utils/__test__/prepareQueryExplain.test.js +115 -0
  224. package/dist/utils/constants.d.ts +13 -4
  225. package/dist/utils/constants.js +15 -4
  226. package/dist/utils/dataFormatters/dataFormatters.d.ts +0 -1
  227. package/dist/utils/dataFormatters/dataFormatters.js +1 -4
  228. package/dist/utils/hooks/index.d.ts +2 -1
  229. package/dist/utils/hooks/index.js +2 -1
  230. package/dist/utils/hooks/useChangedQuerySettings.d.ts +10 -0
  231. package/dist/utils/hooks/useChangedQuerySettings.js +46 -0
  232. package/dist/utils/hooks/useDelayed.d.ts +1 -0
  233. package/dist/utils/hooks/useDelayed.js +13 -0
  234. package/dist/utils/hooks/useEventHandler.d.ts +6 -0
  235. package/dist/utils/hooks/useEventHandler.js +17 -0
  236. package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -0
  237. package/dist/utils/hooks/useLastQueryExecutionSettings.js +5 -0
  238. package/dist/utils/hooks/useQueryExecutionSettings.d.ts +8 -0
  239. package/dist/utils/hooks/useQueryExecutionSettings.js +15 -0
  240. package/dist/utils/prepareQueryExplain.d.ts +3 -1
  241. package/dist/utils/prepareQueryExplain.js +54 -2
  242. package/dist/utils/query.js +1 -0
  243. package/dist/utils/query.test.js +3 -0
  244. package/dist/utils/utils.d.ts +8 -7
  245. package/dist/utils/utils.js +23 -11
  246. package/package.json +4 -2
  247. package/dist/containers/Tenant/Query/ExplainResult/utils.d.ts +0 -2
  248. package/dist/containers/Tenant/Query/ExplainResult/utils.js +0 -4
  249. package/dist/store/utils.d.ts +0 -23
  250. package/dist/store/utils.js +0 -49
  251. package/dist/types/api/restartPDisk.d.ts +0 -4
  252. package/dist/utils/hooks/useQueryModes.d.ts +0 -2
  253. package/dist/utils/hooks/useQueryModes.js +0 -5
  254. /package/dist/{types/api/restartPDisk.js → containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.js} +0 -0
@@ -1,62 +1,82 @@
1
- import { createApiRequest, createRequestActionTypes } from '../../utils';
2
- export const SET_UNAUTHENTICATED = createRequestActionTypes('authentication', 'SET_UNAUTHENTICATED');
3
- export const SET_AUTHENTICATED = createRequestActionTypes('authentication', 'SET_AUTHENTICATED');
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 authentication = (state = initialState, action) => {
11
- switch (action.type) {
12
- case SET_UNAUTHENTICATED.SUCCESS: {
13
- return { ...state, isAuthenticated: false, user: '', error: undefined };
14
- }
15
- case SET_AUTHENTICATED.SUCCESS: {
16
- return { ...state, isAuthenticated: true, error: undefined };
17
- }
18
- case SET_AUTHENTICATED.FAILURE: {
19
- return { ...state, error: action.error };
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
- export default authentication;
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,2 @@
1
+ export declare const useCreateDirectoryFeatureAvailable: () => boolean;
2
+ export declare const useDiskPagesAvailable: () => boolean;
@@ -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, QueryMode, QueryRequestParams } from '../../types/store/query';
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
- mode?: QueryMode;
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, mode: QueryMode) => {
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 { QUERY_MODES, QUERY_SYNTAX, isQueryErrorResponse, parseQueryAPIExecuteResponse, } from '../../utils/query';
4
- import { createRequestActionTypes } from '../utils';
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.queryText;
37
- // Do not save explicit yql syntax value for easier further support (use yql by default)
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, mode, schema = 'modern' }) => {
94
+ queryFn: async ({ query, database, querySettings = {}, schema = 'modern', enableTracingLevel, }) => {
97
95
  let action = 'execute';
98
96
  let syntax = QUERY_SYNTAX.yql;
99
- if (mode === 'pg') {
97
+ if (querySettings.queryMode === 'pg') {
100
98
  action = 'execute-query';
101
99
  syntax = QUERY_SYNTAX.pg;
102
100
  }
103
- else if (mode) {
104
- action = `execute-${mode}`;
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: 'full',
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, mode) => {
134
+ export const saveQueryToHistory = (queryText) => {
130
135
  return {
131
136
  type: SAVE_QUERY_TO_HISTORY,
132
- data: { queryText, mode },
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 { QueryMode, QueryRequestParams } from '../../../types/store/query';
1
+ import type { QueryRequestParams, QuerySettings } from '../../../types/store/query';
2
2
  import type { PreparedExplainResponse } from './types';
3
3
  interface ExplainQueryParams extends QueryRequestParams {
4
- mode?: QueryMode;
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, mode }) => {
9
+ queryFn: async ({ query, database, querySettings, enableTracingLevel }) => {
8
10
  let action = 'explain';
9
11
  let syntax = QUERY_SYNTAX.yql;
10
- if (mode === 'pg') {
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 (mode) {
15
- action = `explain-${mode}`;
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
  };