mirror of https://github.com/harness/drone.git
feat: [AH-1024]: support python package type in repository creation, listing flow (#3519)
* feat: [AH-1024]: support python package type in repository creation, listing flowtry-new-ui
parent
d19163660f
commit
7962ec99ce
|
@ -134,5 +134,6 @@ export interface MFEAppProps {
|
|||
|
||||
export enum FeatureFlags {
|
||||
HAR_TRIGGERS = 'HAR_TRIGGERS',
|
||||
HAR_NPM_PACKAGE_TYPE_ENABLED = 'HAR_NPM_PACKAGE_TYPE_ENABLED'
|
||||
HAR_NPM_PACKAGE_TYPE_ENABLED = 'HAR_NPM_PACKAGE_TYPE_ENABLED',
|
||||
HAR_PYTHON_PACKAGE_TYPE_ENABLED = 'HAR_PYTHON_PACKAGE_TYPE_ENABLED'
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export enum RepositoryPackageType {
|
|||
MAVEN = 'MAVEN',
|
||||
NPM = 'NPM',
|
||||
GRADLE = 'GRADLE',
|
||||
PYPI = 'PYPI',
|
||||
PYTHON = 'PYTHON',
|
||||
NUGET = 'NUGET'
|
||||
}
|
||||
|
||||
|
|
|
@ -75,9 +75,10 @@ const RepositoryTypes: RepositoryTypeListItem[] = [
|
|||
},
|
||||
{
|
||||
label: 'repositoryTypes.pypi',
|
||||
value: RepositoryPackageType.PYPI,
|
||||
value: RepositoryPackageType.PYTHON,
|
||||
icon: 'python',
|
||||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_PYTHON_PACKAGE_TYPE_ENABLED,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
|
|
|
@ -69,5 +69,13 @@ export const UpstreamProxyPackageTypeList: UpstreamRepositoryPackageTypeListItem
|
|||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_NPM_PACKAGE_TYPE_ENABLED,
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
label: 'repositoryTypes.pypi',
|
||||
value: UpstreamProxyPackageType.PYTHON,
|
||||
icon: 'python',
|
||||
tooltip: 'Coming Soon!',
|
||||
featureFlag: FeatureFlags.HAR_PYTHON_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 PythonRepositoryType extends RepositoryStep<VirtualRegistryRequest> {
|
||||
protected packageType = RepositoryPackageType.PYTHON
|
||||
protected repositoryName = 'Python Repository'
|
||||
protected repositoryIcon: IconName = 'python'
|
||||
protected supportedScanners = []
|
||||
protected supportsUpstreamProxy = true
|
||||
protected supportedUpstreamURLSources = [
|
||||
UpstreamRepositoryURLInputSource.PyPi,
|
||||
UpstreamRepositoryURLInputSource.Custom
|
||||
]
|
||||
|
||||
protected defaultValues: VirtualRegistryRequest = {
|
||||
packageType: RepositoryPackageType.PYTHON,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.VIRTUAL
|
||||
},
|
||||
scanners: []
|
||||
}
|
||||
|
||||
protected defaultUpstreamProxyValues: UpstreamRegistryRequest = {
|
||||
packageType: RepositoryPackageType.PYTHON,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.UPSTREAM,
|
||||
source: UpstreamRepositoryURLInputSource.PyPi,
|
||||
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.PYTHON}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
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 />
|
||||
}
|
||||
}
|
|
@ -20,9 +20,11 @@ import { MavenRepositoryType } from './MavenRepository/MavenRepository'
|
|||
import { HelmRepositoryType } from './HelmRepository/HelmRepositoryType'
|
||||
import { GenericRepositoryType } from './GenericRepository/GenericRepositoryType'
|
||||
import { NpmRepositoryType } from './NpmRepository/NpmRepositoryType'
|
||||
import { PythonRepositoryType } from './PythonRepository/PythonRepositoryType'
|
||||
|
||||
repositoryFactory.registerStep(new DockerRepositoryType())
|
||||
repositoryFactory.registerStep(new HelmRepositoryType())
|
||||
repositoryFactory.registerStep(new GenericRepositoryType())
|
||||
repositoryFactory.registerStep(new MavenRepositoryType())
|
||||
repositoryFactory.registerStep(new NpmRepositoryType())
|
||||
repositoryFactory.registerStep(new PythonRepositoryType())
|
||||
|
|
|
@ -62,5 +62,9 @@ export const URLSourceToSupportedAuthTypesMapping: Record<
|
|||
[UpstreamRepositoryURLInputSource.NpmJS]: [
|
||||
UpstreamProxyAuthenticationMode.USER_NAME_AND_PASSWORD,
|
||||
UpstreamProxyAuthenticationMode.ANONYMOUS
|
||||
],
|
||||
[UpstreamRepositoryURLInputSource.PyPi]: [
|
||||
UpstreamProxyAuthenticationMode.USER_NAME_AND_PASSWORD,
|
||||
UpstreamProxyAuthenticationMode.ANONYMOUS
|
||||
]
|
||||
}
|
||||
|
|
|
@ -41,5 +41,9 @@ export const UpstreamURLSourceConfig: Record<UpstreamRepositoryURLInputSource, R
|
|||
[UpstreamRepositoryURLInputSource.NpmJS]: {
|
||||
label: 'upstreamProxyDetails.createForm.source.npmjs',
|
||||
value: UpstreamRepositoryURLInputSource.NpmJS
|
||||
},
|
||||
[UpstreamRepositoryURLInputSource.PyPi]: {
|
||||
label: 'upstreamProxyDetails.createForm.source.pypi',
|
||||
value: UpstreamRepositoryURLInputSource.PyPi
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ createForm:
|
|||
custom: Custom
|
||||
mavenCentral: Maven Central
|
||||
npmjs: npmjs
|
||||
pypi: PyPI
|
||||
authentication:
|
||||
title: Authentication
|
||||
userNameAndPassword: Username and Password
|
||||
|
|
|
@ -22,7 +22,8 @@ export enum UpstreamProxyPackageType {
|
|||
HELM = 'HELM',
|
||||
GENERIC = 'GENERIC',
|
||||
MAVEN = 'MAVEN',
|
||||
NPM = 'NPM'
|
||||
NPM = 'NPM',
|
||||
PYTHON = 'PYTHON'
|
||||
}
|
||||
|
||||
export enum UpstreamRepositoryURLInputSource {
|
||||
|
@ -30,7 +31,8 @@ export enum UpstreamRepositoryURLInputSource {
|
|||
MavenCentral = 'MavenCentral',
|
||||
NpmJS = 'NpmJs',
|
||||
AwsEcr = 'AwsEcr',
|
||||
Custom = 'Custom'
|
||||
Custom = 'Custom',
|
||||
PyPi = 'PyPi'
|
||||
}
|
||||
|
||||
export enum UpstreamProxyAuthenticationMode {
|
||||
|
|
|
@ -82,9 +82,9 @@ repositoryTypes:
|
|||
helm: Helm
|
||||
generic: Generic
|
||||
maven: Maven
|
||||
npm: npm
|
||||
npm: NPM
|
||||
gradle: Gradle
|
||||
pypi: PyPi
|
||||
pypi: Python
|
||||
nuget: NuGet
|
||||
sideNav:
|
||||
repositories: '{{ $.repositoryList.pageHeading }}'
|
||||
|
|
|
@ -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.pypi': string
|
||||
'upstreamProxyDetails.createForm.source.title': string
|
||||
'upstreamProxyDetails.createForm.title': string
|
||||
'upstreamProxyDetails.createForm.url': string
|
||||
|
|
Loading…
Reference in New Issue