ydb-embedded-ui 6.12.0 → 6.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/AutoRefreshControl/i18n/index.d.ts +1 -1
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.d.ts +3 -2
- package/dist/components/ButtonWithConfirmDialog/ButtonWithConfirmDialog.js +9 -5
- package/dist/components/CriticalActionDialog/CriticalActionDialog.d.ts +5 -3
- package/dist/components/CriticalActionDialog/CriticalActionDialog.js +8 -7
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +1 -1
- package/dist/components/CriticalActionDialog/i18n/en.json +1 -0
- package/dist/components/CriticalActionDialog/i18n/index.d.ts +1 -1
- package/dist/components/Errors/PageError/PageError.d.ts +11 -0
- package/dist/components/Errors/PageError/PageError.js +19 -0
- package/dist/components/Errors/i18n/en.json +2 -1
- package/dist/components/Errors/i18n/index.d.ts +1 -1
- package/dist/components/Errors/i18n/ru.json +2 -1
- package/dist/components/Fullscreen/Fullscreen.d.ts +1 -1
- package/dist/components/Fullscreen/Fullscreen.js +34 -27
- package/dist/components/Fullscreen/Fullscreen.scss +16 -8
- package/dist/components/Graph/Graph.d.ts +13 -0
- package/dist/components/Graph/Graph.js +41 -0
- package/dist/components/LabelWithPopover/LabelWithPopover.d.ts +4 -1
- package/dist/components/LabelWithPopover/LabelWithPopover.js +1 -1
- package/dist/components/Loader/Loader.d.ts +2 -1
- package/dist/components/Loader/Loader.js +6 -1
- package/dist/components/LoaderWrapper/LoaderWrapper.d.ts +10 -0
- package/dist/components/LoaderWrapper/LoaderWrapper.js +8 -0
- package/dist/components/MetricChart/reducer.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.d.ts +2 -2
- package/dist/components/PDiskInfo/PDiskInfo.js +9 -6
- package/dist/components/PDiskInfo/i18n/index.d.ts +1 -1
- package/dist/components/ProgressViewer/ProgressViewer.js +3 -0
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.js +13 -3
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +4 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.d.ts +7 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.js +8 -0
- package/dist/components/QuerySettingsDescription/QuerySettingsDescription.scss +8 -0
- package/dist/components/QuerySettingsDescription/index.d.ts +1 -0
- package/dist/components/QuerySettingsDescription/index.js +1 -0
- package/dist/components/VDisk/VDisk.js +3 -4
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +2 -2
- package/dist/components/VDiskInfo/VDiskInfo.js +4 -2
- package/dist/containers/App/Content.js +15 -19
- package/dist/containers/AsideNavigation/AsideNavigation.js +2 -1
- package/dist/containers/AsideNavigation/YdbInternalUser/YdbInternalUser.js +4 -4
- package/dist/containers/Authentication/Authentication.js +8 -10
- package/dist/containers/Authentication/utils.d.ts +8 -0
- package/dist/containers/Authentication/utils.js +15 -0
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +6 -6
- package/dist/containers/Clusters/constants.d.ts +1 -1
- package/dist/containers/Heatmap/Heatmap.js +5 -4
- package/dist/containers/Node/Node.js +5 -7
- package/dist/containers/Node/Node.scss +4 -0
- package/dist/containers/Node/NodeStructure/NodeStructure.js +4 -4
- package/dist/containers/Node/NodeStructure/NodeStructure.scss +4 -0
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/Nodes/Nodes.js +6 -8
- package/dist/containers/Nodes/getNodesColumns.js +6 -21
- package/dist/containers/PDiskPage/PDiskPage.js +19 -8
- package/dist/containers/PDiskPage/i18n/en.json +1 -0
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -1
- package/dist/containers/Storage/PDisk/PDisk.js +3 -4
- package/dist/containers/Storage/Storage.js +4 -6
- package/dist/containers/Tablet/Tablet.js +2 -2
- package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
- package/dist/containers/Tablets/Tablets.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +2 -5
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.js +10 -13
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Network/Network.js +8 -11
- package/dist/containers/Tenant/Diagnostics/Network/Network.scss +1 -0
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.d.ts +1 -2
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.js +3 -5
- package/dist/containers/Tenant/Diagnostics/Overview/TopicStats/TopicStats.js +3 -4
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -4
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverviewTableLayout.js +3 -3
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.js +4 -3
- package/dist/containers/Tenant/Diagnostics/TopShards/TopShards.js +4 -3
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.d.ts +2 -2
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.js +56 -20
- package/dist/containers/Tenant/Query/ExecuteResult/ExecuteResult.scss +10 -6
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/en.json +7 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExecuteResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.d.ts +18 -0
- package/dist/containers/Tenant/Query/ExecuteResult/utils.js +36 -0
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.d.ts +23 -1
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +56 -111
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +1 -30
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.js +18 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Ast/Ast.scss +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.js +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/Graph/Graph.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/MetricsCell.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.d.ts +13 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationCell.js +48 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.d.ts +6 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/OperationParams.js +66 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.d.ts +7 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.js +100 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/SimplifiedPlan.scss +128 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.d.ts +5 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/utils.js +59 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.d.ts +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.js +11 -0
- package/dist/containers/Tenant/Query/ExplainResult/components/TextExplain/TextExplain.scss +14 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/en.json +8 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/ExplainResult/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/Preview/Preview.js +2 -3
- package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.js +1 -19
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.js +1 -1
- package/dist/containers/Tenant/Query/QueryDuration/QueryDuration.scss +11 -0
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +1 -1
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +91 -95
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +4 -6
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +18 -49
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.d.ts +2 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.js +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.test.js +42 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.d.ts +5 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.js +19 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.d.ts +1 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettingsDescription.test.js +56 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.d.ts +2 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.js +12 -0
- package/dist/containers/Tenant/Query/QuerySettingsBanner/QuerySettingsBanner.scss +3 -0
- package/dist/containers/Tenant/Query/QuerySettingsDialog/QuerySettingsDialog.js +20 -23
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.d.ts +123 -7
- package/dist/containers/Tenant/Query/QuerySettingsDialog/constants.js +32 -10
- package/dist/containers/Tenant/Query/i18n/en.json +3 -1
- package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -6
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +5 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.d.ts +2 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/columns.js +13 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/en.json +1 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Schema/SchemaViewer/prepareData.js +3 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/types.d.ts +1 -0
- package/dist/containers/Tenant/Tenant.js +4 -8
- package/dist/containers/Tenant/utils/schemaActions.d.ts +2 -2
- package/dist/containers/Tenant/utils/schemaActions.js +2 -2
- package/dist/containers/Tenants/Tenants.js +4 -7
- package/dist/containers/UserSettings/i18n/en.json +3 -5
- package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
- package/dist/containers/UserSettings/settings.d.ts +2 -3
- package/dist/containers/UserSettings/settings.js +17 -23
- package/dist/containers/VDiskPage/VDiskPage.js +27 -13
- package/dist/containers/VDiskPage/i18n/en.json +1 -0
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -1
- package/dist/services/api.d.ts +21 -8
- package/dist/services/api.js +29 -42
- package/dist/services/settings.d.ts +11 -4
- package/dist/services/settings.js +7 -6
- package/dist/store/configureStore.d.ts +7 -7
- package/dist/store/defaultStore.d.ts +3 -3
- package/dist/store/reducers/api.d.ts +1 -1
- package/dist/store/reducers/api.js +1 -1
- package/dist/store/reducers/authentication/authentication.d.ts +37 -24
- package/dist/store/reducers/authentication/authentication.js +77 -57
- package/dist/store/reducers/authentication/types.d.ts +0 -8
- package/dist/store/reducers/capabilities/capabilities.d.ts +106 -0
- package/dist/store/reducers/capabilities/capabilities.js +22 -0
- package/dist/store/reducers/capabilities/hooks.d.ts +2 -0
- package/dist/store/reducers/capabilities/hooks.js +13 -0
- package/dist/store/reducers/cluster/cluster.d.ts +2 -2
- package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +2 -2
- package/dist/store/reducers/clusters/clusters.d.ts +2 -2
- package/dist/store/reducers/describe.d.ts +2 -2
- package/dist/store/reducers/executeQuery.d.ts +7 -14
- package/dist/store/reducers/executeQuery.js +19 -14
- package/dist/store/reducers/executeTopQueries/executeTopQueries.d.ts +2 -2
- package/dist/store/reducers/explainQuery/explainQuery.d.ts +5 -4
- package/dist/store/reducers/explainQuery/explainQuery.js +14 -4
- package/dist/store/reducers/explainQuery/types.d.ts +13 -1
- package/dist/store/reducers/explainQuery/utils.js +7 -2
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +58 -58
- package/dist/store/reducers/heatmap.d.ts +2 -2
- package/dist/store/reducers/hotKeys/hotKeys.d.ts +2 -2
- package/dist/store/reducers/index.d.ts +6 -6
- package/dist/store/reducers/network/network.d.ts +2 -2
- package/dist/store/reducers/node/node.d.ts +3 -3
- package/dist/store/reducers/node/selectors.d.ts +1 -1
- package/dist/store/reducers/nodes/nodes.d.ts +3 -3
- package/dist/store/reducers/nodesList.d.ts +3 -3
- package/dist/store/reducers/overview/overview.d.ts +2 -2
- package/dist/store/reducers/partitions/partitions.d.ts +2 -2
- package/dist/store/reducers/pdisk/pdisk.d.ts +3 -3
- package/dist/store/reducers/preview.d.ts +2 -2
- package/dist/store/reducers/schema/schema.d.ts +3 -3
- package/dist/store/reducers/schema/schema.js +10 -3
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +2 -2
- package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +2 -2
- package/dist/store/reducers/storage/storage.d.ts +3 -3
- package/dist/store/reducers/tablet.d.ts +3 -3
- package/dist/store/reducers/tablets.d.ts +13 -13
- package/dist/store/reducers/tabletsFilters.d.ts +1 -1
- package/dist/store/reducers/tenant/tenant.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topNodes/topNodes.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +2 -2
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +2 -2
- package/dist/store/reducers/tenants/selectors.d.ts +31 -30
- package/dist/store/reducers/tenants/selectors.js +8 -2
- package/dist/store/reducers/tenants/tenants.d.ts +2 -2
- package/dist/store/reducers/topic.d.ts +44 -44
- package/dist/store/reducers/vdisk/vdisk.d.ts +2 -2
- package/dist/store/reducers/viewSchema/viewSchema.d.ts +2 -2
- package/dist/styles/mixins.scss +2 -0
- package/dist/types/api/capabilities.d.ts +7 -0
- package/dist/types/api/capabilities.js +1 -0
- package/dist/types/api/modifyDisk.d.ts +8 -0
- package/dist/types/api/modifyDisk.js +1 -0
- package/dist/types/api/query.d.ts +39 -3
- package/dist/types/api/query.js +9 -1
- package/dist/types/api/schema/shared.d.ts +8 -0
- package/dist/types/store/query.d.ts +7 -0
- package/dist/utils/__test__/prepareQueryExplain.test.d.ts +1 -0
- package/dist/utils/__test__/prepareQueryExplain.test.js +115 -0
- package/dist/utils/constants.d.ts +13 -4
- package/dist/utils/constants.js +15 -4
- package/dist/utils/dataFormatters/dataFormatters.d.ts +0 -1
- package/dist/utils/dataFormatters/dataFormatters.js +1 -4
- package/dist/utils/hooks/index.d.ts +2 -1
- package/dist/utils/hooks/index.js +2 -1
- package/dist/utils/hooks/useChangedQuerySettings.d.ts +10 -0
- package/dist/utils/hooks/useChangedQuerySettings.js +46 -0
- package/dist/utils/hooks/useDelayed.d.ts +1 -0
- package/dist/utils/hooks/useDelayed.js +13 -0
- package/dist/utils/hooks/useEventHandler.d.ts +6 -0
- package/dist/utils/hooks/useEventHandler.js +17 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.d.ts +2 -0
- package/dist/utils/hooks/useLastQueryExecutionSettings.js +5 -0
- package/dist/utils/hooks/useQueryExecutionSettings.d.ts +8 -0
- package/dist/utils/hooks/useQueryExecutionSettings.js +15 -0
- package/dist/utils/prepareQueryExplain.d.ts +3 -1
- package/dist/utils/prepareQueryExplain.js +54 -2
- package/dist/utils/query.js +1 -0
- package/dist/utils/query.test.js +3 -0
- package/dist/utils/utils.d.ts +8 -7
- package/dist/utils/utils.js +23 -11
- package/package.json +4 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.d.ts +0 -2
- package/dist/containers/Tenant/Query/ExplainResult/utils.js +0 -4
- package/dist/store/utils.d.ts +0 -23
- package/dist/store/utils.js +0 -49
- package/dist/types/api/restartPDisk.d.ts +0 -4
- package/dist/utils/hooks/useQueryModes.d.ts +0 -2
- package/dist/utils/hooks/useQueryModes.js +0 -5
- /package/dist/{types/api/restartPDisk.js → containers/Tenant/Query/ExplainResult/components/SimplifiedPlan/types.js} +0 -0
@@ -1,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 {
|
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,
|
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 [
|
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
|
-
|
75
|
+
const getLastQueryText = useEventHandler(() => {
|
91
76
|
var _a;
|
92
|
-
const {
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
-
|
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
|
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 = (
|
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
|
-
|
124
|
+
querySettings,
|
125
|
+
enableTracingLevel,
|
149
126
|
});
|
150
127
|
setIsResultLoaded(true);
|
151
128
|
props.setShowPreview(false);
|
152
129
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerExpand);
|
153
|
-
};
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
return;
|
130
|
+
});
|
131
|
+
const handleSendQuery = useEventHandler(() => {
|
132
|
+
if (lastUsedQueryAction === QUERY_ACTIONS.explain) {
|
133
|
+
handleGetExplainQueryClick();
|
158
134
|
}
|
159
|
-
|
160
|
-
|
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
|
-
|
186
|
-
}, [monacoHotKey]);
|
138
|
+
});
|
187
139
|
const editorDidMount = (editor, monaco) => {
|
188
140
|
const keybindings = getKeyBindings(monaco);
|
189
|
-
|
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: () =>
|
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: () =>
|
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, {
|
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
|
-
|
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
|
1
|
+
import type { QueryAction } from '../../../../types/store/query';
|
2
2
|
import './QueryEditorControls.scss';
|
3
3
|
interface QueryEditorControlsProps {
|
4
|
-
|
4
|
+
handleSendExecuteClick: () => void;
|
5
5
|
onSettingsButtonClick: () => void;
|
6
6
|
runIsLoading: boolean;
|
7
|
-
|
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: ({
|
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
|
3
|
-
import {
|
4
|
-
import
|
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 {
|
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
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
[
|
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 = ({
|
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
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
};
|
package/dist/containers/Tenant/Query/QueryEditorControls/utils/getChangedQueryExecutionSettings.js
ADDED
@@ -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 @@
|
|
1
|
+
export {};
|
@@ -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 @@
|
|
1
|
+
export {};
|
@@ -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,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
|
+
}
|