diff --git a/catalog-rest-service/src/main/resources/ui/src/AppState.ts b/catalog-rest-service/src/main/resources/ui/src/AppState.ts index f05f050ade5..7cb4af606b3 100644 --- a/catalog-rest-service/src/main/resources/ui/src/AppState.ts +++ b/catalog-rest-service/src/main/resources/ui/src/AppState.ts @@ -32,6 +32,7 @@ class AppState { userTeams: Array = []; inPageSearchText = ''; + explorePageTab = 'tables'; constructor() { makeAutoObservable(this); diff --git a/catalog-rest-service/src/main/resources/ui/src/components/app-bar/Appbar.tsx b/catalog-rest-service/src/main/resources/ui/src/components/app-bar/Appbar.tsx index df8108a6ba0..2989194d93b 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/app-bar/Appbar.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/app-bar/Appbar.tsx @@ -141,7 +141,15 @@ const Appbar: React.FC = (): JSX.Element => { const target = e.target as HTMLInputElement; if (e.key === 'Enter') { setIsOpen(false); - history.push(getExplorePathWithSearch(target.value)); + history.push( + getExplorePathWithSearch( + target.value, + // this is for if user is searching from another page + location.pathname.startsWith(ROUTES.EXPLORE) + ? appState.explorePageTab + : 'tables' + ) + ); } }} /> diff --git a/catalog-rest-service/src/main/resources/ui/src/components/searched-data/SearchedData.tsx b/catalog-rest-service/src/main/resources/ui/src/components/searched-data/SearchedData.tsx index 36f1484788d..3aadd1ae2f5 100644 --- a/catalog-rest-service/src/main/resources/ui/src/components/searched-data/SearchedData.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/components/searched-data/SearchedData.tsx @@ -92,7 +92,7 @@ const SearchedData: React.FC = ({ return ( <> - +
{isLoading ? ( @@ -127,7 +127,10 @@ const SearchedData: React.FC = ({ ) : null} ) : ( - + <> + {children} + + )} )} diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/database-details/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/database-details/index.tsx index 1f084e73537..b464fe5cc17 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/database-details/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/database-details/index.tsx @@ -312,7 +312,7 @@ const DatabaseDetails: FunctionComponent = () => { - {table.description ? ( + {table.description.trim() ? ( diff --git a/catalog-rest-service/src/main/resources/ui/src/pages/explore/index.tsx b/catalog-rest-service/src/main/resources/ui/src/pages/explore/index.tsx index 581bc570e1d..860c2aa57f0 100644 --- a/catalog-rest-service/src/main/resources/ui/src/pages/explore/index.tsx +++ b/catalog-rest-service/src/main/resources/ui/src/pages/explore/index.tsx @@ -26,6 +26,7 @@ import { } from 'Models'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useHistory, useLocation, useParams } from 'react-router-dom'; +import AppState from '../../AppState'; import { searchData } from '../../axiosAPIs/miscAPI'; import { Button } from '../../components/buttons/Button/Button'; import ErrorPlaceHolderES from '../../components/common/error-with-placeholder/ErrorPlaceHolderES'; @@ -471,6 +472,7 @@ const ExplorePage: React.FC = (): React.ReactElement => { }; const onTabChange = (selectedTab: number) => { if (tabsInfo[selectedTab - 1].path !== tab) { + AppState.explorePageTab = tabsInfo[selectedTab - 1].path; resetFilters(); history.push({ pathname: getExplorePathWithSearch( @@ -511,14 +513,18 @@ const ExplorePage: React.FC = (): React.ReactElement => { }; useEffect(() => { - setFilters(filterObject); setSearchText(searchQuery || ''); setCurrentPage(1); - setCurrentTab(getCurrentTab(tab)); - setSearchIndex(getCurrentIndex(tab)); + }, [searchQuery]); + + useEffect(() => { + setFilters(filterObject); setFieldList(tabsInfo[getCurrentTab(tab) - 1].sortingFields); setSortField(tabsInfo[getCurrentTab(tab) - 1].sortField); - }, [searchQuery, tab]); + setCurrentTab(getCurrentTab(tab)); + setSearchIndex(getCurrentIndex(tab)); + setCurrentPage(1); + }, [tab]); useEffect(() => { if (getFilterString(filters)) {