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,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
+ import { isEqual } from 'lodash';
3
4
  import throttle from 'lodash/throttle';
4
5
  import { connect } from 'react-redux';
5
6
  import { MonacoEditor } from '../../../../components/MonacoEditor/MonacoEditor';
@@ -9,8 +10,10 @@ import { explainQueryApi } from '../../../../store/reducers/explainQuery/explain
9
10
  import { setQueryAction } from '../../../../store/reducers/queryActions/queryActions';
10
11
  import { setShowPreview } from '../../../../store/reducers/schema/schema';
11
12
  import { cn } from '../../../../utils/cn';
12
- import { DEFAULT_IS_QUERY_RESULT_COLLAPSED, DEFAULT_SIZE_RESULT_PANE_KEY, LAST_USED_QUERY_ACTION_KEY, QUERY_USE_MULTI_SCHEMA_KEY, } from '../../../../utils/constants';
13
- import { useQueryModes, useSetting } from '../../../../utils/hooks';
13
+ import { DEFAULT_IS_QUERY_RESULT_COLLAPSED, DEFAULT_SIZE_RESULT_PANE_KEY, ENABLE_TRACING_LEVEL_KEY, LAST_USED_QUERY_ACTION_KEY, QUERY_USE_MULTI_SCHEMA_KEY, } from '../../../../utils/constants';
14
+ import { useEventHandler, useQueryExecutionSettings, useSetting } from '../../../../utils/hooks';
15
+ import { useChangedQuerySettings } from '../../../../utils/hooks/useChangedQuerySettings';
16
+ import { useLastQueryExecutionSettings } from '../../../../utils/hooks/useLastQueryExecutionSettings';
14
17
  import { YQL_LANGUAGE_ID } from '../../../../utils/monaco/constats';
15
18
  import { QUERY_ACTIONS } from '../../../../utils/query';
16
19
  import { PaneVisibilityActionTypes, paneVisibilityToggleReducerCreator, } from '../../utils/paneVisibilityToggleHelpers';
@@ -29,10 +32,6 @@ const RESULT_TYPES = {
29
32
  EXECUTE: 'execute',
30
33
  EXPLAIN: 'explain',
31
34
  };
32
- const MONACO_HOT_KEY_ACTIONS = {
33
- sendQuery: 'sendQuery',
34
- sendSelectedQuery: 'sendSelectedQuery',
35
- };
36
35
  const b = cn('query-editor');
37
36
  const initialTenantCommonInfoState = {
38
37
  triggerExpand: false,
@@ -41,14 +40,16 @@ const initialTenantCommonInfoState = {
41
40
  };
42
41
  function QueryEditor(props) {
43
42
  const editorOptions = useEditorOptions();
44
- const { tenantName, path, setTenantPath: setPath, setQueryAction, executeQuery, type, theme, changeUserInput, showPreview, } = props;
43
+ const { tenantName, path, setTenantPath: setPath, executeQuery, type, theme, changeUserInput, showPreview, } = props;
45
44
  const { tenantPath: savedPath } = executeQuery;
46
45
  const [resultType, setResultType] = React.useState(RESULT_TYPES.EXECUTE);
47
46
  const [isResultLoaded, setIsResultLoaded] = React.useState(false);
48
- const [queryMode, setQueryMode] = useQueryModes();
47
+ const [querySettings] = useQueryExecutionSettings();
48
+ const [enableTracingLevel] = useSetting(ENABLE_TRACING_LEVEL_KEY);
49
+ const [lastQueryExecutionSettings, setLastQueryExecutionSettings] = useLastQueryExecutionSettings();
50
+ const { resetBanner } = useChangedQuerySettings();
49
51
  const [useMultiSchema] = useSetting(QUERY_USE_MULTI_SCHEMA_KEY);
50
52
  const [lastUsedQueryAction, setLastUsedQueryAction] = useSetting(LAST_USED_QUERY_ACTION_KEY);
51
- const [monacoHotKey, setMonacoHotKey] = React.useState(null);
52
53
  const [sendExecuteQuery, executeQueryResult] = executeQueryApi.useExecuteQueryMutation();
53
54
  const [sendExplainQuery, explainQueryResult] = explainQueryApi.useExplainQueryMutation();
54
55
  React.useEffect(() => {
@@ -60,22 +61,6 @@ function QueryEditor(props) {
60
61
  }
61
62
  }, [changeUserInput, setPath, tenantName, savedPath]);
62
63
  const [resultVisibilityState, dispatchResultVisibilityState] = React.useReducer(paneVisibilityToggleReducerCreator(DEFAULT_IS_QUERY_RESULT_COLLAPSED), initialTenantCommonInfoState);
63
- const editorRef = React.useRef();
64
- React.useEffect(() => {
65
- const updateEditor = () => {
66
- if (editorRef.current) {
67
- editorRef.current.layout();
68
- }
69
- };
70
- const onChangeWindow = throttle(() => {
71
- updateEditor();
72
- }, 100);
73
- updateEditor();
74
- window.addEventListener('resize', onChangeWindow);
75
- return () => {
76
- window.removeEventListener('resize', onChangeWindow);
77
- };
78
- }, []);
79
64
  React.useEffect(() => {
80
65
  dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerCollapse);
81
66
  }, []);
@@ -87,41 +72,28 @@ function QueryEditor(props) {
87
72
  dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerCollapse);
88
73
  }
