mirror of https://github.com/harness/drone.git
feat: [AH-547]: support actions at version level (#3516)
* feat: [AH-547]: support actions at version leveltry-new-ui
parent
164fa4153d
commit
d19163660f
|
@ -17,6 +17,8 @@
|
||||||
import type { PaginationProps } from '@harnessio/uicore'
|
import type { PaginationProps } from '@harnessio/uicore'
|
||||||
import type {
|
import type {
|
||||||
ArtifactSummary,
|
ArtifactSummary,
|
||||||
|
ArtifactVersionMetadata,
|
||||||
|
ArtifactVersionSummary,
|
||||||
ListArtifactVersion,
|
ListArtifactVersion,
|
||||||
RegistryArtifactMetadata
|
RegistryArtifactMetadata
|
||||||
} from '@harnessio/react-har-service-client'
|
} from '@harnessio/react-har-service-client'
|
||||||
|
@ -52,6 +54,16 @@ export interface ArtifactActionProps {
|
||||||
onClose?: () => void
|
onClose?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VersionActionProps {
|
||||||
|
data: ArtifactVersionMetadata | ArtifactVersionSummary
|
||||||
|
pageType: PageType
|
||||||
|
repoKey: string
|
||||||
|
artifactKey: string
|
||||||
|
versionKey: string
|
||||||
|
readonly?: boolean
|
||||||
|
onClose?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
export abstract class VersionStep<T> {
|
export abstract class VersionStep<T> {
|
||||||
protected abstract packageType: RepositoryPackageType
|
protected abstract packageType: RepositoryPackageType
|
||||||
protected abstract allowedVersionDetailsTabs: VersionDetailsTab[]
|
protected abstract allowedVersionDetailsTabs: VersionDetailsTab[]
|
||||||
|
@ -71,4 +83,6 @@ export abstract class VersionStep<T> {
|
||||||
abstract renderVersionDetailsTab(props: VersionDetailsTabProps): JSX.Element
|
abstract renderVersionDetailsTab(props: VersionDetailsTabProps): JSX.Element
|
||||||
|
|
||||||
abstract renderArtifactActions(props: ArtifactActionProps): JSX.Element
|
abstract renderArtifactActions(props: ArtifactActionProps): JSX.Element
|
||||||
|
|
||||||
|
abstract renderVersionActions(props: VersionActionProps): JSX.Element
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* 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 { Text } from '@harnessio/uicore'
|
||||||
|
|
||||||
|
import { useStrings } from '@ar/frameworks/strings'
|
||||||
|
import type { RepositoryPackageType } from '@ar/common/types'
|
||||||
|
|
||||||
|
import versionFactory from './VersionFactory'
|
||||||
|
import type { VersionActionProps } from './Version'
|
||||||
|
import type { VersionAbstractFactory } from './VersionAbstractFactory'
|
||||||
|
|
||||||
|
interface VersionActionsWidgetProps extends VersionActionProps {
|
||||||
|
factory?: VersionAbstractFactory
|
||||||
|
packageType: RepositoryPackageType
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function VersionActionsWidget(props: VersionActionsWidgetProps): JSX.Element {
|
||||||
|
const { factory = versionFactory, packageType, ...rest } = props
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const repositoryType = factory?.getVersionType(packageType)
|
||||||
|
if (!repositoryType) {
|
||||||
|
return <Text intent="warning">{getString('stepNotFound')}</Text>
|
||||||
|
}
|
||||||
|
return repositoryType.renderVersionActions({ ...rest })
|
||||||
|
}
|
|
@ -107,6 +107,12 @@ export default function ArtifactListTable(props: ArtifactListTableProps): JSX.El
|
||||||
accessor: 'lastUpdated',
|
accessor: 'lastUpdated',
|
||||||
Cell: LatestArtifactCell,
|
Cell: LatestArtifactCell,
|
||||||
serverSortProps: getServerSortProps('lastUpdated')
|
serverSortProps: getServerSortProps('lastUpdated')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Header: '',
|
||||||
|
accessor: 'actions',
|
||||||
|
Cell: LatestArtifactCell,
|
||||||
|
disableSortBy: true
|
||||||
}
|
}
|
||||||
].filter(Boolean) as unknown as Column<ArtifactMetadata>[]
|
].filter(Boolean) as unknown as Column<ArtifactMetadata>[]
|
||||||
}, [currentOrder, currentSort, getString])
|
}, [currentOrder, currentSort, getString])
|
||||||
|
|
|
@ -25,11 +25,12 @@ import type { ArtifactMetadata, StoDigestMetadata } from '@harnessio/react-har-s
|
||||||
|
|
||||||
import { useParentComponents, useRoutes } from '@ar/hooks'
|
import { useParentComponents, useRoutes } from '@ar/hooks'
|
||||||
import TableCells from '@ar/components/TableCells/TableCells'
|
import TableCells from '@ar/components/TableCells/TableCells'
|
||||||
import { RepositoryPackageType } from '@ar/common/types'
|
import { PageType, RepositoryPackageType } from '@ar/common/types'
|
||||||
import LabelsPopover from '@ar/components/LabelsPopover/LabelsPopover'
|
import LabelsPopover from '@ar/components/LabelsPopover/LabelsPopover'
|
||||||
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
||||||
import { useStrings } from '@ar/frameworks/strings'
|
import { useStrings } from '@ar/frameworks/strings'
|
||||||
import { getShortDigest } from '@ar/pages/digest-list/utils'
|
import { getShortDigest } from '@ar/pages/digest-list/utils'
|
||||||
|
import VersionActionsWidget from '@ar/frameworks/Version/VersionActionsWidget'
|
||||||
import { VersionDetailsTab } from '@ar/pages/version-details/components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '@ar/pages/version-details/components/VersionDetailsTabs/constants'
|
||||||
|
|
||||||
import css from './ArtifactListTable.module.scss'
|
import css from './ArtifactListTable.module.scss'
|
||||||
|
@ -217,3 +218,17 @@ export const LatestArtifactCell: CellType = ({ row }) => {
|
||||||
const { original } = row
|
const { original } = row
|
||||||
return <TableCells.LastModifiedCell value={defaultTo(original.lastModified, 0)} />
|
return <TableCells.LastModifiedCell value={defaultTo(original.lastModified, 0)} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const ArtifactVersionActions: CellType = ({ row }) => {
|
||||||
|
const { original } = row
|
||||||
|
return (
|
||||||
|
<VersionActionsWidget
|
||||||
|
pageType={PageType.Table}
|
||||||
|
data={original}
|
||||||
|
repoKey={original.registryIdentifier}
|
||||||
|
artifactKey={original.name}
|
||||||
|
versionKey={original.version}
|
||||||
|
packageType={original.packageType as RepositoryPackageType}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -20,10 +20,11 @@ import { useHistory } from 'react-router-dom'
|
||||||
import { Layout } from '@harnessio/uicore'
|
import { Layout } from '@harnessio/uicore'
|
||||||
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
||||||
|
|
||||||
import type { RepositoryPackageType } from '@ar/common/types'
|
import { PageType, RepositoryPackageType } from '@ar/common/types'
|
||||||
import type { VersionDetailsPathParams } from '@ar/routes/types'
|
import type { VersionDetailsPathParams } from '@ar/routes/types'
|
||||||
import { useDecodedParams, useParentHooks, useRoutes } from '@ar/hooks'
|
import { useDecodedParams, useParentHooks, useRoutes } from '@ar/hooks'
|
||||||
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
||||||
|
import VersionActionsWidget from '@ar/frameworks/Version/VersionActionsWidget'
|
||||||
import SetupClientButton from '@ar/components/SetupClientButton/SetupClientButton'
|
import SetupClientButton from '@ar/components/SetupClientButton/SetupClientButton'
|
||||||
|
|
||||||
import DockerVersionName from './components/DockerVersionName/DockerVersionName'
|
import DockerVersionName from './components/DockerVersionName/DockerVersionName'
|
||||||
|
@ -78,6 +79,14 @@ export default function DockerVersionHeader(props: DockerVersionHeaderProps): JS
|
||||||
versionIdentifier={pathParams.versionIdentifier}
|
versionIdentifier={pathParams.versionIdentifier}
|
||||||
packageType={packageType as RepositoryPackageType}
|
packageType={packageType as RepositoryPackageType}
|
||||||
/>
|
/>
|
||||||
|
<VersionActionsWidget
|
||||||
|
packageType={RepositoryPackageType.DOCKER}
|
||||||
|
repoKey={pathParams.repositoryIdentifier}
|
||||||
|
artifactKey={pathParams.artifactIdentifier}
|
||||||
|
versionKey={pathParams.versionIdentifier}
|
||||||
|
pageType={PageType.Details}
|
||||||
|
data={data}
|
||||||
|
/>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import ArtifactActions from '@ar/pages/artifact-details/components/ArtifactActio
|
||||||
import DockerVersionListTable from '@ar/pages/version-list/DockerVersion/VersionListTable/DockerVersionListTable'
|
import DockerVersionListTable from '@ar/pages/version-list/DockerVersion/VersionListTable/DockerVersionListTable'
|
||||||
import {
|
import {
|
||||||
type ArtifactActionProps,
|
type ArtifactActionProps,
|
||||||
|
type VersionActionProps,
|
||||||
type VersionDetailsHeaderProps,
|
type VersionDetailsHeaderProps,
|
||||||
type VersionDetailsTabProps,
|
type VersionDetailsTabProps,
|
||||||
type VersionListTableProps,
|
type VersionListTableProps,
|
||||||
|
@ -37,6 +38,7 @@ import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||||
import DockerArtifactSecurityTestsContent from './DockerArtifactSecurityTestsContent'
|
import DockerArtifactSecurityTestsContent from './DockerArtifactSecurityTestsContent'
|
||||||
import DockerVersionOSSContent from './DockerVersionOSSContent/DockerVersionOSSContent'
|
import DockerVersionOSSContent from './DockerVersionOSSContent/DockerVersionOSSContent'
|
||||||
import DockerDeploymentsContent from './DockerDeploymentsContent/DockerDeploymentsContent'
|
import DockerDeploymentsContent from './DockerDeploymentsContent/DockerDeploymentsContent'
|
||||||
|
import VersionActions from '../components/VersionActions/VersionActions'
|
||||||
|
|
||||||
export class DockerVersionType extends VersionStep<ArtifactVersionSummary> {
|
export class DockerVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
protected packageType = RepositoryPackageType.DOCKER
|
protected packageType = RepositoryPackageType.DOCKER
|
||||||
|
@ -78,4 +80,8 @@ export class DockerVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
||||||
return <ArtifactActions {...props} />
|
return <ArtifactActions {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderVersionActions(props: VersionActionProps): JSX.Element {
|
||||||
|
return <VersionActions {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import React from 'react'
|
||||||
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
||||||
import {
|
import {
|
||||||
type ArtifactActionProps,
|
type ArtifactActionProps,
|
||||||
|
type VersionActionProps,
|
||||||
type VersionDetailsHeaderProps,
|
type VersionDetailsHeaderProps,
|
||||||
type VersionDetailsTabProps,
|
type VersionDetailsTabProps,
|
||||||
type VersionListTableProps,
|
type VersionListTableProps,
|
||||||
|
@ -33,6 +34,7 @@ import ArtifactActions from '@ar/pages/artifact-details/components/ArtifactActio
|
||||||
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||||
import GenericOverviewPage from './pages/overview/OverviewPage'
|
import GenericOverviewPage from './pages/overview/OverviewPage'
|
||||||
import OSSContentPage from './pages/oss-details/OSSContentPage'
|
import OSSContentPage from './pages/oss-details/OSSContentPage'
|
||||||
|
import VersionActions from '../components/VersionActions/VersionActions'
|
||||||
import GenericArtifactDetailsPage from './pages/artifact-details/GenericArtifactDetailsPage'
|
import GenericArtifactDetailsPage from './pages/artifact-details/GenericArtifactDetailsPage'
|
||||||
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
||||||
|
|
||||||
|
@ -48,7 +50,8 @@ export class GenericVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
[VersionListColumnEnum.Name]: { width: '100%' },
|
[VersionListColumnEnum.Name]: { width: '100%' },
|
||||||
[VersionListColumnEnum.Size]: { width: '100%' },
|
[VersionListColumnEnum.Size]: { width: '100%' },
|
||||||
[VersionListColumnEnum.FileCount]: { width: '100%' },
|
[VersionListColumnEnum.FileCount]: { width: '100%' },
|
||||||
[VersionListColumnEnum.LastModified]: { width: '100%' }
|
[VersionListColumnEnum.LastModified]: { width: '100%' },
|
||||||
|
[VersionListColumnEnum.Actions]: { width: '10%' }
|
||||||
}
|
}
|
||||||
|
|
||||||
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
||||||
|
@ -75,4 +78,8 @@ export class GenericVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
||||||
return <ArtifactActions {...props} />
|
return <ArtifactActions {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderVersionActions(props: VersionActionProps): JSX.Element {
|
||||||
|
return <VersionActions {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import VersionListTable, {
|
||||||
import ArtifactActions from '@ar/pages/artifact-details/components/ArtifactActions/ArtifactActions'
|
import ArtifactActions from '@ar/pages/artifact-details/components/ArtifactActions/ArtifactActions'
|
||||||
import {
|
import {
|
||||||
type ArtifactActionProps,
|
type ArtifactActionProps,
|
||||||
|
type VersionActionProps,
|
||||||
type VersionDetailsHeaderProps,
|
type VersionDetailsHeaderProps,
|
||||||
type VersionDetailsTabProps,
|
type VersionDetailsTabProps,
|
||||||
type VersionListTableProps,
|
type VersionListTableProps,
|
||||||
|
@ -34,6 +35,7 @@ import {
|
||||||
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||||
import HelmVersionOverviewContent from './HelmVersionOverviewContent'
|
import HelmVersionOverviewContent from './HelmVersionOverviewContent'
|
||||||
import HelmArtifactDetailsContent from './HelmArtifactDetailsContent'
|
import HelmArtifactDetailsContent from './HelmArtifactDetailsContent'
|
||||||
|
import VersionActions from '../components/VersionActions/VersionActions'
|
||||||
import HelmVersionOSSContent from './HelmVersionOSSContent/HelmVersionOSSContent'
|
import HelmVersionOSSContent from './HelmVersionOSSContent/HelmVersionOSSContent'
|
||||||
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
||||||
|
|
||||||
|
@ -49,7 +51,8 @@ export class HelmVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
[VersionListColumnEnum.Size]: { width: '100%' },
|
[VersionListColumnEnum.Size]: { width: '100%' },
|
||||||
[VersionListColumnEnum.DownloadCount]: { width: '100%' },
|
[VersionListColumnEnum.DownloadCount]: { width: '100%' },
|
||||||
[VersionListColumnEnum.LastModified]: { width: '100%' },
|
[VersionListColumnEnum.LastModified]: { width: '100%' },
|
||||||
[VersionListColumnEnum.PullCommand]: { width: '100%' }
|
[VersionListColumnEnum.PullCommand]: { width: '100%' },
|
||||||
|
[VersionListColumnEnum.Actions]: { width: '10%' }
|
||||||
}
|
}
|
||||||
|
|
||||||
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
||||||
|
@ -76,4 +79,8 @@ export class HelmVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
||||||
return <ArtifactActions {...props} />
|
return <ArtifactActions {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderVersionActions(props: VersionActionProps): JSX.Element {
|
||||||
|
return <VersionActions {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,17 +26,19 @@ import VersionListTable, {
|
||||||
} from '@ar/pages/version-list/components/VersionListTable/VersionListTable'
|
} from '@ar/pages/version-list/components/VersionListTable/VersionListTable'
|
||||||
import {
|
import {
|
||||||
type ArtifactActionProps,
|
type ArtifactActionProps,
|
||||||
|
type VersionActionProps,
|
||||||
type VersionDetailsHeaderProps,
|
type VersionDetailsHeaderProps,
|
||||||
type VersionDetailsTabProps,
|
type VersionDetailsTabProps,
|
||||||
type VersionListTableProps,
|
type VersionListTableProps,
|
||||||
VersionStep
|
VersionStep
|
||||||
} from '@ar/frameworks/Version/Version'
|
} from '@ar/frameworks/Version/Version'
|
||||||
|
|
||||||
|
import OSSContentPage from './pages/oss-details/OSSContentPage'
|
||||||
|
import VersionActions from '../components/VersionActions/VersionActions'
|
||||||
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||||
import MavenArtifactOverviewPage from './pages/overview/MavenArtifactOverviewPage'
|
import MavenArtifactOverviewPage from './pages/overview/MavenArtifactOverviewPage'
|
||||||
import MavenArtifactDetailsPage from './pages/artifact-details/MavenArtifactDetailsPage'
|
import MavenArtifactDetailsPage from './pages/artifact-details/MavenArtifactDetailsPage'
|
||||||
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
||||||
import OSSContentPage from './pages/oss-details/OSSContentPage'
|
|
||||||
|
|
||||||
export class MavenVersionType extends VersionStep<ArtifactVersionSummary> {
|
export class MavenVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
protected packageType = RepositoryPackageType.MAVEN
|
protected packageType = RepositoryPackageType.MAVEN
|
||||||
|
@ -50,7 +52,8 @@ export class MavenVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
[VersionListColumnEnum.Name]: { width: '100%' },
|
[VersionListColumnEnum.Name]: { width: '100%' },
|
||||||
[VersionListColumnEnum.Size]: { width: '100%' },
|
[VersionListColumnEnum.Size]: { width: '100%' },
|
||||||
[VersionListColumnEnum.FileCount]: { width: '100%' },
|
[VersionListColumnEnum.FileCount]: { width: '100%' },
|
||||||
[VersionListColumnEnum.LastModified]: { width: '100%' }
|
[VersionListColumnEnum.LastModified]: { width: '100%' },
|
||||||
|
[VersionListColumnEnum.Actions]: { width: '10%' }
|
||||||
}
|
}
|
||||||
|
|
||||||
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
||||||
|
@ -77,4 +80,8 @@ export class MavenVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
||||||
return <ArtifactActions {...props} />
|
return <ArtifactActions {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderVersionActions(props: VersionActionProps): JSX.Element {
|
||||||
|
return <VersionActions {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,18 @@ import VersionListTable, {
|
||||||
} from '@ar/pages/version-list/components/VersionListTable/VersionListTable'
|
} from '@ar/pages/version-list/components/VersionListTable/VersionListTable'
|
||||||
import {
|
import {
|
||||||
type ArtifactActionProps,
|
type ArtifactActionProps,
|
||||||
|
type VersionActionProps,
|
||||||
type VersionDetailsHeaderProps,
|
type VersionDetailsHeaderProps,
|
||||||
type VersionDetailsTabProps,
|
type VersionDetailsTabProps,
|
||||||
type VersionListTableProps,
|
type VersionListTableProps,
|
||||||
VersionStep
|
VersionStep
|
||||||
} from '@ar/frameworks/Version/Version'
|
} from '@ar/frameworks/Version/Version'
|
||||||
|
|
||||||
|
import VersionActions from '../components/VersionActions/VersionActions'
|
||||||
import NpmVersionOverviewPage from './pages/overview/NpmVersionOverviewPage'
|
import NpmVersionOverviewPage from './pages/overview/NpmVersionOverviewPage'
|
||||||
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '../components/VersionDetailsTabs/constants'
|
||||||
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
|
||||||
import NpmVersionArtifactDetailsPage from './pages/artifact-dertails/NpmVersionArtifactDetailsPage'
|
import NpmVersionArtifactDetailsPage from './pages/artifact-dertails/NpmVersionArtifactDetailsPage'
|
||||||
|
import VersionDetailsHeaderContent from '../components/VersionDetailsHeaderContent/VersionDetailsHeaderContent'
|
||||||
|
|
||||||
export class NpmVersionType extends VersionStep<ArtifactVersionSummary> {
|
export class NpmVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
protected packageType = RepositoryPackageType.NPM
|
protected packageType = RepositoryPackageType.NPM
|
||||||
|
@ -51,7 +53,8 @@ export class NpmVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
[VersionListColumnEnum.Size]: { width: '100%' },
|
[VersionListColumnEnum.Size]: { width: '100%' },
|
||||||
[VersionListColumnEnum.DownloadCount]: { width: '100%' },
|
[VersionListColumnEnum.DownloadCount]: { width: '100%' },
|
||||||
[VersionListColumnEnum.PullCommand]: { width: '100%' },
|
[VersionListColumnEnum.PullCommand]: { width: '100%' },
|
||||||
[VersionListColumnEnum.LastModified]: { width: '100%' }
|
[VersionListColumnEnum.LastModified]: { width: '100%' },
|
||||||
|
[VersionListColumnEnum.Actions]: { width: '10%' }
|
||||||
}
|
}
|
||||||
|
|
||||||
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
renderVersionListTable(props: VersionListTableProps): JSX.Element {
|
||||||
|
@ -83,4 +86,8 @@ export class NpmVersionType extends VersionStep<ArtifactVersionSummary> {
|
||||||
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
renderArtifactActions(props: ArtifactActionProps): JSX.Element {
|
||||||
return <ArtifactActions {...props} />
|
return <ArtifactActions {...props} />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderVersionActions(props: VersionActionProps): JSX.Element {
|
||||||
|
return <VersionActions {...props} />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* 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 { useHistory } from 'react-router-dom'
|
||||||
|
|
||||||
|
import { useStrings } from '@ar/frameworks/strings'
|
||||||
|
import { queryClient } from '@ar/utils/queryClient'
|
||||||
|
import { useParentComponents, useRoutes } from '@ar/hooks'
|
||||||
|
import { PermissionIdentifier, ResourceType } from '@ar/common/permissionTypes'
|
||||||
|
|
||||||
|
import type { VersionActionProps } from './types'
|
||||||
|
import useDeleteVersionModal from '../../hooks/useDeleteVersionModal'
|
||||||
|
|
||||||
|
export default function DeleteVersionMenuItem(props: VersionActionProps): JSX.Element {
|
||||||
|
const { artifactKey, repoKey, readonly, onClose, versionKey } = props
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const { RbacMenuItem } = useParentComponents()
|
||||||
|
const history = useHistory()
|
||||||
|
const routes = useRoutes()
|
||||||
|
|
||||||
|
const handleAfterDeleteRepository = (): void => {
|
||||||
|
onClose?.()
|
||||||
|
queryClient.invalidateQueries(['GetAllArtifactVersions'])
|
||||||
|
history.push(
|
||||||
|
routes.toARArtifactDetails({
|
||||||
|
repositoryIdentifier: repoKey,
|
||||||
|
artifactIdentifier: artifactKey
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const { triggerDelete } = useDeleteVersionModal({
|
||||||
|
artifactKey,
|
||||||
|
repoKey,
|
||||||
|
versionKey,
|
||||||
|
onSuccess: handleAfterDeleteRepository
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleDeleteService = (): void => {
|
||||||
|
triggerDelete()
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<RbacMenuItem
|
||||||
|
icon="code-delete"
|
||||||
|
text={getString('versionList.actions.deleteVersion')}
|
||||||
|
onClick={handleDeleteService}
|
||||||
|
disabled={readonly}
|
||||||
|
permission={{
|
||||||
|
resource: {
|
||||||
|
resourceType: ResourceType.ARTIFACT_REGISTRY,
|
||||||
|
resourceIdentifier: artifactKey
|
||||||
|
},
|
||||||
|
permission: PermissionIdentifier.DELETE_ARTIFACT
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* 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 { defaultTo } from 'lodash-es'
|
||||||
|
|
||||||
|
import { useParentComponents } from '@ar/hooks'
|
||||||
|
import { useStrings } from '@ar/frameworks/strings'
|
||||||
|
import type { RepositoryPackageType } from '@ar/common/types'
|
||||||
|
import { PermissionIdentifier, ResourceType } from '@ar/common/permissionTypes'
|
||||||
|
import { useSetupClientModal } from '@ar/pages/repository-details/hooks/useSetupClientModal/useSetupClientModal'
|
||||||
|
|
||||||
|
import type { VersionActionProps } from './types'
|
||||||
|
|
||||||
|
export default function SetupClientMenuItem(props: VersionActionProps): JSX.Element {
|
||||||
|
const { artifactKey, repoKey, data, readonly, versionKey } = props
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const { RbacMenuItem } = useParentComponents()
|
||||||
|
|
||||||
|
const [showSetupClientModal] = useSetupClientModal({
|
||||||
|
repoKey,
|
||||||
|
packageType: data.packageType as RepositoryPackageType,
|
||||||
|
artifactKey,
|
||||||
|
versionKey
|
||||||
|
})
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<RbacMenuItem
|
||||||
|
icon="setup-client"
|
||||||
|
text={getString('actions.setupClient')}
|
||||||
|
onClick={showSetupClientModal}
|
||||||
|
disabled={readonly}
|
||||||
|
permission={{
|
||||||
|
resource: {
|
||||||
|
resourceType: ResourceType.ARTIFACT_REGISTRY,
|
||||||
|
resourceIdentifier: defaultTo(repoKey, '')
|
||||||
|
},
|
||||||
|
permission: PermissionIdentifier.VIEW_ARTIFACT_REGISTRY
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* 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, { useState } from 'react'
|
||||||
|
|
||||||
|
import { PageType } from '@ar/common/types'
|
||||||
|
import ActionButton from '@ar/components/ActionButton/ActionButton'
|
||||||
|
|
||||||
|
import type { VersionActionProps } from './types'
|
||||||
|
import SetupClientMenuItem from './SetupClientMenuItem'
|
||||||
|
import DeleteVersionMenuItem from './DeleteVersionMenuItem'
|
||||||
|
|
||||||
|
export default function VersionActions({
|
||||||
|
data,
|
||||||
|
repoKey,
|
||||||
|
artifactKey,
|
||||||
|
versionKey,
|
||||||
|
pageType,
|
||||||
|
readonly,
|
||||||
|
onClose
|
||||||
|
}: VersionActionProps): JSX.Element {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
return (
|
||||||
|
<ActionButton isOpen={open} setOpen={setOpen}>
|
||||||
|
<DeleteVersionMenuItem
|
||||||
|
artifactKey={artifactKey}
|
||||||
|
repoKey={repoKey}
|
||||||
|
versionKey={versionKey}
|
||||||
|
data={data}
|
||||||
|
pageType={pageType}
|
||||||
|
readonly={readonly}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false)
|
||||||
|
onClose?.()
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{pageType === PageType.Table && (
|
||||||
|
<SetupClientMenuItem
|
||||||
|
data={data}
|
||||||
|
pageType={pageType}
|
||||||
|
readonly={readonly}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
versionKey={versionKey}
|
||||||
|
artifactKey={artifactKey}
|
||||||
|
repoKey={repoKey}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ActionButton>
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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 type { ArtifactVersionMetadata, ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
||||||
|
import type { PageType } from '@ar/common/types'
|
||||||
|
|
||||||
|
export interface VersionActionProps {
|
||||||
|
data: ArtifactVersionSummary | ArtifactVersionMetadata
|
||||||
|
versionKey: string
|
||||||
|
artifactKey: string
|
||||||
|
repoKey: string
|
||||||
|
pageType: PageType
|
||||||
|
readonly?: boolean
|
||||||
|
onClose?: () => void
|
||||||
|
}
|
|
@ -21,9 +21,10 @@ import { Layout } from '@harnessio/uicore'
|
||||||
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
import type { ArtifactVersionSummary } from '@harnessio/react-har-service-client'
|
||||||
|
|
||||||
import { useDecodedParams, useRoutes } from '@ar/hooks'
|
import { useDecodedParams, useRoutes } from '@ar/hooks'
|
||||||
import type { RepositoryPackageType } from '@ar/common/types'
|
import { PageType, type RepositoryPackageType } from '@ar/common/types'
|
||||||
import type { VersionDetailsPathParams } from '@ar/routes/types'
|
import type { VersionDetailsPathParams } from '@ar/routes/types'
|
||||||
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
import RepositoryIcon from '@ar/frameworks/RepositoryStep/RepositoryIcon'
|
||||||
|
import VersionActionsWidget from '@ar/frameworks/Version/VersionActionsWidget'
|
||||||
import SetupClientButton from '@ar/components/SetupClientButton/SetupClientButton'
|
import SetupClientButton from '@ar/components/SetupClientButton/SetupClientButton'
|
||||||
|
|
||||||
import VersionNameContent from './VersionNameContent'
|
import VersionNameContent from './VersionNameContent'
|
||||||
|
@ -66,6 +67,14 @@ export default function VersionDetailsHeaderContent(props: VersionDetailsHeaderC
|
||||||
versionIdentifier={pathParams.versionIdentifier}
|
versionIdentifier={pathParams.versionIdentifier}
|
||||||
packageType={packageType as RepositoryPackageType}
|
packageType={packageType as RepositoryPackageType}
|
||||||
/>
|
/>
|
||||||
|
<VersionActionsWidget
|
||||||
|
packageType={data.packageType as RepositoryPackageType}
|
||||||
|
repoKey={pathParams.repositoryIdentifier}
|
||||||
|
artifactKey={pathParams.artifactIdentifier}
|
||||||
|
versionKey={pathParams.versionIdentifier}
|
||||||
|
pageType={PageType.Details}
|
||||||
|
data={data}
|
||||||
|
/>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* 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 { Intent } from '@blueprintjs/core'
|
||||||
|
import { getErrorInfoFromErrorObject, useToaster } from '@harnessio/uicore'
|
||||||
|
import { useDeleteArtifactVersionMutation } from '@harnessio/react-har-service-client'
|
||||||
|
|
||||||
|
import { useGetSpaceRef, useParentHooks } from '@ar/hooks'
|
||||||
|
import { useStrings } from '@ar/frameworks/strings'
|
||||||
|
import { encodeRef } from '@ar/hooks/useGetSpaceRef'
|
||||||
|
|
||||||
|
interface useDeleteVersionModalProps {
|
||||||
|
repoKey: string
|
||||||
|
artifactKey: string
|
||||||
|
versionKey: string
|
||||||
|
onSuccess: () => void
|
||||||
|
}
|
||||||
|
export default function useDeleteVersionModal(props: useDeleteVersionModalProps) {
|
||||||
|
const { repoKey, onSuccess, artifactKey, versionKey } = props
|
||||||
|
const { getString } = useStrings()
|
||||||
|
const { showSuccess, showError, clear } = useToaster()
|
||||||
|
const { useConfirmationDialog } = useParentHooks()
|
||||||
|
const spaceRef = useGetSpaceRef(repoKey)
|
||||||
|
|
||||||
|
const { mutateAsync: deleteVersion } = useDeleteArtifactVersionMutation()
|
||||||
|
|
||||||
|
const handleDeleteVersion = async (isConfirmed: boolean): Promise<void> => {
|
||||||
|
if (isConfirmed) {
|
||||||
|
try {
|
||||||
|
const response = await deleteVersion({
|
||||||
|
registry_ref: spaceRef,
|
||||||
|
artifact: encodeRef(artifactKey),
|
||||||
|
version: versionKey
|
||||||
|
})
|
||||||
|
if (response.content.status === 'SUCCESS') {
|
||||||
|
clear()
|
||||||
|
showSuccess(getString('versionDetails.versionDeleted'))
|
||||||
|
onSuccess()
|
||||||
|
}
|
||||||
|
} catch (e: any) {
|
||||||
|
showError(getErrorInfoFromErrorObject(e, true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const { openDialog } = useConfirmationDialog({
|
||||||
|
titleText: getString('versionDetails.deleteVersionModal.title'),
|
||||||
|
contentText: getString('versionDetails.deleteVersionModal.contentText'),
|
||||||
|
confirmButtonText: getString('delete'),
|
||||||
|
cancelButtonText: getString('cancel'),
|
||||||
|
intent: Intent.DANGER,
|
||||||
|
onCloseDialog: handleDeleteVersion
|
||||||
|
})
|
||||||
|
|
||||||
|
return { triggerDelete: openDialog }
|
||||||
|
}
|
|
@ -92,3 +92,7 @@ dependencyList:
|
||||||
columns:
|
columns:
|
||||||
name: Dependency Name
|
name: Dependency Name
|
||||||
version: Dependency Version
|
version: Dependency Version
|
||||||
|
versionDeleted: Artifact version deleted successfully!
|
||||||
|
deleteVersionModal:
|
||||||
|
title: Delete Artifact Version
|
||||||
|
contentText: Are you sure you want to delete the artifact version?
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
div[class*='TableV2--cells'],
|
div[class*='TableV2--cells'],
|
||||||
div[class*='TableV2--header'] {
|
div[class*='TableV2--header'] {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 40px minmax(var(--har-table-name-column-min-width), 1fr) 1fr 1fr 1fr;
|
grid-template-columns: 40px minmax(var(--har-table-name-column-min-width), 1fr) 1fr 1fr 1fr 50px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
div[class*='TableV2--cells'],
|
div[class*='TableV2--cells'],
|
||||||
div[class*='TableV2--header'] {
|
div[class*='TableV2--header'] {
|
||||||
display: grid !important;
|
display: grid !important;
|
||||||
grid-template-columns: 40px minmax(var(--har-table-name-column-min-width), 1fr) 1fr 1fr 1fr 1fr;
|
grid-template-columns: 40px minmax(var(--har-table-name-column-min-width), 1fr) 1fr 1fr 1fr 1fr 50px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import { handleToggleExpandableRow } from '@ar/components/TableCells/utils'
|
||||||
import {
|
import {
|
||||||
PullCommandCell,
|
PullCommandCell,
|
||||||
ToggleAccordionCell,
|
ToggleAccordionCell,
|
||||||
|
VersionActionsCell,
|
||||||
VersionDeploymentsCell,
|
VersionDeploymentsCell,
|
||||||
VersionDigestsCell,
|
VersionDigestsCell,
|
||||||
VersionPublishedAtCell
|
VersionPublishedAtCell
|
||||||
|
@ -123,6 +124,12 @@ function DockerVersionListTable(props: DockerVersionListTableProps): JSX.Element
|
||||||
accessor: 'pullCommand',
|
accessor: 'pullCommand',
|
||||||
Cell: PullCommandCell,
|
Cell: PullCommandCell,
|
||||||
serverSortProps: getServerSortProps('pullCommand')
|
serverSortProps: getServerSortProps('pullCommand')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Header: '',
|
||||||
|
accessor: 'actions',
|
||||||
|
Cell: VersionActionsCell,
|
||||||
|
disableSortBy: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { defaultTo } from 'lodash-es'
|
import { defaultTo } from 'lodash-es'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link, useParams } from 'react-router-dom'
|
||||||
import type { Cell, CellValue, ColumnInstance, Renderer, Row, TableInstance, UseExpandedRowProps } from 'react-table'
|
import type { Cell, CellValue, ColumnInstance, Renderer, Row, TableInstance, UseExpandedRowProps } from 'react-table'
|
||||||
import { Color, FontVariation } from '@harnessio/design-system'
|
import { Color, FontVariation } from '@harnessio/design-system'
|
||||||
import { Icon } from '@harnessio/icons'
|
import { Icon } from '@harnessio/icons'
|
||||||
|
@ -27,6 +27,8 @@ import { useStrings } from '@ar/frameworks/strings'
|
||||||
import { useDecodedParams, useRoutes } from '@ar/hooks'
|
import { useDecodedParams, useRoutes } from '@ar/hooks'
|
||||||
import TableCells from '@ar/components/TableCells/TableCells'
|
import TableCells from '@ar/components/TableCells/TableCells'
|
||||||
import type { ArtifactDetailsPathParams } from '@ar/routes/types'
|
import type { ArtifactDetailsPathParams } from '@ar/routes/types'
|
||||||
|
import { PageType, type RepositoryPackageType } from '@ar/common/types'
|
||||||
|
import VersionActionsWidget from '@ar/frameworks/Version/VersionActionsWidget'
|
||||||
import { VersionDetailsTab } from '@ar/pages/version-details/components/VersionDetailsTabs/constants'
|
import { VersionDetailsTab } from '@ar/pages/version-details/components/VersionDetailsTabs/constants'
|
||||||
|
|
||||||
import type { VersionListExpandedColumnProps } from './types'
|
import type { VersionListExpandedColumnProps } from './types'
|
||||||
|
@ -116,6 +118,17 @@ export const VersionPublishedAtCell: CellType = ({ value }) => {
|
||||||
return <TableCells.LastModifiedCell value={value} />
|
return <TableCells.LastModifiedCell value={value} />
|
||||||
}
|
}
|
||||||
|
|
||||||
export const VersionActionsCell: CellType = () => {
|
export const VersionActionsCell: CellType = ({ row }) => {
|
||||||
return <></>
|
const { original } = row
|
||||||
|
const { artifactIdentifier, repositoryIdentifier } = useParams<ArtifactDetailsPathParams>()
|
||||||
|
return (
|
||||||
|
<VersionActionsWidget
|
||||||
|
data={original}
|
||||||
|
packageType={original.packageType as RepositoryPackageType}
|
||||||
|
pageType={PageType.Table}
|
||||||
|
repoKey={repositoryIdentifier}
|
||||||
|
artifactKey={artifactIdentifier}
|
||||||
|
versionKey={original.name}
|
||||||
|
/>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
PullCommandCell,
|
PullCommandCell,
|
||||||
|
VersionActionsCell,
|
||||||
VersionDownloadsCell,
|
VersionDownloadsCell,
|
||||||
VersionFileCountCell,
|
VersionFileCountCell,
|
||||||
VersionNameCell,
|
VersionNameCell,
|
||||||
|
@ -54,5 +55,10 @@ export const VERSION_LIST_TABLE_CELL_CONFIG: Record<VersionListColumnEnum, IVers
|
||||||
Header: 'versionList.table.columns.pullCommand',
|
Header: 'versionList.table.columns.pullCommand',
|
||||||
accessor: 'pullCommand',
|
accessor: 'pullCommand',
|
||||||
Cell: PullCommandCell
|
Cell: PullCommandCell
|
||||||
|
},
|
||||||
|
[VersionListColumnEnum.Actions]: {
|
||||||
|
accessor: 'actions',
|
||||||
|
Cell: VersionActionsCell,
|
||||||
|
disableSortBy: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,15 @@ export enum VersionListColumnEnum {
|
||||||
DownloadCount = 'DownloadCount',
|
DownloadCount = 'DownloadCount',
|
||||||
FileCount = 'FileCount',
|
FileCount = 'FileCount',
|
||||||
LastModified = 'LastModified',
|
LastModified = 'LastModified',
|
||||||
PullCommand = 'PullCommand'
|
PullCommand = 'PullCommand',
|
||||||
|
Actions = 'Actions'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IVersionListTableColumnConfigType<T = unknown> {
|
export interface IVersionListTableColumnConfigType<T = unknown> {
|
||||||
Header: keyof StringsMap
|
Header?: keyof StringsMap
|
||||||
accessor: string
|
accessor: string
|
||||||
Cell: Renderer<CellProps<{}, T>>
|
Cell: Renderer<CellProps<{}, T>>
|
||||||
hidden?: boolean
|
hidden?: boolean
|
||||||
width?: string
|
width?: string
|
||||||
|
disableSortBy?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ export const getVersionListTableCellConfigs = (
|
||||||
const columnConfig = VERSION_LIST_TABLE_CELL_CONFIG[key as VersionListColumnEnum]
|
const columnConfig = VERSION_LIST_TABLE_CELL_CONFIG[key as VersionListColumnEnum]
|
||||||
return {
|
return {
|
||||||
...columnConfig,
|
...columnConfig,
|
||||||
Header: getString(columnConfig.Header),
|
Header: columnConfig.Header ? getString(columnConfig.Header) : '',
|
||||||
serverSortProps: getServerSortProps(columnConfig.accessor),
|
serverSortProps: getServerSortProps(columnConfig.accessor),
|
||||||
...columnConfigs[key as VersionListColumnEnum]
|
...columnConfigs[key as VersionListColumnEnum]
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,4 @@ table:
|
||||||
publishedByAt: '{{ $.versionDetails.artifactDetails.layers.lastPush }}'
|
publishedByAt: '{{ $.versionDetails.artifactDetails.layers.lastPush }}'
|
||||||
deployments: '{{ $.versionDetails.tabs.deployments }}'
|
deployments: '{{ $.versionDetails.tabs.deployments }}'
|
||||||
actions:
|
actions:
|
||||||
deleteModal:
|
deleteVersion: Delete Version
|
||||||
title: Delete Version
|
|
||||||
contentText: Are you sure you want to delete the artifact version?
|
|
||||||
|
|
|
@ -197,6 +197,8 @@ export interface StringsMap {
|
||||||
'versionDetails.cards.supplyChain.sbomScore': string
|
'versionDetails.cards.supplyChain.sbomScore': string
|
||||||
'versionDetails.cards.supplyChain.title': string
|
'versionDetails.cards.supplyChain.title': string
|
||||||
'versionDetails.cards.supplyChain.totalComponents': string
|
'versionDetails.cards.supplyChain.totalComponents': string
|
||||||
|
'versionDetails.deleteVersionModal.contentText': string
|
||||||
|
'versionDetails.deleteVersionModal.title': string
|
||||||
'versionDetails.dependencyList.table.columns.name': string
|
'versionDetails.dependencyList.table.columns.name': string
|
||||||
'versionDetails.dependencyList.table.columns.version': string
|
'versionDetails.dependencyList.table.columns.version': string
|
||||||
'versionDetails.deploymentsTable.columns.deploymentPipeline': string
|
'versionDetails.deploymentsTable.columns.deploymentPipeline': string
|
||||||
|
@ -231,8 +233,8 @@ export interface StringsMap {
|
||||||
'versionDetails.tabs.overview': string
|
'versionDetails.tabs.overview': string
|
||||||
'versionDetails.tabs.securityTests': string
|
'versionDetails.tabs.securityTests': string
|
||||||
'versionDetails.tabs.supplyChain': string
|
'versionDetails.tabs.supplyChain': string
|
||||||
'versionList.actions.deleteModal.contentText': string
|
'versionDetails.versionDeleted': string
|
||||||
'versionList.actions.deleteModal.title': string
|
'versionList.actions.deleteVersion': string
|
||||||
'versionList.page': string
|
'versionList.page': string
|
||||||
'versionList.table.columns.activelyDeployed': string
|
'versionList.table.columns.activelyDeployed': string
|
||||||
'versionList.table.columns.deployments': string
|
'versionList.table.columns.deployments': string
|
||||||
|
|
Loading…
Reference in New Issue