Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update sql check errors (#15326)
boojackb4365a1faafc
diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vueindex 8cc318cbe5..45af274745 100644--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue+++ b/frontend/src/components/SQLCheck/SQLCheckButton.vue@@ -15,11 +15,11 @@/></slot>- <NPopover :disabled="policyErrors.length === 0" to="body">+ <NPopover :disabled="statementErrors.length === 0" to="body"><template #trigger><NButtonstyle="--n-padding: 0 14px 0 10px"- :disabled="policyErrors.length > 0"+ :disabled="statementErrors.length > 0":style="buttonStyle"tag="div"v-bind="buttonProps"@@ -40,23 +40,7 @@</NButton></template><template #default>- <template v-if="noReviewPolicyTips">- <i18n-t :keypath="noReviewPolicyTips" tag="div">- <template #environment>- <span>{{ database.effectiveEnvironmentEntity.title }}</span>- </template>- <template #link>- <router-link- v-if="hasManageSQLReviewPolicyPermission"- :to="{ name: WORKSPACE_ROUTE_SQL_REVIEW }"- class="ml-1 normal-link underline"- >- {{ $t("common.go-to-configure") }}- </router-link>- </template>- </i18n-t>- </template>- <ErrorList v-else :errors="policyErrors" />+ <ErrorList :errors="statementErrors" /></template></NPopover>@@ -81,6 +65,7 @@</template><script lang="ts" setup>+import { asyncComputed } from "@vueuse/core";import type { ButtonProps } from "naive-ui";import { NButton, NPopover } from "naive-ui";import { v4 as uuidv4 } from "uuid";@@ -89,8 +74,6 @@ import { onMounted } from "vue";import { useI18n } from "vue-i18n";import { BBSpin } from "@/bbkit";import { releaseServiceClient } from "@/grpcweb";-import { WORKSPACE_ROUTE_SQL_REVIEW } from "@/router/dashboard/workspaceRoutes";-import { useReviewPolicyForDatabase } from "@/store";import type { ComposedDatabase } from "@/types";import type { DatabaseMetadata } from "@/types/proto/v1/database_service";import {@@ -100,7 +83,7 @@ import {} from "@/types/proto/v1/release_service";import { Advice, Advice_Status } from "@/types/proto/v1/sql_service";import type { Defer, VueStyle } from "@/utils";-import { defer, hasWorkspacePermissionV2 } from "@/utils";+import { defer } from "@/utils";import { providePlanCheckRunContext } from "../PlanCheckRun/context";import ErrorList from "../misc/ErrorList.vue";import SQLCheckPanel from "./SQLCheckPanel.vue";@@ -156,35 +139,19 @@ const filteredAdvices = computed(() => {return advices?.filter(adviceFilter);});-const reviewPolicy = useReviewPolicyForDatabase(- computed(() => {- return props.database;- })-);--const hasManageSQLReviewPolicyPermission = computed(() => {- return hasWorkspacePermissionV2("bb.policies.update");-});--const noReviewPolicyTips = computed(() => {- if (- !reviewPolicy.value ||- !reviewPolicy.value.enforce ||- reviewPolicy.value.ruleList.length === 0- ) {- if (hasManageSQLReviewPolicyPermission.value) {- return "issue.sql-check.no-configured-sql-review-policy.admin";- } else {- return "issue.sql-check.no-configured-sql-review-policy.developer";- }+const statementErrors = asyncComputed(async () => {+ const { statement, errors } = await props.getStatement();+ if (errors.length > 0) {+ return errors;+ }+ if (statement.length === 0) {+ return [t("issue.sql-check.statement-is-required")];+ }+ if (new Blob([statement]).size > SKIP_CHECK_THRESHOLD) {+ return [t("issue.sql-check.statement-is-too-large")];}- return "";-});--const policyErrors = computed(() => {- if (noReviewPolicyTips.value) return [noReviewPolicyTips.value];return [];-});+}, []);providePlanCheckRunContext({});@@ -221,7 +188,7 @@ const handleButtonClick = async () => {};const runChecks = async () => {- if (policyErrors.value.length > 0) {+ if (statementErrors.value.length > 0) {return;}@@ -275,8 +242,7 @@ const hasError = computed(() => {onMounted(() => {if (!context) return;context.runSQLCheck.value = async () => {- if (policyErrors.value.length > 0) {- // If SQL Check is disabled, we will do nothing to stop the user.+ if (statementErrors.value.length > 0) {return true;}diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex bc6c65398d..bf15f322c6 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -200,7 +200,6 @@"search-user": "Search user","info": "Info","minutes": "Minutes",- "go-to-configure": "Configure","filter-by-name": "Filter by name","license": "License","view-details": "View details",@@ -920,6 +919,7 @@"sql-check": {"sql-checks": "SQL Checks","not-executed-yet": "Not executed yet",+ "statement-is-required": "SQL statement is required","statement-is-too-large": "As the current statement size exceeds 2MB, the SQL check will be skipped.","back-to-edit": "Back to edit","sql-review-violations": "SQL Review Violations"diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 81f0f5778b..0ad89063b0 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -200,7 +200,6 @@"search-user": "Buscar usuario","info": "Información","minutes": "Minutos",- "go-to-configure": "Configurar","filter-by-name": "Filtrar por nombre","license": "Licencia","view-details": "Ver detalles",@@ -920,6 +919,7 @@"sql-check": {"sql-checks": "Comprobaciones SQL","not-executed-yet": "Aún no ejecutado",+ "statement-is-required": "Se requiere una declaración SQL","statement-is-too-large": "Como el tamaño de la declaración actual supera 2MB, se omitirá la comprobación de SQL.","back-to-edit": "Volver a editar","sql-review-violations": "Infracciones de revisión de SQL"diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex c01cb5f007..3fdffd6e3c 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -200,7 +200,6 @@"search-user": "ユーザーを検索する","info": "情報","minutes": "分",- "go-to-configure": "設定に移動","filter-by-name": "名前でフィルタリングする","license": "ライセンス","view-details": "詳細を確認する",@@ -920,6 +919,7 @@"sql-check": {"sql-checks": "SQLチェック項目","not-executed-yet": "まだ実行されていません",+ "statement-is-required": "SQL文が必要です","statement-is-too-large": "現在のステートメント サイズが 1MB を超えているため、SQL チェックはスキップされます。","back-to-edit": "編集に戻る","sql-review-violations": "SQL監査ルール違反"diff --git a/frontend/src/locales/subscription/es-ES.json b/frontend/src/locales/subscription/es-ES.jsonindex be64d71833..b5755b1b0e 100644--- a/frontend/src/locales/subscription/es-ES.json+++ b/frontend/src/locales/subscription/es-ES.json@@ -50,4 +50,4 @@"desc": "Funciones adicionales de seguridad, cumplimiento y permisos. Soporte dedicado con SLA."}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/subscription/ja-JP.json b/frontend/src/locales/subscription/ja-JP.jsonindex 62d3438003..b1ed8fc667 100644--- a/frontend/src/locales/subscription/ja-JP.json+++ b/frontend/src/locales/subscription/ja-JP.json@@ -50,4 +50,4 @@"desc": "追加のセキュリティ、コンプライアンス、および権限機能。SLA付きの専任サポート。"}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/subscription/vi-VN.json b/frontend/src/locales/subscription/vi-VN.jsonindex c93bc6ad92..4c29d445fb 100644--- a/frontend/src/locales/subscription/vi-VN.json+++ b/frontend/src/locales/subscription/vi-VN.json@@ -50,4 +50,4 @@"desc": "Các tính năng bảo mật, tuân thủ và quyền bổ sung. Hỗ trợ chuyên dụng với SLA."}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/subscription/zh-CN.json b/frontend/src/locales/subscription/zh-CN.jsonindex dbbbd429b1..19ed30a59d 100644--- a/frontend/src/locales/subscription/zh-CN.json+++ b/frontend/src/locales/subscription/zh-CN.json@@ -50,4 +50,4 @@"desc": "额外的安全,合规,权限功能,SLA 支持。"}}-}+}\ No newline at end of filediff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 998f38b4d6..b3fb597a95 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -200,7 +200,6 @@"search-user": "Tìm người dùng","info": "Thông tin","minutes": "Phút",- "go-to-configure": "Đi tới cấu hình","filter-by-name": "Lọc theo tên","license": "Giấy phép","view-details": "Xem chi tiết",@@ -920,6 +919,7 @@"sql-check": {"sql-checks": "Kiểm tra SQL","not-executed-yet": "Chưa được thực hiện",+ "statement-is-required": "Câu lệnh SQL là bắt buộc","statement-is-too-large": "Vì kích thước câu lệnh hiện tại vượt quá 2MB, việc kiểm tra SQL sẽ bị bỏ qua.","back-to-edit": "Quay lại chỉnh sửa","sql-review-violations": "Vi phạm đánh giá SQL"diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 97c5b6767a..0eecd8498a 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -200,7 +200,6 @@"search-user": "搜索用户","info": "信息","minutes": "分钟",- "go-to-configure": "去配置","filter-by-name": "按名称过滤","license": "证书","view-details": "查看详情",@@ -920,6 +919,7 @@"sql-check": {"sql-checks": "SQL 检查项","not-executed-yet": "尚未执行",+ "statement-is-required": "SQL 语句不能为空","statement-is-too-large": "当前语句大小超过 2MB,将跳过 SQL 检查。","back-to-edit": "返回编辑","sql-review-violations": "违反的 SQL 审核规则"