89
74
  }, [props.showPreview, isResultLoaded]);
90
- React.useEffect(() => {
75
+ const getLastQueryText = useEventHandler(() => {
91
76
  var _a;
92
- const { input, history } = executeQuery;
93
- const hasUnsavedInput = input
94
- ? input !== ((_a = history.queries[history.queries.length - 1]) === null || _a === void 0 ? void 0 : _a.queryText)
95
- : false;
96
- if (hasUnsavedInput) {
97
- window.onbeforeunload = (e) => {
98
- e.preventDefault();
99
- // Chrome requires returnValue to be set
100
- e.returnValue = '';
101
- };
102
- }
103
- else {
104
- window.onbeforeunload = null;
105
- }
106
- return () => {
107
- window.onbeforeunload = null;
108
- };
109
- }, [executeQuery]);
110
- const handleSendExecuteClick = (mode, text) => {
77
+ const { history } = executeQuery;
78
+ return ((_a = history.queries[history.queries.length - 1]) === null || _a === void 0 ? void 0 : _a.queryText) || '';
79
+ });
80
+ const handleSendExecuteClick = useEventHandler((text) => {
111
81
  var _a;
112
- if (!mode) {
113
- return;
114
- }
115
82
  const { input, history } = executeQuery;
116
83
  const schema = useMultiSchema ? 'multi' : 'modern';
117
84
  const query = text !== null && text !== void 0 ? text : input;
118
85
  setLastUsedQueryAction(QUERY_ACTIONS.execute);
86
+ if (!isEqual(lastQueryExecutionSettings, querySettings)) {
87
+ resetBanner();
88
+ setLastQueryExecutionSettings(querySettings);
89
+ }
119
90
  setResultType(RESULT_TYPES.EXECUTE);
120
91
  sendExecuteQuery({
121
92
  query,
122
93
  database: tenantName,
123
- mode,
94
+ querySettings,
124
95
  schema,
96
+ enableTracingLevel,
125
97
  });
126
98
  setIsResultLoaded(true);
127
99
  props.setShowPreview(false);
@@ -129,64 +101,45 @@ function QueryEditor(props) {
129
101
  if (!text) {
130
102
  const { queries, currentIndex } = history;
131
103
  if (query !== ((_a = queries[currentIndex]) === null || _a === void 0 ? void 0 : _a.queryText)) {
132
- props.saveQueryToHistory(input, mode);
104
+ props.saveQueryToHistory(input);
133
105
  }
134
106
  }
135
107
  dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerExpand);
136
- };
108
+ });
137
109
  const handleSettingsClick = () => {
138
- setQueryAction('settings');
110
+ props.setQueryAction('settings');
139
111
  props.setShowPreview(false);
140
112
  };
