@@ -79,46 +79,56 @@ const ProfileTab: React.FC<EntityDetailTabProps> = ({ entity }) => {
7979 const fetchRelationShipResult = useCallback (
8080 async ( {
8181 pagination,
82- sorting
82+ sorting : _sorting
8383 } : {
8484 pagination ?: any ;
8585 sorting : [ { id : string ; desc : boolean } ] ;
8686 } ) => {
87- if ( ! entity ?. typeName ) {
87+ if ( ! entity ?. typeName || ! guid ) {
8888 return ;
8989 }
90- const { pageSize, pageIndex } = pagination || { } ;
91- const offsetParam = searchParams . get ( "pageOffset" ) ;
92- const limitParam = searchParams . get ( "pageLimit" ) ;
93- if ( pageIndex > 1 ) {
94- searchParams . set ( "pageOffset" , `${ pageSize + pageIndex } ` ) ;
95- }
96- let params : any = {
97- order : sorting [ 0 ] ?. desc == false ? "asc" : "desc" ,
98- offset : ! isEmpty ( offsetParam ) ? offsetParam : pageIndex + pageSize ,
99- limit : ! isEmpty ( limitParam ) ? limitParam : pageSize ,
100- sort_by : sorting [ 0 ] ?. id || "timestamp" ,
90+ const { pageSize = 25 , pageIndex = 0 } = pagination || { } ;
91+ const includeDeletedEntities = searchParams . get ( "includeDE" ) === "true" ;
92+ const baseParams = {
10193 guid : guid ,
102- relation :
103- entity ?. typeName === "hive_db"
104- ? "__hive_table.db"
105- : "__hbase_table.namespace" ,
106- sortBy : sorting [ 0 ] ?. id || "name" ,
107- sortOrder : sorting [ 0 ] ?. desc == false ? "ASCENDING" : "DESCENDING" ,
108- excludeDeletedEntities : ! isEmpty ( searchParams . get ( "includeDE" ) )
109- ? ! searchParams . get ( "includeDE" )
110- : true ,
94+ limit : pageSize ,
95+ offset : pageIndex * pageSize ,
96+ sortBy : "name" ,
97+ sortOrder : "ASCENDING" ,
98+ excludeDeletedEntities : ! includeDeletedEntities ,
11199 includeSubClassifications : true ,
112100 includeSubTypes : true ,
113101 includeClassificationAttributes : true
114102 } ;
103+ const relationList =
104+ entity ?. typeName === "hive_db"
105+ ? [ "__hive_table.db" , "__iceberg_table.db" ]
106+ : entity ?. typeName === "hbase_namespace"
107+ ? [ "__hbase_table.namespace" ]
108+ : [ ] ;
115109 dispatch ( { type : "request" } ) ;
116110
117111 try {
118- let searchResp = await getRelationShip ( { params : params } ) ;
112+ const responses = await Promise . all (
113+ relationList . map ( ( relation ) =>
114+ getRelationShip ( {
115+ params : {
116+ ...baseParams ,
117+ relation
118+ }
119+ } )
120+ )
121+ ) ;
122+ const mergedEntities = responses . flatMap (
123+ ( resp ) => resp ?. data ?. entities || [ ]
124+ ) ;
125+ const uniqueEntities = mergedEntities . filter (
126+ ( entityObj , index , arr ) =>
127+ arr . findIndex ( ( item ) => item . guid === entityObj . guid ) === index
128+ ) ;
119129 dispatch ( {
120130 type : "success" ,
121- respData : searchResp . data . entities
131+ respData : uniqueEntities
122132 } ) ;
123133 } catch ( error : any ) {
124134 console . error ( "Error fetching data:" , error . response . data . errorMessage ) ;
0 commit comments