Skip to content

Commit

Permalink
feat: list repo支持include配置 TencentBlueKing#2145
Browse files Browse the repository at this point in the history
* feat: list repo支持include配置 TencentBlueKing#2145

* feat: list repo支持include配置 TencentBlueKing#2145

* feat: list repo支持include配置 TencentBlueKing#2145
  • Loading branch information
owenlxu authored May 16, 2024
1 parent 0a3b68a commit 1417172
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ data class RepoListOption(
val category: String? = null,
@ApiModelProperty("是否可展示的仓库", required = false)
val display: Boolean? = true,
@ApiModelProperty("包含的仓库列表,不受display限制", required = false)
val include: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,16 @@ class RepositoryServiceImpl(
criteria.and(TRepository::category).isEqualTo(this.toUpperCase())
}
val query = Query(criteria).with(Sort.by(Sort.Direction.DESC, TRepository::createdDate.name))
return repositoryDao.find(query).map { convertToInfo(it)!! }
val originResults = repositoryDao.find(query).map { convertToInfo(it)!! }
val originNames = originResults.map { it.name }.toSet()
var includeResults = emptyList<RepositoryInfo>()
if (names.isNotEmpty() && option.include != null) {
val inValues = names.intersect(setOf(option.include!!)).minus(originNames)
val includeCriteria = where(TRepository::projectId).isEqualTo(projectId)
.and(TRepository::name).inValues(inValues)
includeResults = repositoryDao.find(Query(includeCriteria)).map { convertToInfo(it)!! }
}
return originResults + includeResults
}

override fun listPermissionRepoPage(
Expand Down Expand Up @@ -558,7 +567,7 @@ class RepositoryServiceImpl(
proxyChannelService.deleteProxy(proxyRepository)
logger.info(
"Success to delete private proxy channel [${proxy.name}]" +
" in repo[${repository.projectId}|${repository.name}]",
" in repo[${repository.projectId}|${repository.name}]",
)
}

Expand Down Expand Up @@ -681,7 +690,7 @@ class RepositoryServiceImpl(
if (configuration == null) {
return true
}
return when(configuration) {
return when (configuration) {
is com.tencent.bkrepo.common.artifact.pojo.configuration.proxy.ProxyConfiguration ->
category == RepositoryCategory.PROXY
is CompositeConfiguration -> category == RepositoryCategory.COMPOSITE
Expand Down

0 comments on commit 1417172

Please sign in to comment.