Skip to content

Commit 2dd278e

Browse files
committed
fix: review
1 parent d68d4c9 commit 2dd278e

File tree

8 files changed

+37
-22
lines changed

8 files changed

+37
-22
lines changed

package-lock.json

Lines changed: 4 additions & 4 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
@@ -59,7 +59,7 @@
5959
"use-query-params": "^2.2.1",
6060
"uuid": "^10.0.0",
6161
"web-vitals": "^1.1.2",
62-
"ydb-ui-components": "^4.6.0",
62+
"ydb-ui-components": "^4.7.0",
6363
"zod": "^3.24.1"
6464
},
6565
"scripts": {

src/containers/Tenant/ObjectSummary/SchemaTree/SchemaTree.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
nodeTableTypeToPathType,
2525
} from '../../utils/schema';
2626
import {getActions} from '../../utils/schemaActions';
27+
import type {DropdownItem, TreeNodeMeta} from '../../utils/types';
2728
import {CreateDirectoryDialog} from '../CreateDirectoryDialog/CreateDirectoryDialog';
2829
import {useDispatchTreeKey, useTreeKey} from '../UpdateTreeContext';
2930
import {isDomain} from '../transformPath';
@@ -96,6 +97,7 @@ export function SchemaTree(props: SchemaTreeProps) {
9697
// FIXME: should only be explicitly set to true for tables with indexes
9798
// at the moment of writing there is no property to determine this, fix later
9899
expandable: !isChildless,
100+
meta: {subType: PathSubType},
99101
};
100102
});
101103

@@ -158,7 +160,7 @@ export function SchemaTree(props: SchemaTreeProps) {
158160
parentPath={parentPath}
159161
onSuccess={handleSuccessSubmit}
160162
/>
161-
<NavigationTree
163+
<NavigationTree<DropdownItem, TreeNodeMeta>
162164
key={schemaTreeKey}
163165
rootState={{
164166
path: rootPath,

src/containers/Tenant/Query/Preview/Preview.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
gap: var(--g-spacing-1);
2929
}
3030
&__message-container {
31-
padding: 15px 20px;
31+
padding: var(--g-spacing-3) 0;
3232
}
3333

3434
&__result {

src/containers/Tenant/Query/Preview/components/PreviewView.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,23 @@ export function Preview({
6060
};
6161

6262
const renderContent = () => {
63-
let message;
64-
6563
if (error) {
66-
message = (
64+
return (
6765
<div className={b('message-container', 'error')}>
6866
{parseQueryErrorToString(error)}
6967
</div>
7068
);
7169
}
72-
if (message) {
73-
return message;
74-
}
75-
return <div className={b('result')}>{renderResult?.()}</div>;
70+
return renderResult?.();
7671
};
7772

7873
return (
7974
<LoaderWrapper loading={loading}>
8075
<div className={b()}>
8176
{renderHeader()}
82-
<Fullscreen>{renderContent()}</Fullscreen>
77+
<Fullscreen>
78+
<div className={b('result')}>{renderContent()}</div>
79+
</Fullscreen>
8380
</div>
8481
</LoaderWrapper>
8582
);

src/containers/Tenant/utils/controls.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import type {ButtonSize} from '@gravity-ui/uikit';
22
import {Button, Icon} from '@gravity-ui/uikit';
3-
import type {NavigationTreeNodeType, NavigationTreeProps} from 'ydb-ui-components';
3+
import type {NavigationTreeNodeType} from 'ydb-ui-components';
44

55
import {api} from '../../../store/reducers/api';
66
import {setShowPreview} from '../../../store/reducers/schema/schema';
77
import {TENANT_PAGES_IDS, TENANT_QUERY_TABS_ID} from '../../../store/reducers/tenant/constants';
88
import {setQueryTab, setTenantPage} from '../../../store/reducers/tenant/tenant';
99
import i18n from '../i18n';
1010

11+
import type {YdbNavigationTreeProps} from './types';
12+
1113
import EyeIcon from '@gravity-ui/icons/svgs/eye.svg';
1214

1315
interface ControlsAdditionalEffects {
@@ -32,7 +34,7 @@ const bindActions = (
3234
};
3335
};
3436

35-
type Controls = ReturnType<Required<NavigationTreeProps>['renderAdditionalNodeElements']>;
37+
type Controls = ReturnType<Required<YdbNavigationTreeProps>['renderAdditionalNodeElements']>;
3638

3739
type SummaryType = 'preview';
3840

@@ -55,8 +57,8 @@ export const getSchemaControls =
5557
additionalEffects: ControlsAdditionalEffects,
5658
size?: ButtonSize,
5759
isTopicPreviewAvailable?: boolean,
58-
) =>
59-
(path: string, type: NavigationTreeNodeType) => {
60+
): YdbNavigationTreeProps['renderAdditionalNodeElements'] =>
61+
(path, type, meta) => {
6062
const options = bindActions(path, dispatch, additionalEffects);
6163
const openPreview = getPreviewControl(options, size);
6264

@@ -72,7 +74,7 @@ export const getSchemaControls =
7274
column_table: openPreview,
7375

7476
index_table: undefined,
75-
topic: isTopicPreviewAvailable ? openPreview : undefined,
77+
topic: isTopicPreviewAvailable && !meta?.subType ? openPreview : undefined,
7678
stream: undefined,
7779

7880
index: undefined,

src/containers/Tenant/utils/schemaActions.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Copy, PlugConnection} from '@gravity-ui/icons';
22
import {Flex, Spin} from '@gravity-ui/uikit';
33
import copy from 'copy-to-clipboard';
4-
import type {NavigationTreeNodeType, NavigationTreeProps} from 'ydb-ui-components';
4+
import type {NavigationTreeNodeType} from 'ydb-ui-components';
55

66
import type {SnippetParams} from '../../../components/ConnectToDB/types';
77
import type {AppDispatch} from '../../../store';
@@ -39,6 +39,7 @@ import {
3939
selectQueryTemplate,
4040
upsertQueryTemplate,
4141
} from './schemaQueryTemplates';
42+
import type {YdbNavigationTreeProps} from './types';
4243

4344
interface ActionsAdditionalParams {
4445
setActivePath: (path: string) => void;
@@ -139,7 +140,7 @@ const bindActions = (
139140
};
140141
};
141142

142-
type ActionsSet = ReturnType<Required<NavigationTreeProps>['getActions']>;
143+
type ActionsSet = ReturnType<Required<YdbNavigationTreeProps>['getActions']>;
143144

144145
interface ActionConfig {
145146
text: string;

src/containers/Tenant/utils/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type {NavigationTreeProps} from 'ydb-ui-components';
2+
3+
export type DropdownItem = {
4+
text: string;
5+
action: () => void;
6+
iconEnd?: React.ReactNode;
7+
};
8+
9+
export type TreeNodeMeta = {
10+
subType?: string;
11+
};
12+
13+
export type YdbNavigationTreeProps = NavigationTreeProps<DropdownItem, TreeNodeMeta | undefined>;

0 commit comments

Comments
 (0)