diff --git a/web/src/ar/pages/artifact-list/components/ArtifactListTable/ArtifactListTableCell.tsx b/web/src/ar/pages/artifact-list/components/ArtifactListTable/ArtifactListTableCell.tsx index 4ec7c89a4..86ca1cea5 100644 --- a/web/src/ar/pages/artifact-list/components/ArtifactListTable/ArtifactListTableCell.tsx +++ b/web/src/ar/pages/artifact-list/components/ArtifactListTable/ArtifactListTableCell.tsx @@ -107,6 +107,7 @@ export const ArtifactListPullCommandCell: CellType = ({ value, row }) => { const { packageType } = original const { getString } = useStrings() switch (packageType) { + case RepositoryPackageType.MAVEN: case RepositoryPackageType.GENERIC: return ( { @@ -51,6 +52,8 @@ export class GenericVersionType extends VersionStep { switch (props.tab) { case VersionDetailsTab.OVERVIEW: return + case VersionDetailsTab.ARTIFACT_DETAILS: + return default: return } diff --git a/web/src/ar/pages/version-details/MavenVersion/pages/artifact-details/MavenArtifactDetailsPage.tsx b/web/src/ar/pages/version-details/MavenVersion/pages/artifact-details/MavenArtifactDetailsPage.tsx new file mode 100644 index 000000000..13550900b --- /dev/null +++ b/web/src/ar/pages/version-details/MavenVersion/pages/artifact-details/MavenArtifactDetailsPage.tsx @@ -0,0 +1,80 @@ +/* + * Copyright 2024 Harness, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import React from 'react' +import { Page } from '@harnessio/uicore' +import { useGetArtifactFilesQuery } from '@harnessio/react-har-service-client' + +import { DEFAULT_PAGE_INDEX } from '@ar/constants' +import type { VersionDetailsPathParams } from '@ar/routes/types' +import { useDecodedParams, useGetSpaceRef, useParentHooks } from '@ar/hooks' +import { + type ArtifactFileListPageQueryParams, + useArtifactFileListQueryParamOptions +} from '@ar/pages/version-details/components/ArtifactFileListTable/utils' +import ArtifactFileListTable from '@ar/pages/version-details/components/ArtifactFileListTable/ArtifactFileListTable' +import versionDetailsPageCss from '../../MavenVersion.module.scss' + +export default function MavenArtifactDetailsPage() { + const registryRef = useGetSpaceRef() + const { useQueryParams, useUpdateQueryParams } = useParentHooks() + const { updateQueryParams } = useUpdateQueryParams>() + + const pathParams = useDecodedParams() + const queryParamOptions = useArtifactFileListQueryParamOptions() + const queryParams = useQueryParams(queryParamOptions) + const { searchTerm, page, size, sort } = queryParams + + const [sortField, sortOrder] = sort || [] + + const { + isFetching: loading, + error, + data, + refetch + } = useGetArtifactFilesQuery({ + registry_ref: registryRef, + artifact: pathParams.artifactIdentifier, + version: pathParams.versionIdentifier, + queryParams: { + searchTerm, + page, + size, + sortField, + sortOrder + } + }) + const response = data?.content + + return ( + refetch()}> + {response && ( + updateQueryParams({ page: pageNumber })} + setSortBy={sortArr => { + updateQueryParams({ sort: sortArr, page: DEFAULT_PAGE_INDEX }) + }} + sortBy={sort} + /> + )} + + ) +}