1- import { useEffect , useMemo , useReducer } from 'react' ;
1+ import { useEffect , useReducer } from 'react' ;
22import { useDispatch , useSelector } from 'react-redux' ;
33import cn from 'bem-cn-lite' ;
44import { useLocation } from 'react-router' ;
@@ -22,28 +22,12 @@ import {
2222//@ts -ignore
2323import { getTenantInfo , clearTenant } from '../../store/reducers/tenant' ;
2424import routes , { CLUSTER_PAGES , createHref } from '../../routes' ;
25+ import type { TEvDescribeSchemeResult } from '../../types/api/schema' ;
2526
2627import './Tenant.scss' ;
2728
2829const b = cn ( 'tenant-page' ) ;
2930
30- export const TABLE_TYPE = 'Table' ;
31- export const OLAP_TABLE_TYPE = 'ColumnTable' ;
32- export const OLAP_STORE_TYPE = 'ColumnStore' ;
33-
34- export function calcEntityType ( currentPathType ?: string ) {
35- return currentPathType && currentPathType . replace ( 'EPathType' , '' ) ;
36- }
37-
38- export function isTableType ( currentPathType ?: string ) {
39- const type = calcEntityType ( currentPathType ) ;
40-
41- if ( type === TABLE_TYPE || type === OLAP_TABLE_TYPE ) {
42- return true ;
43- }
44- return false ;
45- }
46-
4731const getInitialIsSummaryCollapsed = ( ) => {
4832 return Boolean ( localStorage . getItem ( DEFAULT_IS_TENANT_SUMMARY_COLLAPSED ) ) ;
4933} ;
@@ -114,11 +98,7 @@ function Tenant(props: TenantProps) {
11498 } ;
11599 } , [ tenantName , dispatch ] ) ;
116100
117- const currentPathType = currentItem . PathDescription ?. Self ?. PathType ;
118-
119- const entityType = useMemo ( ( ) => {
120- return calcEntityType ( currentPathType ) ;
121- } , [ currentPathType ] ) ;
101+ const currentPathType = ( currentItem as TEvDescribeSchemeResult ) . PathDescription ?. Self ?. PathType ;
122102
123103 const onCollapseSummaryHandler = ( ) => {
124104 dispatchSummaryVisibilityAction ( PaneVisibilityActionTypes . triggerCollapse ) ;
@@ -142,14 +122,14 @@ function Tenant(props: TenantProps) {
142122 onSplitStartDragAdditional = { onSplitStartDragAdditional }
143123 >
144124 < ObjectSummary
145- type = { entityType as string }
125+ type = { currentPathType }
146126 onCollapseSummary = { onCollapseSummaryHandler }
147127 onExpandSummary = { onExpandSummaryHandler }
148128 isCollapsed = { summaryVisibilityState . collapsed }
149129 additionalTenantInfo = { props . additionalTenantInfo }
150130 />
151131 < ObjectGeneral
152- type = { entityType as string }
132+ type = { currentPathType }
153133 additionalTenantInfo = { props . additionalTenantInfo }
154134 additionalNodesInfo = { props . additionalNodesInfo }
155135 />
0 commit comments