Skip to content

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

feat: replace data classification file upload with inline JSON editor (#19736)

Danny Xub0e5253855ce
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.go
index 2fee30b3a4..c42127a77d 100644
--- a/backend/api/v1/setting_service.go
+++ b/backend/api/v1/setting_service.go
@@ -486,8 +486,33 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Req
if len(payload.Configs) > 1 {
return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("only support define 1 classification config for now"))
}
- if len(payload.Configs) == 1 && len(payload.Configs[0].Classification) == 0 {
- return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("missing classification map"))
+ if len(payload.Configs) == 1 {
+ config := payload.Configs[0]
+ if len(config.Classification) == 0 {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("missing classification map"))
+ }
+ if len(config.Levels) == 0 {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("levels must not be empty"))
+ }
+ // Validate that level numbers are unique and consecutive starting from 1.
+ seen := make(map[int32]bool, len(config.Levels))
+ for _, level := range config.Levels {
+ if seen[level.Level] {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("duplicate level number: %d", level.Level))
+ }
+ seen[level.Level] = true
+ }
+ for i := 1; i <= len(config.Levels); i++ {
+ if !seen[int32(i)] {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("levels must be consecutive integers starting from 1, missing level %d", i))
+ }
+ }
+ // Validate that classification level references are valid.
+ for id, c := range config.Classification {
+ if c.Level != nil && (*c.Level < 1 || *c.Level > int32(len(config.Levels))) {
+ return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("classification %q references invalid level %d", id, *c.Level))
+ }
+ }
}
resetClassification = true
storeSettingValue = payload
diff --git a/frontend/src/components/SensitiveData/ClassificationView.vue b/frontend/src/components/SensitiveData/ClassificationView.vue
index 6467459ef6..0b49974486 100644
--- a/frontend/src/components/SensitiveData/ClassificationView.vue
+++ b/frontend/src/components/SensitiveData/ClassificationView.vue
@@ -1,101 +1,102 @@
<template>
<div class="w-full flex flex-col gap-y-4">
- <div class="text-sm text-control-light">
- {{ $t("database.classification.description") }}
- <LearnMoreLink
- url="https://docs.bytebase.com/security/data-masking/data-classification?source=console"
- class="ml-1"
- />
- </div>
-
<div class="flex items-center justify-between">
- <div class="textinfolabel">
- {{ $t("settings.sensitive-data.classification.upload-label") }}
- <span
- class="normal-link cursor-pointer hover:underline"
- @click="state.showExampleModal = true"
- >
- {{ $t("settings.sensitive-data.view-example") }}
- </span>
+ <div class="text-sm text-control-light">
+ {{ $t("database.classification.description") }}
+ <LearnMoreLink
+ url="https://docs.bytebase.com/security/data-masking/data-classification?source=console"
+ class="ml-1"
+ />
</div>
<PermissionGuardWrapper
v-slot="slotProps"
:permissions="['bb.settings.set']"
>
- <div class="flex items-center justify-end gap-x-2">
- <BBButtonConfirm
- :tertiary="true"
- :text="false"
- :type="'DELETE'"
- :ok-text="$t('common.delete')"
- :require-confirm="true"
- :hide-icon="true"
- :button-text="$t('common.clear')"
- :disabled="slotProps.disabled || !hasClassificationFeature"
- @confirm="clearSetting"
- />
- <NButton
- type="primary"
- :disabled="slotProps.disabled || !hasClassificationFeature"
- @click="onUpload"
- >
- <template #icon>
- <UploadIcon class="h-4 w-4" />
- </template>
- {{ $t("settings.sensitive-data.classification.upload") }}
- </NButton>
- <input
- ref="uploader"
- type="file"
- accept=".json"
- class="sr-only hidden"
- :disabled="slotProps.disabled || !hasClassificationFeature"
- @input="onFileChange"
- />
+ <div class="flex items-center justify-end gap-x-2 shrink-0">
+ <template v-if="editing">
+ <NButton
+ :disabled="!editorDirty"
+ @click="onRevert"
+ >
+ {{ $t("common.revert") }}
+ </NButton>
+ <NButton
+ @click="onCancelEdit"
+ >
+ {{ $t("common.cancel") }}
+ </NButton>
+ <NButton
+ type="primary"
+ :disabled="!editorDirty || slotProps.disabled || !hasClassificationFeature"
+ @click="onSave"
+ >
+ {{ $t("common.save") }}
+ </NButton>
+ </template>
+ <template v-else>
+ <BBButtonConfirm
+ v-if="!emptyConfig"
+ :tertiary="true"
+ :text="false"
+ :type="'DELETE'"
+ :ok-text="$t('common.delete')"
+ :require-confirm="true"
+ :hide-icon="true"
+ :button-text="$t('common.clear')"
+ :disabled="slotProps.disabled || !hasClassificationFeature"
+ @confirm="clearSetting"
+ />
+ <NButton
+ type="primary"
+ :disabled="slotProps.disabled || !hasClassificationFeature"
+ @click="editing = true"
+ >
+ {{ $t("common.edit") }}
+ </NButton>
+ </template>
</div>
</PermissionGuardWrapper>
</div>
- <div
- v-if="emptyConfig"
- class="flex justify-center border-2 border-gray-300 border-dashed rounded-md relative h-72"
- >
- <SingleFileSelector
- class="flex flex-col gap-y-1 text-center justify-center items-center absolute top-0 bottom-0 left-0 right-0"
- :support-file-extensions="['.json']"
- :max-file-size-in-mi-b="maxFileSizeInMiB"
- :disabled="!allowEdit || !hasClassificationFeature"
- :show-no-data-placeholder="true"
- @on-select="onFileSelect"
- >
- </SingleFileSelector>
- </div>
- <div v-else class="h-full">
+ <template v-if="editing">
+ <div class="textinfolabel space-y-1">
+ <p>{{ $t("settings.sensitive-data.classification.guide-intro") }}</p>
+ <ul class="list-disc list-inside">
+ <li>{{ $t("settings.sensitive-data.classification.guide-levels") }}</li>
+ <li>{{ $t("settings.sensitive-data.classification.guide-classification") }}</li>
+ <li>{{ $t("settings.sensitive-data.classification.guide-hierarchy") }}</li>
+ </ul>
+ </div>
+ <div class="border rounded-sm overflow-hidden" style="height: 50vh">
+ <MonacoEditor
+ :content="editorContent"
+ :readonly="!allowEdit || !hasClassificationFeature"
+ language="json"
+ class="w-full h-full"
+ @update:content="onEditorChange"
+ />
+ </div>
+ </template>
+
+ <div v-if="!editing && !emptyConfig" class="h-full">
<ClassificationTree :classification-config="state.classification" />
</div>
</div>
-
- <DataExampleModal
- v-if="state.showExampleModal"
- :example="exampleJSON"
- @dismiss="state.showExampleModal = false"
- />
</template>
<script lang="ts" setup>
import { create } from "@bufbuild/protobuf";
-import { head, isEmpty, isEqual } from "lodash-es";
-import { UploadIcon } from "lucide-vue-next";
-import { NButton, useDialog } from "naive-ui";
+import { head, isEmpty } from "lodash-es";
+import { NButton } from "naive-ui";
import { v4 as uuidv4 } from "uuid";
import { computed, reactive, ref, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
import { BBButtonConfirm } from "@/bbkit";
+import { MonacoEditor } from "@/components/MonacoEditor";
import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";
import { featureToRef, pushNotification, useSettingV1Store } from "@/store";
import type {
- DataClassificationSetting_DataClassificationConfig_Level as ClassificationLevel,
DataClassificationSetting_DataClassificationConfig_DataClassification as DataClassification,
DataClassificationSetting_DataClassificationConfig,
} from "@/types/proto-es/v1/setting_service_pb";
@@ -110,27 +111,22 @@ import {
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
import { hasWorkspacePermissionV2 } from "@/utils";
import LearnMoreLink from "../LearnMoreLink.vue";
-import SingleFileSelector from "../SingleFileSelector.vue";
import classificationExample from "./classification-example.json";
import ClassificationTree from "./components/ClassificationTree.vue";
-import DataExampleModal from "./components/DataExampleModal.vue";
-const uploader = ref<HTMLInputElement | null>(null);
-const maxFileSizeInMiB = 10;
-
-interface UploadClassificationConfig {
+interface ClassificationJSON {
title: string;
- levels: ClassificationLevel[];
- classification: { [key: string]: DataClassification };
+ levels: { title: string; level: number }[];
+ classification: {
+ [key: string]: { id: string; title: string; level?: number };
+ };
}
interface LocalState {
classification: DataClassificationSetting_DataClassificationConfig;
- showExampleModal: boolean;
}
const { t } = useI18n();
-const $dialog = useDialog();
const settingStore = useSettingV1Store();
const formerConfig = computed(() => {
@@ -144,7 +140,6 @@ const formerConfig = computed(() => {
});
const state = reactive<LocalState>({
- showExampleModal: false,
classification: create(
DataClassificationSetting_DataClassificationConfigSchema,
{
@@ -174,31 +169,125 @@ const emptyConfig = computed(
() => Object.keys(state.classification.classification).length === 0
);
-const allowSave = computed(() => {
- return (
- allowEdit.value &&
- hasClassificationFeature.value &&
- !isEqual(formerConfig.value, state.classification)
- );
+const configToJSON = (
+ config: DataClassificationSetting_DataClassificationConfig
+): string => {
+ const data: ClassificationJSON = {
+ title: config.title,
+ levels: config.levels.map((l) => ({
+ title: l.title,
+ level: l.level,
+ })),
+ classification: {},
+ };
+ for (const [key, val] of Object.entries(config.classification)) {
+ const entry: ClassificationJSON["classification"][string] = {
+ id: val.id,
+ title: val.title,
+ };
+ if (val.level !== undefined && val.level !== 0) {
+ entry.level = val.level;
+ }
+ data.classification[key] = entry;
+ }
+ return JSON.stringify(data, null, 2);
+};
+
+const savedContent = computed(() => {
+ if (emptyConfig.value) {
+ return JSON.stringify(classificationExample, null, 2);
+ }
+ return configToJSON(state.classification);
});
-const saveChanges = async () => {
- if (Object.keys(formerConfig.value.classification).length !== 0) {
- $dialog.warning({
- title: t("settings.sensitive-data.classification.override-title"),
- content: t("settings.sensitive-data.classification.override-desc"),
- style: "z-index: 100000",
- negativeText: t("common.cancel"),
- positiveText: t(
- "settings.sensitive-data.classification.override-confirm"
- ),
- onPositiveClick: async () => {
- await upsertSetting([state.classification]);
- },
+const editing = ref(false);
+const editorContent = ref("");
+const editorDirty = computed(() => {
+ return editorContent.value !== savedContent.value;
+});
+
+watchEffect(() => {
+ if (editing.value) return;
+ editorContent.value = savedContent.value;
+});
+
+const onEditorChange = (content: string) => {
+ editorContent.value = content;
+};
+
+const onRevert = () => {
+ editorContent.value = savedContent.value;
+};
+
+const onCancelEdit = () => {
+ editorContent.value = savedContent.value;
+ editing.value = false;
+};
+
+const onSave = async () => {
+ let data: ClassificationJSON;
+ try {
+ data = JSON.parse(editorContent.value);
+ } catch {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("settings.sensitive-data.classification.invalid-json"),
});
return;
}
- await upsertSetting([state.classification]);
+
+ if (isEmpty(data.classification) || Array.isArray(data.classification)) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("settings.sensitive-data.classification.missing-classification"),
+ });
+ return;
+ }
+ if (Object.keys(data.classification).length === 0) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("settings.sensitive-data.classification.empty-classification"),
+ });
+ return;
+ }
+ if (!Array.isArray(data.levels) || data.levels.length === 0) {
+ pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("settings.sensitive-data.classification.missing-levels"),
+ });
+ return;
+ }
+
+ const config = create(
+ DataClassificationSetting_DataClassificationConfigSchema,
+ {
+ id: state.classification.id || uuidv4(),
+ title: data.title || "",
+ levels: data.levels.map((level) =>
+ create(
+ DataClassificationSetting_DataClassificationConfig_LevelSchema,
+ level
+ )
+ ),
+ classification: Object.values(data.classification).reduce(
+ (map, item) => {
+ map[item.id] = create(
+ DataClassificationSetting_DataClassificationConfig_DataClassificationSchema,
+ item
+ );
+ return map;
+ },
+ {} as { [key: string]: DataClassification }
+ ),
+ }
+ );
+
+ await upsertSetting([config]);
+ editing.value = false;
};
const clearSetting = async () => {
@@ -233,105 +322,4 @@ const allowEdit = computed(() => {
const hasClassificationFeature = featureToRef(
PlanFeature.FEATURE_DATA_CLASSIFICATION
);
-
-const onUpload = () => {
- uploader.value?.click();
-};
-
-const onFileChange = () => {
- const files = uploader.value?.files;
- if (!files || files.length !== 1) {
- return;
- }
- const file = files.item(0);
- if (!file) {
- return;
- }
- if (file.size > maxFileSizeInMiB * 1024 * 1024) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.file-selector.size-limit", {
- size: maxFileSizeInMiB,
- }),
- });
- return;
- }
- onFileSelect(file);
-};
-
-const onFileSelect = (file: File) => {
- const fr = new FileReader();
- fr.onload = () => {
- if (!fr.result) {
- return;
- }
- const data: UploadClassificationConfig = JSON.parse(fr.result as string);
- if (isEmpty(data.classification) || Array.isArray(data.classification)) {
- return pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Data format error",
- description: `Should has the "classification" field. Please check the example.`,
- });
- }
- if (Object.keys(data.classification).length === 0) {
- return pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Data format error",
- description: `"classification" field is empty. Please check the example.`,
- });
- }
- if (!Array.isArray(data.levels) || data.levels.length === 0) {
- return pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Data format error",
- description: `Should has the "levels" field. Please check the example.`,
- });
- }
- Object.assign(state.classification, {
- title: data.title || state.classification.title || "",
- levels: data.levels.map((level) =>
- create(
- DataClassificationSetting_DataClassificationConfig_LevelSchema,
- level
- )
- ),
- classification: Object.values(data.classification).reduce(
- (map, data) => {
- map[data.id] = create(
- DataClassificationSetting_DataClassificationConfig_DataClassificationSchema,
- data
- );
- return map;
- },
- {} as { [key: string]: DataClassification }
- ),
- });
- if (isEqual(formerConfig.value, state.classification)) {
- return pushNotification({
- module: "bytebase",
- style: "INFO",
- title: "Nothing changed",
- });
- }
- if (allowSave.value) {
- saveChanges();
- }
- };
- fr.onerror = () => {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: "Read file error",
- description: String(fr.error),
- });
- return;
- };
- fr.readAsText(file);
-};
-
-const exampleJSON = JSON.stringify(classificationExample, null, 2);
</script>
diff --git a/frontend/src/components/SensitiveData/components/ClassificationTree.vue b/frontend/src/components/SensitiveData/components/ClassificationTree.vue
index 2c2b908da5..27c3bcf0de 100644
--- a/frontend/src/components/SensitiveData/components/ClassificationTree.vue
+++ b/frontend/src/components/SensitiveData/components/ClassificationTree.vue
@@ -15,6 +15,7 @@
:selectable="true"
:pattern="state.searchText"
:show-irrelevant-nodes="false"
+ :default-expand-all="true"
:expand-on-click="true"
:render-suffix="renderSuffix"
:render-label="renderLabel"
diff --git a/frontend/src/components/SensitiveData/components/DataExampleModal.vue b/frontend/src/components/SensitiveData/components/DataExampleModal.vue
deleted file mode 100644
index 1bcf17b475..0000000000
--- a/frontend/src/components/SensitiveData/components/DataExampleModal.vue
+++ /dev/null
@@ -1,39 +0,0 @@
-<template>
- <BBModal
- :close-on-esc="true"
- :mask-closable="true"
- :trap-focus="false"
- :title="$t('settings.sensitive-data.json-format-example')"
- class="w-3xl max-w-full"
- @close="$emit('dismiss')"
- >
- <div class="my-4 rounded-xs p-4 bg-gray-100 relative">
- <div class="absolute top-2 right-2 p-2">
- <CopyButton
- quaternary
- :text="false"
- :size="'medium'"
- :content="example"
- />
- </div>
- <NConfigProvider :hljs="hljs">
- <NCode language="json" :code="example" />
- </NConfigProvider>
- </div>
- </BBModal>
-</template>
-
-<script lang="ts" setup>
-import hljs from "highlight.js/lib/core";
-import { NCode, NConfigProvider } from "naive-ui";
-import { BBModal } from "@/bbkit";
-import { CopyButton } from "@/components/v2";
-
-defineProps<{
- example: string;
-}>();
-
-defineEmits<{
- (event: "dismiss"): void;
-}>();
-</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 759075ce84..70761a5e81 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -924,14 +924,15 @@
}
},
"classification": {
- "upload": "Upload classification",
- "upload-label": "You can upload classification file with JSON format.",
- "override-title": "Classification data override",
- "override-desc": "Existed classification data will be overridden and affect all projects.",
- "override-confirm": "Still upload"
- },
- "json-format-example": "JSON format example",
- "view-example": "View example"
+ "guide-intro": "Edit the classification JSON below. An example template is provided when no classification is configured.",
+ "guide-levels": "\"levels\" defines sensitivity tiers with consecutive numbers starting from 1 (e.g., 1 = Public, 2 = Internal, 3 = Confidential).",
+ "guide-classification": "\"classification\" maps each category by ID. Leaf categories must reference a level number; parent categories omit the level.",
+ "guide-hierarchy": "IDs use a dash-separated hierarchy (e.g., \"1\" is a parent, \"1-1\" and \"1-2\" are its children).",
+ "invalid-json": "Invalid JSON format",
+ "missing-classification": "Missing \"classification\" field",
+ "empty-classification": "The \"classification\" field is empty",
+ "missing-levels": "Missing \"levels\" field"
+ }
}
},
"remind": {
@@ -1749,7 +1750,7 @@
"transfer-database-to": "Transfer databases to target project",
"classification": {
"self": "Classification",
- "description": "Use data classification to manage masking policy for many columns by controlling only a small number of classifications."
+ "description": "Define classification levels to apply consistent masking policies across columns and databases."
},
"partitioned": "Partitioned",
"partition-tables": "Partition tables",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 8d98718fba..c1410bcabf 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -924,14 +924,15 @@
}
},
"classification": {
- "upload": "Subir clasificación",
- "upload-label": "Puede cargar un archivo de clasificación con formato JSON.",
- "override-title": "Anulación de datos de clasificación",
- "override-desc": "Los datos de clasificación existentes se anularán y afectarán a todos los proyectos.",
- "override-confirm": "Aún subiendo"
- },
- "json-format-example": "Ejemplo de formato JSON",
- "view-example": "Ver ejemplo"
+ "guide-intro": "Edit the classification JSON below. An example template is provided when no classification is configured.",
+ "guide-levels": "\"levels\" defines sensitivity tiers with consecutive numbers starting from 1 (e.g., 1 = Public, 2 = Internal, 3 = Confidential).",
+ "guide-classification": "\"classification\" maps each category by ID. Leaf categories must reference a level number; parent categories omit the level.",
+ "guide-hierarchy": "IDs use a dash-separated hierarchy (e.g., \"1\" is a parent, \"1-1\" and \"1-2\" are its children).",
+ "invalid-json": "Invalid JSON format",
+ "missing-classification": "Missing \"classification\" field",
+ "empty-classification": "The \"classification\" field is empty",
+ "missing-levels": "Missing \"levels\" field"
+ }
}
},
"remind": {
@@ -1749,7 +1750,7 @@
"transfer-database-to": "Transferir bases de datos al proyecto de destino",
"classification": {
"self": "Clasificación",
- "description": "Utilice la clasificación de datos para administrar la política de enmascaramiento para muchas columnas controlando solo una pequeña cantidad de clasificaciones."
+ "description": "Define classification levels to apply consistent masking policies across columns and databases."
},
"partitioned": "Particionado",
"partition-tables": "Tablas de particiones",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 3a5b4be673..8f30b35780 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -924,14 +924,15 @@
}
},
"classification": {
- "upload": "分類をアップロード",
- "upload-label": "データを分類・分類したJSON形式ファイルをアップロードできます。",
- "override-title": "カバレッジの分類および等級付けされたデータ",
- "override-desc": "既存の分類およびグレーディング データは上書きされ、関連するすべてのプロジェクトが影響を受けます。",
- "override-confirm": "インポートを続行する"
- },
- "json-format-example": "JSON形式の例",
- "view-example": "サンプルを見る"
+ "guide-intro": "Edit the classification JSON below. An example template is provided when no classification is configured.",
+ "guide-levels": "\"levels\" defines sensitivity tiers with consecutive numbers starting from 1 (e.g., 1 = Public, 2 = Internal, 3 = Confidential).",
+ "guide-classification": "\"classification\" maps each category by ID. Leaf categories must reference a level number; parent categories omit the level.",
+ "guide-hierarchy": "IDs use a dash-separated hierarchy (e.g., \"1\" is a parent, \"1-1\" and \"1-2\" are its children).",
+ "invalid-json": "Invalid JSON format",
+ "missing-classification": "Missing \"classification\" field",
+ "empty-classification": "The \"classification\" field is empty",
+ "missing-levels": "Missing \"levels\" field"
+ }
}
},
"remind": {
@@ -1749,7 +1750,7 @@
"transfer-database-to": "データベースをターゲットプロジェクトに転送します",
"classification": {
"self": "分類",
- "description": "データ分類を使用して、少数の分類のみを制御することで、多数の列のマスキング ポリシーを管理します。"
+ "description": "Define classification levels to apply consistent masking policies across columns and databases."
},
"partitioned": "パーティション",
"partition-tables": "パーティションテーブル",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index b01f4e0a98..be4c71eb2f 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -924,14 +924,15 @@
}
},
"classification": {
- "upload": "Tải lên phân loại",
- "upload-label": "Bạn có thể tải lên tệp phân loại với định dạng JSON.",
- "override-title": "Ghi đè dữ liệu phân loại",
- "override-desc": "Dữ liệu phân loại hiện có sẽ bị ghi đè và ảnh hưởng đến tất cả các dự án.",
- "override-confirm": "Vẫn tải lên"
- },
- "json-format-example": "Ví dụ định dạng JSON",
- "view-example": "Xem ví dụ"
+ "guide-intro": "Edit the classification JSON below. An example template is provided when no classification is configured.",
+ "guide-levels": "\"levels\" defines sensitivity tiers with consecutive numbers starting from 1 (e.g., 1 = Public, 2 = Internal, 3 = Confidential).",
+ "guide-classification": "\"classification\" maps each category by ID. Leaf categories must reference a level number; parent categories omit the level.",
+ "guide-hierarchy": "IDs use a dash-separated hierarchy (e.g., \"1\" is a parent, \"1-1\" and \"1-2\" are its children).",
+ "invalid-json": "Invalid JSON format",
+ "missing-classification": "Missing \"classification\" field",
+ "empty-classification": "The \"classification\" field is empty",
+ "missing-levels": "Missing \"levels\" field"
+ }
}
},
"remind": {
@@ -1749,7 +1750,7 @@
"transfer-database-to": "Chuyển cơ sở dữ liệu sang dự án đích",
"classification": {
"self": "Phân loại",
- "description": "Sử dụng phân loại dữ liệu để quản lý chính sách che giấu cho nhiều cột bằng cách chỉ kiểm soát một số lượng nhỏ các phân loại."
+ "description": "Define classification levels to apply consistent masking policies across columns and databases."
},
"partitioned": "Đã phân vùng",
"partition-tables": "Bảng phân vùng",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index d60ef9c5f8..e881195e73 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -924,14 +924,15 @@
}
},
"classification": {
- "upload": "导入分类分级",
- "upload-label": "您可以上传数据分类分级的 JSON 格式文件。",
- "override-title": "覆盖分类分级数据",
- "override-desc": "已有的分类分级数据将会被覆盖,涉及到的项目都会受到影响。",
- "override-confirm": "继续导入"
- },
- "json-format-example": "JSON 格式样例",
- "view-example": "查看样例"
+ "guide-intro": "在下方编辑分类分级的 JSON 配置。未配置时将显示示例模板。",
+ "guide-levels": "\"levels\" 定义敏感级别,级别编号从 1 开始连续递增(例如 1 = 公开、2 = 内部、3 = 机密)。",
+ "guide-classification": "\"classification\" 以 ID 为键映射各分类。叶子分类必须引用级别编号,父分类省略级别。",
+ "guide-hierarchy": "ID 使用短横线分隔的层级结构(例如 \"1\" 为父分类,\"1-1\" 和 \"1-2\" 为其子分类)。",
+ "invalid-json": "JSON 格式无效",
+ "missing-classification": "缺少 \"classification\" 字段",
+ "empty-classification": "\"classification\" 字段为空",
+ "missing-levels": "缺少 \"levels\" 字段"
+ }
}
},
"remind": {
@@ -1749,7 +1750,7 @@
"transfer-database-to": "将数据库转移到目标项目",
"classification": {
"self": "分类分级",
- "description": "通过分类分级,来批量管理列的脱敏规则。"
+ "description": "定义分类分级,跨列和数据库统一应用脱敏策略。"
},
"partitioned": "分区",
"partition-tables": "分区表",