Skip to content

Commit

Permalink
feat: 红线检查结果增加链接,方便查看问题详情 TencentBlueKing#5763
Browse files Browse the repository at this point in the history
  • Loading branch information
JamiKX1 committed Dec 17, 2021
1 parent 40e4f75 commit 7e47108
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ object QualityUtils {
.replace("##taskId##", taskId.toString())
.replace("##buildId##", buildId)
.replace("##detail##", detail)
"<a target='_blank' href='${HomeHostUtil.innerServerHost()}$fillDetailUrl'>$value</a>"
"<a target='_blank' href='${HomeHostUtil.innerServerHost()}/console$fillDetailUrl'>$value</a>"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@
package com.tencent.devops.quality.constant

val codeccToolUrlPathMap = mapOf(
"COVERITY" to "/console/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"COVERITY" to "/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"KLOCWORK" to "/console/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"KLOCWORK" to "/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"PINPOINT" to "/console/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"PINPOINT" to "/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"SPOTBUGS" to "/console/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"SPOTBUGS" to "/codecc/##projectId##/task/##taskId##/defect/compile/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"CCN" to "/console/codecc/##projectId##/task/##taskId##/defect/##detail##/list" +
"CCN" to "/codecc/##projectId##/task/##taskId##/defect/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"DUPC" to "/console/codecc/##projectId##/task/##taskId##/defect/##detail##/list" +
"DUPC" to "/codecc/##projectId##/task/##taskId##/defect/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber",
"STANDARD" to "/console/codecc/##projectId##/task/##taskId##/defect/standard/list?dimension=STANDARD&" +
"STANDARD" to "/codecc/##projectId##/task/##taskId##/defect/standard/list?dimension=STANDARD&" +
"buildId=##buildId##",
"SECURITY" to "/console/codecc/##projectId##/task/##taskId##/defect/security/list?dimension=SECURITY&" +
"SECURITY" to "/codecc/##projectId##/task/##taskId##/defect/security/list?dimension=SECURITY&" +
"buildId=##buildId##",
"DEFECT" to "/console/codecc/##projectId##/task/##taskId##/defect/defect/list?dimension=DEFECT&buildId=##buildId##")
"DEFECT" to "/codecc/##projectId##/task/##taskId##/defect/defect/list?dimension=DEFECT&buildId=##buildId##")

const val DEFAULT_CODECC_URL = "/console/codecc/##projectId##/task/##taskId##/defect/lint/##detail##/list" +
const val DEFAULT_CODECC_URL = "/codecc/##projectId##/task/##taskId##/defect/lint/##detail##/list" +
"?buildId=##buildId##&status=7&sortField=createBuildNumber"
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ class QualityRuleCheckService @Autowired constructor(
.replace("##taskId##", taskId.toString())
.replace("##buildId##", buildId)
.replace("##detail##", record.detail!!)
"<a target='_blank' href='$fillDetailUrl'>查看详情</a>"
"<a target='_blank' href='/console$fillDetailUrl'>查看详情</a>"
}
} else {
record.logPrompt ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,17 @@
package com.tencent.devops.quality.util

import com.tencent.devops.common.client.Client
import com.tencent.devops.common.service.utils.HomeHostUtil
import com.tencent.devops.plugin.codecc.CodeccUtils
import com.tencent.devops.process.api.service.ServiceVarResource
import com.tencent.devops.quality.constant.DEFAULT_CODECC_URL
import com.tencent.devops.quality.constant.codeccToolUrlPathMap
import org.springframework.beans.factory.annotation.Value

object QualityUrlUtils {

@Value("\${quality.codecc.host:}")
private val codeccHost: String = ""

fun getCodeCCUrl(
projectId: String,
pipelineId: String,
Expand All @@ -50,14 +53,14 @@ object QualityUrlUtils {
var taskId = variable?.get(CodeccUtils.BK_CI_CODECC_TASK_ID)

return if (detail.isNullOrBlank() || detail!!.split(",").size > 1) {
"${HomeHostUtil.innerServerHost()}/console/codecc/$projectId/task/$taskId/detail?buildId=$buildId"
"http://$codeccHost/codecc/$projectId/task/$taskId/detail?buildId=$buildId"
} else {
val detailValue = codeccToolUrlPathMap[detail] ?: DEFAULT_CODECC_URL
val fillDetailUrl = detailValue.replace("##projectId##", projectId)
.replace("##taskId##", taskId.toString())
.replace("##buildId##", buildId)
.replace("##detail##", detail)
"${HomeHostUtil.innerServerHost()}$fillDetailUrl"
"http://$codeccHost$fillDetailUrl"
}
return ""
}
Expand Down

0 comments on commit 7e47108

Please sign in to comment.