mirror of
https://github.com/harness/drone.git
synced 2025-05-04 01:11:59 +08:00
feat: [AH-1102]: Support NuGet in Registry Creation flow (Virtual and Upstream) (#3533)
* feat: [AH-1102]: Support NuGet in Registry Creation flow (Virtual and Upstream) * feat: [AH-1102]: Support NuGet in Registry Creation flow (Virtual and Upstream)
This commit is contained in:
parent
956b4dab7d
commit
61e69bdea3
@ -51,7 +51,7 @@
|
||||
"@codemirror/view": "^6.9.6",
|
||||
"@harnessio/design-system": "^2.1.1",
|
||||
"@harnessio/icons": "^2.1.9",
|
||||
"@harnessio/react-har-service-client": "^0.13.0",
|
||||
"@harnessio/react-har-service-client": "^0.14.0",
|
||||
"@harnessio/react-ssca-manager-client": "^0.65.0",
|
||||
"@harnessio/uicore": "^4.1.2",
|
||||
"@tanstack/react-query": "4.20.4",
|
||||
|
@ -135,5 +135,6 @@ export interface MFEAppProps {
|
||||
export enum FeatureFlags {
|
||||
HAR_TRIGGERS = 'HAR_TRIGGERS',
|
||||
HAR_NPM_PACKAGE_TYPE_ENABLED = 'HAR_NPM_PACKAGE_TYPE_ENABLED',
|
||||
HAR_PYTHON_PACKAGE_TYPE_ENABLED = 'HAR_PYTHON_PACKAGE_TYPE_ENABLED'
|
||||
HAR_PYTHON_PACKAGE_TYPE_ENABLED = 'HAR_PYTHON_PACKAGE_TYPE_ENABLED',
|
||||
HAR_NUGET_PACKAGE_TYPE_ENABLED = 'HAR_NUGET_PACKAGE_TYPE_ENABLED'
|
||||
}
|
||||
|
@ -86,6 +86,7 @@ const RepositoryTypes: RepositoryTypeListItem[] = [
|
||||
value: RepositoryPackageType.NUGET,
|
||||
icon: 'nuget-repository-type',
|
||||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_NUGET_PACKAGE_TYPE_ENABLED,
|
||||
disabled: true
|
||||
}
|
||||
]
|
||||
|
@ -77,5 +77,13 @@ export const UpstreamProxyPackageTypeList: UpstreamRepositoryPackageTypeListItem
|
||||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_PYTHON_PACKAGE_TYPE_ENABLED,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
label: 'repositoryTypes.nuget',
|
||||
value: UpstreamProxyPackageType.NUGET,
|
||||
icon: 'nuget-repository-type',
|
||||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_NUGET_PACKAGE_TYPE_ENABLED,
|
||||
disabled: true
|
||||
}
|
||||
]
|
||||
|
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 type { IconName } from '@harnessio/icons'
|
||||
|
||||
import { RepositoryConfigType, RepositoryPackageType } from '@ar/common/types'
|
||||
import UpstreamProxyActions from '@ar/pages/upstream-proxy-details/components/UpstreamProxyActions/UpstreamProxyActions'
|
||||
import UpstreamProxyConfigurationForm from '@ar/pages/upstream-proxy-details/components/Forms/UpstreamProxyConfigurationForm'
|
||||
import UpstreamProxyCreateFormContent from '@ar/pages/upstream-proxy-details/components/FormContent/UpstreamProxyCreateFormContent'
|
||||
import UpstreamProxyDetailsHeader from '@ar/pages/upstream-proxy-details/components/UpstreamProxyDetailsHeader/UpstreamProxyDetailsHeader'
|
||||
import {
|
||||
type CreateRepositoryFormProps,
|
||||
type RepositoryActionsProps,
|
||||
type RepositoryConfigurationFormProps,
|
||||
type RepositoryDetailsHeaderProps,
|
||||
RepositoryStep,
|
||||
type RepositoySetupClientProps
|
||||
} from '@ar/frameworks/RepositoryStep/Repository'
|
||||
import {
|
||||
UpstreamProxyAuthenticationMode,
|
||||
type UpstreamRegistryRequest,
|
||||
UpstreamRepositoryURLInputSource
|
||||
} from '@ar/pages/upstream-proxy-details/types'
|
||||
|
||||
import type { Repository, VirtualRegistryRequest } from '../types'
|
||||
import RepositoryActions from '../components/Actions/RepositoryActions'
|
||||
import RedirectPageView from '../components/RedirectPageView/RedirectPageView'
|
||||
import SetupClientContent from '../components/SetupClientContent/SetupClientContent'
|
||||
import RepositoryConfigurationForm from '../components/Forms/RepositoryConfigurationForm'
|
||||
import RepositoryCreateFormContent from '../components/FormContent/RepositoryCreateFormContent'
|
||||
import RepositoryDetailsHeader from '../components/RepositoryDetailsHeader/RepositoryDetailsHeader'
|
||||
|
||||
export class NuGetRepositoryType extends RepositoryStep<VirtualRegistryRequest> {
|
||||
protected packageType = RepositoryPackageType.NUGET
|
||||
protected repositoryName = 'NuGet Repository'
|
||||
protected repositoryIcon: IconName = 'nuget-repository-type'
|
||||
protected supportedScanners = []
|
||||
protected supportsUpstreamProxy = true
|
||||
protected supportedUpstreamURLSources = [
|
||||
UpstreamRepositoryURLInputSource.NuGetorg,
|
||||
UpstreamRepositoryURLInputSource.Custom
|
||||
]
|
||||
|
||||
protected defaultValues: VirtualRegistryRequest = {
|
||||
packageType: RepositoryPackageType.NUGET,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.VIRTUAL
|
||||
},
|
||||
scanners: []
|
||||
}
|
||||
|
||||
protected defaultUpstreamProxyValues: UpstreamRegistryRequest = {
|
||||
packageType: RepositoryPackageType.NUGET,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.UPSTREAM,
|
||||
source: UpstreamRepositoryURLInputSource.NuGetorg,
|
||||
authType: UpstreamProxyAuthenticationMode.ANONYMOUS,
|
||||
url: ''
|
||||
},
|
||||
cleanupPolicy: [],
|
||||
scanners: []
|
||||
}
|
||||
|
||||
renderCreateForm(props: CreateRepositoryFormProps): JSX.Element {
|
||||
const { type } = props
|
||||
if (type === RepositoryConfigType.VIRTUAL) {
|
||||
return <RepositoryCreateFormContent isEdit={false} />
|
||||
} else {
|
||||
return <UpstreamProxyCreateFormContent isEdit={false} readonly={false} />
|
||||
}
|
||||
}
|
||||
|
||||
renderCofigurationForm(props: RepositoryConfigurationFormProps<Repository>): JSX.Element {
|
||||
const { type } = props
|
||||
if (type === RepositoryConfigType.VIRTUAL) {
|
||||
return <RepositoryConfigurationForm ref={props.formikRef} readonly={props.readonly} />
|
||||
} else {
|
||||
return <UpstreamProxyConfigurationForm ref={props.formikRef} readonly={props.readonly} />
|
||||
}
|
||||
}
|
||||
|
||||
renderActions(props: RepositoryActionsProps<Repository>): JSX.Element {
|
||||
if (props.type === RepositoryConfigType.VIRTUAL) {
|
||||
return <RepositoryActions data={props.data} readonly={props.readonly} pageType={props.pageType} />
|
||||
}
|
||||
return <UpstreamProxyActions data={props.data} readonly={props.readonly} pageType={props.pageType} />
|
||||
}
|
||||
|
||||
renderSetupClient(props: RepositoySetupClientProps): JSX.Element {
|
||||
const { repoKey, onClose, artifactKey, versionKey } = props
|
||||
return (
|
||||
<SetupClientContent
|
||||
repoKey={repoKey}
|
||||
artifactKey={artifactKey}
|
||||
versionKey={versionKey}
|
||||
onClose={onClose}
|
||||
packageType={RepositoryPackageType.NUGET}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
renderRepositoryDetailsHeader(props: RepositoryDetailsHeaderProps<Repository>): JSX.Element {
|
||||
const { type } = props
|
||||
if (type === RepositoryConfigType.VIRTUAL) {
|
||||
return <RepositoryDetailsHeader data={props.data} />
|
||||
} else {
|
||||
return <UpstreamProxyDetailsHeader data={props.data} />
|
||||
}
|
||||
}
|
||||
|
||||
renderRedirectPage(): JSX.Element {
|
||||
return <RedirectPageView />
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import { HelmRepositoryType } from './HelmRepository/HelmRepositoryType'
|
||||
import { GenericRepositoryType } from './GenericRepository/GenericRepositoryType'
|
||||
import { NpmRepositoryType } from './NpmRepository/NpmRepositoryType'
|
||||
import { PythonRepositoryType } from './PythonRepository/PythonRepositoryType'
|
||||
import { NuGetRepositoryType } from './NuGetRepository/NuGetRepositoryType'
|
||||
|
||||
repositoryFactory.registerStep(new DockerRepositoryType())
|
||||
repositoryFactory.registerStep(new HelmRepositoryType())
|
||||
@ -28,3 +29,4 @@ repositoryFactory.registerStep(new GenericRepositoryType())
|
||||
repositoryFactory.registerStep(new MavenRepositoryType())
|
||||
repositoryFactory.registerStep(new NpmRepositoryType())
|
||||
repositoryFactory.registerStep(new PythonRepositoryType())
|
||||
repositoryFactory.registerStep(new NuGetRepositoryType())
|
||||
|
@ -66,5 +66,9 @@ export const URLSourceToSupportedAuthTypesMapping: Record<
|
||||
[UpstreamRepositoryURLInputSource.PyPi]: [
|
||||
UpstreamProxyAuthenticationMode.USER_NAME_AND_PASSWORD,
|
||||
UpstreamProxyAuthenticationMode.ANONYMOUS
|
||||
],
|
||||
[UpstreamRepositoryURLInputSource.NuGetorg]: [
|
||||
UpstreamProxyAuthenticationMode.USER_NAME_AND_PASSWORD,
|
||||
UpstreamProxyAuthenticationMode.ANONYMOUS
|
||||
]
|
||||
}
|
||||
|
@ -45,5 +45,9 @@ export const UpstreamURLSourceConfig: Record<UpstreamRepositoryURLInputSource, R
|
||||
[UpstreamRepositoryURLInputSource.PyPi]: {
|
||||
label: 'upstreamProxyDetails.createForm.source.pypi',
|
||||
value: UpstreamRepositoryURLInputSource.PyPi
|
||||
},
|
||||
[UpstreamRepositoryURLInputSource.NuGetorg]: {
|
||||
label: 'upstreamProxyDetails.createForm.source.nugetOrg',
|
||||
value: UpstreamRepositoryURLInputSource.NuGetorg
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ createForm:
|
||||
mavenCentral: Maven Central
|
||||
npmjs: npmjs
|
||||
pypi: PyPI
|
||||
nugetOrg: NuGet.org
|
||||
authentication:
|
||||
title: Authentication
|
||||
userNameAndPassword: Username and Password
|
||||
|
@ -23,7 +23,8 @@ export enum UpstreamProxyPackageType {
|
||||
GENERIC = 'GENERIC',
|
||||
MAVEN = 'MAVEN',
|
||||
NPM = 'NPM',
|
||||
PYTHON = 'PYTHON'
|
||||
PYTHON = 'PYTHON',
|
||||
NUGET = 'NUGET'
|
||||
}
|
||||
|
||||
export enum UpstreamRepositoryURLInputSource {
|
||||
@ -32,7 +33,8 @@ export enum UpstreamRepositoryURLInputSource {
|
||||
NpmJS = 'NpmJs',
|
||||
AwsEcr = 'AwsEcr',
|
||||
Custom = 'Custom',
|
||||
PyPi = 'PyPi'
|
||||
PyPi = 'PyPi',
|
||||
NuGetorg = 'NuGet.org'
|
||||
}
|
||||
|
||||
export enum UpstreamProxyAuthenticationMode {
|
||||
|
@ -148,6 +148,7 @@ export interface StringsMap {
|
||||
'upstreamProxyDetails.createForm.source.ecr': string
|
||||
'upstreamProxyDetails.createForm.source.mavenCentral': string
|
||||
'upstreamProxyDetails.createForm.source.npmjs': string
|
||||
'upstreamProxyDetails.createForm.source.nugetOrg': string
|
||||
'upstreamProxyDetails.createForm.source.pypi': string
|
||||
'upstreamProxyDetails.createForm.source.title': string
|
||||
'upstreamProxyDetails.createForm.title': string
|
||||
|
@ -1945,10 +1945,10 @@
|
||||
yargs "^17.6.2"
|
||||
zod "^3.19.1"
|
||||
|
||||
"@harnessio/react-har-service-client@^0.13.0":
|
||||
version "0.13.0"
|
||||
resolved "https://registry.yarnpkg.com/@harnessio/react-har-service-client/-/react-har-service-client-0.13.0.tgz#c71ff5f4684b6bc5aaaa8e3b28b379fc50a9a71f"
|
||||
integrity sha512-b0gehNm752mE4FqbdYUJlv+tceqetsw4I4P2qMW9vjA1NLIz0Bwo1qpF1CDh8iJmbAwdkYjaiVftuefzVNQh4w==
|
||||
"@harnessio/react-har-service-client@^0.14.0":
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/@harnessio/react-har-service-client/-/react-har-service-client-0.14.0.tgz#d12c1ecd81041875a7266ea561ad2b7a49e39af3"
|
||||
integrity sha512-O/UgSiL29soCdp5/W59k51uonpbK3u2FlVLxbbjycnNlW9c3LlEVhuhmNT1tuoSXzR42N2FodOQ+DZnwCGDs4w==
|
||||
dependencies:
|
||||
"@harnessio/oats-cli" "^3.0.0"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user