Skip to content

Commit a376c85

Browse files
authored
Merge branch 'main' into astandrik.2079
2 parents 09afc42 + 714e7c7 commit a376c85

File tree

88 files changed

+1372
-841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1372
-841
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "8.22.1"
2+
".": "8.25.0"
33
}

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# Changelog
22

3+
## [8.25.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.24.1...v8.25.0) (2025-04-25)
4+
5+
6+
### Features
7+
8+
* add endpoint to connect to db code snippets ([#2198](https://github.com/ydb-platform/ydb-embedded-ui/issues/2198)) ([6e45802](https://github.com/ydb-platform/ydb-embedded-ui/commit/6e45802dc05baf3fe9ff5cef26e396964b8d827a))
9+
10+
11+
### Bug Fixes
12+
13+
* find out performance issue with big tables of nodes ([#2206](https://github.com/ydb-platform/ydb-embedded-ui/issues/2206)) ([5c22404](https://github.com/ydb-platform/ydb-embedded-ui/commit/5c2240477ef132c9b58ca96b2ae1549f6e410e3b))
14+
15+
## [8.24.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.24.0...v8.24.1) (2025-04-23)
16+
17+
18+
### Bug Fixes
19+
20+
* fix top shards path column and better overriding for advisor ([#2197](https://github.com/ydb-platform/ydb-embedded-ui/issues/2197)) ([57df88b](https://github.com/ydb-platform/ydb-embedded-ui/commit/57df88b27fc1e3315f1a901dd4ec7eaecbaf6fae))
21+
22+
## [8.24.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.23.0...v8.24.0) (2025-04-22)
23+
24+
25+
### Features
26+
27+
* add possibility to pass external columns ([#2187](https://github.com/ydb-platform/ydb-embedded-ui/issues/2187)) ([65b2e72](https://github.com/ydb-platform/ydb-embedded-ui/commit/65b2e72bd0516609257120b1b44d38f4336e368e))
28+
29+
## [8.23.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.22.1...v8.23.0) (2025-04-22)
30+
31+
32+
### Features
33+
34+
* enable basename for multi cluster version ([#2153](https://github.com/ydb-platform/ydb-embedded-ui/issues/2153)) ([91963b9](https://github.com/ydb-platform/ydb-embedded-ui/commit/91963b9e256be20682fbb0cbe9ae26b8d8f567a9))
35+
36+
37+
### Bug Fixes
38+
39+
* display query settings banner for non-default api call or txmode ([#2152](https://github.com/ydb-platform/ydb-embedded-ui/issues/2152)) ([395efc7](https://github.com/ydb-platform/ydb-embedded-ui/commit/395efc718645762bf4b0ddf2b419035790bb94a1))
40+
* fix wrong pdisk id order ([#2170](https://github.com/ydb-platform/ydb-embedded-ui/issues/2170)) ([c840b21](https://github.com/ydb-platform/ydb-embedded-ui/commit/c840b21d3d95441202ac7a97472fc556c7b50d04))
41+
* normalizePathSlashes should normalize multiple leading slashes ([#2186](https://github.com/ydb-platform/ydb-embedded-ui/issues/2186)) ([3e09755](https://github.com/ydb-platform/ydb-embedded-ui/commit/3e097553a949e85c3e779594207dc45d4876e465))
42+
* table in queries sorts by string values after backend sort ([#2183](https://github.com/ydb-platform/ydb-embedded-ui/issues/2183)) ([fc66fbe](https://github.com/ydb-platform/ydb-embedded-ui/commit/fc66fbef10e105aa22c7cce235996e0d8f6f70b2))
43+
* **TableGroup:** prevent content border overflow ([#2166](https://github.com/ydb-platform/ydb-embedded-ui/issues/2166)) ([7cefb6d](https://github.com/ydb-platform/ydb-embedded-ui/commit/7cefb6d025c84cc3669cfa7704f7aaa199f6c077))
44+
* **Tenants:** show create DB button only when table is loaded ([#2175](https://github.com/ydb-platform/ydb-embedded-ui/issues/2175)) ([b82e029](https://github.com/ydb-platform/ydb-embedded-ui/commit/b82e029c9040fc2ead47353e3992ce2d35179970))
45+
* update PDisk errors colors ([#2171](https://github.com/ydb-platform/ydb-embedded-ui/issues/2171)) ([2bb7b2d](https://github.com/ydb-platform/ydb-embedded-ui/commit/2bb7b2dac480b080c4e730ebde6d50b0c930b5f0))
46+
* **Versions:** should calculate minor version to get color ([#2180](https://github.com/ydb-platform/ydb-embedded-ui/issues/2180)) ([f77f933](https://github.com/ydb-platform/ydb-embedded-ui/commit/f77f933e3a47c772e5795c6c8546fb2ae4e18818))
47+
348
## [8.22.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v8.22.0...v8.22.1) (2025-04-15)
449

550

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ydb-embedded-ui",
3-
"version": "8.22.1",
3+
"version": "8.25.0",
44
"files": [
55
"dist"
66
],

src/assets/icons/overview.svg

Lines changed: 1 addition & 0 deletions
Loading

src/assets/icons/user-check.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/ConnectToDB/ConnectToDBDialog.tsx

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ import React from 'react';
22

33
import NiceModal from '@ebay/nice-modal-react';
44
import {Dialog, Tabs} from '@gravity-ui/uikit';
5+
import {skipToken} from '@reduxjs/toolkit/query';
56

7+
import {tenantApi} from '../../store/reducers/tenant/tenant';
68
import {cn} from '../../utils/cn';
9+
import {useTypedSelector} from '../../utils/hooks';
10+
import {useClusterNameFromQuery} from '../../utils/hooks/useDatabaseFromQuery';
711
import {LinkWithIcon} from '../LinkWithIcon/LinkWithIcon';
12+
import {LoaderWrapper} from '../LoaderWrapper/LoaderWrapper';
813
import {YDBSyntaxHighlighterLazy} from '../SyntaxHighlighter/lazy';
914

1015
import {getDocsLink} from './getDocsLink';
@@ -32,9 +37,26 @@ interface ConnectToDBDialogProps extends SnippetParams {
3237
onClose: VoidFunction;
3338
}
3439

35-
function ConnectToDBDialog({open, onClose, database, endpoint}: ConnectToDBDialogProps) {
40+
function ConnectToDBDialog({
41+
open,
42+
onClose,
43+
database,
44+
endpoint: endpointFromProps,
45+
}: ConnectToDBDialogProps) {
3646
const [activeTab, setActiveTab] = React.useState<SnippetLanguage>('bash');
3747

48+
const clusterName = useClusterNameFromQuery();
49+
const singleClusterMode = useTypedSelector((state) => state.singleClusterMode);
50+
51+
// If there is endpoint from props, we don't need to request tenant data
52+
// Also we should not request tenant data if we are in single cluster mode
53+
// Since there is no ControlPlane data in this case
54+
const shouldRequestTenantData = database && !endpointFromProps && !singleClusterMode;
55+
const params = shouldRequestTenantData ? {path: database, clusterName} : skipToken;
56+
const {currentData: tenantData, isLoading: isTenantDataLoading} =
57+
tenantApi.useGetTenantInfoQuery(params);
58+
const endpoint = endpointFromProps ?? tenantData?.ControlPlane?.endpoint;
59+
3860
const snippet = getSnippetCode(activeTab, {database, endpoint});
3961
const docsLink = getDocsLink(activeTab);
4062

@@ -52,12 +74,14 @@ function ConnectToDBDialog({open, onClose, database, endpoint}: ConnectToDBDialo
5274
className={b('dialog-tabs')}
5375
/>
5476
<div className={b('snippet-container')}>
55-
<YDBSyntaxHighlighterLazy
56-
language={activeTab}
57-
text={snippet}
58-
transparentBackground={false}
59-
withClipboardButton={{alwaysVisible: true}}
60-
/>
77+
<LoaderWrapper loading={isTenantDataLoading}>
78+
<YDBSyntaxHighlighterLazy
79+
language={activeTab}
80+
text={snippet}
81+
transparentBackground={false}
82+
withClipboardButton={{alwaysVisible: true}}
83+
/>
84+
</LoaderWrapper>
6185
</div>
6286
{docsLink ? (
6387
<LinkWithIcon
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import {prepareEndpoint} from '../utils';
2+
3+
describe('prepareEndpoint', () => {
4+
test('should remove all search params', () => {
5+
const input = 'grpc://example.com:2139/?database=/root/test&param=value';
6+
const expected = 'grpc://example.com:2139';
7+
expect(prepareEndpoint(input)).toBe(expected);
8+
});
9+
test('should handle URL without path or params', () => {
10+
const input = 'grpc://example.com:2139';
11+
const expected = 'grpc://example.com:2139';
12+
expect(prepareEndpoint(input)).toBe(expected);
13+
});
14+
test('should remove trailing slash from path', () => {
15+
const input = 'grpc://example.com:2139/';
16+
const expected = 'grpc://example.com:2139';
17+
expect(prepareEndpoint(input)).toBe(expected);
18+
});
19+
test('should handle complex paths', () => {
20+
const input = 'grpc://example.com:2139/multi/level/path/?database=/root/test';
21+
const expected = 'grpc://example.com:2139/multi/level/path';
22+
expect(prepareEndpoint(input)).toBe(expected);
23+
});
24+
test('should handle empty string', () => {
25+
expect(prepareEndpoint('')).toBeUndefined();
26+
});
27+
test('should handle undefined input', () => {
28+
expect(prepareEndpoint()).toBeUndefined();
29+
});
30+
test('should return undefined for invalid URL', () => {
31+
const input = 'invalid-url';
32+
expect(prepareEndpoint(input)).toBeUndefined();
33+
});
34+
});

src/components/ConnectToDB/snippets.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {SnippetLanguage, SnippetParams} from './types';
2+
import {prepareEndpoint} from './utils';
23

34
export function getBashSnippetCode({database, endpoint}: SnippetParams) {
45
return `ydb -e ${endpoint || '<endpoint>'} --token-file ~/my_token
@@ -198,7 +199,12 @@ with ydb.Driver(driver_config) as driver:
198199
print(driver.discovery_debug_details())`;
199200
}
200201

201-
export function getSnippetCode(lang: SnippetLanguage, params: SnippetParams) {
202+
export function getSnippetCode(lang: SnippetLanguage, rawParams: SnippetParams) {
203+
const params = {
204+
...rawParams,
205+
endpoint: prepareEndpoint(rawParams.endpoint),
206+
};
207+
202208
switch (lang) {
203209
case 'cpp': {
204210
return getCPPSnippetCode(params);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// We have endpoint in format grpc://example.com:2139/?database=/root/test
2+
// We need it to be like grpc://example.com:2139 to make code in snippets work
3+
// We pass database to snippets as a separate param
4+
export function prepareEndpoint(connectionString = '') {
5+
try {
6+
const urlObj = new URL(connectionString);
7+
urlObj.search = '';
8+
9+
let endpoint = urlObj.toString();
10+
11+
// Remove trailing slash if present
12+
if (endpoint.endsWith('/')) {
13+
endpoint = endpoint.slice(0, -1);
14+
}
15+
16+
return endpoint;
17+
} catch {
18+
return undefined;
19+
}
20+
}

0 commit comments

Comments
 (0)