Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support displaying sql summary report check result (#7632)

Liu Jib0d7c8f6006e
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
index 7496915e36..c391b3e663 100644
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
+++ b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckBar/PlanCheckDetail.vue
@@ -63,6 +63,9 @@
>
<span class="border-r border-control-border ml-1"></span>
</template>
+ <template v-if="row.checkResult.sqlSummaryReport">
+ {{ row.checkResult.sqlSummaryReport.affectedRows }}
+ </template>
<a
v-if="row.link"
@@ -191,22 +194,31 @@ const checkResultList = computed((): PlanCheckRun_Result[] => {
const categoryAndTitle = (
checkResult: PlanCheckRun_Result
): [string, string] => {
- const code = checkResult.sqlReviewReport?.code ?? checkResult.code;
- if (code === SQLReviewPolicyErrorCode.EMPTY_POLICY) {
- const title = messageWithCode(checkResult.title, code);
- return ["", title];
+ if (checkResult.sqlReviewReport) {
+ const code = checkResult.sqlReviewReport?.code ?? checkResult.code;
+ if (code === SQLReviewPolicyErrorCode.EMPTY_POLICY) {
+ const title = messageWithCode(checkResult.title, code);
+ return ["", title];
+ }
+ if (LocalizedSQLRuleErrorCodes.has(code)) {
+ const rule = ruleTemplateMap.get(checkResult.title as RuleType);
+ if (rule) {
+ const ruleLocalization = getRuleLocalization(rule.type);
+ const key = `sql-review.category.${rule.category.toLowerCase()}`;
+ const category = t(key);
+ const title = messageWithCode(ruleLocalization.title, code);
+ return [category, title];
+ } else {
+ return ["", messageWithCode(checkResult.title, code)];
+ }
+ }
+ return ["", checkResult.title];
}
- if (LocalizedSQLRuleErrorCodes.has(code)) {
- const rule = ruleTemplateMap.get(checkResult.title as RuleType);
- if (rule) {
- const ruleLocalization = getRuleLocalization(rule.type);
- const key = `sql-review.category.${rule.category.toLowerCase()}`;
- const category = t(key);
- const title = messageWithCode(ruleLocalization.title, code);
- return [category, title];
- } else {
- return ["", messageWithCode(checkResult.title, code)];
+ if (checkResult.sqlSummaryReport) {
+ if (typeof checkResult.sqlSummaryReport.affectedRows === "number") {
+ return ["", t("task.check-type.affected-rows")];
}
+ return ["", checkResult.title];
}
return ["", checkResult.title];
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index b4f1d0df93..37666f6afb 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -303,7 +303,8 @@
"lgtm": "LGTM",
"pitr": "PITR",
"affected-rows": "Affected rows",
- "sql-type": "SQL type"
+ "sql-type": "SQL type",
+ "summary-report": "Summary report"
},
"earliest-allowed-time-hint": "'@:{'common.when'}' specifies the expected execution timing for this task. If this field is not specified, the task will be executed once it has passed all other gating criteria.",
"earliest-allowed-time-unset": "Unset",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 0d58be835a..63da4ea2f8 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -302,7 +302,8 @@
"lgtm": "LGTM",
"pitr": "PITR",
"affected-rows": "Filas afectadas",
- "sql-type": "Tipo de SQL"
+ "sql-type": "Tipo de SQL",
+ "summary-report": "Informe resumido"
},
"earliest-allowed-time-hint": "'@:{'common.when'}' especifica el tiempo de ejecución esperado para esta tarea. Si este campo no está especificado, la tarea se ejecutará una vez que haya pasado todos los demás criterios de filtrado.",
"earliest-allowed-time-unset": "No establecido",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 95b0db68ed..474b052312 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -300,7 +300,8 @@
"lgtm": "LGTM",
"pitr": "PITR",
"affected-rows": "影响行数",
- "sql-type": "SQL 类型"
+ "sql-type": "SQL 类型",
+ "summary-report": "概要报告"
},
"earliest-allowed-time-hint": "'@:{'common.when'}' 指定了该任务最早允许执行的时间。如果该字段没有被指定,则任务会在满足其他条件后立即执行。",
"comment": "评论",