ydb-embedded-ui 4.11.1 → 4.12.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.12.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.11.1...v4.12.0) (2023-08-02)
4
+
5
+
6
+ ### Features
7
+
8
+ * **Query:** add explanation to the query method selector ([#492](https://github.com/ydb-platform/ydb-embedded-ui/issues/492)) ([ce6407c](https://github.com/ydb-platform/ydb-embedded-ui/commit/ce6407c254e9498d5b3bce60298905ea72621766))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * fix tablet size ([#490](https://github.com/ydb-platform/ydb-embedded-ui/issues/490)) ([5a9b9d9](https://github.com/ydb-platform/ydb-embedded-ui/commit/5a9b9d955a882b1191502f5bac8eff5cf8638a52))
14
+ * **Search:** add minimum width to Search ([#494](https://github.com/ydb-platform/ydb-embedded-ui/issues/494)) ([2add1dc](https://github.com/ydb-platform/ydb-embedded-ui/commit/2add1dcb3c8a76297ab35600e6d8a8772a411b1d))
15
+
3
16
  ## [4.11.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.11.0...v4.11.1) (2023-07-27)
4
17
 
5
18
 
@@ -0,0 +1,3 @@
1
+ .ydb-search {
2
+ min-width: 100px;
3
+ }
@@ -1,7 +1,12 @@
1
1
  import {useRef, useEffect, useState} from 'react';
2
+ import cn from 'bem-cn-lite';
2
3
 
3
4
  import {TextInput} from '@gravity-ui/uikit';
4
5
 
6
+ import './Search.scss';
7
+
8
+ const b = cn('ydb-search');
9
+
5
10
  interface SearchProps {
6
11
  onChange: (value: string) => void;
7
12
  value?: string;
@@ -44,7 +49,7 @@ export const Search = ({
44
49
  <TextInput
45
50
  hasClear
46
51
  autoFocus
47
- className={className}
52
+ className={b(null, className)}
48
53
  placeholder={placeholder}
49
54
  value={searchValue}
50
55
  onUpdate={onSearchValueChange}
@@ -2,7 +2,7 @@
2
2
  display: flex;
3
3
  justify-content: center;
4
4
 
5
- width: 18px;
5
+ width: 23px;
6
6
  height: 18px;
7
7
 
8
8
  font-size: 10px;
@@ -56,4 +56,17 @@
56
56
  }
57
57
  }
58
58
  }
59
+
60
+ &__item-with-popover {
61
+ display: flex;
62
+ align-items: center;
63
+
64
+ height: 24px;
65
+
66
+ line-height: initial;
67
+ }
68
+
69
+ &__popover {
70
+ max-width: 340px;
71
+ }
59
72
  }
@@ -6,6 +6,7 @@ import {useMemo} from 'react';
6
6
  import type {QueryAction, QueryMode} from '../../../../types/store/query';
7
7
  import {QUERY_MODES} from '../../../../utils/query';
8
8
  import {Icon} from '../../../../components/Icon';
9
+ import {LabelWithPopover} from '../../../../components/LabelWithPopover';
9
10
 
10
11
  import SaveQuery from '../SaveQuery/SaveQuery';
11
12
 
@@ -18,16 +19,34 @@ const queryModeSelectorPopupQa = 'query-mode-selector-popup';
18
19
 
19
20
  const b = block('ydb-query-editor-controls');
20
21
 
21
- const OldQueryModeSelectorTitles = {
22
- [QUERY_MODES.script]: 'YQL Script',
23
- [QUERY_MODES.scan]: 'Scan',
22
+ const OldQueryModeSelectorOptions = {
23
+ [QUERY_MODES.script]: {
24
+ title: 'YQL Script',
25
+ description: i18n('method-description.script'),
26
+ },
27
+ [QUERY_MODES.scan]: {
28
+ title: 'Scan',
29
+ description: i18n('method-description.scan'),
30
+ },
24
31
  } as const;
25
32
 
26
- const QueryModeSelectorTitles = {
27
- [QUERY_MODES.script]: 'YQL Script',
28
- [QUERY_MODES.scan]: 'Scan',
29
- [QUERY_MODES.data]: 'Data',
30
- [QUERY_MODES.query]: 'YQL - QueryService',
33
+ const QueryModeSelectorOptions = {
34
+ [QUERY_MODES.script]: {
35
+ title: 'YQL Script',
36
+ description: i18n('method-description.script'),
37
+ },
38
+ [QUERY_MODES.scan]: {
39
+ title: 'Scan',
40
+ description: i18n('method-description.scan'),
41
+ },
42
+ [QUERY_MODES.data]: {
43
+ title: 'Data',
44
+ description: i18n('method-description.data'),
45
+ },
46
+ [QUERY_MODES.query]: {
47
+ title: 'YQL - QueryService',
48
+ description: i18n('method-description.query'),
49
+ },
31
50
  } as const;
32
51
 
33
52
  interface QueryEditorControlsProps {
@@ -58,13 +77,20 @@ export const QueryEditorControls = ({
58
77
  enableAdditionalQueryModes,
59
78
  }: QueryEditorControlsProps) => {
60
79
  const querySelectorMenuItems = useMemo(() => {
61
- const titles = enableAdditionalQueryModes
62
- ? QueryModeSelectorTitles
63
- : OldQueryModeSelectorTitles;
80
+ const options = enableAdditionalQueryModes
81
+ ? QueryModeSelectorOptions
82
+ : OldQueryModeSelectorOptions;
64
83
 
65
- return Object.entries(titles).map(([mode, title]) => {
84
+ return Object.entries(options).map(([mode, {title, description}]) => {
66
85
  return {
67
- text: title,
86
+ text: (
87
+ <LabelWithPopover
88
+ className={b('item-with-popover')}
89
+ contentClassName={b('popover')}
90
+ text={title}
91
+ popoverContent={description}
92
+ />
93
+ ),
68
94
  action: () => {
69
95
  onUpdateQueryMode(mode as QueryMode);
70
96
  },
@@ -119,7 +145,7 @@ export const QueryEditorControls = ({
119
145
  <Button className={b('mode-selector__button')} qa={queryModeSelectorQa}>
120
146
  <span className={b('mode-selector__button-content')}>
121
147
  {`${i18n('controls.query-mode-selector_type')} ${
122
- QueryModeSelectorTitles[queryMode]
148
+ QueryModeSelectorOptions[queryMode].title
123
149
  }`}
124
150
  <Icon name="chevron-down" width={16} height={16} />
125
151
  </span>
@@ -15,5 +15,10 @@
15
15
 
16
16
  "preview.title": "Preview",
17
17
  "preview.not-available": "Preview is not available",
18
- "preview.close": "Close preview"
18
+ "preview.close": "Close preview",
19
+
20
+ "method-description.script": "For YQL-scripts combining DDL and DML. API call: schema.scripting",
21
+ "method-description.scan": "Read-only queries, potentially reading a lot of data. API call: table.ExecuteScan",
22
+ "method-description.data": "DML queries for changing and fetching data in serialization mode. API call: table.executeDataQuery",
23
+ "method-description.query": "Any queries. An experimental API call supposed to replace all existing methods. API Call: query.ExecuteScript"
19
24
  }
@@ -15,5 +15,10 @@
15
15
 
16
16
  "preview.title": "Предпросмотр",
17
17
  "preview.not-available": "Предпросмотр недоступен",
18
- "preview.close": "Закрыть предпросмотр"
18
+ "preview.close": "Закрыть предпросмотр",
19
+
20
+ "method-description.script": "Для скриптов, совмещающих DDL и DML-конструкции. API call: schema.scripting",
21
+ "method-description.scan": "Только читающие запросы, потенциально читающие много данных. API call: table.ExecuteScan",
22
+ "method-description.data": "DML-запросы для изменения и выборки данных в режиме изоляции Serializable. API call: table.executeDataQuery",
23
+ "method-description.query": "Любые запросы. Экспериментальный перспективный метод, который в будущем заменит все остальные. API call: query.ExecuteScript"
19
24
  }
@@ -1,5 +1,7 @@
1
1
  import DataTable from '@gravity-ui/react-data-table';
2
2
 
3
+ import {EType} from '../types/api/tablet';
4
+
3
5
  const SECOND = 1000;
4
6
 
5
7
  export const AUTO_RELOAD_INTERVAL = 10 * SECOND;
@@ -40,17 +42,18 @@ export const TABLET_COLORS = {
40
42
  };
41
43
 
42
44
  export const TABLET_SYMBOLS = {
43
- OldTxProxy: 'P',
44
- TxProxy: 'P',
45
- BSController: 'BS',
46
- Dummy: 'DY',
47
- RTMRPartition: 'RP',
48
- PersQueueReadBalancer: 'PB',
49
- Cms: 'CM',
50
- BlockStorePartition: 'BP',
51
- BlockStoreVolume: 'BV',
52
- Console: 'CN',
53
- TenantSlotBroker: 'TB',
45
+ [EType.OldTxProxy]: 'P',
46
+ [EType.TxProxy]: 'P',
47
+ [EType.BSController]: 'BS',
48
+ [EType.Dummy]: 'DY',
49
+ [EType.RTMRPartition]: 'RP',
50
+ [EType.PersQueueReadBalancer]: 'PB',
51
+ [EType.Cms]: 'CM',
52
+ [EType.BlockStorePartition]: 'BP',
53
+ [EType.BlockStoreVolume]: 'BV',
54
+ [EType.Console]: 'CN',
55
+ [EType.TenantSlotBroker]: 'TB',
56
+ [EType.BlockStoreDiskRegistry]: 'BDR',
54
57
  };
55
58
 
56
59
  const isTabletType = (type: string): type is keyof typeof TABLET_SYMBOLS => type in TABLET_SYMBOLS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.11.1",
3
+ "version": "4.12.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],