Skip to content

Commit a61f8d9

Browse files
committed
fix: show topic preview if available
1 parent 66c82df commit a61f8d9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import React from 'react';
66
import {NavigationTree} from 'ydb-ui-components';
77

88
import {getConnectToDBDialog} from '../../../../components/ConnectToDB/ConnectToDBDialog';
9-
import {useCreateDirectoryFeatureAvailable} from '../../../../store/reducers/capabilities/hooks';
9+
import {
10+
useCreateDirectoryFeatureAvailable,
11+
useTopicDataAvailable,
12+
} from '../../../../store/reducers/capabilities/hooks';
1013
import {selectIsDirty, selectUserInput} from '../../../../store/reducers/query/query';
1114
import {schemaApi} from '../../../../store/reducers/schema/schema';
1215
import {tableSchemaDataApi} from '../../../../store/reducers/tableSchemaData';
@@ -44,6 +47,8 @@ export function SchemaTree(props: SchemaTreeProps) {
4447
{currentData: actionsSchemaData, isFetching: isActionsDataFetching},
4548
] = tableSchemaDataApi.useLazyGetTableSchemaDataQuery();
4649

50+
const isTopicPreviewAvailable = useTopicDataAvailable();
51+
4752
const [createDirectoryOpen, setCreateDirectoryOpen] = React.useState(false);
4853
const [parentPath, setParentPath] = React.useState('');
4954
const setSchemaTreeKey = useDispatchTreeKey();
@@ -171,9 +176,14 @@ export function SchemaTree(props: SchemaTreeProps) {
171176

172177
return [];
173178
}}
174-
renderAdditionalNodeElements={getSchemaControls(dispatch, {
175-
setActivePath: onActivePathUpdate,
176-
})}
179+
renderAdditionalNodeElements={getSchemaControls(
180+
dispatch,
181+
{
182+
setActivePath: onActivePathUpdate,
183+
},
184+
undefined,
185+
isTopicPreviewAvailable,
186+
)}
177187
activePath={currentPath}
178188
onActivePathUpdate={onActivePathUpdate}
179189
cache={false}

src/containers/Tenant/utils/controls.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const getSchemaControls =
5454
dispatch: React.Dispatch<any>,
5555
additionalEffects: ControlsAdditionalEffects,
5656
size?: ButtonSize,
57+
isTopicPreviewAvailable?: boolean,
5758
) =>
5859
(path: string, type: NavigationTreeNodeType) => {
5960
const options = bindActions(path, dispatch, additionalEffects);
@@ -71,7 +72,7 @@ export const getSchemaControls =
7172
column_table: openPreview,
7273

7374
index_table: undefined,
74-
topic: openPreview,
75+
topic: isTopicPreviewAvailable ? openPreview : undefined,
7576
stream: undefined,
7677

7778
index: undefined,

0 commit comments

Comments
 (0)