mirror of
https://github.com/harness/drone.git
synced 2025-05-21 19:39:59 +08:00
feat: [CDE-205]: Update body for create gitspace api to make it work for private repos. (#2331)
* feat: [CDE-205]: Update body for create gitspace api to make it work for private repos.
This commit is contained in:
parent
e1724bfd5e
commit
c2cb422c28
@ -18,7 +18,7 @@ import css from './GitnessRepoImportForm.module.scss'
|
|||||||
|
|
||||||
const RepositoryText = ({ repoList, value }: { repoList: TypesRepository[] | null; value?: string }) => {
|
const RepositoryText = ({ repoList, value }: { repoList: TypesRepository[] | null; value?: string }) => {
|
||||||
const { getString } = useStrings()
|
const { getString } = useStrings()
|
||||||
const repoMetadata = repoList?.find(repo => repo.git_url === value)
|
const repoMetadata = repoList?.find(repo => repo.path === value)
|
||||||
const repoName = repoMetadata?.path
|
const repoName = repoMetadata?.path
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -114,7 +114,7 @@ export const GitnessRepoImportForm = () => {
|
|||||||
const formik = useFormikContext<any>()
|
const formik = useFormikContext<any>()
|
||||||
|
|
||||||
const { values } = formik
|
const { values } = formik
|
||||||
const repoMetadata = repoListOptions.find(repo => repo.git_url === values.code_repo_url)
|
const repoMetadata = repoListOptions.find(repo => repo.path === values.code_repo_url)
|
||||||
if (repoRef !== repoMetadata?.path) {
|
if (repoRef !== repoMetadata?.path) {
|
||||||
setReporef(repoMetadata?.path as string)
|
setReporef(repoMetadata?.path as string)
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ export const GitnessRepoImportForm = () => {
|
|||||||
<Text>{repo.path}</Text>
|
<Text>{repo.path}</Text>
|
||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
}
|
}
|
||||||
active={repo.git_url === values.code_repo_url}
|
active={repo.path === values.code_repo_url}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const repoParams = repo?.path?.split('/') || []
|
const repoParams = repo?.path?.split('/') || []
|
||||||
formik.setValues((prvValues: any) => {
|
formik.setValues((prvValues: any) => {
|
||||||
@ -166,10 +166,11 @@ export const GitnessRepoImportForm = () => {
|
|||||||
code_repo_url: repo.git_url,
|
code_repo_url: repo.git_url,
|
||||||
branch: repo.default_branch,
|
branch: repo.default_branch,
|
||||||
identifier: repoParams?.[repoParams.length - 1],
|
identifier: repoParams?.[repoParams.length - 1],
|
||||||
name: repo.path
|
name: repo.path,
|
||||||
|
code_repo_type: 'gitness'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
formik.setFieldValue('code_repo_url', repo.git_url)
|
formik.setFieldValue('code_repo_url', repo.path)
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
@ -56,7 +56,8 @@ export const ThirdPartyRepoImportForm = () => {
|
|||||||
code_repo_url: response.url,
|
code_repo_url: response.url,
|
||||||
branch: response.branch,
|
branch: response.branch,
|
||||||
identifier: getRepoIdFromURL(response.url),
|
identifier: getRepoIdFromURL(response.url),
|
||||||
name: getRepoNameFromURL(response.url)
|
name: getRepoNameFromURL(response.url),
|
||||||
|
code_repo_type: 'unknown'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
setRepoCheckState(RepoCheckStatus.Valid)
|
setRepoCheckState(RepoCheckStatus.Valid)
|
||||||
|
@ -65,7 +65,10 @@ export const GitspaceCreate = () => {
|
|||||||
onSubmit={async data => {
|
onSubmit={async data => {
|
||||||
try {
|
try {
|
||||||
const payload = data
|
const payload = data
|
||||||
const response = await mutate({ ...payload, space_ref: space } as OpenapiCreateGitspaceRequest & {
|
const response = await mutate({
|
||||||
|
...payload,
|
||||||
|
space_ref: space
|
||||||
|
} as OpenapiCreateGitspaceRequest & {
|
||||||
space_ref?: string
|
space_ref?: string
|
||||||
})
|
})
|
||||||
showSuccess(getString('cde.create.gitspaceCreateSuccess'))
|
showSuccess(getString('cde.create.gitspaceCreateSuccess'))
|
||||||
|
@ -22,7 +22,7 @@ export type EnumFileDiffStatus = string
|
|||||||
|
|
||||||
export type EnumGitspaceAccessType = 'jwt_token' | 'user_credentials' | 'ssh_key'
|
export type EnumGitspaceAccessType = 'jwt_token' | 'user_credentials' | 'ssh_key'
|
||||||
|
|
||||||
export type EnumGitspaceCodeRepoType = 'github' | 'gitlab' | 'harness_code' | 'bitbucket' | 'unknown'
|
export type EnumGitspaceCodeRepoType = 'github' | 'gitlab' | 'harness_code' | 'bitbucket' | 'unknown' | 'gitness'
|
||||||
|
|
||||||
export type EnumGitspaceEntityType = 'gitspace_config' | 'gitspace_instance'
|
export type EnumGitspaceEntityType = 'gitspace_config' | 'gitspace_instance'
|
||||||
|
|
||||||
@ -319,6 +319,7 @@ export interface OpenapiCreateConnectorRequest {
|
|||||||
export interface OpenapiCreateGitspaceRequest {
|
export interface OpenapiCreateGitspaceRequest {
|
||||||
branch?: string
|
branch?: string
|
||||||
code_repo_url?: string
|
code_repo_url?: string
|
||||||
|
code_repo_type?: EnumGitspaceCodeRepoType
|
||||||
devcontainer_path?: string | null
|
devcontainer_path?: string | null
|
||||||
ide?: EnumIDEType
|
ide?: EnumIDEType
|
||||||
identifier?: string
|
identifier?: string
|
||||||
|
Loading…
Reference in New Issue
Block a user