Skip to content

Commit

Permalink
NCL-8939 Set single page request to page size 0
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikk0123 committed Dec 3, 2024
1 parent 412cfeb commit c793594
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
8 changes: 4 additions & 4 deletions src/components/ArtifactPages/ArtifactPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -44,18 +44,18 @@ 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]);

usePncWebSocketEffect(
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]
Expand Down
10 changes: 5 additions & 5 deletions src/components/BuildConfigPages/BuildConfigPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions src/components/BuildPages/BuildPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions src/components/ProductMilestonePages/ProductMilestonePages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -93,13 +93,13 @@ export const ProductMilestonePages = ({ children }: PropsWithChildren<IProductMi
},
});

serviceContainerBuildsRunner({ serviceData: { id: productMilestoneId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG });
serviceContainerCloseResultsRunner({ serviceData: { id: productMilestoneId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG });
serviceContainerBuildsRunner({ serviceData: { id: productMilestoneId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG });
serviceContainerCloseResultsRunner({ serviceData: { id: productMilestoneId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG });
serviceContainerDeliverablesAnalysesRunner({
serviceData: { id: productMilestoneId },
requestConfig: SINGLE_PAGE_REQUEST_CONFIG,
requestConfig: TOTAL_COUNT_REQUEST_CONFIG,
});
serviceContainerArtifactsRunner({ serviceData: { id: productMilestoneId }, requestConfig: SINGLE_PAGE_REQUEST_CONFIG });
serviceContainerArtifactsRunner({ serviceData: { id: productMilestoneId }, requestConfig: TOTAL_COUNT_REQUEST_CONFIG });
}, [
serviceContainerProductMilestoneRunner,
serviceContainerProductVersionRunner,
Expand All @@ -116,17 +116,17 @@ export const ProductMilestonePages = ({ children }: PropsWithChildren<IProductMi
if (hasBuildStarted(wsData, { productMilestoneId })) {
serviceContainerBuildsRunnerDebounced({
serviceData: { id: productMilestoneId },
requestConfig: SINGLE_PAGE_REQUEST_CONFIG,
requestConfig: TOTAL_COUNT_REQUEST_CONFIG,
});
} else if (hasMilestoneCloseFinished(wsData, { productMilestoneId })) {
serviceContainerCloseResultsRunner({
serviceData: { id: productMilestoneId },
requestConfig: SINGLE_PAGE_REQUEST_CONFIG,
requestConfig: TOTAL_COUNT_REQUEST_CONFIG,
});
} else if (hasDeliverablesAnalysisStarted(wsData, { productMilestoneId })) {
serviceContainerDeliverablesAnalysesRunner({
serviceData: { id: productMilestoneId },
requestConfig: SINGLE_PAGE_REQUEST_CONFIG,
requestConfig: TOTAL_COUNT_REQUEST_CONFIG,
});
}
},
Expand Down
10 changes: 5 additions & 5 deletions src/components/ProductVersionPages/ProductVersionPages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Outlet, useOutletContext } from 'react-router-dom';
import { ProductVersion } 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 { IServiceContainerState, useServiceContainer } from 'hooks/useServiceContainer';
Expand Down Expand Up @@ -45,10 +45,10 @@ export const ProductVersionPages = () => {
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,
Expand Down

0 comments on commit c793594

Please sign in to comment.