mirror of
https://github.com/harness/drone.git
synced 2025-05-17 01:20:13 +08:00
feat: [AH-853]: Implement Maven Artifact Details Page (#3317)
* feat: [AH-856]: Support Maven Artifact in global artifact list table * feat: [AH-853]: Implement Maven Artifact Details Page
This commit is contained in:
parent
30df15d021
commit
58e0787663
@ -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 (
|
||||
<TableCells.LinkCell
|
||||
|
@ -29,6 +29,7 @@ import {
|
||||
import { MavenVersionListPage } from './pages/list/MavenVersionListPage'
|
||||
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||
import MavenArtifactOverviewPage from './pages/overview/MavenArtifactOverviewPage'
|
||||
import MavenArtifactDetailsPage from './pages/artifact-details/MavenArtifactDetailsPage'
|
||||
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
||||
|
||||
export class GenericVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||
@ -51,6 +52,8 @@ export class GenericVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||
switch (props.tab) {
|
||||
case VersionDetailsTab.OVERVIEW:
|
||||
return <MavenArtifactOverviewPage />
|
||||
case VersionDetailsTab.ARTIFACT_DETAILS:
|
||||
return <MavenArtifactDetailsPage />
|
||||
default:
|
||||
return <String stringID="tabNotFound" />
|
||||
}
|
||||
|
@ -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<Partial<ArtifactFileListPageQueryParams>>()
|
||||
|
||||
const pathParams = useDecodedParams<VersionDetailsPathParams>()
|
||||
const queryParamOptions = useArtifactFileListQueryParamOptions()
|
||||
const queryParams = useQueryParams<ArtifactFileListPageQueryParams>(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 (
|
||||
<Page.Body
|
||||
className={versionDetailsPageCss.pageBody}
|
||||
loading={loading}
|
||||
error={error?.message || error}
|
||||
retryOnError={() => refetch()}>
|
||||
{response && (
|
||||
<ArtifactFileListTable
|
||||
data={response}
|
||||
gotoPage={pageNumber => updateQueryParams({ page: pageNumber })}
|
||||
setSortBy={sortArr => {
|
||||
updateQueryParams({ sort: sortArr, page: DEFAULT_PAGE_INDEX })
|
||||
}}
|
||||
sortBy={sort}
|
||||
/>
|
||||
)}
|
||||
</Page.Body>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user