ydb-embedded-ui 6.9.2 → 6.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. package/README.md +7 -10
  2. package/dist/components/NodeHostWrapper/NodeHostWrapper.scss +1 -1
  3. package/dist/components/{VirtualTable/VirtualTable.d.ts → PaginatedTable/PaginatedTable.d.ts} +3 -3
  4. package/dist/components/{VirtualTable/VirtualTable.js → PaginatedTable/PaginatedTable.js} +4 -4
  5. package/dist/components/{VirtualTable/VirtualTable.scss → PaginatedTable/PaginatedTable.scss} +11 -11
  6. package/dist/components/PaginatedTable/ResizeablePaginatedTable.d.ts +6 -0
  7. package/dist/components/{VirtualTable/ResizeableVirtualTable.js → PaginatedTable/ResizeablePaginatedTable.js} +3 -3
  8. package/dist/components/{VirtualTable → PaginatedTable}/i18n/index.js +1 -1
  9. package/dist/components/PaginatedTable/index.d.ts +4 -0
  10. package/dist/components/PaginatedTable/index.js +4 -0
  11. package/dist/components/{VirtualTable → PaginatedTable}/reducer.d.ts +3 -3
  12. package/dist/components/{VirtualTable → PaginatedTable}/reducer.js +1 -1
  13. package/dist/components/PaginatedTable/shared.js +2 -0
  14. package/dist/components/{VirtualTable → PaginatedTable}/types.d.ts +2 -2
  15. package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +1 -1
  16. package/dist/components/VDisk/VDisk.js +19 -6
  17. package/dist/containers/App/App.d.ts +1 -1
  18. package/dist/containers/App/App.js +2 -2
  19. package/dist/containers/App/App.scss +1 -1
  20. package/dist/containers/AppWithClusters/AppWithClusters.js +1 -10
  21. package/dist/containers/AsideNavigation/Navigation.d.ts +1 -1
  22. package/dist/containers/Heatmap/Histogram/Histogram.js +3 -3
  23. package/dist/containers/Heatmap/util.js +2 -1
  24. package/dist/containers/Nodes/NodesWrapper.js +5 -5
  25. package/dist/containers/Nodes/{VirtualNodes.d.ts → PaginatedNodes.d.ts} +1 -1
  26. package/dist/containers/Nodes/{VirtualNodes.js → PaginatedNodes.js} +3 -3
  27. package/dist/containers/Nodes/getNodesColumns.d.ts +2 -2
  28. package/dist/containers/Storage/PDisk/PDisk.js +10 -2
  29. package/dist/containers/Storage/{VirtualStorage.d.ts → PaginatedStorage.d.ts} +2 -2
  30. package/dist/containers/Storage/{VirtualStorage.js → PaginatedStorage.js} +5 -5
  31. package/dist/containers/Storage/Storage.js +3 -12
  32. package/dist/containers/Storage/StorageGroups/{VirtualStorageGroups.d.ts → PaginatedStorageGroups.d.ts} +3 -3
  33. package/dist/containers/Storage/StorageGroups/{VirtualStorageGroups.js → PaginatedStorageGroups.js} +3 -3
  34. package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +2 -2
  35. package/dist/containers/Storage/StorageNodes/{VirtualStorageNodes.d.ts → PaginatedStorageNodes.d.ts} +3 -3
  36. package/dist/containers/Storage/StorageNodes/{VirtualStorageNodes.js → PaginatedStorageNodes.js} +3 -3
  37. package/dist/containers/Storage/StorageWrapper.js +5 -5
  38. package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +1 -1
  39. package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.scss +0 -5
  40. package/dist/containers/Tenant/Query/Query.js +2 -8
  41. package/dist/containers/Tenant/Query/Query.scss +1 -1
  42. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +2 -0
  43. package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +23 -36
  44. package/dist/containers/Tenant/Query/QueryEditor/keybindings.d.ts +9 -0
  45. package/dist/containers/Tenant/Query/QueryEditor/keybindings.js +13 -0
  46. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +1 -3
  47. package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +3 -3
  48. package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.d.ts +7 -6
  49. package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.js +55 -47
  50. package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.scss +2 -32
  51. package/dist/containers/Tenant/Query/SaveQuery/i18n/en.json +13 -0
  52. package/dist/containers/Tenant/Query/SaveQuery/i18n/index.d.ts +2 -0
  53. package/dist/containers/Tenant/Query/SaveQuery/i18n/index.js +4 -0
  54. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.d.ts +1 -4
  55. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.js +5 -3
  56. package/dist/containers/Tenant/Query/i18n/en.json +2 -1
  57. package/dist/containers/Tenant/Query/i18n/index.d.ts +1 -1
  58. package/dist/containers/Tenant/Query/utils/useSavedQueries.d.ts +2 -0
  59. package/dist/containers/Tenant/Query/utils/useSavedQueries.js +5 -0
  60. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +6 -2
  61. package/dist/containers/Tenant/utils/schemaActions.d.ts +1 -1
  62. package/dist/containers/Tenant/utils/schemaActions.js +10 -4
  63. package/dist/containers/UserSettings/UserSettings.d.ts +1 -1
  64. package/dist/containers/UserSettings/UserSettings.js +1 -2
  65. package/dist/containers/UserSettings/i18n/en.json +9 -4
  66. package/dist/containers/UserSettings/i18n/index.d.ts +1 -1
  67. package/dist/containers/UserSettings/settings.d.ts +7 -2
  68. package/dist/containers/UserSettings/settings.js +38 -14
  69. package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +1 -2
  70. package/dist/lib.d.ts +1 -1
  71. package/dist/lib.js +1 -1
  72. package/dist/services/settings.d.ts +2 -0
  73. package/dist/services/settings.js +4 -2
  74. package/dist/store/configureStore.d.ts +4 -14
  75. package/dist/store/defaultStore.d.ts +2 -7
  76. package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +20 -20
  77. package/dist/store/reducers/index.d.ts +3 -13
  78. package/dist/store/reducers/index.js +2 -2
  79. package/dist/store/reducers/node/selectors.d.ts +1 -1
  80. package/dist/store/reducers/nodesList.d.ts +1 -1
  81. package/dist/store/reducers/queryActions/queryActions.d.ts +34 -0
  82. package/dist/store/reducers/queryActions/queryActions.js +58 -0
  83. package/dist/store/reducers/queryActions/types.d.ts +5 -0
  84. package/dist/store/reducers/queryActions/types.js +1 -0
  85. package/dist/store/reducers/storage/storage.js +1 -1
  86. package/dist/store/reducers/tablets.d.ts +5 -5
  87. package/dist/store/reducers/tabletsFilters.d.ts +1 -1
  88. package/dist/store/reducers/tenants/selectors.d.ts +9 -9
  89. package/dist/store/reducers/topic.d.ts +15 -15
  90. package/dist/styles/mixins.scss +8 -0
  91. package/dist/utils/constants.d.ts +3 -1
  92. package/dist/utils/constants.js +5 -2
  93. package/dist/utils/disks/prepareDisks.js +4 -2
  94. package/dist/utils/hooks/index.d.ts +0 -2
  95. package/dist/utils/hooks/index.js +0 -2
  96. package/package.json +1 -1
  97. package/dist/components/VirtualTable/ResizeableVirtualTable.d.ts +0 -6
  98. package/dist/components/VirtualTable/index.d.ts +0 -3
  99. package/dist/components/VirtualTable/index.js +0 -3
  100. package/dist/components/VirtualTable/shared.js +0 -2
  101. package/dist/containers/AppWithClusters/i18n/en.json +0 -4
  102. package/dist/containers/AppWithClusters/i18n/index.d.ts +0 -2
  103. package/dist/containers/AppWithClusters/i18n/index.js +0 -5
  104. package/dist/containers/AppWithClusters/i18n/ru.json +0 -4
  105. package/dist/store/reducers/saveQuery.d.ts +0 -12
  106. package/dist/store/reducers/saveQuery.js +0 -25
  107. package/dist/utils/hooks/useNodesRequestParams.d.ts +0 -15
  108. package/dist/utils/hooks/useNodesRequestParams.js +0 -23
  109. package/dist/utils/hooks/useStorageRequestParams.d.ts +0 -8
  110. package/dist/utils/hooks/useStorageRequestParams.js +0 -20
  111. /package/dist/components/{VirtualTable → PaginatedTable}/ResizeHandler.d.ts +0 -0
  112. /package/dist/components/{VirtualTable → PaginatedTable}/ResizeHandler.js +0 -0
  113. /package/dist/components/{VirtualTable → PaginatedTable}/TableChunk.d.ts +0 -0
  114. /package/dist/components/{VirtualTable → PaginatedTable}/TableChunk.js +0 -0
  115. /package/dist/components/{VirtualTable → PaginatedTable}/TableHead.d.ts +0 -0
  116. /package/dist/components/{VirtualTable → PaginatedTable}/TableHead.js +0 -0
  117. /package/dist/components/{VirtualTable → PaginatedTable}/TableRow.d.ts +0 -0
  118. /package/dist/components/{VirtualTable → PaginatedTable}/TableRow.js +0 -0
  119. /package/dist/components/{VirtualTable → PaginatedTable}/constants.d.ts +0 -0
  120. /package/dist/components/{VirtualTable → PaginatedTable}/constants.js +0 -0
  121. /package/dist/components/{VirtualTable → PaginatedTable}/i18n/en.json +0 -0
  122. /package/dist/components/{VirtualTable → PaginatedTable}/i18n/index.d.ts +0 -0
  123. /package/dist/components/{VirtualTable → PaginatedTable}/i18n/ru.json +0 -0
  124. /package/dist/components/{VirtualTable → PaginatedTable}/shared.d.ts +0 -0
  125. /package/dist/components/{VirtualTable → PaginatedTable}/types.js +0 -0
  126. /package/dist/components/{VirtualTable → PaginatedTable}/useIntersectionObserver.d.ts +0 -0
  127. /package/dist/components/{VirtualTable → PaginatedTable}/useIntersectionObserver.js +0 -0
  128. /package/dist/components/{VirtualTable → PaginatedTable}/utils.d.ts +0 -0
  129. /package/dist/components/{VirtualTable → PaginatedTable}/utils.js +0 -0
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { ResizeableVirtualTable } from '../../../components/VirtualTable/ResizeableVirtualTable';
3
+ import { ResizeablePaginatedTable } from '../../../components/PaginatedTable';
4
4
  import { VISIBLE_ENTITIES } from '../../../store/reducers/storage/constants';
