Skip to content

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

chore: support remove masking for object schema in ui (#15631)

ecmadao690d14b29319
diff --git a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
index fb2d114cb8..94aa42b07b 100644
--- a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
+++ b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
@@ -34,11 +34,7 @@
:database="database"
:row-clickable="false"
:row-selectable="!isMaskingForNoSQL"
- :show-operation="
- hasUpdateCatalogPermission &&
- hasSensitiveDataFeature &&
- !isMaskingForNoSQL
- "
+ :show-operation="hasUpdateCatalogPermission && hasSensitiveDataFeature"
:column-list="filteredColumnList"
:checked-column-index-list="checkedColumnIndexList"
@delete="onColumnRemove"
@@ -77,7 +73,6 @@
import { ShieldCheckIcon } from "lucide-vue-next";
import { NButton } from "naive-ui";
import { computed, reactive, watch } from "vue";
-import { updateColumnCatalog } from "@/components/ColumnDataTable/utils";
import {
FeatureModal,
FeatureBadge,
@@ -272,17 +267,6 @@ const filteredColumnList = computed(() => {
});
const removeSensitiveColumn = async (sensitiveColumn: MaskData) => {
- await updateColumnCatalog({
- database: props.database.name,
- schema: sensitiveColumn.schema,
- table: sensitiveColumn.table,
- column: sensitiveColumn.column,
- columnCatalog: {
- classification: "",
- semanticType: "",
- },
- notification: "common.removed",
- });
await removeMaskingExceptions(sensitiveColumn);
};
diff --git a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
index 2841cbfcc4..c9c1098acb 100644
--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
+++ b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
@@ -18,7 +18,6 @@ import { useI18n } from "vue-i18n";
import { useRouter, RouterLink } from "vue-router";
import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";
import SemanticTypeCell from "@/components/ColumnDataTable/SemanticTypeCell.vue";
-import { updateColumnCatalog } from "@/components/ColumnDataTable/utils";
import type { MaskData } from "@/components/SensitiveData/types";
import { MiniActionButton } from "@/components/v2";
import {
@@ -26,7 +25,6 @@ import {
useDatabaseCatalogV1Store,
useSettingV1Store,
useDatabaseCatalog,
- getColumnCatalog,
} from "@/store";
import type { ComposedDatabase } from "@/types";
import { DataClassificationSetting_DataClassificationConfig as DataClassificationConfig } from "@/types/proto/v1/setting_service";
@@ -155,16 +153,9 @@ const dataTableColumns = computed(() => {
width: "minmax(min-content, auto)",
resizable: true,
render(item) {
- const columnCatalog = getColumnCatalog(
- databaseCatalog.value,
- item.schema,
- item.table,
- item.column
- );
-
return (
<ClassificationCell
- classification={columnCatalog.classification}
+ classification={item.classificationId}
classificationConfig={classificationConfig.value}
readonly={!props.showOperation || item.disableClassification}
onApply={(id: string) => onClassificationIdApply(item, id)}
@@ -183,7 +174,7 @@ const dataTableColumns = computed(() => {
NPopconfirm,
{
onPositiveClick: () => {
- emit("delete", item);
+ onMaskingClear(item);
},
},
{
@@ -244,14 +235,25 @@ const onClassificationIdApply = async (
item: MaskData,
classification: string
) => {
- await updateColumnCatalog({
- database: props.database.name,
- schema: item.schema,
- table: item.table,
- column: item.column,
- columnCatalog: { classification },
- notification: !classification ? "common.removed" : undefined,
+ (item.target as any).classification = classification;
+ await dbCatalogStore.updateDatabaseCatalog(databaseCatalog.value);
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.updated"),
+ });
+};
+
+const onMaskingClear = async (item: MaskData) => {
+ (item.target as any).classification = "";
+ (item.target as any).semanticType = "";
+ await dbCatalogStore.updateDatabaseCatalog(databaseCatalog.value);
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.removed"),
});
+ emit("delete", item);
};
const handleUpdateCheckedRowKeys = (keys: string[]) => {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 65ad89b248..9bc8e206c1 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -225,7 +225,8 @@
"text-wrap": "Text wrap",
"catalog": "Catalog",
"summary": "Summary",
- "errors": "Errors"
+ "errors": "Errors",
+ "removed": "Removed"
},
"error-page": {
"go-back-home": "Go back home"
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 644394845a..c53e352588 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -225,7 +225,8 @@
"text-wrap": "Ajuste de texto",
"catalog": "Catálogo",
"summary": "Resumen",
- "errors": "Errores"
+ "errors": "Errores",
+ "removed": "Remoto"
},
"error-page": {
"go-back-home": "Volver al inicio"
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index be32d6da04..ec2d216bb3 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -225,7 +225,8 @@
"text-wrap": "テキストの折り返し",
"catalog": "カタログ",
"summary": "まとめ",
- "errors": "エラー"
+ "errors": "エラー",
+ "removed": "削除されました"
},
"error-page": {
"go-back-home": "ホームページに戻る"
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 085bc0068b..fefd15cd26 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -225,7 +225,8 @@
"text-wrap": "Ngắt dòng văn bản",
"catalog": "Danh mục",
"summary": "Tóm tắt",
- "errors": "Lỗi"
+ "errors": "Lỗi",
+ "removed": "LOẠI BỎ"
},
"error-page": {
"go-back-home": "Về trang chủ"
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 42e784420d..50212c1e5e 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -225,7 +225,8 @@
"text-wrap": "文本折行",
"catalog": "Catalog",
"summary": "总结",
- "errors": "错误"
+ "errors": "错误",
+ "removed": "已移除"
},
"error-page": {
"go-back-home": "回到主页"