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

View File

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

View File

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

View File

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

View File

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

View File

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