5
5
  import { StorageGroupsEmptyDataMessage } from './StorageGroupsEmptyDataMessage';
6
6
  import { getStorageGroups } from './getGroups';
7
7
  import { STORAGE_GROUPS_COLUMNS_WIDTH_LS_KEY, getPreparedStorageGroupsColumns, } from './getStorageGroupsColumns';
8
8
  import i18n from './i18n';
9
- export const VirtualStorageGroups = ({ searchValue, visibleEntities, tenant, nodeId, nodesMap, onShowAll, parentContainer, renderControls, renderErrorMessage, }) => {
9
+ export const PaginatedStorageGroups = ({ searchValue, visibleEntities, tenant, nodeId, nodesMap, onShowAll, parentContainer, renderControls, renderErrorMessage, }) => {
10
10
  const filters = React.useMemo(() => {
11
11
  return [searchValue, visibleEntities, tenant, nodeId];
12
12
  }, [searchValue, visibleEntities, tenant, nodeId]);
@@ -31,5 +31,5 @@ export const VirtualStorageGroups = ({ searchValue, visibleEntities, tenant, nod
31
31
  }
32
32
  return i18n('empty.default');
33
33
  };
34
- return (_jsx(ResizeableVirtualTable, { columnsWidthLSKey: STORAGE_GROUPS_COLUMNS_WIDTH_LS_KEY, parentContainer: parentContainer, columns: columns, fetchData: fetchData, limit: 50, renderControls: renderControls, renderErrorMessage: renderErrorMessage, renderEmptyDataMessage: renderEmptyDataMessage, dependencyArray: filters }));
34
+ return (_jsx(ResizeablePaginatedTable, { columnsWidthLSKey: STORAGE_GROUPS_COLUMNS_WIDTH_LS_KEY, parentContainer: parentContainer, columns: columns, fetchData: fetchData, limit: 50, renderControls: renderControls, renderErrorMessage: renderErrorMessage, renderEmptyDataMessage: renderEmptyDataMessage, dependencyArray: filters }));
35
35
  };
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { Column as DataTableColumn } from '@gravity-ui/react-data-table';
3
- import type { Column as VirtualTableColumn } from '../../../components/VirtualTable';
3
+ import type { Column as PaginatedTableColumn } from '../../../components/PaginatedTable';
4
4
  import type { PreparedStorageGroup, VisibleEntities } from '../../../store/reducers/storage/types';
5
5
  import type { NodesMap } from '../../../types/store/nodesList';
6
6
  import './StorageGroups.scss';
7
7
  export declare const STORAGE_GROUPS_COLUMNS_WIDTH_LS_KEY = "storageGroupsColumnsWidth";
8
- type StorageGroupsColumn = VirtualTableColumn<PreparedStorageGroup> & DataTableColumn<PreparedStorageGroup>;
8
+ type StorageGroupsColumn = PaginatedTableColumn<PreparedStorageGroup> & DataTableColumn<PreparedStorageGroup>;
9
9
  export declare const GROUPS_COLUMNS_IDS: {
10
10
  readonly PoolName: "PoolName";
11
11
  readonly MediaType: "MediaType";
@@ -1,8 +1,8 @@
1
- import type { RenderControls, RenderErrorMessage } from '../../../components/VirtualTable';
1
+ import type { RenderControls, RenderErrorMessage } from '../../../components/PaginatedTable';
2
2
  import type { VisibleEntities } from '../../../store/reducers/storage/types';
3
3
  import type { AdditionalNodesProps } from '../../../types/additionalProps';
4
4
  import { NodesUptimeFilterValues } from '../../../utils/nodes';
5
- interface VirtualStorageNodesProps {
5
+ interface PaginatedStorageNodesProps {
6
6
  searchValue: string;
7
7
  visibleEntities: VisibleEntities;
8
8
  nodesUptimeFilter: NodesUptimeFilterValues;
@@ -13,5 +13,5 @@ interface VirtualStorageNodesProps {
13
13
  renderControls: RenderControls;
14
14
  renderErrorMessage: RenderErrorMessage;
15
15
  }
16
- export declare const VirtualStorageNodes: ({ searchValue, visibleEntities, nodesUptimeFilter, tenant, additionalNodesProps, onShowAll, parentContainer, renderControls, renderErrorMessage, }: VirtualStorageNodesProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const PaginatedStorageNodes: ({ searchValue, visibleEntities, nodesUptimeFilter, tenant, additionalNodesProps, onShowAll, parentContainer, renderControls, renderErrorMessage, }: PaginatedStorageNodesProps) => import("react/jsx-runtime").JSX.Element;
17
17
  export {};
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { ResizeableVirtualTable } from '../../../components/VirtualTable/ResizeableVirtualTable';
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 VirtualStorageNodes = ({ searchValue, visibleEntities, nodesUptimeFilter, tenant, additionalNodesProps, onShowAll, parentContainer, renderControls, renderErrorMessage, }) => {
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(ResizeableVirtualTable, { 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 }));
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 { USE_BACKEND_PARAMS_FOR_TABLES_KEY } from '../../utils/constants';
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 [useVirtualTable] = useSetting(USE_BACKEND_PARAMS_FOR_TABLES_KEY);
8
- if (useVirtualTable) {
9
- return _jsx(VirtualStorage, { parentContainer: parentContainer, ...props });
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
  };
@@ -46,7 +46,7 @@
46
46
  }
47
47
 
48
48
  .data-table__sticky_moving,
49
- .ydb-virtual-table__head {
49
+ .ydb-paginated-table__head {
50
50
  top: 46px !important;
51
51
  }
52
52
  }
@@ -47,13 +47,8 @@
47
47
  &__inspector {
48
48
  overflow-y: auto;
49
49
 
50
- width: 100%;
51
50
  padding: 15px 20px;
52
51
  @include json-tree-styles();
53
- &
54
- .json-inspector__leaf.json-inspector__leaf_root.json-inspector__leaf_expanded.json-inspector__leaf_composite {
55
- max-width: calc(100% - 50px);
56
- }
57
52
 
58
53
  &_fullscreen {
59
54
  padding: 10px;
@@ -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 { SAVED_QUERIES_KEY } from '../../../utils/constants';
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 (_jsx(SavedQueries, { changeUserInput: handleUserInputChange, savedQueries: savedQueries, onDeleteQuery: handleDeleteQuery }));
30
+ return _jsx(SavedQueries, { changeUserInput: handleUserInputChange });
37
31
  }
38
32
  default: {
39
33
  return null;
@@ -1,7 +1,7 @@
1
1
  @import '../../../styles/mixins.scss';
2
2
 
3
3
  .ydb-query {
4
- max-height: 100%;
4
+ max-height: calc(100% - 56px); // 56px - height of TenantNavigation
5
5
  @include flex-container();
6
6
 
7
7
  &__tabs {
@@ -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, SAVED_QUERIES_KEY, } from '../../../../utils/constants';
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, onSaveQueryClick: onSaveQueryHandler, savedQueries: savedQueries, disabled: !executeQuery.input, onUpdateQueryMode: setQueryMode, queryMode: queryMode, highlightedAction: lastUsedQueryAction }));
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 (_jsx("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', {
275
- top: true,
276
- }), 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 }) })] }) }));
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, onSaveQueryClick, savedQueries, disabled, onUpdateQueryMode, queryMode, highlightedAction, }: QueryEditorControlsProps) => import("react/jsx-runtime").JSX.Element;
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, onSaveQueryClick, savedQueries, disabled, onUpdateQueryMode, queryMode, highlightedAction, }) => {
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, { savedQueries: savedQueries, onSaveQuery: onSaveQueryClick, saveButtonDisabled: disabled })] }));
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
- export default SaveQuery;
2
- declare function SaveQuery({ savedQueries, onSaveQuery, saveButtonDisabled }: {
3
- savedQueries: any;
4
- onSaveQuery: any;
5
- saveButtonDisabled: any;
6
- }): import("react/jsx-runtime").JSX.Element;
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 some from 'lodash/some';
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('kv-save-query');
10
- function SaveQuery({ savedQueries, onSaveQuery, saveButtonDisabled }) {
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
- setIsDialogVisible(true);
19
- dispatch(setQueryNameToEdit(null));
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
- onSaveQuery(queryNameToEdit);
45
- dispatch(setQueryNameToEdit(null));
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 = (onClick) => {
53
- return (_jsx(Button, { onClick: onClick, disabled: saveButtonDisabled, children: queryNameToEdit ? 'Edit query' : 'Save query' }));
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: 'Edit existing',
29
+ text: i18n('action.edit-existing'),
60
30
  },
61
31
  {
62
32
  action: onSaveQueryClick,
63
- text: 'Save as new',
33
+ text: i18n('action.save-as-new'),
64
34
  },
65
35
  ];
66
- return (_jsx(DropdownMenu, { items: items, switcher: renderSaveButton(), popupPlacement: ['top'] }));
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(React.Fragment, { children: [queryNameToEdit ? renderSaveDropdownMenu() : renderSaveButton(onSaveQueryClick), isDialogVisible && renderDialog()] }));
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
- .kv-save-query {
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
- color: var(--g-color-text-secondary);
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;
@@ -0,0 +1,4 @@
1
+ import { registerKeysets } from '../../../../../utils/i18n';
2
+ import en from './en.json';
3
+ const COMPONENT = 'ydb-save-query-dialog';
4
+ export default registerKeysets(COMPONENT, { en });
@@ -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: ({ savedQueries, changeUserInput, onDeleteQuery }: SavedQueriesProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const SavedQueries: ({ changeUserInput }: SavedQueriesProps) => import("react/jsx-runtime").JSX.Element;
11
8
  export {};