From c793594f379ba27e64bb857292eca68bc76a8741 Mon Sep 17 00:00:00 2001 From: Patrik Korytar Date: Tue, 12 Nov 2024 12:32:02 +0100 Subject: [PATCH] NCL-8939 Set single page request to page size 0 --- src/common/constants.ts | 2 +- src/components/ArtifactPages/ArtifactPages.tsx | 8 ++++---- .../BuildConfigPages/BuildConfigPages.tsx | 10 +++++----- src/components/BuildPages/BuildPages.tsx | 10 +++++----- .../ProductMilestonePages.tsx | 16 ++++++++-------- .../ProductVersionPages/ProductVersionPages.tsx | 10 +++++----- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/common/constants.ts b/src/common/constants.ts index 248d5128..d20bfb40 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -81,7 +81,7 @@ export const RepositoryUrls = { }; // For getting total item count -export const SINGLE_PAGE_REQUEST_CONFIG: AxiosRequestConfig = { params: { pageSize: 1 } }; +export const TOTAL_COUNT_REQUEST_CONFIG: AxiosRequestConfig = { params: { pageSize: 0 } }; export const FILTERING_PLACEHOLDER_DEFAULT: string = 'string | !string | s?ring | st*g'; diff --git a/src/components/ArtifactPages/ArtifactPages.tsx b/src/components/ArtifactPages/ArtifactPages.tsx index 7f05fbaa..5e0ccfce 100644 --- a/src/components/ArtifactPages/ArtifactPages.tsx +++ b/src/components/ArtifactPages/ArtifactPages.tsx @@ -4,7 +4,7 @@ import { Outlet, useOutletContext } from 'react-router-dom'; import { Artifact } from 'pnc-api-types-ts'; import { breadcrumbData } from 'common/breadcrumbData'; -import { SINGLE_PAGE_REQUEST_CONFIG } from 'common/constants'; +import { TOTAL_COUNT_REQUEST_CONFIG } from 'common/constants'; import { useParamsRequired } from 'hooks/useParamsRequired'; import { hasBuildFinished, usePncWebSocketEffect } from 'hooks/usePncWebSocketEffect'; @@ -44,10 +44,10 @@ export const ArtifactPages = () => { useEffect(() => { serviceContainerArtifactRunner({ serviceData: { id: artifactId } }); - serviceContainerBuildsRunner({ serviceData: { id: artifactId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerBuildsRunner({ serviceData: { id: artifactId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); serviceContainerProductMilestonesReleasesRunner({ serviceData: { id: artifactId }, - requestConfig: SINGLE_PAGE_REQUEST_CONFIG, + requestConfig: TOTAL_COUNT_REQUEST_CONFIG, }); }, [serviceContainerArtifactRunner, serviceContainerBuildsRunner, serviceContainerProductMilestonesReleasesRunner, artifactId]); @@ -55,7 +55,7 @@ export const ArtifactPages = () => { useCallback( (wsData: any) => { if (hasBuildFinished(wsData)) { - serviceContainerBuildsRunner({ serviceData: { id: artifactId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerBuildsRunner({ serviceData: { id: artifactId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); } }, [serviceContainerBuildsRunner, artifactId] diff --git a/src/components/BuildConfigPages/BuildConfigPages.tsx b/src/components/BuildConfigPages/BuildConfigPages.tsx index 638df771..a5c8aac3 100644 --- a/src/components/BuildConfigPages/BuildConfigPages.tsx +++ b/src/components/BuildConfigPages/BuildConfigPages.tsx @@ -4,7 +4,7 @@ import { Outlet, useOutletContext } from 'react-router-dom'; import { Build, BuildConfiguration } from 'pnc-api-types-ts'; import { breadcrumbData } from 'common/breadcrumbData'; -import { SINGLE_PAGE_REQUEST_CONFIG } from 'common/constants'; +import { TOTAL_COUNT_REQUEST_CONFIG } from 'common/constants'; import { useComponentQueryParams } from 'hooks/useComponentQueryParams'; import { useParamsRequired } from 'hooks/useParamsRequired'; @@ -100,10 +100,10 @@ export const BuildConfigPages = ({ componentIdBuildHistory = 'bh1' }: IBuildConf useEffect(() => { serviceContainerBuildConfigRunner({ serviceData: { id: buildConfigId } }); - serviceContainerDependenciesRunner({ serviceData: { id: buildConfigId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerDependantsRunner({ serviceData: { id: buildConfigId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerGroupConfigsRunner({ serviceData: { id: buildConfigId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerRevisionsRunner({ serviceData: { id: buildConfigId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerDependenciesRunner({ serviceData: { id: buildConfigId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerDependantsRunner({ serviceData: { id: buildConfigId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerGroupConfigsRunner({ serviceData: { id: buildConfigId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerRevisionsRunner({ serviceData: { id: buildConfigId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); }, [ serviceContainerBuildConfigRunner, serviceContainerDependenciesRunner, diff --git a/src/components/BuildPages/BuildPages.tsx b/src/components/BuildPages/BuildPages.tsx index 5467d87d..4bb45101 100644 --- a/src/components/BuildPages/BuildPages.tsx +++ b/src/components/BuildPages/BuildPages.tsx @@ -5,7 +5,7 @@ import { Build } from 'pnc-api-types-ts'; import { breadcrumbData } from 'common/breadcrumbData'; import { buildStatusData } from 'common/buildStatusData'; -import { SINGLE_PAGE_REQUEST_CONFIG } from 'common/constants'; +import { TOTAL_COUNT_REQUEST_CONFIG } from 'common/constants'; import { useParamsRequired } from 'hooks/useParamsRequired'; import { hasBuildFinished, hasBuildStatusChanged, usePncWebSocketEffect } from 'hooks/usePncWebSocketEffect'; @@ -70,8 +70,8 @@ export const BuildPages = () => { useEffect(() => { serviceContainerBuildRunner({ serviceData: { id: buildId } }); - serviceContainerArtifactsRunner({ serviceData: { id: buildId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerDependenciesRunner({ serviceData: { id: buildId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerArtifactsRunner({ serviceData: { id: buildId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerDependenciesRunner({ serviceData: { id: buildId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); }, [serviceContainerBuildRunner, serviceContainerArtifactsRunner, serviceContainerDependenciesRunner, buildId]); useEffect(() => { @@ -102,8 +102,8 @@ export const BuildPages = () => { if (hasBuildFinished(wsData, { buildId })) { serviceContainerBuildRunner({ serviceData: { id: buildId } }); - serviceContainerArtifactsRunner({ serviceData: { id: buildId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerDependenciesRunner({ serviceData: { id: buildId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerArtifactsRunner({ serviceData: { id: buildId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerDependenciesRunner({ serviceData: { id: buildId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); } else if (hasBuildStatusChanged(wsData, { buildId })) { const wsBuild: Build = wsData.build; serviceContainerBuildSetter(wsBuild); diff --git a/src/components/ProductMilestonePages/ProductMilestonePages.tsx b/src/components/ProductMilestonePages/ProductMilestonePages.tsx index c4e2dd51..8e247420 100644 --- a/src/components/ProductMilestonePages/ProductMilestonePages.tsx +++ b/src/components/ProductMilestonePages/ProductMilestonePages.tsx @@ -4,7 +4,7 @@ import { Outlet, useOutletContext } from 'react-router-dom'; import { ProductMilestone } from 'pnc-api-types-ts'; import { breadcrumbData } from 'common/breadcrumbData'; -import { SINGLE_PAGE_REQUEST_CONFIG } from 'common/constants'; +import { TOTAL_COUNT_REQUEST_CONFIG } from 'common/constants'; import { useParamsRequired } from 'hooks/useParamsRequired'; import { @@ -93,13 +93,13 @@ export const ProductMilestonePages = ({ children }: PropsWithChildren { useEffect(() => { serviceContainerProductVersionRunner({ serviceData: { id: productVersionId } }); - serviceContainerProductMilestonesRunner({ serviceData: { id: productVersionId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerProductReleasesRunner({ serviceData: { id: productVersionId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerBuildConfigsRunner({ serviceData: { id: productVersionId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); - serviceContainerGroupConfigsRunner({ serviceData: { id: productVersionId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG }); + serviceContainerProductMilestonesRunner({ serviceData: { id: productVersionId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerProductReleasesRunner({ serviceData: { id: productVersionId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerBuildConfigsRunner({ serviceData: { id: productVersionId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); + serviceContainerGroupConfigsRunner({ serviceData: { id: productVersionId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG }); }, [ serviceContainerProductVersionRunner, serviceContainerProductMilestonesRunner,