From 43fdf78d7347f7c92d0cf40ef756bb9b21e43e2b Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Mon, 31 Jul 2023 21:14:21 +0530 Subject: [PATCH] ui: fixed loading issue in table, and remove unwanted params from API in table profiler (#12668) * ui: fixed loading issue in table, and remove unwanted params from API in table profiler * fixed unit test and addressing comment * added "testDefinition" params to API as it required to for edit test --- .../BotListV1/BotListV1.component.tsx | 30 +++--- .../DataInsightDetail/TopActiveUsers.tsx | 5 +- .../DataInsightDetail/TopViewEntities.tsx | 7 +- .../TestSuites/TestSuites.component.tsx | 27 ++--- .../GlossaryImportResult.component.tsx | 8 +- .../component/DataQualityTab.tsx | 46 ++++---- .../TableProfiler/TableProfilerV1.tsx | 100 ++++++++++-------- .../TeamImportResult.component.tsx | 10 +- .../UserImportResult.component.tsx | 10 +- .../ui/src/components/UserList/UserListV1.tsx | 34 +++--- .../ui/src/pages/AlertsPage/AlertsPage.tsx | 60 +++++------ .../ui/src/pages/DataInsightPage/KPIList.tsx | 29 ++--- .../DatabaseSchemaPage/SchemaTablesTab.tsx | 8 +- .../ServiceMainTabContent.tsx | 34 +++--- .../ui/src/pages/TagsPage/TagsPage.tsx | 33 +++--- 15 files changed, 231 insertions(+), 210 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BotListV1/BotListV1.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/BotListV1/BotListV1.component.tsx index 380b368d4b5..cc3ec3d50d0 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BotListV1/BotListV1.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/BotListV1/BotListV1.component.tsx @@ -267,21 +267,21 @@ const BotListV1 = ({ - , - }} - locale={{ - emptyText: , - }} - pagination={false} - rowKey="name" - size="small" - /> + {loading ? ( + + ) : ( +
, + }} + pagination={false} + rowKey="name" + size="small" + /> + )} {paging.total > PAGE_SIZE_LARGE && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopActiveUsers.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopActiveUsers.tsx index 9b5abf03ef4..ef604fb1177 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopActiveUsers.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopActiveUsers.tsx @@ -135,14 +135,15 @@ const TopActiveUsers: FC = ({ chartFilter }) => { }} /> }> - {isEmpty(mostActiveUsers) ? ( + {isLoading ? ( + + ) : isEmpty(mostActiveUsers) ? ( ) : (
}} pagination={false} size="small" /> diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopViewEntities.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopViewEntities.tsx index 482351f79cb..285dc790c3e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopViewEntities.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataInsightDetail/TopViewEntities.tsx @@ -15,6 +15,7 @@ import { Card, Space, Table, Typography } from 'antd'; import { ColumnsType } from 'antd/lib/table'; import { AxiosError } from 'axios'; import PageHeader from 'components/header/PageHeader.component'; +import Loader from 'components/Loader/Loader'; import { isEmpty, isUndefined } from 'lodash'; import React, { FC, useEffect, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -27,7 +28,6 @@ import { ChartFilter } from '../../interface/data-insight.interface'; import { getDecodedFqn } from '../../utils/StringsUtils'; import { showErrorToast } from '../../utils/ToastUtils'; import ProfilePicture from '../common/ProfilePicture/ProfilePicture'; -import Loader from '../Loader/Loader'; import './DataInsightDetail.less'; import { EmptyGraphPlaceholder } from './EmptyGraphPlaceholder'; @@ -130,14 +130,15 @@ const TopViewEntities: FC = ({ chartFilter }) => { }} /> }> - {isEmpty(mostViewedEntities) ? ( + {isLoading ? ( + + ) : isEmpty(mostViewedEntities) ? ( ) : (
}} pagination={false} size="small" /> diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuites/TestSuites.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuites/TestSuites.component.tsx index 018ab01b69e..c327fbcc582 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuites/TestSuites.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/TestSuites/TestSuites.component.tsx @@ -198,18 +198,21 @@ export const TestSuites = ({ summaryPanel }: { summaryPanel: ReactNode }) => { {summaryPanel}-
}} - locale={{ - emptyText: , - }} - pagination={false} - size="small" - /> + {isLoading ? ( + + ) : ( +
, + }} + pagination={false} + size="small" + /> + )} {testSuites.paging.total > PAGE_SIZE && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/ImportResult/GlossaryImportResult.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/ImportResult/GlossaryImportResult.component.tsx index 5a8b59976a3..963b9d30a66 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Glossary/ImportResult/GlossaryImportResult.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Glossary/ImportResult/GlossaryImportResult.component.tsx @@ -216,16 +216,16 @@ export const GlossaryImportResult: FC = ({ csvImportResult }) => { parseCsvFile(); }, [csvImportResult.importResultsCsv]); + if (loading) { + return ; + } + return (
, - }} pagination={false} rowKey="name" scroll={{ x: true }} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx index f8f27ace259..9e631398e2e 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx @@ -401,29 +401,29 @@ const DataQualityTab: React.FC = ({ return ( -
(), - expandRowByClick: true, - rowExpandable: () => true, - expandedRowRender: (recode) => , - }} - loading={{ - indicator: , - spinning: isLoading, - }} - locale={{ - emptyText: , - }} - pagination={false} - rowKey="id" - size="small" - /> + {isLoading ? ( + + ) : ( +
(), + expandRowByClick: true, + rowExpandable: () => true, + expandedRowRender: (recode) => , + }} + locale={{ + emptyText: , + }} + pagination={false} + rowKey="id" + size="small" + /> + )} {!isUndefined(pagingData) && pagingData.paging.total > PAGE_SIZE && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx index dc852f2430c..6845dabdff4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx @@ -31,6 +31,7 @@ import classNames from 'classnames'; import { SummaryCard } from 'components/common/SummaryCard/SummaryCard.component'; import { SummaryCardProps } from 'components/common/SummaryCard/SummaryCard.interface'; import DatePickerMenu from 'components/DatePickerMenu/DatePickerMenu.component'; +import Loader from 'components/Loader/Loader'; import { DateRangeObject } from 'components/ProfilerDashboard/component/TestSummary'; import TabsLabel from 'components/TabsLabel/TabsLabel.component'; import { useTourProvider } from 'components/TourProvider/TourProvider'; @@ -136,7 +137,7 @@ const TableProfilerV1: FC = ({ const [selectedTestCaseStatus, setSelectedTestCaseStatus] = useState(''); const [selectedTestType, setSelectedTestType] = useState(''); - const [isTestCaseLoading, setIsTestCaseLoading] = useState(false); + const [isLoading, setIsLoading] = useState(false); const [dateRangeObject, setDateRangeObject] = useState(DEFAULT_RANGE_DATA); @@ -379,11 +380,11 @@ const TableProfilerV1: FC = ({ }; const fetchAllTests = async (params?: ListTestCaseParams) => { - setIsTestCaseLoading(true); + setIsLoading(true); try { const { data } = await getListTestCase({ ...params, - fields: 'testCaseResult,entityLink,testDefinition,testSuite', + fields: 'testCaseResult, testDefinition', entityLink: generateEntityLink(datasetFQN || ''), includeAllTests: true, limit: API_RES_MAX_SIZE, @@ -393,7 +394,7 @@ const TableProfilerV1: FC = ({ } catch (error) { showErrorToast(error as AxiosError); } finally { - setIsTestCaseLoading(false); + setIsLoading(false); } }; @@ -444,11 +445,14 @@ const TableProfilerV1: FC = ({ // and the datasetFQN comes form url parameter which is already encoded, // we are decoding FQN below to avoid double encoding in the API function const decodedDatasetFQN = decodeURIComponent(datasetFQN); + setIsLoading(true); try { const response = await getLatestTableProfileByFqn(decodedDatasetFQN); setTable(response); } catch (error) { showErrorToast(error as AxiosError); + } finally { + setIsLoading(false); } }; @@ -485,18 +489,20 @@ const TableProfilerV1: FC = ({ }, [viewTest, isTourOpen, isTableProfile, allTests]); useEffect(() => { - if ( + const fetchProfiler = !isTableDeleted && datasetFQN && !isTourOpen && - (isTableProfile || isColumnProfile) - ) { + (isTableProfile || isColumnProfile) && + isUndefined(table); + + if (fetchProfiler) { fetchLatestProfilerData(); } if (isTourOpen) { setTable(mockDatasetData.tableDetails as unknown as Table); } - }, [datasetFQN, isTourOpen, isTableProfile]); + }, [datasetFQN, isTourOpen, isTableProfile, isColumnProfile]); return ( = ({ = ({ = ({ )} - {isColumnProfile && ( - ({ - ...col, - key: col.name, - }))} - dateRangeObject={dateRangeObject} - hasEditAccess={editTest} - /> - )} + {isLoading ? ( + + ) : ( + <> + {isColumnProfile && ( + ({ + ...col, + key: col.name, + }))} + dateRangeObject={dateRangeObject} + hasEditAccess={editTest} + /> + )} - {isDataQuality && ( - - )} + {isDataQuality && ( + + )} - {isTableProfile && ( - - )} + {isTableProfile && ( + + )} - {settingModalVisible && ( - + {settingModalVisible && ( + + )} + )} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamImportResult/TeamImportResult.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamImportResult/TeamImportResult.component.tsx index b5a7f048d72..19006935221 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamImportResult/TeamImportResult.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Team/TeamImportResult/TeamImportResult.component.tsx @@ -199,6 +199,8 @@ export const TeamImportResult = ({ setIsLoading(false); }, }); + } else { + setIsLoading(false); } }; @@ -207,16 +209,16 @@ export const TeamImportResult = ({ parseCsvFile(); }, [csvImportResult.importResultsCsv]); + if (loading) { + return ; + } + return (
, - }} pagination={false} rowKey="name*" scroll={{ x: true }} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Team/UserImportResult/UserImportResult.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Team/UserImportResult/UserImportResult.component.tsx index 73a265ddb1d..ea71c94a941 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Team/UserImportResult/UserImportResult.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Team/UserImportResult/UserImportResult.component.tsx @@ -191,6 +191,8 @@ export const UserImportResult = ({ setIsLoading(false); }, }); + } else { + setIsLoading(false); } }; @@ -199,6 +201,10 @@ export const UserImportResult = ({ parseCsvFile(); }, [csvImportResult.importResultsCsv]); + if (loading) { + return ; + } + return (
, - }} pagination={false} rowKey="name*" scroll={{ x: true }} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx index 63f0dab19a0..307f883662d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/UserList/UserListV1.tsx @@ -252,23 +252,23 @@ const UserListV1: FC = ({ -
, - }} - locale={{ - emptyText: , - }} - pagination={false} - rowKey="id" - size="small" - /> + {isDataLoading ? ( + + ) : ( +
, + }} + pagination={false} + rowKey="id" + size="small" + /> + )} {paging.total > PAGE_SIZE_MEDIUM && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/AlertsPage/AlertsPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/AlertsPage/AlertsPage.tsx index b721c579984..811c165c784 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/AlertsPage/AlertsPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/AlertsPage/AlertsPage.tsx @@ -185,37 +185,37 @@ const AlertsPage = () => { -
, - }} - locale={{ - emptyText: !loading && ( - - history.push( - getSettingPath( - GlobalSettingsMenuCategory.NOTIFICATIONS, - GlobalSettingOptions.ADD_ALERTS + {loading ? ( + + ) : ( +
+ history.push( + getSettingPath( + GlobalSettingsMenuCategory.NOTIFICATIONS, + GlobalSettingOptions.ADD_ALERTS + ) ) - ) - } - /> - ), - }} - pagination={false} - rowKey="id" - size="middle" - /> + } + /> + ), + }} + pagination={false} + rowKey="id" + size="middle" + /> + )} {Boolean( diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx index c4711f4a438..df98ac921f8 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/DataInsightPage/KPIList.tsx @@ -201,19 +201,22 @@ const KPIList = ({ viewKPIPermission }: { viewKPIPermission: boolean }) => { return ( <> -
}} - locale={{ - emptyText: noDataPlaceHolder, - }} - pagination={false} - rowKey="name" - size="small" - /> + {isLoading ? ( + + ) : ( +
+ )} {kpiList.length > PAGE_SIZE_MEDIUM && ( diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx index e8774bfa6c6..7992d407110 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/DatabaseSchemaPage/SchemaTablesTab.tsx @@ -144,7 +144,9 @@ function SchemaTablesTab({ - {isEmpty(tableData) && !showDeletedTables && !tableDataLoading ? ( + {tableDataLoading ? ( + + ) : isEmpty(tableData) && !showDeletedTables ? ( , - }} locale={{ emptyText: , }} diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx index 1f2232b5cc2..e34c9872d79 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/ServiceDetailsPage/ServiceMainTabContent.tsx @@ -289,23 +289,23 @@ function ServiceMainTabContent({ -
, - }} - locale={{ - emptyText: , - }} - pagination={false} - rowKey="id" - size="small" - /> + {isServiceLoading ? ( + + ) : ( +
, + }} + pagination={false} + rowKey="id" + size="small" + /> + )} {Boolean(!isNil(paging.after) || !isNil(paging.before)) && !isEmpty(data) && ( { -
} size="small" /> - ), - spinning: isTagsLoading, - }} - pagination={false} - rowClassName={(record) => (record.disabled ? 'opacity-60' : '')} - rowKey="id" - size="small" - /> + {isTagsLoading ? ( + + ) : ( +
(record.disabled ? 'opacity-60' : '')} + rowKey="id" + size="small" + /> + )} {paging.total > PAGE_SIZE && (