fix(ui): block multiple paging req while fetching data (#18436)

This commit is contained in:
Chirag Madlani 2024-10-30 14:05:44 +05:30 committed by GitHub
parent 4c3a784f7c
commit 289404748a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with 33 additions and 3 deletions

View File

@ -521,9 +521,10 @@ const ClassificationDetails = forwardRef(
size="small" size="small"
/> />
{showPagination && !isTagsLoading && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isTagsLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleTagsPageChange} pagingHandler={handleTagsPageChange}

View File

@ -183,6 +183,7 @@ const DataModelTable = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleDataModelPageChange} pagingHandler={handleDataModelPageChange}

View File

@ -344,6 +344,7 @@ export const TestSuites = () => {
<NextPrevious <NextPrevious
isNumberBased isNumberBased
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleTestSuitesPageChange} pagingHandler={handleTestSuitesPageChange}

View File

@ -206,6 +206,7 @@ export const DatabaseSchemaTable = ({
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
isNumberBased={Boolean(searchValue)} isNumberBased={Boolean(searchValue)}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}

View File

@ -176,6 +176,7 @@ export const QualityTab = () => {
<NextPrevious <NextPrevious
isNumberBased isNumberBased
currentPage={currentPage} currentPage={currentPage}
isLoading={isTestsLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleTestCasePageChange} pagingHandler={handleTestCasePageChange}

View File

@ -631,6 +631,7 @@ const AssetsTabs = forwardRef(
<NextPrevious <NextPrevious
isNumberBased isNumberBased
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={({ currentPage }: PagingHandlerParams) => pagingHandler={({ currentPage }: PagingHandlerParams) =>

View File

@ -308,6 +308,7 @@ const AppRunsHistory = forwardRef(
<NextPrevious <NextPrevious
isNumberBased isNumberBased
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleAppHistoryPageChange} pagingHandler={handleAppHistoryPageChange}

View File

@ -317,6 +317,7 @@ const BotListV1 = ({
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={loading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleBotPageChange} pagingHandler={handleBotPageChange}

View File

@ -362,6 +362,7 @@ function IngestionListTable({
<Col span={24}> <Col span={24}>
<NextPrevious <NextPrevious
currentPage={ingestionPagingInfo.currentPage} currentPage={ingestionPagingInfo.currentPage}
isLoading={isLoading}
isNumberBased={isNumberBasedPaging} isNumberBased={isNumberBasedPaging}
pageSize={ingestionPagingInfo.pageSize} pageSize={ingestionPagingInfo.pageSize}
paging={ingestionPagingInfo.paging} paging={ingestionPagingInfo.paging}

View File

@ -525,6 +525,7 @@ const Services = ({ serviceName }: ServicesProps) => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
isNumberBased={!isEmpty(searchTerm)} isNumberBased={!isEmpty(searchTerm)}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}

View File

@ -401,6 +401,7 @@ export const UserTab = ({
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
isNumberBased={Boolean(searchText)} isNumberBased={Boolean(searchText)}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}

View File

@ -27,6 +27,7 @@ interface BasicProps {
pageSize: number; pageSize: number;
currentPage: number; currentPage: number;
isNumberBased?: boolean; isNumberBased?: boolean;
isLoading?: boolean;
} }
export interface PagingProps { export interface PagingProps {

View File

@ -37,6 +37,7 @@ const NextPrevious: FC<NextPreviousProps> = ({
pageSize, pageSize,
isNumberBased = false, isNumberBased = false,
currentPage = 1, currentPage = 1,
isLoading,
...pagingProps ...pagingProps
}: NextPreviousProps) => { }: NextPreviousProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -91,7 +92,7 @@ const NextPrevious: FC<NextPreviousProps> = ({
ghost ghost
className="hover-button text-sm flex-center" className="hover-button text-sm flex-center"
data-testid="previous" data-testid="previous"
disabled={computePrevDisableState()} disabled={computePrevDisableState() || isLoading}
icon={<ArrowLeftOutlined />} icon={<ArrowLeftOutlined />}
type="primary" type="primary"
onClick={onPreviousHandler}> onClick={onPreviousHandler}>
@ -105,7 +106,7 @@ const NextPrevious: FC<NextPreviousProps> = ({
ghost ghost
className="hover-button text-sm flex-center" className="hover-button text-sm flex-center"
data-testid="next" data-testid="next"
disabled={computeNextDisableState()} disabled={computeNextDisableState() || isLoading}
type="primary" type="primary"
onClick={onNextHandler}> onClick={onNextHandler}>
<span> {t('label.next')}</span> <span> {t('label.next')}</span>
@ -113,6 +114,7 @@ const NextPrevious: FC<NextPreviousProps> = ({
</Button> </Button>
{onShowSizeChange && ( {onShowSizeChange && (
<Dropdown <Dropdown
disabled={isLoading}
menu={{ menu={{
items: pageSizeOptions.map((size) => ({ items: pageSizeOptions.map((size) => ({
label: `${size} / Page`, label: `${size} / Page`,

View File

@ -185,6 +185,7 @@ function APIEndpointsTab({
<Col span={24}> <Col span={24}>
<NextPrevious <NextPrevious
currentPage={currentEndpointsPage} currentPage={currentEndpointsPage}
isLoading={apiEndpointsLoading}
pageSize={PAGE_SIZE} pageSize={PAGE_SIZE}
paging={apiEndpoints.paging} paging={apiEndpoints.paging}
pagingHandler={endpointPaginationHandler} pagingHandler={endpointPaginationHandler}

View File

@ -199,6 +199,7 @@ const ApplicationPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleApplicationPageChange} pagingHandler={handleApplicationPageChange}

View File

@ -211,6 +211,7 @@ export const CustomPageSettings = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handlePersonaPageChange} pagingHandler={handlePersonaPageChange}

View File

@ -251,6 +251,7 @@ const KPIList = () => {
<Col span={24}> <Col span={24}>
<NextPrevious <NextPrevious
currentPage={kpiPage} currentPage={kpiPage}
isLoading={isLoading}
pageSize={PAGE_SIZE_MEDIUM} pageSize={PAGE_SIZE_MEDIUM}
paging={kpiPaging} paging={kpiPaging}
pagingHandler={kpiPagingHandler} pagingHandler={kpiPagingHandler}

View File

@ -176,6 +176,7 @@ function SchemaTablesTab({
<Col span={24}> <Col span={24}>
<NextPrevious <NextPrevious
currentPage={currentTablesPage} currentPage={currentTablesPage}
isLoading={tableDataLoading}
pageSize={PAGE_SIZE} pageSize={PAGE_SIZE}
paging={tableData.paging} paging={tableData.paging}
pagingHandler={tablePaginationHandler} pagingHandler={tablePaginationHandler}

View File

@ -153,6 +153,7 @@ const MarketPlacePage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handleMarketPlacePageChange} pagingHandler={handleMarketPlacePageChange}

View File

@ -291,6 +291,7 @@ const MetricListPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={loadingMore}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={onPageChange} pagingHandler={onPageChange}

View File

@ -275,6 +275,7 @@ const NotificationListPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={loadingCount > 0}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={onPageChange} pagingHandler={onPageChange}

View File

@ -242,6 +242,7 @@ const ObservabilityAlertsPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={loading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={onPageChange} pagingHandler={onPageChange}

View File

@ -162,6 +162,7 @@ export const PersonaPage = () => {
<Col span={24}> <Col span={24}>
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handlePersonaPageChange} pagingHandler={handlePersonaPageChange}

View File

@ -337,6 +337,7 @@ const PoliciesListPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handlePaging} pagingHandler={handlePaging}

View File

@ -335,6 +335,7 @@ const RolesListPage = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={handlePaging} pagingHandler={handlePaging}

View File

@ -214,6 +214,7 @@ function ServiceMainTabContent({
!isEmpty(data) && ( !isEmpty(data) && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isServiceLoading}
pageSize={PAGE_SIZE} pageSize={PAGE_SIZE}
paging={paging} paging={paging}
pagingHandler={pagingHandler} pagingHandler={pagingHandler}

View File

@ -94,6 +94,7 @@ function ServiceVersionMainTabContent({
!isEmpty(data) && ( !isEmpty(data) && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isServiceLoading}
pageSize={PAGE_SIZE} pageSize={PAGE_SIZE}
paging={paging} paging={paging}
pagingHandler={pagingHandler} pagingHandler={pagingHandler}

View File

@ -157,6 +157,7 @@ const StoredProcedureTab = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isLoading}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}
pagingHandler={storedProcedurePagingHandler} pagingHandler={storedProcedurePagingHandler}

View File

@ -476,6 +476,7 @@ const UserListPageV1 = () => {
{showPagination && ( {showPagination && (
<NextPrevious <NextPrevious
currentPage={currentPage} currentPage={currentPage}
isLoading={isDataLoading}
isNumberBased={Boolean(searchValue)} isNumberBased={Boolean(searchValue)}
pageSize={pageSize} pageSize={pageSize}
paging={paging} paging={paging}