mirror of
https://github.com/harness/drone.git
synced 2025-05-05 15:32:56 +00:00
feat: [AH-1224]: support RPM in repository creation and edit flow (#3712)
* feat: [AH-1224]: add FF for upstream flow * feat: [AH-1224]: support RPM in repository creation and edit flow
This commit is contained in:
parent
a1969452b8
commit
6d48117eff
@ -51,7 +51,7 @@
|
||||
"@codemirror/view": "^6.9.6",
|
||||
"@harnessio/design-system": "^2.1.1",
|
||||
"@harnessio/icons": "^2.1.12",
|
||||
"@harnessio/react-har-service-client": "^0.17.0",
|
||||
"@harnessio/react-har-service-client": "^0.18.0",
|
||||
"@harnessio/react-ng-manager-client": "^1.40.0",
|
||||
"@harnessio/react-ssca-manager-client": "^0.65.0",
|
||||
"@harnessio/uicore": "^4.2.0",
|
||||
|
@ -134,5 +134,6 @@ export interface MFEAppProps {
|
||||
|
||||
export enum FeatureFlags {
|
||||
HAR_TRIGGERS = 'HAR_TRIGGERS',
|
||||
HAR_NUGET_PACKAGE_TYPE_ENABLED = 'HAR_NUGET_PACKAGE_TYPE_ENABLED'
|
||||
HAR_NUGET_PACKAGE_TYPE_ENABLED = 'HAR_NUGET_PACKAGE_TYPE_ENABLED',
|
||||
HAR_RPM_PACKAGE_TYPE_ENABLED = 'HAR_RPM_PACKAGE_TYPE_ENABLED'
|
||||
}
|
||||
|
@ -94,7 +94,8 @@ const RepositoryTypes: RepositoryTypeListItem[] = [
|
||||
icon: 'red-hat-logo',
|
||||
tooltip: 'Coming Soon!',
|
||||
disabled: true,
|
||||
tag: ThumbnailTagEnum.ComingSoon
|
||||
tag: ThumbnailTagEnum.ComingSoon,
|
||||
featureFlag: FeatureFlags.HAR_RPM_PACKAGE_TYPE_ENABLED
|
||||
},
|
||||
{
|
||||
label: 'repositoryTypes.go',
|
||||
|
@ -91,7 +91,8 @@ export const UpstreamProxyPackageTypeList: UpstreamRepositoryPackageTypeListItem
|
||||
icon: 'red-hat-logo',
|
||||
tooltip: 'Coming Soon!',
|
||||
disabled: true,
|
||||
tag: ThumbnailTagEnum.ComingSoon
|
||||
tag: ThumbnailTagEnum.ComingSoon,
|
||||
featureFlag: FeatureFlags.HAR_RPM_PACKAGE_TYPE_ENABLED
|
||||
},
|
||||
{
|
||||
label: 'repositoryTypes.go',
|
||||
|
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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 RPMRepositoryType extends RepositoryStep<VirtualRegistryRequest> {
|
||||
protected packageType = RepositoryPackageType.RPM
|
||||
protected repositoryName = 'RPM Repository'
|
||||
protected repositoryIcon: IconName = 'red-hat-logo'
|
||||
protected supportedScanners = []
|
||||
protected supportsUpstreamProxy = true
|
||||
protected supportedUpstreamURLSources = [UpstreamRepositoryURLInputSource.Custom]
|
||||
|
||||
protected defaultValues: VirtualRegistryRequest = {
|
||||
packageType: RepositoryPackageType.RPM,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.VIRTUAL
|
||||
},
|
||||
scanners: []
|
||||
}
|
||||
|
||||
protected defaultUpstreamProxyValues: UpstreamRegistryRequest = {
|
||||
packageType: RepositoryPackageType.RPM,
|
||||
identifier: '',
|
||||
config: {
|
||||
type: RepositoryConfigType.UPSTREAM,
|
||||
source: UpstreamRepositoryURLInputSource.Custom,
|
||||
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.RPM}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
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 />
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ import { GenericRepositoryType } from './GenericRepository/GenericRepositoryType
|
||||
import { NpmRepositoryType } from './NpmRepository/NpmRepositoryType'
|
||||
import { PythonRepositoryType } from './PythonRepository/PythonRepositoryType'
|
||||
import { NuGetRepositoryType } from './NuGetRepository/NuGetRepositoryType'
|
||||
import { RPMRepositoryType } from './RPMRepository/RPMRepositoryType'
|
||||
|
||||
repositoryFactory.registerStep(new DockerRepositoryType())
|
||||
repositoryFactory.registerStep(new HelmRepositoryType())
|
||||
@ -30,3 +31,4 @@ repositoryFactory.registerStep(new MavenRepositoryType())
|
||||
repositoryFactory.registerStep(new NpmRepositoryType())
|
||||
repositoryFactory.registerStep(new PythonRepositoryType())
|
||||
repositoryFactory.registerStep(new NuGetRepositoryType())
|
||||
repositoryFactory.registerStep(new RPMRepositoryType())
|
||||
|
@ -1945,10 +1945,10 @@
|
||||
yargs "^17.6.2"
|
||||
zod "^3.19.1"
|
||||
|
||||
"@harnessio/react-har-service-client@^0.17.0":
|
||||
version "0.17.0"
|
||||
resolved "https://registry.yarnpkg.com/@harnessio/react-har-service-client/-/react-har-service-client-0.17.0.tgz#0d292fd06a706469a850001af052055846c4e4a2"
|
||||
integrity sha512-NhSdpuFydxXaaxZJrjXuUfz61pXsWGy0qDqgoel6PRu6VuUHMxzl1n/8jhJh4gqCJAj7RHxbq2292NfhKlRcUA==
|
||||
"@harnessio/react-har-service-client@^0.18.0":
|
||||
version "0.18.0"
|
||||
resolved "https://registry.yarnpkg.com/@harnessio/react-har-service-client/-/react-har-service-client-0.18.0.tgz#e6c784517640be50ed4e0d7725a6b54645e53f03"
|
||||
integrity sha512-pfQpDJyQyDYhkkNAwZawAG7LQBJLu/u4mDCLuGQKvO+OcKT+OKYCPAZJAyWwtiulAyXZuu5tNeSGW4LmQE6kLw==
|
||||
dependencies:
|
||||
"@harnessio/oats-cli" "^3.0.0"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user