Skip to content

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

chore: error hit for global masking rule (#18126)

ecmadaod04da5d8ac61
diff --git a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
index 219fbe18da..f369a074df 100644
--- a/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
+++ b/frontend/src/components/SensitiveData/components/MaskingRuleConfig.vue
@@ -6,7 +6,7 @@
<div
class="flex-1 flex flex-col gap-y-2 overflow-x-hidden overflow-y-auto"
>
- <div class="flex items-center h-[36px]">
+ <div class="flex items-center h-9">
<NInput
v-if="!readonly"
v-model:value="state.title"
@@ -72,13 +72,22 @@
<NButton :disabled="disabled" @click="onCancel">
{{ $t("common.cancel") }}
</NButton>
- <NButton
- type="primary"
- :disabled="!isValid || disabled || !state.dirty"
- @click="onConfirm"
- >
- {{ $t("common.confirm") }}
- </NButton>
+ <NTooltip :disabled="errorMessages.length === 0">
+ <template #trigger>
+ <NButton
+ type="primary"
+ :disabled="errorMessages.length !== 0 || disabled || !state.dirty"
+ @click="onConfirm"
+ >
+ {{ $t("common.confirm") }}
+ </NButton>
+ </template>
+ <ul class="list-disc pl-4">
+ <li v-for="(msg, i) in errorMessages" :key="i">
+ {{ msg }}
+ </li>
+ </ul>
+ </NTooltip>
</div>
</div>
</div>
@@ -89,7 +98,7 @@ import { create } from "@bufbuild/protobuf";
import { head } from "lodash-es";
import { TrashIcon } from "lucide-vue-next";
import type { SelectOption } from "naive-ui";
-import { NButton, NInput, NPopconfirm, NSelect } from "naive-ui";
+import { NButton, NInput, NPopconfirm, NSelect, NTooltip } from "naive-ui";
import { computed, nextTick, onMounted, reactive } from "vue";
import { useI18n } from "vue-i18n";
import ExprEditor from "@/components/ExprEditor";
@@ -149,6 +158,19 @@ const state = reactive<LocalState>({
});
const settingStore = useSettingV1Store();
+const errorMessages = computed(() => {
+ const msg: string[] = [];
+ if (!state.semanticType) {
+ msg.push(
+ t("settings.sensitive-data.global-rules.error.missing-semantic-type")
+ );
+ }
+ if (!validateSimpleExpr(state.expr)) {
+ msg.push(t("settings.sensitive-data.global-rules.error.invalid-condition"));
+ }
+ return msg;
+});
+
const semanticTypeSettingValue = computed(() => {
const semanticTypeSetting = settingStore.getSettingByName(
Setting_SettingName.SEMANTIC_TYPES
@@ -209,12 +231,6 @@ const onCancel = async () => {
nextTick(() => (state.dirty = false));
};
-const isValid = computed(() => {
- const { expr, semanticType } = state;
- if (!expr || !semanticType) return false;
- return validateSimpleExpr(expr);
-});
-
const onConfirm = async () => {
const celexpr = await buildCELExpr(state.expr);
if (!celexpr) {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index c971ae5ca6..9178e5cec1 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -738,7 +738,11 @@
"description": "Use global rule to apply masking in batch, e.g. all columns named as \"email\" will be masked with the specific semantic type and apply the masking algorithm.",
"condition-order": "Condition order",
"re-order": "Re-order",
- "delete-rule-tip": "Delete this rule?"
+ "delete-rule-tip": "Delete this rule?",
+ "error": {
+ "missing-semantic-type": "Semantic type is required",
+ "invalid-condition": "Condition is invalid"
+ }
},
"semantic-types": {
"self": "Semantic Types",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index cba2fb3857..078b3f4aa0 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -738,7 +738,11 @@
"description": "Utilice una regla global para aplicar el enmascaramiento en lote, por ejemplo, todas las columnas denominadas \"correo electrónico\" se enmascararán con el tipo semántico específico y se aplicará el algoritmo de enmascaramiento.",
"condition-order": "Orden de condición",
"re-order": "Reordenar",
- "delete-rule-tip": "¿Eliminar esta regla?"
+ "delete-rule-tip": "¿Eliminar esta regla?",
+ "error": {
+ "missing-semantic-type": "Se requiere el tipo semántico.",
+ "invalid-condition": "La condición no es válida."
+ }
},
"semantic-types": {
"self": "Tipos Semánticos",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index f509bd1168..587c95cd41 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -738,7 +738,11 @@
"description": "グローバル ルールを使用してバッチでマスキングを適用します。たとえば、「email」という名前のすべての列は特定のセマンティック タイプでマスキングされ、マスキング アルゴリズムが適用されます。",
"condition-order": "条件付きシーケンス",
"re-order": "並び替え",
- "delete-rule-tip": "このルールを削除しますか?"
+ "delete-rule-tip": "このルールを削除しますか?",
+ "error": {
+ "missing-semantic-type": "セマンティックタイプは必須です",
+ "invalid-condition": "条件が無効です"
+ }
},
"semantic-types": {
"self": "セマンティックタイプ",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 25eea581dd..1980bcbff2 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -738,7 +738,11 @@
"description": "Sử dụng quy tắc toàn cục để áp dụng che giấu hàng loạt, ví dụ: tất cả các cột có tên là \"email\" sẽ được che bằng loại ngữ nghĩa cụ thể và áp dụng thuật toán che.",
"condition-order": "Thứ tự điều kiện",
"re-order": "Sắp xếp lại",
- "delete-rule-tip": "Xóa quy tắc này?"
+ "delete-rule-tip": "Xóa quy tắc này?",
+ "error": {
+ "missing-semantic-type": "Kiểu ngữ nghĩa là bắt buộc",
+ "invalid-condition": "Điều kiện không hợp lệ"
+ }
},
"semantic-types": {
"self": "Loại ngữ nghĩa",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index d16d3a7e53..606a3051e9 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -738,7 +738,11 @@
"description": "使用全局规则批量脱敏,例如所有名为「电子邮件」的列将被脱敏成特定语义类型,并应用对应的脱敏算法。",
"condition-order": "条件序列",
"re-order": "排序",
- "delete-rule-tip": "删除这条规则?"
+ "delete-rule-tip": "删除这条规则?",
+ "error": {
+ "missing-semantic-type": "需要指定语义类型",
+ "invalid-condition": "规则的条件无效"
+ }
},
"semantic-types": {
"self": "语义类型",