mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-18 14:16:48 +00:00
fix(ui/lineage): show data is too large error when limitation exceeds (#10038)
This commit is contained in:
parent
77c72dad01
commit
0f2b15c93e
@ -106,6 +106,8 @@ type Props = {
|
|||||||
shouldRefetch?: boolean;
|
shouldRefetch?: boolean;
|
||||||
resetShouldRefetch?: () => void;
|
resetShouldRefetch?: () => void;
|
||||||
applyView?: boolean;
|
applyView?: boolean;
|
||||||
|
onLineageClick?: () => void;
|
||||||
|
isLineageTab?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EmbeddedListSearch = ({
|
export const EmbeddedListSearch = ({
|
||||||
@ -134,6 +136,8 @@ export const EmbeddedListSearch = ({
|
|||||||
shouldRefetch,
|
shouldRefetch,
|
||||||
resetShouldRefetch,
|
resetShouldRefetch,
|
||||||
applyView = false,
|
applyView = false,
|
||||||
|
onLineageClick,
|
||||||
|
isLineageTab = false,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { shouldRefetchEmbeddedListSearch, setShouldRefetchEmbeddedListSearch } = useEntityContext();
|
const { shouldRefetchEmbeddedListSearch, setShouldRefetchEmbeddedListSearch } = useEntityContext();
|
||||||
// Adjust query based on props
|
// Adjust query based on props
|
||||||
@ -143,7 +147,6 @@ export const EmbeddedListSearch = ({
|
|||||||
unionType,
|
unionType,
|
||||||
filters,
|
filters,
|
||||||
};
|
};
|
||||||
|
|
||||||
const finalFilters =
|
const finalFilters =
|
||||||
(fixedFilters && mergeFilterSets(fixedFilters, baseFilters)) || generateOrFilters(unionType, filters);
|
(fixedFilters && mergeFilterSets(fixedFilters, baseFilters)) || generateOrFilters(unionType, filters);
|
||||||
|
|
||||||
@ -191,6 +194,12 @@ export const EmbeddedListSearch = ({
|
|||||||
fetchPolicy: 'cache-first',
|
fetchPolicy: 'cache-first',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [serverError, setServerError] = useState<any>(undefined);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setServerError(error);
|
||||||
|
}, [error]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (shouldRefetch && resetShouldRefetch) {
|
if (shouldRefetch && resetShouldRefetch) {
|
||||||
refetch({
|
refetch({
|
||||||
@ -282,9 +291,18 @@ export const EmbeddedListSearch = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isServerOverloadError = [503, 500, 504].includes(serverError?.networkError?.response?.status);
|
||||||
|
|
||||||
|
const onClickLessHops = () => {
|
||||||
|
setServerError(undefined);
|
||||||
|
onChangeFilters(defaultFilters);
|
||||||
|
};
|
||||||
|
|
||||||
|
const ErrorMessage = () => <Message type="error" content="Failed to load results! An unexpected error occurred." />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
{error && <Message type="error" content="Failed to load results! An unexpected error occurred." />}
|
{!isLineageTab ? error && <ErrorMessage /> : serverError && !isServerOverloadError && <ErrorMessage />}
|
||||||
<EmbeddedListSearchHeader
|
<EmbeddedListSearchHeader
|
||||||
onSearch={(q) => onChangeQuery(addFixedQuery(q, fixedQuery as string, emptySearchQuery as string))}
|
onSearch={(q) => onChangeQuery(addFixedQuery(q, fixedQuery as string, emptySearchQuery as string))}
|
||||||
placeholderText={placeholderText}
|
placeholderText={placeholderText}
|
||||||
@ -303,6 +321,10 @@ export const EmbeddedListSearch = ({
|
|||||||
/>
|
/>
|
||||||
<EmbeddedListSearchResults
|
<EmbeddedListSearchResults
|
||||||
unionType={unionType}
|
unionType={unionType}
|
||||||
|
isServerOverloadError={isServerOverloadError}
|
||||||
|
onClickLessHops={onClickLessHops}
|
||||||
|
onLineageClick={onLineageClick}
|
||||||
|
isLineageTab={isLineageTab}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
searchResponse={data}
|
searchResponse={data}
|
||||||
filters={finalFacets}
|
filters={finalFacets}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Pagination, Spin, Typography } from 'antd';
|
import { Button, Pagination, Spin, Typography } from 'antd';
|
||||||
import { LoadingOutlined } from '@ant-design/icons';
|
import { LoadingOutlined } from '@ant-design/icons';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { FacetFilterInput, FacetMetadata, SearchResults as SearchResultType } from '../../../../../../types.generated';
|
import { FacetFilterInput, FacetMetadata, SearchResults as SearchResultType } from '../../../../../../types.generated';
|
||||||
@ -66,6 +66,20 @@ const StyledLoading = styled(LoadingOutlined)`
|
|||||||
padding-bottom: 18px;
|
padding-bottom: 18px;
|
||||||
]`;
|
]`;
|
||||||
|
|
||||||
|
const ErrorMessage = styled.div`
|
||||||
|
padding-top: 70px;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const StyledLinkButton = styled(Button)`
|
||||||
|
margin: 0 -14px;
|
||||||
|
font-size: 16px;
|
||||||
|
`;
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
page: number;
|
page: number;
|
||||||
searchResponse?: SearchResultType | null;
|
searchResponse?: SearchResultType | null;
|
||||||
@ -84,6 +98,10 @@ interface Props {
|
|||||||
setNumResultsPerPage: (numResults: number) => void;
|
setNumResultsPerPage: (numResults: number) => void;
|
||||||
entityAction?: React.FC<EntityActionProps>;
|
entityAction?: React.FC<EntityActionProps>;
|
||||||
applyView?: boolean;
|
applyView?: boolean;
|
||||||
|
isServerOverloadError?: any;
|
||||||
|
onClickLessHops?: () => void;
|
||||||
|
onLineageClick?: () => void;
|
||||||
|
isLineageTab?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EmbeddedListSearchResults = ({
|
export const EmbeddedListSearchResults = ({
|
||||||
@ -104,6 +122,10 @@ export const EmbeddedListSearchResults = ({
|
|||||||
setNumResultsPerPage,
|
setNumResultsPerPage,
|
||||||
entityAction,
|
entityAction,
|
||||||
applyView,
|
applyView,
|
||||||
|
isServerOverloadError,
|
||||||
|
onClickLessHops,
|
||||||
|
onLineageClick,
|
||||||
|
isLineageTab = false,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const pageStart = searchResponse?.start || 0;
|
const pageStart = searchResponse?.start || 0;
|
||||||
const pageSize = searchResponse?.count || 0;
|
const pageSize = searchResponse?.count || 0;
|
||||||
@ -131,7 +153,19 @@ export const EmbeddedListSearchResults = ({
|
|||||||
<Spin indicator={<StyledLoading />} />
|
<Spin indicator={<StyledLoading />} />
|
||||||
</LoadingContainer>
|
</LoadingContainer>
|
||||||
)}
|
)}
|
||||||
{!loading && (
|
{isLineageTab && !loading && isServerOverloadError && (
|
||||||
|
<ErrorMessage>
|
||||||
|
Data is too large. Please use
|
||||||
|
<StyledLinkButton onClick={onLineageClick} type="link">
|
||||||
|
visualize lineage
|
||||||
|
</StyledLinkButton>
|
||||||
|
or see less hops by clicking
|
||||||
|
<StyledLinkButton onClick={onClickLessHops} type="link">
|
||||||
|
here
|
||||||
|
</StyledLinkButton>
|
||||||
|
</ErrorMessage>
|
||||||
|
)}
|
||||||
|
{!loading && !isServerOverloadError && (
|
||||||
<EntitySearchResults
|
<EntitySearchResults
|
||||||
searchResults={searchResponse?.searchResults || []}
|
searchResults={searchResponse?.searchResults || []}
|
||||||
additionalPropertiesList={
|
additionalPropertiesList={
|
||||||
|
@ -52,6 +52,8 @@ type Props = {
|
|||||||
shouldRefetch?: boolean;
|
shouldRefetch?: boolean;
|
||||||
resetShouldRefetch?: () => void;
|
resetShouldRefetch?: () => void;
|
||||||
applyView?: boolean;
|
applyView?: boolean;
|
||||||
|
onLineageClick?: () => void;
|
||||||
|
isLineageTab?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const EmbeddedListSearchSection = ({
|
export const EmbeddedListSearchSection = ({
|
||||||
@ -69,6 +71,8 @@ export const EmbeddedListSearchSection = ({
|
|||||||
shouldRefetch,
|
shouldRefetch,
|
||||||
resetShouldRefetch,
|
resetShouldRefetch,
|
||||||
applyView,
|
applyView,
|
||||||
|
onLineageClick,
|
||||||
|
isLineageTab
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@ -155,6 +159,8 @@ export const EmbeddedListSearchSection = ({
|
|||||||
shouldRefetch={shouldRefetch}
|
shouldRefetch={shouldRefetch}
|
||||||
resetShouldRefetch={resetShouldRefetch}
|
resetShouldRefetch={resetShouldRefetch}
|
||||||
applyView={applyView}
|
applyView={applyView}
|
||||||
|
onLineageClick={onLineageClick}
|
||||||
|
isLineageTab={isLineageTab}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,8 @@ type Props = {
|
|||||||
skipCache?: boolean;
|
skipCache?: boolean;
|
||||||
setSkipCache?: (skipCache: boolean) => void;
|
setSkipCache?: (skipCache: boolean) => void;
|
||||||
resetShouldRefetch?: () => void;
|
resetShouldRefetch?: () => void;
|
||||||
|
onLineageClick?: () => void;
|
||||||
|
isLineageTab?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ImpactAnalysis = ({
|
export const ImpactAnalysis = ({
|
||||||
@ -24,6 +26,8 @@ export const ImpactAnalysis = ({
|
|||||||
skipCache,
|
skipCache,
|
||||||
setSkipCache,
|
setSkipCache,
|
||||||
resetShouldRefetch,
|
resetShouldRefetch,
|
||||||
|
onLineageClick,
|
||||||
|
isLineageTab
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const finalStartTimeMillis = startTimeMillis || undefined;
|
const finalStartTimeMillis = startTimeMillis || undefined;
|
||||||
const finalEndTimeMillis = endTimeMillis || undefined;
|
const finalEndTimeMillis = endTimeMillis || undefined;
|
||||||
@ -49,6 +53,8 @@ export const ImpactAnalysis = ({
|
|||||||
defaultFilters={[{ field: 'degree', values: ['1'] }]}
|
defaultFilters={[{ field: 'degree', values: ['1'] }]}
|
||||||
shouldRefetch={shouldRefetch}
|
shouldRefetch={shouldRefetch}
|
||||||
resetShouldRefetch={resetShouldRefetch}
|
resetShouldRefetch={resetShouldRefetch}
|
||||||
|
onLineageClick={onLineageClick}
|
||||||
|
isLineageTab={isLineageTab}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -181,6 +181,8 @@ export const LineageTab = ({
|
|||||||
<LineageTabContext.Provider value={{ isColumnLevelLineage, selectedColumn, lineageDirection }}>
|
<LineageTabContext.Provider value={{ isColumnLevelLineage, selectedColumn, lineageDirection }}>
|
||||||
<ImpactAnalysis
|
<ImpactAnalysis
|
||||||
urn={impactAnalysisUrn}
|
urn={impactAnalysisUrn}
|
||||||
|
onLineageClick={routeToLineage}
|
||||||
|
isLineageTab
|
||||||
direction={lineageDirection as LineageDirection}
|
direction={lineageDirection as LineageDirection}
|
||||||
startTimeMillis={startTimeMillis}
|
startTimeMillis={startTimeMillis}
|
||||||
endTimeMillis={endTimeMillis}
|
endTimeMillis={endTimeMillis}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user