141
- const handleGetExplainQueryClick = (mode) => {
113
+ const handleGetExplainQueryClick = useEventHandler(() => {
142
114
  const { input } = executeQuery;
143
115
  setLastUsedQueryAction(QUERY_ACTIONS.explain);
116
+ if (!isEqual(lastQueryExecutionSettings, querySettings)) {
117
+ resetBanner();
118
+ setLastQueryExecutionSettings(querySettings);
119
+ }
144
120
  setResultType(RESULT_TYPES.EXPLAIN);
145
121
  sendExplainQuery({
146
122
  query: input,
147
123
  database: tenantName,
148
- mode: mode,
124
+ querySettings,
125
+ enableTracingLevel,
149
126
  });
150
127
  setIsResultLoaded(true);
151
128
  props.setShowPreview(false);
152
129
  dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerExpand);
153
- };
154
- React.useEffect(() => {
155
- var _a, _b;
156
- if (monacoHotKey === null) {
157
- return;
130
+ });
131
+ const handleSendQuery = useEventHandler(() => {
132
+ if (lastUsedQueryAction === QUERY_ACTIONS.explain) {
133
+ handleGetExplainQueryClick();
158
134
  }
159
- setMonacoHotKey(null);
160
- switch (monacoHotKey) {
161
- case MONACO_HOT_KEY_ACTIONS.sendQuery: {
162
- if (lastUsedQueryAction === QUERY_ACTIONS.explain) {
163
- handleGetExplainQueryClick(queryMode);
164
- }
165
- else {
166
- handleSendExecuteClick(queryMode);
167
- }
168
- break;
169
- }
170
- case MONACO_HOT_KEY_ACTIONS.sendSelectedQuery: {
171
- const selection = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.getSelection();
172
- const model = (_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.getModel();
173
- if (selection && model) {
174
- const text = model.getValueInRange({
175
- startLineNumber: selection.getSelectionStart().lineNumber,
176
- startColumn: selection.getSelectionStart().column,
177
- endLineNumber: selection.getPosition().lineNumber,
178
- endColumn: selection.getPosition().column,
179
- });
180
- handleSendExecuteClick(queryMode, text);
181
- }
182
- break;
183
- }
135
+ else {
136
+ handleSendExecuteClick();
184
137
  }
185
- // eslint-disable-next-line react-hooks/exhaustive-deps
186
- }, [monacoHotKey]);
138
+ });
187
139
  const editorDidMount = (editor, monaco) => {
188
140
  const keybindings = getKeyBindings(monaco);
189
- editorRef.current = editor;
141
+ initResizeHandler(editor);
142
+ initUserPrompt(editor, getLastQueryText);
190
143
  editor.focus();
191
144
  editor.addAction({
192
145
  id: 'sendQuery',
@@ -200,7 +153,7 @@ function QueryEditor(props) {
200
153
  contextMenuOrder: 1,
201
154
  // Method that will be executed when the action is triggered.
202
155
  // @param editor The editor instance is passed in as a convenience
203
- run: () => setMonacoHotKey(MONACO_HOT_KEY_ACTIONS.sendQuery),
156
+ run: () => handleSendQuery(),
204
157
  });
205
158
  const canSendSelectedText = editor.createContextKey('canSendSelectedText', false);
206
159
  editor.onDidChangeCursorSelection(({ selection, secondarySelections }) => {
@@ -216,7 +169,19 @@ function QueryEditor(props) {
216
169
  precondition: 'canSendSelectedText',
217
170
  contextMenuGroupId: CONTEXT_MENU_GROUP_ID,
218
171
  contextMenuOrder: 1,
219
- run: () => setMonacoHotKey(MONACO_HOT_KEY_ACTIONS.sendSelectedQuery),
172
+ run: (e) => {
173
+ const selection = e.getSelection();
174
+ const model = e.getModel();
175
+ if (selection && model) {
176
+ const text = model.getValueInRange({
177
+ startLineNumber: selection.getSelectionStart().lineNumber,
178
+ startColumn: selection.getSelectionStart().column,
179
+ endLineNumber: selection.getPosition().lineNumber,
180
+ endColumn: selection.getPosition().column,
181
+ });
182
+ handleSendExecuteClick(text);
183
+ }
184
+ },
220
185
  });
221
186
  editor.addAction({
222
187
  id: 'previous-query',
@@ -243,7 +208,7 @@ function QueryEditor(props) {
243
208
  label: i18n('action.save-query'),
244
209
  keybindings: [keybindings.saveQuery],
245
210
  run: () => {
246
- setQueryAction('save');
211
+ props.setQueryAction('save');
247
212
  },
248
213
  });
249
214
  };
@@ -260,7 +225,7 @@ function QueryEditor(props) {
260
225
  dispatchResultVisibilityState(PaneVisibilityActionTypes.clear);
261
226
  };
262
227
  const renderControls = () => {
263
- return (_jsx(QueryEditorControls, { onRunButtonClick: handleSendExecuteClick, onSettingsButtonClick: handleSettingsClick, runIsLoading: executeQueryResult.isLoading, onExplainButtonClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading, disabled: !executeQuery.input, onUpdateQueryMode: setQueryMode, queryMode: queryMode, highlightedAction: lastUsedQueryAction }));
228
+ return (_jsx(QueryEditorControls, { handleSendExecuteClick: handleSendExecuteClick, onSettingsButtonClick: handleSettingsClick, runIsLoading: executeQueryResult.isLoading, handleGetExplainQueryClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading, disabled: !executeQuery.input, highlightedAction: lastUsedQueryAction }));
264
229
  };
265
230
  return (_jsxs("div", { className: b(), children: [_jsxs(SplitPane, { direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_RESULT_PANE_KEY, triggerCollapse: resultVisibilityState.triggerCollapse, triggerExpand: resultVisibilityState.triggerExpand, minSize: [0, 52], collapsedSizes: [100, 0], onSplitStartDragAdditional: onSplitStartDragAdditional, children: [_jsxs("div", { className: b('pane-wrapper', {
266
231
  top: true,
@@ -287,14 +252,45 @@ function Result({ executeQueryData, executeQueryError, explainQueryData, explain
287
252
  }
288
253
  if (resultType === RESULT_TYPES.EXECUTE) {
289
254
  if (executeQueryData || executeQueryError) {
290
- const { stats, ...data } = executeQueryData || {};
291
- return (_jsx(ExecuteResult, { data: data, stats: stats, error: executeQueryError, isResultsCollapsed: resultVisibilityState.collapsed, onExpandResults: onExpandResultHandler, onCollapseResults: onCollapseResultHandler }));
255
+ return (_jsx(ExecuteResult, { data: executeQueryData, error: executeQueryError, isResultsCollapsed: resultVisibilityState.collapsed, onExpandResults: onExpandResultHandler, onCollapseResults: onCollapseResultHandler, theme: theme }));
292
256
  }
293
257
  return null;
294
258
  }
295
259
  if (resultType === RESULT_TYPES.EXPLAIN) {
296
- const { plan, ast } = explainQueryData || {};
297
- return (_jsx(ExplainResult, { error: explainQueryError, explain: plan, ast: ast, loading: explainQueryLoading, theme: theme, isResultsCollapsed: resultVisibilityState.collapsed, onExpandResults: onExpandResultHandler, onCollapseResults: onCollapseResultHandler }));
260
+ const { plan, ast, simplifiedPlan } = explainQueryData || {};
261
+ return (_jsx(ExplainResult, { error: explainQueryError, explain: plan, simplifiedPlan: simplifiedPlan, ast: ast, loading: explainQueryLoading, theme: theme, isResultsCollapsed: resultVisibilityState.collapsed, onExpandResults: onExpandResultHandler, onCollapseResults: onCollapseResultHandler }));
298
262
  }
299
263
  return null;
300
264
  }
265
+ function initResizeHandler(editor) {
266
+ const layoutEditor = throttle(() => {
267
+ editor.layout();
268
+ }, 100);
269
+ editor.layout();
270
+ window.addEventListener('resize', layoutEditor);
271
+ editor.onDidDispose(() => {
272
+ window.removeEventListener('resize', layoutEditor);
273
+ });
274
+ }
275
+ function initUserPrompt(editor, getInitialText) {
276
+ setUserPrompt(editor.getValue(), getInitialText());
277
+ editor.onDidChangeModelContent(() => {
278
+ setUserPrompt(editor.getValue(), getInitialText());
279
+ });
280
+ editor.onDidDispose(() => {
281
+ window.onbeforeunload = null;
282
+ });
283
+ }
284
+ function setUserPrompt(text, initialText) {
285
+ const hasUnsavedInput = text ? text !== initialText : false;
286
+ if (hasUnsavedInput) {
287
+ window.onbeforeunload = (e) => {
288
+ e.preventDefault();
289
+ // Chrome requires returnValue to be set
290
+ e.returnValue = '';
291
+ };
292
+ }
293
+ else {
294
+ window.onbeforeunload = null;
295
+ }
296
+ }
@@ -1,15 +1,13 @@
1
- import type { QueryAction, QueryMode } from '../../../../types/store/query';
1
+ import type { QueryAction } from '../../../../types/store/query';
2
2
  import './QueryEditorControls.scss';
3
3
  interface QueryEditorControlsProps {
4
- onRunButtonClick: (mode?: QueryMode) => void;
4
+ handleSendExecuteClick: () => void;
5
5
  onSettingsButtonClick: () => void;
6
6
  runIsLoading: boolean;
7
- onExplainButtonClick: (mode?: QueryMode) => void;
7
+ handleGetExplainQueryClick: () => void;
8
8
  explainIsLoading: boolean;
9
9
  disabled: boolean;
10
- onUpdateQueryMode: (mode: QueryMode) => void;
11
- queryMode: QueryMode;
12
10
  highlightedAction: QueryAction;
13
11
  }
14
- export declare const QueryEditorControls: ({ onRunButtonClick, onSettingsButtonClick, onUpdateQueryMode, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, queryMode, highlightedAction, }: QueryEditorControlsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const QueryEditorControls: ({ handleSendExecuteClick, onSettingsButtonClick, runIsLoading, handleGetExplainQueryClick, explainIsLoading, disabled, highlightedAction, }: QueryEditorControlsProps) => import("react/jsx-runtime").JSX.Element;
15
13
  export {};
@@ -1,59 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { ChevronDown, Gear, PlayFill } from '@gravity-ui/icons';
4
- import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
5
- import { LabelWithPopover } from '../../../../components/LabelWithPopover';
6
- import { QUERY_SETTINGS, useSetting } from '../../../../lib';
2
+ import { Gear, PlayFill } from '@gravity-ui/icons';
3
+ import { Button, Icon, Tooltip } from '@gravity-ui/uikit';
4
+ import QuerySettingsDescription from '../../../../components/QuerySettingsDescription/QuerySettingsDescription';
7
5
  import { cn } from '../../../../utils/cn';
8
- import { QUERY_MODES, QUERY_MODES_TITLES } from '../../../../utils/query';
6
+ import { useChangedQuerySettings } from '../../../../utils/hooks/useChangedQuerySettings';
9
7
  import { SaveQuery } from '../SaveQuery/SaveQuery';
10
8
  import i18n from '../i18n';
11
9
  import './QueryEditorControls.scss';
12
- const queryModeSelectorQa = 'query-mode-selector';
13
- const queryModeSelectorPopupQa = 'query-mode-selector-popup';
14
10
  const b = cn('ydb-query-editor-controls');
15
- const QueryModeSelectorOptions = {
16
- [QUERY_MODES.script]: {
17
- title: QUERY_MODES_TITLES[QUERY_MODES.script],
18
- description: i18n('method-description.script'),
19
- },
20
- [QUERY_MODES.scan]: {
21
- title: QUERY_MODES_TITLES[QUERY_MODES.scan],
22
- description: i18n('method-description.scan'),
23
- },
24
- [QUERY_MODES.data]: {
25
- title: QUERY_MODES_TITLES[QUERY_MODES.data],
26
- description: i18n('method-description.data'),
27
- },
28
- [QUERY_MODES.query]: {
29
- title: QUERY_MODES_TITLES[QUERY_MODES.query],
30
- description: i18n('method-description.query'),
31
- },
32
- [QUERY_MODES.pg]: {
33
- title: QUERY_MODES_TITLES[QUERY_MODES.pg],
34
- description: i18n('method-description.pg'),
35
- },
11
+ const SettingsButton = ({ onClick, runIsLoading }) => {
12
+ const { changedCurrentSettings, changedCurrentSettingsDescriptions } = useChangedQuerySettings();
13
+ const extraGearProps = changedCurrentSettings.length > 0
14
+ ? { view: 'outlined-info', selected: true }
15
+ : null;
16
+ return (_jsx(Tooltip, { disabled: changedCurrentSettings.length === 0, content: _jsx(QuerySettingsDescription, { prefix: i18n('gear.tooltip'), querySettings: changedCurrentSettingsDescriptions }), openDelay: 0, placement: ['top-start'], children: _jsxs(Button, { onClick: onClick, loading: runIsLoading, className: b('gear-button'), ...extraGearProps, children: [_jsx(Icon, { data: Gear, size: 16 }), extraGearProps ? (_jsxs("div", { className: b('changed-settings'), children: ["(", changedCurrentSettings.length, ")"] })) : null] }) }));
36
17
  };
37
- export const QueryEditorControls = ({ onRunButtonClick, onSettingsButtonClick, onUpdateQueryMode, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, queryMode, highlightedAction, }) => {
38
- const [useQuerySettings] = useSetting(QUERY_SETTINGS);
18
+ export const QueryEditorControls = ({ handleSendExecuteClick, onSettingsButtonClick, runIsLoading, handleGetExplainQueryClick, explainIsLoading, disabled, highlightedAction, }) => {
39
19
  const runView = highlightedAction === 'execute' ? 'action' : undefined;
40
20
  const explainView = highlightedAction === 'explain' ? 'action' : undefined;
41
- const querySelectorMenuItems = React.useMemo(() => {
42
- return Object.entries(QueryModeSelectorOptions).map(([mode, { title, description }]) => {
43
- return {
44
- text: (_jsx(LabelWithPopover, { className: b('item-with-popover'), contentClassName: b('popover'), text: title, popoverContent: description })),
45
- action: () => {
46
- onUpdateQueryMode(mode);
47
- },
48
- };
49
- });
50
- }, [onUpdateQueryMode]);
51
- return (_jsxs("div", { className: b(), children: [_jsxs("div", { className: b('left'), children: [_jsxs(Button, { onClick: () => {
52
- onRunButtonClick(queryMode);
53
- }, disabled: disabled, loading: runIsLoading, view: runView, className: b('run-button'), children: [_jsx(Icon, { data: PlayFill, size: 14 }), 'Run'] }), _jsx(Button, { onClick: () => {
54
- onExplainButtonClick(queryMode);
55
- }, disabled: disabled, loading: explainIsLoading, view: explainView, children: "Explain" }), useQuerySettings ? (_jsx(Button, { onClick: onSettingsButtonClick, loading: runIsLoading, className: b('gear-button'), children: _jsx(Icon, { data: Gear, size: 16 }) })) : (_jsx("div", { className: b('mode-selector'), children: _jsx(DropdownMenu, { items: querySelectorMenuItems, popupProps: {
56
- className: b('mode-selector__popup'),
57
- qa: queryModeSelectorPopupQa,
58
- }, switcher: _jsx(Button, { className: b('mode-selector__button'), qa: queryModeSelectorQa, children: _jsxs("span", { className: b('mode-selector__button-content'), children: [`${i18n('controls.query-mode-selector_type')} ${QueryModeSelectorOptions[queryMode].title}`, _jsx(Icon, { data: ChevronDown })] }) }) }) }))] }), _jsx(SaveQuery, { isSaveButtonDisabled: disabled })] }));
21
+ const onRunButtonClick = () => {
22
+ handleSendExecuteClick();
23
+ };
24
+ const onExplainButtonClick = () => {
25
+ handleGetExplainQueryClick();
26
+ };
27
+ return (_jsxs("div", { className: b(), children: [_jsxs("div", { className: b('left'), children: [_jsxs(Button, { onClick: onRunButtonClick, disabled: disabled, loading: runIsLoading, view: runView, className: b('run-button'), children: [_jsx(Icon, { data: PlayFill, size: 14 }), 'Run'] }), _jsx(Button, { onClick: onExplainButtonClick, disabled: disabled, loading: explainIsLoading, view: explainView, children: "Explain" }), _jsx(SettingsButton, { onClick: onSettingsButtonClick, runIsLoading: runIsLoading })] }), _jsx(SaveQuery, { isSaveButtonDisabled: disabled })] }));
59
28
  };
@@ -0,0 +1,2 @@
1
+ import type { QuerySettings } from '../../../../../types/store/query';
2
+ export default function getChangedQueryExecutionSettings(currentSettings: QuerySettings, defaultSettings: QuerySettings): (keyof QuerySettings)[];
@@ -0,0 +1,5 @@
1
+ export default function getChangedQueryExecutionSettings(currentSettings, defaultSettings) {
2
+ const currentMap = new Map(Object.entries(currentSettings));
3
+ const defaultMap = new Map(Object.entries(defaultSettings));
4
+ return Array.from(currentMap.keys()).filter((key) => currentMap.get(key) !== defaultMap.get(key));
5
+ }
@@ -0,0 +1,42 @@
1
+ import { ISOLATION_LEVELS, QUERY_MODES, STATISTICS_MODES, TRACING_LEVELS, } from '../../../../../utils/query';
2
+ const DEFAULT_QUERY_SETTINGS = {
3
+ queryMode: QUERY_MODES.script,
4
+ isolationLevel: ISOLATION_LEVELS.serializable,
5
+ timeout: '60',
6
+ statisticsMode: STATISTICS_MODES.none,
7
+ tracingLevel: TRACING_LEVELS.detailed,
8
+ };
9
+ import getChangedQueryExecutionSettings from './getChangedQueryExecutionSettings';
10
+ describe('getChangedQueryExecutionSettings', () => {
11
+ it('should return an empty array if no settings have changed', () => {
12
+ const currentSettings = { ...DEFAULT_QUERY_SETTINGS };
13
+ const result = getChangedQueryExecutionSettings(currentSettings, DEFAULT_QUERY_SETTINGS);
14
+ expect(result).toEqual([]);
15
+ });
16
+ it('should return the keys of settings that have changed', () => {
17
+ const currentSettings = {
18
+ ...DEFAULT_QUERY_SETTINGS,
19
+ queryMode: QUERY_MODES.data,
20
+ timeout: '30',
21
+ };
22
+ const result = getChangedQueryExecutionSettings(currentSettings, DEFAULT_QUERY_SETTINGS);
23
+ expect(result).toEqual(['queryMode', 'timeout']);
24
+ });
25
+ it('should return all keys if all settings have changed', () => {
26
+ const currentSettings = {
27
+ queryMode: QUERY_MODES.data,
28
+ isolationLevel: ISOLATION_LEVELS.onlinero,
29
+ timeout: '90',
30
+ statisticsMode: STATISTICS_MODES.basic,
31
+ tracingLevel: TRACING_LEVELS.basic,
32
+ };
33
+ const result = getChangedQueryExecutionSettings(currentSettings, DEFAULT_QUERY_SETTINGS);
34
+ expect(result).toEqual([
35
+ 'queryMode',
36
+ 'isolationLevel',
37
+ 'timeout',
38
+ 'statisticsMode',
39
+ 'tracingLevel',
40
+ ]);
41
+ });
42
+ });
@@ -0,0 +1,5 @@
1
+ import type { QuerySettings } from '../../../../../types/store/query';
2
+ export default function getChangedQueryExecutionSettingsDescription({ currentSettings, defaultSettings, }: {
3
+ currentSettings: QuerySettings;
4
+ defaultSettings: QuerySettings;
5
+ }): Record<string, string>;
@@ -0,0 +1,19 @@
1
+ import { QUERY_SETTINGS_FIELD_SETTINGS } from '../../QuerySettingsDialog/constants';
2
+ import getChangedQueryExecutionSettings from './getChangedQueryExecutionSettings';
3
+ export default function getChangedQueryExecutionSettingsDescription({ currentSettings, defaultSettings, }) {
4
+ const keys = getChangedQueryExecutionSettings(currentSettings, defaultSettings);
5
+ const result = {};
6
+ keys.forEach((key) => {
7
+ var _a;
8
+ const settings = QUERY_SETTINGS_FIELD_SETTINGS[key];
9
+ const currentValue = currentSettings[key];
10
+ if ('options' in settings) {
11
+ const content = (_a = settings.options.find((option) => option.value === currentValue)) === null || _a === void 0 ? void 0 : _a.content;
12
+ result[settings.title] = content;
13
+ }
14
+ else {
15
+ result[settings.title] = currentValue;
16
+ }
17
+ });
18
+ return result;
19
+ }
@@ -0,0 +1,56 @@
1
+ import { ISOLATION_LEVELS, ISOLATION_LEVELS_TITLES, QUERY_MODES, QUERY_MODES_TITLES, STATISTICS_MODES, STATISTICS_MODES_TITLES, TRACING_LEVELS, TRACING_LEVELS_TITLES, } from '../../../../../utils/query';
2
+ import { QUERY_SETTINGS_FIELD_SETTINGS } from '../../QuerySettingsDialog/constants';
3
+ import getChangedQueryExecutionSettingsDescription from './getChangedQueryExecutionSettingsDescription';
4
+ const DEFAULT_QUERY_SETTINGS = {
5
+ queryMode: QUERY_MODES.script,
6
+ isolationLevel: ISOLATION_LEVELS.serializable,
7
+ timeout: '60',
8
+ statisticsMode: STATISTICS_MODES.none,
9
+ tracingLevel: TRACING_LEVELS.detailed,
10
+ };
11
+ describe('getChangedQueryExecutionSettingsDescription', () => {
12
+ it('should return an empty object if no settings changed', () => {
13
+ const currentSettings = { ...DEFAULT_QUERY_SETTINGS };
14
+ const result = getChangedQueryExecutionSettingsDescription({
15
+ currentSettings,
16
+ defaultSettings: DEFAULT_QUERY_SETTINGS,
17
+ });
18
+ expect(result).toEqual({});
19
+ });
20
+ it('should return the description for changed settings', () => {
21
+ var _a;
22
+ const currentSettings = {
23
+ ...DEFAULT_QUERY_SETTINGS,
24
+ queryMode: QUERY_MODES.pg,
25
+ timeout: '63',
26
+ };
27
+ const result = getChangedQueryExecutionSettingsDescription({
28
+ currentSettings,
29
+ defaultSettings: DEFAULT_QUERY_SETTINGS,
30
+ });
31
+ expect(result).toEqual({
32
+ [QUERY_SETTINGS_FIELD_SETTINGS.queryMode.title]: (_a = QUERY_SETTINGS_FIELD_SETTINGS.queryMode.options.find((option) => option.value === QUERY_MODES.pg)) === null || _a === void 0 ? void 0 : _a.content,
33
+ [QUERY_SETTINGS_FIELD_SETTINGS.timeout.title]: '63',
34
+ });
35
+ });
36
+ it('should return the correct description for all changed settings', () => {
37
+ const currentSettings = {
38
+ queryMode: QUERY_MODES.data,
39
+ isolationLevel: ISOLATION_LEVELS.snapshot,
40
+ timeout: '120',
41
+ statisticsMode: STATISTICS_MODES.profile,
42
+ tracingLevel: TRACING_LEVELS.diagnostic,
43
+ };
44
+ const result = getChangedQueryExecutionSettingsDescription({
45
+ currentSettings,
46
+ defaultSettings: DEFAULT_QUERY_SETTINGS,
47
+ });
48
+ expect(result).toEqual({
49
+ [QUERY_SETTINGS_FIELD_SETTINGS.queryMode.title]: QUERY_MODES_TITLES.data,
50
+ [QUERY_SETTINGS_FIELD_SETTINGS.isolationLevel.title]: ISOLATION_LEVELS_TITLES['snapshot-read-only'],
51
+ [QUERY_SETTINGS_FIELD_SETTINGS.timeout.title]: '120',
52
+ [QUERY_SETTINGS_FIELD_SETTINGS.statisticsMode.title]: STATISTICS_MODES_TITLES.profile,
53
+ [QUERY_SETTINGS_FIELD_SETTINGS.tracingLevel.title]: TRACING_LEVELS_TITLES.diagnostic,
54
+ });
55
+ });
56
+ });
@@ -0,0 +1,2 @@
1
+ import './QuerySettingsBanner.scss';
2
+ export declare function QuerySettingsBanner(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Alert } from '@gravity-ui/uikit';
3
+ import QuerySettingsDescription from '../../../../components/QuerySettingsDescription/QuerySettingsDescription';
4
+ import { cn } from '../../../../utils/cn';
5
+ import { useChangedQuerySettings } from '../../../../utils/hooks/useChangedQuerySettings';
6
+ import i18n from '../i18n';
7
+ const b = cn('ydb-query-settings-banner');
8
+ import './QuerySettingsBanner.scss';
9
+ export function QuerySettingsBanner() {
10
+ const { isBannerShown, changedLastExecutionSettingsDescriptions, closeBanner } = useChangedQuerySettings();
11
+ return isBannerShown ? (_jsx(Alert, { className: b(), theme: "info", align: "baseline", message: _jsx(QuerySettingsDescription, { prefix: i18n('banner.query-settings.message'), querySettings: changedLastExecutionSettingsDescriptions }), onClose: closeBanner })) : null;
12
+ }
@@ -0,0 +1,3 @@
1
+ .ydb-query-settings-banner {
2
+ margin: var(--g-spacing-1) var(--g-spacing-5);
3
+ }