From 6fa553cc54cd6840921e9287e245f1d89f574cfa Mon Sep 17 00:00:00 2001 From: mingshewhe Date: Mon, 30 Oct 2023 11:43:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90PAC=E3=80=91feat=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BB=A3=E7=A0=81=E5=BA=93=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=20#8118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pipeline/pojo/element/trigger/enums/CodeEventType.kt | 4 ++++ .../com/tencent/devops/repository/dao/RepoPipelineRefDao.kt | 2 +- .../devops/repository/service/RepoPipelineService.kt | 6 +++++- support-files/i18n/repository/message_zh_CN.properties | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backend/ci/core/common/common-pipeline/src/main/kotlin/com/tencent/devops/common/pipeline/pojo/element/trigger/enums/CodeEventType.kt b/src/backend/ci/core/common/common-pipeline/src/main/kotlin/com/tencent/devops/common/pipeline/pojo/element/trigger/enums/CodeEventType.kt index 8262b1fc0cd..c6020b6b9d5 100644 --- a/src/backend/ci/core/common/common-pipeline/src/main/kotlin/com/tencent/devops/common/pipeline/pojo/element/trigger/enums/CodeEventType.kt +++ b/src/backend/ci/core/common/common-pipeline/src/main/kotlin/com/tencent/devops/common/pipeline/pojo/element/trigger/enums/CodeEventType.kt @@ -59,4 +59,8 @@ enum class CodeEventType { SHELVE_COMMIT, SHELVE_DELETE, SHELVE_SUBMIT; + + companion object { + const val MESSAGE_CODE_PREFIX = "EVENT_TYPE" + } } diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepoPipelineRefDao.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepoPipelineRefDao.kt index 596d2245718..02cf70d43ad 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepoPipelineRefDao.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepoPipelineRefDao.kt @@ -235,7 +235,7 @@ class RepoPipelineRefDao { ids: List ): List { return with(TRepositoryPipelineRef.T_REPOSITORY_PIPELINE_REF) { - dslContext.selectFrom(this).where(ID.`in`(ids)).fetch() + dslContext.selectFrom(this).where(ID.`in`(ids)).orderBy(EVENT_TYPE.desc()).fetch() } } } diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepoPipelineService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepoPipelineService.kt index ab5f12aba1b..7f7d0c109ae 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepoPipelineService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepoPipelineService.kt @@ -35,6 +35,7 @@ import com.tencent.devops.common.api.util.JsonUtil import com.tencent.devops.common.client.Client import com.tencent.devops.common.pipeline.pojo.element.ElementProp import com.tencent.devops.common.pipeline.pojo.element.ElementPropType +import com.tencent.devops.common.pipeline.pojo.element.trigger.enums.CodeEventType import com.tencent.devops.common.web.utils.I18nUtil import com.tencent.devops.repository.constant.RepositoryMessageCode.TRIGGER_CONDITION_PREFIX import com.tencent.devops.repository.dao.RepoPipelineRefDao @@ -227,7 +228,10 @@ class RepoPipelineService @Autowired constructor( repositoryHashId = HashUtil.encodeOtherLongId(it.repositoryId), atomCode = it.atomCode, triggerType = it.triggerType, - eventType = it.eventType, + eventType = I18nUtil.getCodeLanMessage( + messageCode = "${CodeEventType.MESSAGE_CODE_PREFIX}_${it.eventType}", + defaultMessage = it.eventType, + ), taskParams = JsonUtil.to(it.taskParams, object : TypeReference>() {}), triggerCondition = it.triggerCondition?.let { condition -> translateCondition(condition) diff --git a/support-files/i18n/repository/message_zh_CN.properties b/support-files/i18n/repository/message_zh_CN.properties index 390fee02733..db8f19de644 100644 --- a/support-files/i18n/repository/message_zh_CN.properties +++ b/support-files/i18n/repository/message_zh_CN.properties @@ -44,7 +44,7 @@ trigger.condition.fromBranches=来源分支 trigger.condition.includeSourceBranchName=源分支 trigger.condition.excludeSourceBranchName=排除的源分支 trigger.condition.relativePath=相对路径 -trigger.condition.includeCrState=CR状态 +trigger.condition.includeCrState=评审状态 trigger.condition.includeCrState.approving=评审中 trigger.condition.includeCrState.approved=评审通过 trigger.condition.includeCrState.change_denied=评审被拒绝