diff --git a/src/components/BuildArtifactsPage/BuildArtifactsPage.tsx b/src/components/BuildArtifactsPage/BuildArtifactsPage.tsx index 26c14d9c..8de7f4aa 100644 --- a/src/components/BuildArtifactsPage/BuildArtifactsPage.tsx +++ b/src/components/BuildArtifactsPage/BuildArtifactsPage.tsx @@ -1,5 +1,26 @@ -import { ContentBox } from 'components/ContentBox/ContentBox'; +import { useParams } from 'react-router-dom'; -export const BuildArtifactsPage = () => { - return ; +import { useQueryParamsEffect } from 'hooks/useQueryParamsEffect'; +import { useServiceContainer } from 'hooks/useServiceContainer'; + +import { ArtifactsList } from 'components/ArtifactsList/ArtifactsList'; + +import * as buildApi from 'services/buildApi'; + +interface IBuildArtifactsPageProps { + componentId?: string; +} + +export const BuildArtifactsPage = ({ componentId = 'a1' }: IBuildArtifactsPageProps) => { + const { buildId } = useParams(); + + const serviceContainerArtifacts = useServiceContainer(buildApi.getBuiltArtifacts); + const serviceContainerArtifactsRunner = serviceContainerArtifacts.run; + + useQueryParamsEffect( + ({ requestConfig } = {}) => serviceContainerArtifactsRunner({ serviceData: { id: buildId }, requestConfig }), + { componentId } + ); + + return ; }; diff --git a/src/services/buildApi.ts b/src/services/buildApi.ts index fe1b226d..2cd5d597 100644 --- a/src/services/buildApi.ts +++ b/src/services/buildApi.ts @@ -1,6 +1,6 @@ import { AxiosRequestConfig } from 'axios'; -import { Build, BuildPage, BuildsGraph, RunningBuildCount } from 'pnc-api-types-ts'; +import { ArtifactPage, Build, BuildPage, BuildsGraph, RunningBuildCount } from 'pnc-api-types-ts'; import { mockClient } from 'services/mockClient'; @@ -38,6 +38,17 @@ export const getBuild = ({ id }: IBuildApiData, requestConfig: AxiosRequestConfi return pncClient.getHttpClient().get(`/builds/${id}`, requestConfig); }; +/** + * Gets Artifacts built in a Build. + * + * @param serviceData - object containing: + * - id - Build ID + * @param requestConfig - Axios based request config + */ +export const getBuiltArtifacts = ({ id }: IBuildApiData, requestConfig: AxiosRequestConfig = {}) => { + return pncClient.getHttpClient().get(`/builds/${id}/artifacts/built`, requestConfig); +}; + /** * Gets Build Metrics by a list of build Ids. *