Change Explore Placeholder when ES failed (#10575)

This commit is contained in:
Ashish Gupta 2023-03-15 10:41:30 +05:30 committed by GitHub
parent 5fb5333f8b
commit d1f2067860
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 23 deletions

View File

@ -74,7 +74,6 @@ const Explore: React.FC<ExploreProps> = ({
page = 1,
onChangePage = noop,
loading,
isElasticSearchIssue = false,
}) => {
const { t } = useTranslation();
const { tab } = useParams<{ tab: string }>();
@ -330,7 +329,6 @@ const Explore: React.FC<ExploreProps> = ({
currentPage={page}
data={searchResults?.hits.hits ?? []}
handleSummaryPanelDisplay={handleSummaryPanelDisplay}
isElasticSearchIssue={isElasticSearchIssue}
isSummaryPanelVisible={showSummaryPanel}
paginate={(value) => {
if (isNumber(value)) {

View File

@ -72,7 +72,6 @@ export interface ExploreProps {
onChangePage?: (page: number) => void;
loading?: boolean;
isElasticSearchIssue?: boolean;
}
export interface ExploreQuickFilterField {

View File

@ -78,5 +78,4 @@ export interface SearchedDataProps {
details: EntityDetailsType,
entityType: string
) => void;
isElasticSearchIssue: boolean;
}

View File

@ -88,7 +88,6 @@ jest.mock('../common/error-with-placeholder/ErrorPlaceHolderES', () => {
});
const MOCK_PROPS = {
isElasticSearchIssue: false,
isFilterSelected: false,
isSummaryPanelVisible: false,
currentPage: 0,

View File

@ -49,7 +49,6 @@ const SearchedData: React.FC<SearchedDataProps> = ({
searchText,
selectedEntityId,
handleSummaryPanelDisplay,
isElasticSearchIssue,
}) => {
const highlightSearchResult = () => {
return data.map(({ _source: table, highlight, _index }, index) => {
@ -162,11 +161,7 @@ const SearchedData: React.FC<SearchedDataProps> = ({
{children}
<ErrorPlaceHolderES
query={searchText}
type={
isElasticSearchIssue
? ELASTICSEARCH_ERROR_PLACEHOLDER_TYPE.ERROR
: ELASTICSEARCH_ERROR_PLACEHOLDER_TYPE.NO_DATA
}
type={ELASTICSEARCH_ERROR_PLACEHOLDER_TYPE.NO_DATA}
/>
</>
)}

View File

@ -20,7 +20,7 @@ import {
UrlParams,
} from 'components/Explore/explore.interface';
import { SORT_ORDER } from 'enums/common.enum';
import { get, isNil, isString } from 'lodash';
import { isNil, isString } from 'lodash';
import Qs from 'qs';
import React, {
FunctionComponent,
@ -69,9 +69,6 @@ const ExplorePage: FunctionComponent = () => {
const [isLoading, setIsLoading] = useState(true);
const [isElasticSearchIssue, setIsElasticSearchIssue] =
useState<boolean>(false);
const parsedSearch = useMemo(
() =>
Qs.parse(
@ -268,13 +265,6 @@ const ExplorePage: FunctionComponent = () => {
])
.catch((err) => {
showErrorToast(err);
if (
get(err, 'response.data.responseMessage', '').includes(
'elasticsearch'
)
) {
setIsElasticSearchIssue(true);
}
})
.finally(() => setIsLoading(false));
}, [
@ -303,7 +293,6 @@ const ExplorePage: FunctionComponent = () => {
return (
<PageContainerV1>
<Explore
isElasticSearchIssue={isElasticSearchIssue}
loading={isLoading}
page={page}
postFilter={postFilter}