ydb-embedded-ui 6.9.2 → 6.10.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/NodeHostWrapper/NodeHostWrapper.scss +1 -1
- package/dist/components/{VirtualTable/VirtualTable.d.ts → PaginatedTable/PaginatedTable.d.ts} +3 -3
- package/dist/components/{VirtualTable/VirtualTable.js → PaginatedTable/PaginatedTable.js} +4 -4
- package/dist/components/{VirtualTable/VirtualTable.scss → PaginatedTable/PaginatedTable.scss} +11 -11
- package/dist/components/PaginatedTable/ResizeablePaginatedTable.d.ts +6 -0
- package/dist/components/{VirtualTable/ResizeableVirtualTable.js → PaginatedTable/ResizeablePaginatedTable.js} +3 -3
- package/dist/components/{VirtualTable → PaginatedTable}/i18n/index.js +1 -1
- package/dist/components/PaginatedTable/index.d.ts +4 -0
- package/dist/components/PaginatedTable/index.js +4 -0
- package/dist/components/{VirtualTable → PaginatedTable}/reducer.d.ts +3 -3
- package/dist/components/{VirtualTable → PaginatedTable}/reducer.js +1 -1
- package/dist/components/PaginatedTable/shared.js +2 -0
- package/dist/components/{VirtualTable → PaginatedTable}/types.d.ts +2 -2
- package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +1 -1
- package/dist/components/VDisk/VDisk.js +19 -6
- package/dist/containers/App/App.d.ts +1 -1
- package/dist/containers/App/App.js +2 -2
- package/dist/containers/App/App.scss +1 -1
- package/dist/containers/AppWithClusters/AppWithClusters.js +1 -10
- package/dist/containers/AsideNavigation/Navigation.d.ts +1 -1
- package/dist/containers/Heatmap/Histogram/Histogram.js +3 -3
- package/dist/containers/Heatmap/util.js +2 -1
- package/dist/containers/Nodes/NodesWrapper.js +5 -5
- package/dist/containers/Nodes/{VirtualNodes.d.ts → PaginatedNodes.d.ts} +1 -1
- package/dist/containers/Nodes/{VirtualNodes.js → PaginatedNodes.js} +3 -3
- package/dist/containers/Nodes/getNodesColumns.d.ts +2 -2
- package/dist/containers/Storage/PDisk/PDisk.js +10 -2
- package/dist/containers/Storage/{VirtualStorage.d.ts → PaginatedStorage.d.ts} +2 -2
- package/dist/containers/Storage/{VirtualStorage.js → PaginatedStorage.js} +5 -5
- package/dist/containers/Storage/Storage.js +3 -12
- package/dist/containers/Storage/StorageGroups/{VirtualStorageGroups.d.ts → PaginatedStorageGroups.d.ts} +3 -3
- package/dist/containers/Storage/StorageGroups/{VirtualStorageGroups.js → PaginatedStorageGroups.js} +3 -3
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +2 -2
- package/dist/containers/Storage/StorageNodes/{VirtualStorageNodes.d.ts → PaginatedStorageNodes.d.ts} +3 -3
- package/dist/containers/Storage/StorageNodes/{VirtualStorageNodes.js → PaginatedStorageNodes.js} +3 -3
- package/dist/containers/Storage/StorageWrapper.js +5 -5
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +1 -1
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +1 -2
- package/dist/containers/Tenant/Query/Query.js +2 -8
- package/dist/containers/Tenant/Query/Query.scss +1 -1
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +2 -0
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +23 -36
- package/dist/containers/Tenant/Query/QueryEditor/keybindings.d.ts +9 -0
- package/dist/containers/Tenant/Query/QueryEditor/keybindings.js +13 -0
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +1 -3
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +3 -3
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.d.ts +7 -6
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.js +55 -47
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.scss +2 -32
- package/dist/containers/Tenant/Query/SaveQuery/i18n/en.json +13 -0
- package/dist/containers/Tenant/Query/SaveQuery/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Query/SaveQuery/i18n/index.js +4 -0
- package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.d.ts +1 -4
- package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.js +5 -3
- package/dist/containers/Tenant/Query/i18n/en.json +2 -1
- package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/Query/utils/useSavedQueries.d.ts +2 -0
- package/dist/containers/Tenant/Query/utils/useSavedQueries.js +5 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -2
- package/dist/containers/Tenant/utils/schemaActions.d.ts +1 -1
- package/dist/containers/Tenant/utils/schemaActions.js +10 -4
- package/dist/containers/UserSettings/UserSettings.d.ts +1 -1
- package/dist/containers/UserSettings/UserSettings.js +1 -2
- package/dist/containers/UserSettings/i18n/en.json +9 -4
- package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
- package/dist/containers/UserSettings/settings.d.ts +7 -2
- package/dist/containers/UserSettings/settings.js +38 -14
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +1 -2
- package/dist/lib.d.ts +1 -1
- package/dist/lib.js +1 -1
- package/dist/services/settings.d.ts +2 -0
- package/dist/services/settings.js +4 -2
- package/dist/store/configureStore.d.ts +4 -14
- package/dist/store/defaultStore.d.ts +2 -7
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +20 -20
- package/dist/store/reducers/index.d.ts +3 -13
- package/dist/store/reducers/index.js +2 -2
- package/dist/store/reducers/node/selectors.d.ts +1 -1
- package/dist/store/reducers/nodesList.d.ts +1 -1
- package/dist/store/reducers/queryActions/queryActions.d.ts +34 -0
- package/dist/store/reducers/queryActions/queryActions.js +58 -0
- package/dist/store/reducers/queryActions/types.d.ts +5 -0
- package/dist/store/reducers/queryActions/types.js +1 -0
- package/dist/store/reducers/storage/storage.js +1 -1
- package/dist/store/reducers/tablets.d.ts +5 -5
- package/dist/store/reducers/tabletsFilters.d.ts +1 -1
- package/dist/store/reducers/tenants/selectors.d.ts +9 -9
- package/dist/store/reducers/topic.d.ts +15 -15
- package/dist/utils/constants.d.ts +3 -1
- package/dist/utils/constants.js +5 -2
- package/dist/utils/disks/prepareDisks.js +4 -2
- package/dist/utils/hooks/index.d.ts +0 -2
- package/dist/utils/hooks/index.js +0 -2
- package/package.json +1 -1
- package/dist/components/VirtualTable/ResizeableVirtualTable.d.ts +0 -6
- package/dist/components/VirtualTable/index.d.ts +0 -3
- package/dist/components/VirtualTable/index.js +0 -3
- package/dist/components/VirtualTable/shared.js +0 -2
- package/dist/containers/AppWithClusters/i18n/en.json +0 -4
- package/dist/containers/AppWithClusters/i18n/index.d.ts +0 -2
- package/dist/containers/AppWithClusters/i18n/index.js +0 -5
- package/dist/containers/AppWithClusters/i18n/ru.json +0 -4
- package/dist/store/reducers/saveQuery.d.ts +0 -12
- package/dist/store/reducers/saveQuery.js +0 -25
- package/dist/utils/hooks/useNodesRequestParams.d.ts +0 -15
- package/dist/utils/hooks/useNodesRequestParams.js +0 -23
- package/dist/utils/hooks/useStorageRequestParams.d.ts +0 -8
- package/dist/utils/hooks/useStorageRequestParams.js +0 -20
- /package/dist/components/{VirtualTable → PaginatedTable}/ResizeHandler.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/ResizeHandler.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableChunk.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableChunk.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableHead.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableHead.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableRow.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/TableRow.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/constants.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/constants.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/i18n/en.json +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/i18n/index.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/i18n/ru.json +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/shared.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/types.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/useIntersectionObserver.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/useIntersectionObserver.js +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/utils.d.ts +0 -0
- /package/dist/components/{VirtualTable → PaginatedTable}/utils.js +0 -0
package/dist/containers/Storage/StorageNodes/{VirtualStorageNodes.js → PaginatedStorageNodes.js}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import React from 'react';
|
3
|
-
import {
|
3
|
+
import { ResizeablePaginatedTable } from '../../../components/PaginatedTable';
|
4
4
|
import { VISIBLE_ENTITIES } from '../../../store/reducers/storage/constants';
|
5
5
|
import { NodesUptimeFilterValues, getUptimeParamValue } from '../../../utils/nodes';
|
6
6
|
import { StorageNodesEmptyDataMessage } from './StorageNodesEmptyDataMessage';
|
@@ -8,7 +8,7 @@ import { getStorageNodes } from './getNodes';
|
|
8
8
|
import { STORAGE_NODES_COLUMNS_WIDTH_LS_KEY, getPreparedStorageNodesColumns, } from './getStorageNodesColumns';
|
9
9
|
import i18n from './i18n';
|
10
10
|
import { getRowUnavailableClassName } from './shared';
|
11
|
-
export const
|
11
|
+
export const PaginatedStorageNodes = ({ searchValue, visibleEntities, nodesUptimeFilter, tenant, additionalNodesProps, onShowAll, parentContainer, renderControls, renderErrorMessage, }) => {
|
12
12
|
const filters = React.useMemo(() => {
|
13
13
|
return [searchValue, visibleEntities, nodesUptimeFilter, tenant];
|
14
14
|
}, [searchValue, visibleEntities, nodesUptimeFilter, tenant]);
|
@@ -34,5 +34,5 @@ export const VirtualStorageNodes = ({ searchValue, visibleEntities, nodesUptimeF
|
|
34
34
|
}
|
35
35
|
return i18n('empty.default');
|
36
36
|
};
|
37
|
-
return (_jsx(
|
37
|
+
return (_jsx(ResizeablePaginatedTable, { columnsWidthLSKey: STORAGE_NODES_COLUMNS_WIDTH_LS_KEY, parentContainer: parentContainer, columns: columns, fetchData: fetchData, rowHeight: 50, limit: 50, renderControls: renderControls, renderErrorMessage: renderErrorMessage, renderEmptyDataMessage: renderEmptyDataMessage, getRowClassName: getRowUnavailableClassName, dependencyArray: filters }));
|
38
38
|
};
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { USE_PAGINATED_TABLES_KEY } from '../../utils/constants';
|
3
3
|
import { useSetting } from '../../utils/hooks';
|
4
|
+
import { PaginatedStorage } from './PaginatedStorage';
|
4
5
|
import { Storage } from './Storage';
|
5
|
-
import { VirtualStorage } from './VirtualStorage';
|
6
6
|
export const StorageWrapper = ({ parentContainer, ...props }) => {
|
7
|
-
const [
|
8
|
-
if (
|
9
|
-
return _jsx(
|
7
|
+
const [usePaginatedTables] = useSetting(USE_PAGINATED_TABLES_KEY);
|
8
|
+
if (usePaginatedTables) {
|
9
|
+
return _jsx(PaginatedStorage, { parentContainer: parentContainer, ...props });
|
10
10
|
}
|
11
11
|
return _jsx(Storage, { ...props });
|
12
12
|
};
|
@@ -50,8 +50,7 @@
|
|
50
50
|
width: 100%;
|
51
51
|
padding: 15px 20px;
|
52
52
|
@include json-tree-styles();
|
53
|
-
&
|
54
|
-
.json-inspector__leaf.json-inspector__leaf_root.json-inspector__leaf_expanded.json-inspector__leaf_composite {
|
53
|
+
& .json-inspector__leaf.json-inspector__leaf_root.json-inspector__leaf_composite {
|
55
54
|
max-width: calc(100% - 50px);
|
56
55
|
}
|
57
56
|
|
@@ -4,8 +4,7 @@ import { Helmet } from 'react-helmet-async';
|
|
4
4
|
import { changeUserInput } from '../../../store/reducers/executeQuery';
|
5
5
|
import { TENANT_QUERY_TABS_ID } from '../../../store/reducers/tenant/constants';
|
6
6
|
import { cn } from '../../../utils/cn';
|
7
|
-
import {
|
8
|
-
import { useSetting, useTypedDispatch, useTypedSelector } from '../../../utils/hooks';
|
7
|
+
import { useTypedDispatch, useTypedSelector } from '../../../utils/hooks';
|
9
8
|
import QueriesHistory from './QueriesHistory/QueriesHistory';
|
10
9
|
import QueryEditor from './QueryEditor/QueryEditor';
|
11
10
|
import { QueryTabs, queryEditorTabs } from './QueryTabs/QueryTabs';
|
@@ -15,11 +14,6 @@ const b = cn('ydb-query');
|
|
15
14
|
export const Query = (props) => {
|
16
15
|
const dispatch = useTypedDispatch();
|
17
16
|
const { queryTab = TENANT_QUERY_TABS_ID.newQuery } = useTypedSelector((state) => state.tenant);
|
18
|
-
const [savedQueries, setSavedQueries] = useSetting(SAVED_QUERIES_KEY, []);
|
19
|
-
const handleDeleteQuery = (queryName) => {
|
20
|
-
const newSavedQueries = savedQueries.filter((el) => el.name.toLowerCase() !== queryName.toLowerCase());
|
21
|
-
setSavedQueries(newSavedQueries);
|
22
|
-
};
|
23
17
|
const handleUserInputChange = (value) => {
|
24
18
|
dispatch(changeUserInput(value));
|
25
19
|
};
|
@@ -33,7 +27,7 @@ export const Query = (props) => {
|
|
33
27
|
return _jsx(QueriesHistory, { changeUserInput: handleUserInputChange });
|
34
28
|
}
|
35
29
|
case TENANT_QUERY_TABS_ID.saved: {
|
36
|
-
return
|
30
|
+
return _jsx(SavedQueries, { changeUserInput: handleUserInputChange });
|
37
31
|
}
|
38
32
|
default: {
|
39
33
|
return null;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { goToNextQuery, goToPreviousQuery, saveQueryToHistory, setTenantPath } from '../../../../store/reducers/executeQuery';
|
3
|
+
import { setQueryAction } from '../../../../store/reducers/queryActions/queryActions';
|
3
4
|
import { setShowPreview } from '../../../../store/reducers/schema/schema';
|
4
5
|
import type { EPathType } from '../../../../types/api/schema';
|
5
6
|
import type { ExecuteQueryState } from '../../../../types/store/executeQuery';
|
@@ -13,6 +14,7 @@ interface QueryEditorProps {
|
|
13
14
|
goToNextQuery: (...args: Parameters<typeof goToNextQuery>) => void;
|
14
15
|
goToPreviousQuery: (...args: Parameters<typeof goToPreviousQuery>) => void;
|
15
16
|
setTenantPath: (...args: Parameters<typeof setTenantPath>) => void;
|
17
|
+
setQueryAction: (...args: Parameters<typeof setQueryAction>) => void;
|
16
18
|
executeQuery: ExecuteQueryState;
|
17
19
|
theme: string;
|
18
20
|
type?: EPathType;
|
@@ -6,9 +6,10 @@ import { MonacoEditor } from '../../../../components/MonacoEditor/MonacoEditor';
|
|
6
6
|
import SplitPane from '../../../../components/SplitPane';
|
7
7
|
import { executeQueryApi, goToNextQuery, goToPreviousQuery, saveQueryToHistory, setTenantPath, } from '../../../../store/reducers/executeQuery';
|
8
8
|
import { explainQueryApi } from '../../../../store/reducers/explainQuery/explainQuery';
|
9
|
+
import { setQueryAction } from '../../../../store/reducers/queryActions/queryActions';
|
9
10
|
import { setShowPreview } from '../../../../store/reducers/schema/schema';
|
10
11
|
import { cn } from '../../../../utils/cn';
|
11
|
-
import { DEFAULT_IS_QUERY_RESULT_COLLAPSED, DEFAULT_SIZE_RESULT_PANE_KEY, LAST_USED_QUERY_ACTION_KEY, QUERY_USE_MULTI_SCHEMA_KEY,
|
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';
|
12
13
|
import { useQueryModes, useSetting } from '../../../../utils/hooks';
|
13
14
|
import { LANGUAGE_YQL_ID } from '../../../../utils/monaco/yql/constants';
|
14
15
|
import { QUERY_ACTIONS } from '../../../../utils/query';
|
@@ -17,8 +18,10 @@ import { ExecuteResult } from '../ExecuteResult/ExecuteResult';
|
|
17
18
|
import { ExplainResult } from '../ExplainResult/ExplainResult';
|
18
19
|
import { Preview } from '../Preview/Preview';
|
19
20
|
import { QueryEditorControls } from '../QueryEditorControls/QueryEditorControls';
|
21
|
+
import { SaveQueryDialog } from '../SaveQuery/SaveQuery';
|
20
22
|
import i18n from '../i18n';
|
21
23
|
import { useEditorOptions } from './helpers';
|
24
|
+
import { getKeyBindings } from './keybindings';
|
22
25
|
import './QueryEditor.scss';
|
23
26
|
const CONTEXT_MENU_GROUP_ID = 'navigation';
|
24
27
|
const RESULT_TYPES = {
|
@@ -37,14 +40,13 @@ const initialTenantCommonInfoState = {
|
|
37
40
|
};
|
38
41
|
function QueryEditor(props) {
|
39
42
|
const editorOptions = useEditorOptions();
|
40
|
-
const { tenantName, path, setTenantPath: setPath, executeQuery, type, theme, changeUserInput, showPreview, } = props;
|
43
|
+
const { tenantName, path, setTenantPath: setPath, setQueryAction, executeQuery, type, theme, changeUserInput, showPreview, } = props;
|
41
44
|
const { tenantPath: savedPath } = executeQuery;
|
42
45
|
const [resultType, setResultType] = React.useState(RESULT_TYPES.EXECUTE);
|
43
46
|
const [isResultLoaded, setIsResultLoaded] = React.useState(false);
|
44
47
|
const [queryMode, setQueryMode] = useQueryModes();
|
45
48
|
const [useMultiSchema] = useSetting(QUERY_USE_MULTI_SCHEMA_KEY);
|
46
49
|
const [lastUsedQueryAction, setLastUsedQueryAction] = useSetting(LAST_USED_QUERY_ACTION_KEY);
|
47
|
-
const [savedQueries, setSavedQueries] = useSetting(SAVED_QUERIES_KEY);
|
48
50
|
const [monacoHotKey, setMonacoHotKey] = React.useState(null);
|
49
51
|
const [sendExecuteQuery, executeQueryResult] = executeQueryApi.useExecuteQueryMutation();
|
50
52
|
const [sendExplainQuery, explainQueryResult] = explainQueryApi.useExplainQueryMutation();
|
@@ -178,15 +180,13 @@ function QueryEditor(props) {
|
|
178
180
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
179
181
|
}, [monacoHotKey]);
|
180
182
|
const editorDidMount = (editor, monaco) => {
|
183
|
+
const keybindings = getKeyBindings(monaco);
|
181
184
|
editorRef.current = editor;
|
182
185
|
editor.focus();
|
183
186
|
editor.addAction({
|
184
187
|
id: 'sendQuery',
|
185
188
|
label: i18n('action.send-query'),
|
186
|
-
keybindings: [
|
187
|
-
// eslint-disable-next-line no-bitwise
|
188
|
-
monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter,
|
189
|
-
],
|
189
|
+
keybindings: [keybindings.sendQuery],
|
190
190
|
// A precondition for this action.
|
191
191
|
precondition: undefined,
|
192
192
|
// A rule to evaluate on top of the precondition in order to dispatch the keybindings.
|
@@ -207,10 +207,7 @@ function QueryEditor(props) {
|
|
207
207
|
editor.addAction({
|
208
208
|
id: 'sendSelectedQuery',
|
209
209
|
label: i18n('action.send-selected-query'),
|
210
|
-
keybindings: [
|
211
|
-
// eslint-disable-next-line no-bitwise
|
212
|
-
monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.Enter,
|
213
|
-
],
|
210
|
+
keybindings: [keybindings.sendSelectedQuery],
|
214
211
|
precondition: 'canSendSelectedText',
|
215
212
|
contextMenuGroupId: CONTEXT_MENU_GROUP_ID,
|
216
213
|
contextMenuOrder: 1,
|
@@ -219,10 +216,7 @@ function QueryEditor(props) {
|
|
219
216
|
editor.addAction({
|
220
217
|
id: 'previous-query',
|
221
218
|
label: i18n('action.previous-query'),
|
222
|
-
keybindings: [
|
223
|
-
// eslint-disable-next-line no-bitwise
|
224
|
-
monaco.KeyMod.CtrlCmd | monaco.KeyCode.UpArrow,
|
225
|
-
],
|
219
|
+
keybindings: [keybindings.selectPreviousQuery],
|
226
220
|
contextMenuGroupId: CONTEXT_MENU_GROUP_ID,
|
227
221
|
contextMenuOrder: 2,
|
228
222
|
run: () => {
|
@@ -232,16 +226,21 @@ function QueryEditor(props) {
|
|
232
226
|
editor.addAction({
|
233
227
|
id: 'next-query',
|
234
228
|
label: i18n('action.next-query'),
|
235
|
-
keybindings: [
|
236
|
-
// eslint-disable-next-line no-bitwise
|
237
|
-
monaco.KeyMod.CtrlCmd | monaco.KeyCode.DownArrow,
|
238
|
-
],
|
229
|
+
keybindings: [keybindings.selectNextQuery],
|
239
230
|
contextMenuGroupId: CONTEXT_MENU_GROUP_ID,
|
240
231
|
contextMenuOrder: 3,
|
241
232
|
run: () => {
|
242
233
|
props.goToNextQuery();
|
243
234
|
},
|
244
235
|
});
|
236
|
+
editor.addAction({
|
237
|
+
id: 'save-query',
|
238
|
+
label: i18n('action.save-query'),
|
239
|
+
keybindings: [keybindings.saveQuery],
|
240
|
+
run: () => {
|
241
|
+
setQueryAction('save');
|
242
|
+
},
|
243
|
+
});
|
245
244
|
};
|
246
245
|
const onChange = (newValue) => {
|
247
246
|
props.changeUserInput({ input: newValue });
|
@@ -255,25 +254,12 @@ function QueryEditor(props) {
|
|
255
254
|
const onSplitStartDragAdditional = () => {
|
256
255
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.clear);
|
257
256
|
};
|
258
|
-
const onSaveQueryHandler = (queryName) => {
|
259
|
-
const { input } = executeQuery;
|
260
|
-
const queryIndex = savedQueries.findIndex((el) => el.name.toLowerCase() === queryName.toLowerCase());
|
261
|
-
const newSavedQueries = [...savedQueries];
|
262
|
-
const newQuery = { name: queryName, body: input };
|
263
|
-
if (queryIndex === -1) {
|
264
|
-
newSavedQueries.push(newQuery);
|
265
|
-
}
|
266
|
-
else {
|
267
|
-
newSavedQueries[queryIndex] = newQuery;
|
268
|
-
}
|
269
|
-
setSavedQueries(newSavedQueries);
|
270
|
-
};
|
271
257
|
const renderControls = () => {
|
272
|
-
return (_jsx(QueryEditorControls, { onRunButtonClick: handleSendExecuteClick, runIsLoading: executeQueryResult.isLoading, onExplainButtonClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading,
|
258
|
+
return (_jsx(QueryEditorControls, { onRunButtonClick: handleSendExecuteClick, runIsLoading: executeQueryResult.isLoading, onExplainButtonClick: handleGetExplainQueryClick, explainIsLoading: explainQueryResult.isLoading, disabled: !executeQuery.input, onUpdateQueryMode: setQueryMode, queryMode: queryMode, highlightedAction: lastUsedQueryAction }));
|
273
259
|
};
|
274
|
-
return (
|
275
|
-
|
276
|
-
|
260
|
+
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', {
|
261
|
+
top: true,
|
262
|
+
}), children: [_jsx("div", { className: b('monaco-wrapper'), children: _jsx("div", { className: b('monaco'), children: _jsx(MonacoEditor, { language: LANGUAGE_YQL_ID, value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount, theme: `vs-${theme}` }) }) }), renderControls()] }), _jsx("div", { className: b('pane-wrapper'), children: _jsx(Result, { executeQueryData: executeQueryResult.data, executeQueryError: executeQueryResult.error, explainQueryData: explainQueryResult.data, explainQueryError: explainQueryResult.error, explainQueryLoading: explainQueryResult.isLoading, resultVisibilityState: resultVisibilityState, onExpandResultHandler: onExpandResultHandler, onCollapseResultHandler: onCollapseResultHandler, type: type, theme: theme, resultType: resultType, tenantName: tenantName, path: path, showPreview: showPreview }) })] }), _jsx(SaveQueryDialog, {})] }));
|
277
263
|
}
|
278
264
|
const mapStateToProps = (state) => {
|
279
265
|
return {
|
@@ -287,6 +273,7 @@ const mapDispatchToProps = {
|
|
287
273
|
goToNextQuery,
|
288
274
|
setShowPreview,
|
289
275
|
setTenantPath,
|
276
|
+
setQueryAction,
|
290
277
|
};
|
291
278
|
export default connect(mapStateToProps, mapDispatchToProps)(QueryEditor);
|
292
279
|
function Result({ executeQueryData, executeQueryError, explainQueryData, explainQueryError, explainQueryLoading, resultVisibilityState, onExpandResultHandler, onCollapseResultHandler, type, theme, resultType, tenantName, path, showPreview, }) {
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type Monaco from 'monaco-editor';
|
2
|
+
export declare function getKeyBindings(monaco: typeof Monaco): {
|
3
|
+
sendQuery: number;
|
4
|
+
sendSelectedQuery: number;
|
5
|
+
selectPreviousQuery: number;
|
6
|
+
selectNextQuery: number;
|
7
|
+
saveQuery: number;
|
8
|
+
saveSelectedQuery: number;
|
9
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export function getKeyBindings(monaco) {
|
2
|
+
const { KeyMod, KeyCode } = monaco;
|
3
|
+
const ctrlKey = KeyMod.CtrlCmd;
|
4
|
+
/* eslint-disable no-bitwise */
|
5
|
+
return {
|
6
|
+
sendQuery: ctrlKey | KeyCode.Enter,
|
7
|
+
sendSelectedQuery: ctrlKey | KeyMod.Shift | monaco.KeyCode.Enter,
|
8
|
+
selectPreviousQuery: ctrlKey | KeyCode.UpArrow,
|
9
|
+
selectNextQuery: ctrlKey | KeyCode.DownArrow,
|
10
|
+
saveQuery: ctrlKey | KeyCode.KeyS,
|
11
|
+
saveSelectedQuery: ctrlKey | KeyMod.Shift | KeyCode.KeyS,
|
12
|
+
};
|
13
|
+
}
|
@@ -5,12 +5,10 @@ interface QueryEditorControlsProps {
|
|
5
5
|
runIsLoading: boolean;
|
6
6
|
onExplainButtonClick: (mode?: QueryMode) => void;
|
7
7
|
explainIsLoading: boolean;
|
8
|
-
onSaveQueryClick: (queryName: string) => void;
|
9
|
-
savedQueries: unknown;
|
10
8
|
disabled: boolean;
|
11
9
|
onUpdateQueryMode: (mode: QueryMode) => void;
|
12
10
|
queryMode: QueryMode;
|
13
11
|
highlightedAction: QueryAction;
|
14
12
|
}
|
15
|
-
export declare const QueryEditorControls: ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading,
|
13
|
+
export declare const QueryEditorControls: ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, onUpdateQueryMode, queryMode, highlightedAction, }: QueryEditorControlsProps) => import("react/jsx-runtime").JSX.Element;
|
16
14
|
export {};
|
@@ -5,7 +5,7 @@ import { Button, DropdownMenu, Icon } from '@gravity-ui/uikit';
|
|
5
5
|
import { LabelWithPopover } from '../../../../components/LabelWithPopover';
|
6
6
|
import { cn } from '../../../../utils/cn';
|
7
7
|
import { QUERY_MODES, QUERY_MODES_TITLES } from '../../../../utils/query';
|
8
|
-
import SaveQuery from '../SaveQuery/SaveQuery';
|
8
|
+
import { SaveQuery } from '../SaveQuery/SaveQuery';
|
9
9
|
import i18n from '../i18n';
|
10
10
|
import './QueryEditorControls.scss';
|
11
11
|
const queryModeSelectorQa = 'query-mode-selector';
|
@@ -33,7 +33,7 @@ const QueryModeSelectorOptions = {
|
|
33
33
|
description: i18n('method-description.pg'),
|
34
34
|
},
|
35
35
|
};
|
36
|
-
export const QueryEditorControls = ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading,
|
36
|
+
export const QueryEditorControls = ({ onRunButtonClick, runIsLoading, onExplainButtonClick, explainIsLoading, disabled, onUpdateQueryMode, queryMode, highlightedAction, }) => {
|
37
37
|
const querySelectorMenuItems = React.useMemo(() => {
|
38
38
|
return Object.entries(QueryModeSelectorOptions).map(([mode, { title, description }]) => {
|
39
39
|
return {
|
@@ -53,5 +53,5 @@ export const QueryEditorControls = ({ onRunButtonClick, runIsLoading, onExplainB
|
|
53
53
|
}, disabled: disabled, loading: explainIsLoading, view: explainView, children: "Explain" }), _jsx("div", { className: b('mode-selector'), children: _jsx(DropdownMenu, { items: querySelectorMenuItems, popupProps: {
|
54
54
|
className: b('mode-selector__popup'),
|
55
55
|
qa: queryModeSelectorPopupQa,
|
56
|
-
}, 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, {
|
56
|
+
}, 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 })] }));
|
57
57
|
};
|
@@ -1,6 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
import './SaveQuery.scss';
|
2
|
+
interface SaveQueryProps {
|
3
|
+
isSaveButtonDisabled?: boolean;
|
4
|
+
}
|
5
|
+
export declare function SaveQuery({ isSaveButtonDisabled }: SaveQueryProps): import("react/jsx-runtime").JSX.Element;
|
6
|
+
export declare function SaveQueryDialog(): import("react/jsx-runtime").JSX.Element;
|
7
|
+
export {};
|
@@ -1,70 +1,78 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React from 'react';
|
3
3
|
import { Button, Dialog, DropdownMenu, TextInput } from '@gravity-ui/uikit';
|
4
|
-
import
|
5
|
-
import { setQueryNameToEdit } from '../../../../store/reducers/saveQuery';
|
4
|
+
import { clearQueryNameToEdit, saveQuery, selectQueryAction, selectQueryName, setQueryAction, } from '../../../../store/reducers/queryActions/queryActions';
|
6
5
|
import { cn } from '../../../../utils/cn';
|
7
6
|
import { useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
7
|
+
import { useSavedQueries } from '../utils/useSavedQueries';
|
8
|
+
import i18n from './i18n';
|
8
9
|
import './SaveQuery.scss';
|
9
|
-
const b = cn('
|
10
|
-
function SaveQuery({
|
11
|
-
const singleClusterMode = useTypedSelector((state) => state.singleClusterMode);
|
12
|
-
const [isDialogVisible, setIsDialogVisible] = React.useState(false);
|
13
|
-
const [queryName, setQueryName] = React.useState('');
|
14
|
-
const [validationError, setValidationError] = React.useState(null);
|
15
|
-
const queryNameToEdit = useTypedSelector((state) => state.saveQuery);
|
10
|
+
const b = cn('ydb-save-query');
|
11
|
+
export function SaveQuery({ isSaveButtonDisabled }) {
|
16
12
|
const dispatch = useTypedDispatch();
|
13
|
+
const queryNameToEdit = useTypedSelector(selectQueryName);
|
17
14
|
const onSaveQueryClick = () => {
|
18
|
-
|
19
|
-
dispatch(
|
20
|
-
};
|
21
|
-
const onCloseDialog = () => {
|
22
|
-
setIsDialogVisible(false);
|
23
|
-
setQueryName('');
|
24
|
-
setValidationError(null);
|
25
|
-
};
|
26
|
-
const onQueryNameChange = (value) => {
|
27
|
-
setQueryName(value);
|
28
|
-
setValidationError(validateQueryName(value));
|
29
|
-
};
|
30
|
-
const validateQueryName = (value) => {
|
31
|
-
if (some(savedQueries, (q) => q.name.toLowerCase() === value.trim().toLowerCase())) {
|
32
|
-
return 'This name already exists';
|
33
|
-
}
|
34
|
-
return null;
|
35
|
-
};
|
36
|
-
const onSaveClick = () => {
|
37
|
-
if (!queryName || validationError) {
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
onSaveQuery(queryName);
|
41
|
-
onCloseDialog();
|
15
|
+
dispatch(setQueryAction('save'));
|
16
|
+
dispatch(clearQueryNameToEdit());
|
42
17
|
};
|
43
18
|
const onEditQueryClick = () => {
|
44
|
-
|
45
|
-
dispatch(
|
46
|
-
};
|
47
|
-
const renderDialog = () => {
|
48
|
-
return (_jsxs(Dialog, { open: isDialogVisible, hasCloseButton: false, size: "s", onClose: onCloseDialog, onEnterKeyDown: onSaveClick, children: [_jsx(Dialog.Header, { caption: "Save query" }), _jsxs(Dialog.Body, { className: b('dialog-body'), children: [singleClusterMode && (_jsx("div", { className: b('dialog-row'), children: "The query will be saved in your browser" })), _jsxs("div", { className: b('dialog-row'), children: [_jsx("label", { htmlFor: "queryName", className: b('field-title', 'required'), children: "Query name" }), _jsxs("div", { className: b('control-wrapper'), children: [_jsx(TextInput, { id: "queryName", placeholder: "Enter query name", value: queryName, onUpdate: onQueryNameChange, hasClear: true, autoFocus: true }), _jsx("span", { className: b('error'), children: validationError })] })] })] }), _jsx(Dialog.Footer, { textButtonApply: "Save", textButtonCancel: "Cancel", onClickButtonCancel: onCloseDialog, onClickButtonApply: onSaveClick, propsButtonApply: {
|
49
|
-
disabled: !queryName || Boolean(validationError),
|
50
|
-
} })] }));
|
19
|
+
dispatch(saveQuery(queryNameToEdit));
|
20
|
+
dispatch(clearQueryNameToEdit());
|
51
21
|
};
|
52
|
-
const renderSaveButton = (
|
53
|
-
return (_jsx(Button, { onClick:
|
22
|
+
const renderSaveButton = () => {
|
23
|
+
return (_jsx(Button, { onClick: onSaveQueryClick, disabled: isSaveButtonDisabled, children: i18n('action.save') }));
|
54
24
|
};
|
55
25
|
const renderSaveDropdownMenu = () => {
|
56
26
|
const items = [
|
57
27
|
{
|
58
28
|
action: onEditQueryClick,
|
59
|
-
text: '
|
29
|
+
text: i18n('action.edit-existing'),
|
60
30
|
},
|
61
31
|
{
|
62
32
|
action: onSaveQueryClick,
|
63
|
-
text: '
|
33
|
+
text: i18n('action.save-as-new'),
|
64
34
|
},
|
65
35
|
];
|
66
|
-
return (_jsx(DropdownMenu, { items: items,
|
36
|
+
return (_jsx(DropdownMenu, { items: items, renderSwitcher: (props) => (_jsx(Button, { ...props, disabled: isSaveButtonDisabled, children: i18n('action.edit') })), popupProps: { placement: 'top' } }));
|
37
|
+
};
|
38
|
+
return queryNameToEdit ? renderSaveDropdownMenu() : renderSaveButton();
|
39
|
+
}
|
40
|
+
export function SaveQueryDialog() {
|
41
|
+
const savedQueries = useSavedQueries();
|
42
|
+
const dispatch = useTypedDispatch();
|
43
|
+
const queryAction = useTypedSelector(selectQueryAction);
|
44
|
+
const [queryName, setQueryName] = React.useState('');
|
45
|
+
const [validationError, setValidationError] = React.useState();
|
46
|
+
const validateQueryName = (value) => {
|
47
|
+
if (!value) {
|
48
|
+
return i18n('error.name-not-empty');
|
49
|
+
}
|
50
|
+
if (savedQueries.some((q) => q.name.toLowerCase() === value.trim().toLowerCase())) {
|
51
|
+
return i18n('error.name-exists');
|
52
|
+
}
|
53
|
+
return undefined;
|
54
|
+
};
|
55
|
+
const onCloseDialog = () => {
|
56
|
+
dispatch(setQueryAction('idle'));
|
57
|
+
setQueryName('');
|
58
|
+
setValidationError(undefined);
|
59
|
+
};
|
60
|
+
const handleQueryNameChange = (value) => {
|
61
|
+
setQueryName(value);
|
62
|
+
setValidationError(undefined);
|
63
|
+
};
|
64
|
+
const onSaveClick = () => {
|
65
|
+
dispatch(saveQuery(queryName));
|
66
|
+
onCloseDialog();
|
67
67
|
};
|
68
|
-
return (_jsxs(
|
68
|
+
return (_jsxs(Dialog, { open: queryAction === 'save', hasCloseButton: false, size: "s", onClose: onCloseDialog, children: [_jsx(Dialog.Header, { caption: i18n('action.save') }), _jsxs("form", { onSubmit: (e) => {
|
69
|
+
e.preventDefault();
|
70
|
+
const validationError = validateQueryName(queryName);
|
71
|
+
setValidationError(validationError);
|
72
|
+
if (!validationError) {
|
73
|
+
onSaveClick();
|
74
|
+
}
|
75
|
+
}, children: [_jsxs(Dialog.Body, { className: b('dialog-body'), children: [_jsx("div", { className: b('dialog-row'), children: i18n('description') }), _jsxs("div", { className: b('dialog-row'), children: [_jsx("label", { htmlFor: "queryName", className: b('field-title', 'required'), children: i18n('input-label') }), _jsx("div", { className: b('control-wrapper'), children: _jsx(TextInput, { id: "queryName", placeholder: i18n('input-placeholder'), value: queryName, onUpdate: handleQueryNameChange, hasClear: true, autoFocus: true, autoComplete: false, validationState: validationError ? 'invalid' : undefined, errorMessage: validationError }) })] })] }), _jsx(Dialog.Footer, { textButtonApply: i18n('button-apply'), textButtonCancel: i18n('button-cancel'), onClickButtonCancel: onCloseDialog, propsButtonApply: {
|
76
|
+
type: 'submit',
|
77
|
+
} })] })] }));
|
69
78
|
}
|
70
|
-
export default SaveQuery;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
.
|
1
|
+
.ydb-save-query {
|
2
2
|
&__dialog-row {
|
3
3
|
display: flex;
|
4
4
|
align-items: flex-start;
|
@@ -25,37 +25,7 @@
|
|
25
25
|
&__control-wrapper {
|
26
26
|
display: flex;
|
27
27
|
flex-grow: 1;
|
28
|
-
flex-direction: column;
|
29
|
-
}
|
30
|
-
&__error {
|
31
|
-
display: inline-block;
|
32
|
-
|
33
|
-
height: 17px;
|
34
|
-
|
35
|
-
color: var(--g-color-text-danger);
|
36
|
-
}
|
37
|
-
&__embedded-tooltip {
|
38
|
-
display: flex;
|
39
|
-
align-items: center;
|
40
|
-
|
41
|
-
height: 100%;
|
42
|
-
margin-left: -10px;
|
43
28
|
|
44
|
-
|
45
|
-
&:hover {
|
46
|
-
cursor: pointer;
|
47
|
-
|
48
|
-
color: var(--g-color-text-complementary);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
&__embedded-popup {
|
53
|
-
max-width: 150px !important;
|
54
|
-
padding: 10px;
|
55
|
-
|
56
|
-
border-radius: 5px;
|
57
|
-
&::before {
|
58
|
-
border-radius: 5px;
|
59
|
-
}
|
29
|
+
min-height: 48px;
|
60
30
|
}
|
61
31
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"action.save": "Save query",
|
3
|
+
"action.edit": "Edit query",
|
4
|
+
"action.save-as-new": "Save as new",
|
5
|
+
"action.edit-existing": "Edit existing",
|
6
|
+
"description": "The query will be saved in your browser",
|
7
|
+
"input-label": "Query name",
|
8
|
+
"input-placeholder": "Enter query name",
|
9
|
+
"button-apply": "Save",
|
10
|
+
"button-cancel": "Cancel",
|
11
|
+
"error.name-exists": "This name already exists",
|
12
|
+
"error.name-not-empty": "Name should not be empty"
|
13
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
declare const _default: (key: "description" | "button-cancel" | "action.save" | "action.edit" | "action.save-as-new" | "action.edit-existing" | "input-label" | "input-placeholder" | "button-apply" | "error.name-exists" | "error.name-not-empty", params?: import("@gravity-ui/i18n").Params) => string;
|
2
|
+
export default _default;
|
@@ -1,11 +1,8 @@
|
|
1
|
-
import type { SavedQuery } from '../../../../types/store/query';
|
2
1
|
import './SavedQueries.scss';
|
3
2
|
interface SavedQueriesProps {
|
4
|
-
savedQueries: SavedQuery[];
|
5
3
|
changeUserInput: (value: {
|
6
4
|
input: string;
|
7
5
|
}) => void;
|
8
|
-
onDeleteQuery: (queryName: string) => void;
|
9
6
|
}
|
10
|
-
export declare const SavedQueries: ({
|
7
|
+
export declare const SavedQueries: ({ changeUserInput }: SavedQueriesProps) => import("react/jsx-runtime").JSX.Element;
|
11
8
|
export {};
|
@@ -5,20 +5,22 @@ import DataTable from '@gravity-ui/react-data-table';
|
|
5
5
|
import { Button, Dialog, Icon } from '@gravity-ui/uikit';
|
6
6
|
import { ResizeableDataTable } from '../../../../components/ResizeableDataTable/ResizeableDataTable';
|
7
7
|
import { TruncatedQuery } from '../../../../components/TruncatedQuery/TruncatedQuery';
|
8
|
-
import { setQueryNameToEdit } from '../../../../store/reducers/
|
8
|
+
import { deleteSavedQuery, setQueryNameToEdit, } from '../../../../store/reducers/queryActions/queryActions';
|
9
9
|
import { TENANT_QUERY_TABS_ID } from '../../../../store/reducers/tenant/constants';
|
10
10
|
import { setQueryTab } from '../../../../store/reducers/tenant/tenant';
|
11
11
|
import { cn } from '../../../../utils/cn';
|
12
12
|
import { useTypedDispatch } from '../../../../utils/hooks';
|
13
13
|
import { MAX_QUERY_HEIGHT, QUERY_TABLE_SETTINGS } from '../../utils/constants';
|
14
14
|
import i18n from '../i18n';
|
15
|
+
import { useSavedQueries } from '../utils/useSavedQueries';
|
15
16
|
import './SavedQueries.scss';
|
16
17
|
const b = cn('ydb-saved-queries');
|
17
18
|
const DeleteDialog = ({ visible, queryName, onCancelClick, onConfirmClick }) => {
|
18
19
|
return (_jsxs(Dialog, { open: visible, hasCloseButton: false, size: "s", onClose: onCancelClick, onEnterKeyDown: onConfirmClick, children: [_jsx(Dialog.Header, { caption: i18n('delete-dialog.header') }), _jsxs(Dialog.Body, { className: b('dialog-body'), children: [i18n('delete-dialog.question'), _jsx("span", { className: b('dialog-query-name'), children: ` ${queryName}?` })] }), _jsx(Dialog.Footer, { textButtonApply: i18n('delete-dialog.delete'), textButtonCancel: i18n('delete-dialog.cancel'), onClickButtonCancel: onCancelClick, onClickButtonApply: onConfirmClick })] }));
|
19
20
|
};
|
20
21
|
const SAVED_QUERIES_COLUMNS_WIDTH_LS_KEY = 'savedQueriesTableColumnsWidth';
|
21
|
-
export const SavedQueries = ({
|
22
|
+
export const SavedQueries = ({ changeUserInput }) => {
|
23
|
+
const savedQueries = useSavedQueries();
|
22
24
|
const dispatch = useTypedDispatch();
|
23
25
|
const [isDeleteDialogVisible, setIsDeleteDialogVisible] = React.useState(false);
|
24
26
|
const [queryNameToDelete, setQueryNameToDelete] = React.useState('');
|
@@ -31,7 +33,7 @@ export const SavedQueries = ({ savedQueries, changeUserInput, onDeleteQuery }) =
|
|
31
33
|
};
|
32
34
|
const onConfirmDeleteClick = () => {
|
33
35
|
closeDeleteDialog();
|
34
|
-
|
36
|
+
dispatch(deleteSavedQuery(queryNameToDelete));
|
35
37
|
setQueryNameToDelete('');
|
36
38
|
};
|
37
39
|
const onQueryClick = (queryText, queryName) => {
|
@@ -21,5 +21,6 @@
|
|
21
21
|
"action.send-query": "Send query",
|
22
22
|
"action.send-selected-query": "Send selected query",
|
23
23
|
"action.previous-query": "Previous query in history",
|
24
|
-
"action.next-query": "Next query in history"
|
24
|
+
"action.next-query": "Next query in history",
|
25
|
+
"action.save-query": "Save query"
|
25
26
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: (key: "controls.query-mode-selector_type" | "tabs.newQuery" | "tabs.history" | "tabs.saved" | "history.empty" | "saved.empty" | "delete-dialog.header" | "delete-dialog.question" | "delete-dialog.delete" | "delete-dialog.cancel" | "preview.title" | "preview.not-available" | "preview.close" | "method-description.script" | "method-description.scan" | "method-description.data" | "method-description.query" | "method-description.pg" | "query-duration.description" | "action.send-query" | "action.send-selected-query" | "action.previous-query" | "action.next-query", params?: import("@gravity-ui/i18n").Params) => string;
|
1
|
+
declare const _default: (key: "controls.query-mode-selector_type" | "tabs.newQuery" | "tabs.history" | "tabs.saved" | "history.empty" | "saved.empty" | "delete-dialog.header" | "delete-dialog.question" | "delete-dialog.delete" | "delete-dialog.cancel" | "preview.title" | "preview.not-available" | "preview.close" | "method-description.script" | "method-description.scan" | "method-description.data" | "method-description.query" | "method-description.pg" | "query-duration.description" | "action.send-query" | "action.send-selected-query" | "action.previous-query" | "action.next-query" | "action.save-query", params?: import("@gravity-ui/i18n").Params) => string;
|
2
2
|
export default _default;
|