Skip to content

Commit a25e0ea

Browse files
committed
fix(Tenant): hide preview button for index tables
1 parent 9280384 commit a25e0ea

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/containers/Tenant/ObjectSummary/ObjectSummary.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import CopyToClipboard from '../../../components/CopyToClipboard/CopyToClipboard
1616
import InfoViewer from '../../../components/InfoViewer/InfoViewer';
1717
import Icon from '../../../components/Icon/Icon';
1818

19-
import type {EPathType} from '../../../types/api/schema';
20-
import {isColumnEntityType, isTableType} from '../utils/schema';
19+
import type {EPathSubType, EPathType} from '../../../types/api/schema';
20+
import {isColumnEntityType, isIndexTable, isTableType} from '../utils/schema';
2121

2222
import {
2323
DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED,
@@ -71,6 +71,7 @@ function prepareOlapTableSchema(tableSchema: any) {
7171

7272
interface ObjectSummaryProps {
7373
type?: EPathType;
74+
subType?: EPathSubType;
7475
onCollapseSummary: VoidFunction;
7576
onExpandSummary: VoidFunction;
7677
isCollapsed: boolean;
@@ -229,10 +230,10 @@ function ObjectSummary(props: ObjectSummaryProps) {
229230
};
230231

231232
const renderCommonInfoControls = () => {
232-
const isTable = isTableType(props.type);
233+
const showPreview = isTableType(props.type) && !isIndexTable(props.subType);
233234
return (
234235
<React.Fragment>
235-
{isTable && (
236+
{showPreview && (
236237
<Button view="flat-secondary" onClick={onOpenPreview} title="Show preview">
237238
<Icon name="tablePreview" viewBox={'0 0 16 16'} height={16} width={16} />
238239
</Button>

src/containers/Tenant/Tenant.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ function Tenant(props: TenantProps) {
104104
};
105105
}, [tenantName, dispatch]);
106106

107-
const currentPathType = (currentItem as TEvDescribeSchemeResult).PathDescription?.Self?.PathType;
107+
const {
108+
PathType: currentPathType,
109+
PathSubType: currentPathSubType,
110+
} = (currentItem as TEvDescribeSchemeResult).PathDescription?.Self || {};
108111

109112
const onCollapseSummaryHandler = () => {
110113
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.triggerCollapse);
@@ -138,6 +141,7 @@ function Tenant(props: TenantProps) {
138141
>
139142
<ObjectSummary
140143
type={currentPathType}
144+
subType={currentPathSubType}
141145
onCollapseSummary={onCollapseSummaryHandler}
142146
onExpandSummary={onExpandSummaryHandler}
143147
isCollapsed={summaryVisibilityState.collapsed}

src/containers/Tenant/utils/schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export const mapPathTypeToNavigationTreeType = (
3535
export const isTableType = (type?: EPathType) =>
3636
mapPathTypeToNavigationTreeType(type) === 'table';
3737

38+
export const isIndexTable = (subType?: EPathSubType) =>
39+
mapTablePathSubTypeToNavigationTreeType(subType) === 'index_table';
40+
3841
export const isColumnEntityType = (type?: EPathType) =>
3942
type === EPathType.EPathTypeColumnStore ||
4043
type === EPathType.EPathTypeColumnTable;

0 commit comments

Comments
 (0)