Fixed: Openmetadata Tour Page Issue table is not present for dummy data #9725 (#9826)

* Fixed: Openmetadata Tour Page Issue table is not present for dummy data #9725

* fixed failing unit test

Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
This commit is contained in:
Shailesh Parmar 2023-01-22 18:47:14 +05:30 committed by GitHub
parent 22573ae600
commit 8aa6ffb10e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View File

@ -19,6 +19,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Space, Typography } from 'antd';
import { AxiosError } from 'axios';
import classNames from 'classnames';
import { ROUTES } from 'constants/constants';
import { lowerCase } from 'lodash';
import React, {
FunctionComponent,
@ -27,7 +28,7 @@ import React, {
useRef,
useState,
} from 'react';
import { Link } from 'react-router-dom';
import { Link, useLocation } from 'react-router-dom';
import { getSampleDataByTableId } from 'rest/tableAPI';
import { WORKFLOWS_PROFILER_DOCS } from '../../constants/docs.constants';
import { Table, TableData } from '../../generated/entity/data/table';
@ -55,6 +56,7 @@ interface Props {
const SampleDataTable: FunctionComponent<Props> = ({ tableId }: Props) => {
const tableRef = useRef<HTMLDivElement>(null);
const location = useLocation();
const [sampleData, setSampleData] = useState<SampleData>();
const [scrollOffset, setScrollOffSet] = useState<number>(0);
const [containerWidth, setContainerWidth] = useState<number>(0);
@ -121,7 +123,7 @@ const SampleDataTable: FunctionComponent<Props> = ({ tableId }: Props) => {
useEffect(() => {
setIsLoading(true);
if (tableId) {
if (tableId && !location.pathname.includes(ROUTES.TOUR)) {
fetchSampleData();
} else {
setIsLoading(false);

View File

@ -18,6 +18,7 @@ import SampleDataTable from './SampleDataTable.component';
jest.mock('react-router-dom', () => ({
Link: jest.fn().mockImplementation(({ children }) => <span>{children}</span>),
useLocation: jest.fn().mockImplementation(() => ({ pathname: 'test' })),
}));
jest.mock('rest/tableAPI', () => ({

View File

@ -98,6 +98,8 @@ const TableProfilerChart = ({ selectedTimeRange }: TableProfilerChartProps) => {
datasetFQN,
PROFILER_FILTER_RANGE[selectedTimeRange].days
);
} else {
setIsLoading(false);
}
}, [datasetFQN, selectedTimeRange]);

View File

@ -88,7 +88,7 @@ const AddUsersModalV1 = ({
});
};
const searchUsers = (text: string, page: number) => {
const searchUsers = (text: string, page = 1) => {
searchData(text, page, PAGE_SIZE_MEDIUM, '', '', '', SearchIndex.USER)
.then((res) => {
const data = getFilterUserData(
@ -150,7 +150,7 @@ const AddUsersModalV1 = ({
setCurrentPage(1);
setSearchText(searchValue);
if (searchValue) {
searchUsers(searchValue, currentPage);
searchUsers(searchValue);
} else {
fetchAllUsers();
}