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: add example for upload json file (#12035)
ecmadao9b55afe20903
diff --git a/frontend/src/components/SensitiveData/ClassificationView.vue b/frontend/src/components/SensitiveData/ClassificationView.vueindex 2dae1407b2..301be7ad33 100644--- a/frontend/src/components/SensitiveData/ClassificationView.vue+++ b/frontend/src/components/SensitiveData/ClassificationView.vue@@ -18,12 +18,12 @@/></div><div class="textinfolabel">- {{ $t("settings.sensitive-data.classification.label") }}+ {{ $t("settings.sensitive-data.classification.upload-label") }}<spanclass="normal-link cursor-pointer hover:underline"@click="state.showExampleModal = true">- {{ $t("settings.sensitive-data.classification.view-example") }}+ {{ $t("settings.sensitive-data.view-example") }}</span></div><div@@ -52,8 +52,9 @@</div></div>- <ClassificationExampleModal+ <DataExampleModalv-if="state.showExampleModal"+ :example="JSON.stringify(example, null, 2)"@dismiss="state.showExampleModal = false"/>@@ -230,4 +231,62 @@ const onFileSelect = (file: File) => {};fr.readAsText(file);};++const example: UploadClassificationConfig = {+ title: "Classification Example",+ levels: [+ {+ id: "1",+ title: "Level 1",+ description: "",+ },+ {+ id: "2",+ title: "Level 2",+ description: "",+ },+ ],+ classifications: [+ {+ id: "1",+ title: "Basic",+ description: "",+ },+ {+ id: "1-1",+ title: "Basic",+ description: "",+ },+ {+ id: "1-2",+ title: "Assert",+ description: "",+ },+ {+ id: "1-3",+ title: "Contact",+ description: "",+ },+ {+ id: "1-4",+ title: "Health",+ description: "",+ },+ {+ id: "2",+ title: "Relationship",+ description: "",+ },+ {+ id: "2-1",+ title: "Social",+ description: "",+ },+ {+ id: "2-2",+ title: "Business",+ description: "",+ },+ ],+};</script>diff --git a/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue b/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vueindex 78fe99e325..9db76b68e0 100644--- a/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue+++ b/frontend/src/components/SensitiveData/MaskingAlgorithmsView.vue@@ -24,6 +24,15 @@{{ $t("common.add") }}</NButton></div>+ <div class="textinfolabel">+ {{ $t("settings.sensitive-data.algorithms.upload-label") }}+ <span+ class="normal-link cursor-pointer hover:underline"+ @click="state.showExampleModal = true"+ >+ {{ $t("settings.sensitive-data.view-example") }}+ </span>+ </div><div class="space-y-5 divide-y-2 pb-10 divide-gray-100"><MaskingAlgorithmsTable:readonly="!hasPermission || !hasSensitiveDataFeature"@@ -38,6 +47,11 @@:readonly="!hasPermission || !hasSensitiveDataFeature"@dismiss="onDrawerDismiss"/>+ <DataExampleModal+ v-if="state.showExampleModal"+ :example="JSON.stringify(example, null, 2)"+ @dismiss="state.showExampleModal = false"+ /></template><script lang="ts" setup>@@ -51,7 +65,10 @@ import {useSettingV1Store,pushNotification,} from "@/store";-import { MaskingAlgorithmSetting_Algorithm as Algorithm } from "@/types/proto/v1/setting_service";+import {+ MaskingAlgorithmSetting_Algorithm as Algorithm,+ MaskingAlgorithmSetting_Algorithm_InnerOuterMask_MaskType,+} from "@/types/proto/v1/setting_service";import { hasWorkspacePermissionV2 } from "@/utils";import MaskingAlgorithmsCreateDrawer from "./components/MaskingAlgorithmsCreateDrawer.vue";import MaskingAlgorithmsTable from "./components/MaskingAlgorithmsTable.vue";@@ -63,6 +80,7 @@ interface LocalState {showCreateDrawer: boolean;pendingEditData: Algorithm;processing: boolean;+ showExampleModal: boolean;}const state = reactive<LocalState>({@@ -71,6 +89,7 @@ const state = reactive<LocalState>({id: uuidv4(),}),processing: false,+ showExampleModal: false,});const { t } = useI18n();@@ -188,4 +207,66 @@ const onFileSelect = async (file: File) => {};fr.readAsText(file);};++const example: Algorithm[] = [+ {+ id: "5d625aee-2628-4515-a4b6-6c494499a829",+ title: "Full mask",+ description: "Use substitution to replace the full data.",+ category: "MASK",+ fullMask: {+ substitution: "****",+ },+ },+ {+ id: "240ea8b6-0dd1-409f-abd3-380a35e4f52b",+ title: "Range mask",+ description: "Use substitution to replace the range data.",+ category: "MASK",+ rangeMask: {+ slices: [+ {+ start: 1,+ end: 2,+ substitution: "****",+ },+ ],+ },+ },+ {+ id: "d530cb90-45d6-4916-99ef-c6dde5b88651",+ title: "MD5 hash",+ description: "Hasing the full data with the salt.",+ category: "HASH",+ md5Mask: {+ salt: "the hash salt",+ },+ },+ {+ id: "d8faf746-7d4a-4291-8e66-dbe547a7f7fc",+ title: "Inner mask",+ description:+ "Masking the interior of its string argument, leaving the ends unmasked. Other arguments specify the sizes of the unmasked ends.",+ category: "MASK",+ innerOuterMask: {+ prefixLen: 1,+ suffixLen: 2,+ substitution: "***",+ type: MaskingAlgorithmSetting_Algorithm_InnerOuterMask_MaskType.INNER,+ },+ },+ {+ id: "112f49cf-1347-4834-ab8a-fe7db5ed1dba",+ title: "Outer mask",+ description:+ "Masking the ends of its string argument, leaving the interior unmasked. Other arguments specify the sizes of the masked ends.",+ category: "MASK",+ innerOuterMask: {+ prefixLen: 1,+ suffixLen: 2,+ substitution: "***",+ type: MaskingAlgorithmSetting_Algorithm_InnerOuterMask_MaskType.OUTER,+ },+ },+];</script>diff --git a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue b/frontend/src/components/SensitiveData/components/DataExampleModal.vuesimilarity index 52%rename from frontend/src/components/SensitiveData/components/ClassificationExampleModal.vuerename to frontend/src/components/SensitiveData/components/DataExampleModal.vueindex ed926647be..640f98ab32 100644--- a/frontend/src/components/SensitiveData/components/ClassificationExampleModal.vue+++ b/frontend/src/components/SensitiveData/components/DataExampleModal.vue@@ -3,7 +3,7 @@:close-on-esc="true":mask-closable="true":trap-focus="false"- :title="$t('settings.sensitive-data.classification.json-format-example')"+ :title="$t('settings.sensitive-data.json-format-example')"class="w-[48rem] max-w-full"@close="$emit('dismiss')">@@ -16,7 +16,7 @@<heroicons-outline:clipboard-document class="w-4 h-4" /></div><NConfigProvider :hljs="hljs">- <NCode language="json" :code="JSON.stringify(example, null, 2)" />+ <NCode language="json" :code="example" /></NConfigProvider></div></BBModal>@@ -29,76 +29,21 @@ import { NCode, NConfigProvider } from "naive-ui";import { useI18n } from "vue-i18n";import { pushNotification } from "@/store";+const props = defineProps<{+ example: string;+}>();+defineEmits<{(event: "dismiss"): void;}>();-// TODO: localization.-const example = {- title: "Classification Example",- levels: [- {- id: "1",- title: "Level 1",- description: "",- },- {- id: "2",- title: "Level 2",- description: "",- },- ],- classifications: [- {- id: "1",- title: "Basic",- description: "",- },- {- id: "1-1",- title: "Basic",- description: "",- },- {- id: "1-2",- title: "Assert",- description: "",- },- {- id: "1-3",- title: "Contact",- description: "",- },- {- id: "1-4",- title: "Health",- description: "",- },- {- id: "2",- title: "Relationship",- description: "",- },- {- id: "2-1",- title: "Social",- description: "",- },- {- id: "2-2",- title: "Business",- description: "",- },- ],-};-const { copy: copyTextToClipboard, isSupported } = useClipboard({legacy: true,});const { t } = useI18n();const handleCopy = () => {- copyTextToClipboard(JSON.stringify(example, null, 2)).then(() => {+ copyTextToClipboard(props.example).then(() => {pushNotification({module: "bytebase",style: "SUCCESS",diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 0492251be6..fe63f216e4 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -274,8 +274,7 @@"project-member": "Project member","leave-without-saving": "Leave without saving?","configure-now": "Configure now",- "connection": "Connection",- "permission-denied": "Permission denied"+ "connection": "Connection"},"error-page": {"go-back-home": "Go back home"@@ -762,7 +761,8 @@},"algorithms": {"self": "Masking Algorithm",- "upload": "Upload Algorithm",+ "upload": "Upload algorithm",+ "upload-label": "You can upload algorithm file with JSON format.","override-title": "Algorithm data override","override-desc": "Existed algorithms will be overridden, you have to re-configure the algorithm for semantic types.","override-confirm": "Still upload",@@ -835,14 +835,14 @@"upload": "Upload classification","upload-succeed": "Upload succeed","search": "Search classification",- "label": "You can upload classification file with JSON format.",- "view-example": "View example",- "json-format-example": "Classification JSON format example",+ "upload-label": "You can upload classification file with JSON format.","copy-succeed": "Copy example succeed","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"},"release": {"new-version-available": "New version is available",@@ -1222,9 +1222,6 @@},"affected-rows-n": "Affected rows: {n}"}- },- "sql-review": {- "statement-type": "Statement type"}},"alter-schema": {@@ -3318,10 +3315,6 @@"self": "Export Center","permission-denied": "Permission denied"},- "review-center": {- "self": "Review Center",- "review-sql": "Review SQL"- },"schema-designer": {"self": "Schema Designer","schema-design": "Schema Design",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex f072b14833..7c638ad8e6 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -274,8 +274,7 @@"project-member": "Miembro del proyecto","leave-without-saving": "¿Salir sin ahorrar?","configure-now": "Configurar ahora",- "connection": "Conexión",- "permission-denied": "Permiso denegado"+ "connection": "Conexión"},"error-page": {"go-back-home": "Volver al inicio"@@ -763,6 +762,7 @@"algorithms": {"self": "Algoritmo De Enmascaramiento","upload": "Subir algoritmo",+ "upload-label": "Puede cargar un archivo de algoritmo con formato JSON.","override-title": "Anulación de datos de algoritmo","override-desc": "Los algoritmos existentes se anularán; deberá volver a configurar el algoritmo para tipos semánticos.","override-confirm": "Aún subiendo",@@ -835,14 +835,14 @@"upload": "Subir clasificación","upload-succeed": "Subida exitosa","search": "Clasificación de búsqueda",- "label": "Puede cargar un archivo de clasificación con formato JSON.",- "view-example": "Ver ejemplo",- "json-format-example": "Ejemplo de formato JSON de clasificación",+ "upload-label": "Puede cargar un archivo de clasificación con formato JSON.","copy-succeed": "Copiar ejemplo correctamente","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"},"release": {"new-version-available": "Nueva versión disponible",@@ -1222,9 +1222,6 @@},"affected-rows-n": "Filas afectadas: {n}"}- },- "sql-review": {- "statement-type": "Tipo de declaración"}},"alter-schema": {@@ -3318,10 +3315,6 @@"self": "centro de exportacion","permission-denied": "Permiso denegado"},- "review-center": {- "self": "Centro de revisión",- "review-sql": "Revisar SQL"- },"schema-designer": {"self": "Diseñador de esquemas","schema-design": "Esquema diseñar",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 6044576993..de74c4a1a4 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -274,8 +274,7 @@"project-member": "プロジェクトメンバー","leave-without-saving": "変更を保存していませんか?","configure-now": "今すぐ設定する",- "connection": "接続する",- "permission-denied": "許可が拒否されました"+ "connection": "接続する"},"error-page": {"go-back-home": "ホームページに戻る"@@ -763,6 +762,7 @@"algorithms": {"self": "減感アルゴリズム","upload": "インポートアルゴリズム",+ "upload-label": "アルゴリズム ファイルを JSON 形式でアップロードできます。","override-title": "カバーアルゴリズムデータ","override-desc": "既存のアルゴリズムは上書きされるため、セマンティック タイプに合わせてアルゴリズムを再構成する必要があります。","override-confirm": "インポートを続行する",@@ -835,14 +835,14 @@"upload": "輸入分類と格付け","upload-succeed": "インポート成功","search": "検索分類の評価",- "label": "データを分類・分類したJSON形式ファイルをアップロードできます。",- "view-example": "サンプルを見る",- "json-format-example": "分類と格付けの JSON 形式の例",+ "upload-label": "データを分類・分類したJSON形式ファイルをアップロードできます。","copy-succeed": "サンプルをコピーしました","override-title": "カバレッジの分類および等級付けされたデータ","override-desc": "既存の分類およびグレーディング データは上書きされ、関連するすべてのプロジェクトが影響を受けます。","override-confirm": "インポートを続行する"- }+ },+ "json-format-example": "JSON形式の例",+ "view-example": "サンプルを見る"},"release": {"new-version-available": "更新する新しいバージョンがあります",@@ -1222,9 +1222,6 @@},"affected-rows-n": "影響を受ける行: {n}"}- },- "sql-review": {- "statement-type": "ステートメントタイプ"}},"alter-schema": {@@ -3318,10 +3315,6 @@"self": "輸出センター","permission-denied": "この操作を実行する権限がありません"},- "review-center": {- "self": "レビューセンター",- "review-sql": "SQLを確認する"- },"schema-designer": {"self": "スキーマデザイナー","schema-design": "スキーマ設計",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 0fd3ff2233..d57a5e3715 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -274,8 +274,7 @@"project-member": "项目成员","leave-without-saving": "不保存变动?","configure-now": "现在配置",- "connection": "连接",- "permission-denied": "没有权限"+ "connection": "连接"},"error-page": {"go-back-home": "回到主页"@@ -763,6 +762,7 @@"algorithms": {"self": "脱敏算法","upload": "导入算法",+ "upload-label": "您可以上传 JSON 格式的算法文件。","override-title": "覆盖算法数据","override-desc": "现有的算法将被覆盖,您必须重新配置语义类型的算法。","override-confirm": "继续导入",@@ -835,14 +835,14 @@"upload": "导入分类分级","upload-succeed": "导入成功","search": "搜索分类分级",- "label": "您可以上传数据分类分级的 JSON 格式文件。",- "view-example": "查看样例",- "json-format-example": "分类分级 JSON 格式样例",+ "upload-label": "您可以上传数据分类分级的 JSON 格式文件。","copy-succeed": "样例已复制","override-title": "覆盖分类分级数据","override-desc": "已有的分类分级数据将会被覆盖,涉及到的项目都会受到影响。","override-confirm": "继续导入"- }+ },+ "json-format-example": "JSON 格式样例",+ "view-example": "查看样例"},"release": {"new-version-available": "有新版本可更新",@@ -1222,9 +1222,6 @@},"affected-rows-n": "影响行数:{n}"}- },- "sql-review": {- "statement-type": "语句类型"}},"alter-schema": {@@ -3318,10 +3315,6 @@"self": "导出中心","permission-denied": "您没有权限执行此操作"},- "review-center": {- "self": "SQL 审核中心",- "review-sql": "审核 SQL"- },"schema-designer": {"self": "Schema 设计器","schema-design": "Schema 设计",