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 data masking ui (#14892)
ecmadaodb84c8d41dc5
diff --git a/frontend/src/components/ColumnDataTable/ClassificationCell.vue b/frontend/src/components/ColumnDataTable/ClassificationCell.vueindex b74d2fe9de..8d21474e25 100644--- a/frontend/src/components/ColumnDataTable/ClassificationCell.vue+++ b/frontend/src/components/ColumnDataTable/ClassificationCell.vue@@ -1,5 +1,5 @@<template>- <div class="flex flex-row items-center">+ <div class="flex items-center gap-x-1"><ClassificationLevelBadge:classification="classification":classification-config="classificationConfig"diff --git a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue b/frontend/src/components/ColumnDataTable/SemanticTypeCell.vueindex e3c2cd355c..da2ee96b92 100644--- a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue+++ b/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue@@ -1,20 +1,16 @@<template>- <div class="flex items-center">- {{ semanticType?.title }}- <button+ <div class="flex items-center gap-x-1">+ <span v-if="semanticType?.title">{{ semanticType?.title }}</span>+ <span v-else class="text-control-placeholder italic"> N/A </span>+ <MiniActionButtonv-if="!readonly && semanticType"- class="w-5 h-5 p-0.5 hover:bg-gray-300 rounded cursor-pointer"- @click.prevent="onSemanticTypeApply('')"+ @click.prevent="() => onSemanticTypeApply('')">- <heroicons-outline:x class="w-4 h-4" />- </button>- <button- v-if="!readonly"- class="w-5 h-5 p-0.5 hover:bg-gray-300 rounded cursor-pointer"- @click.prevent="openSemanticTypeDrawer()"- >- <heroicons-outline:pencil class="w-4 h-4" />- </button>+ <XIcon class="w-3 h-3" />+ </MiniActionButton>+ <MiniActionButton v-if="!readonly" @click.prevent="openSemanticTypeDrawer">+ <PencilIcon class="w-3 h-3" />+ </MiniActionButton></div><FeatureModal@@ -34,9 +30,10 @@</template><script lang="ts" setup>-import { computed } from "vue";-import { reactive } from "vue";+import { PencilIcon, XIcon } from "lucide-vue-next";+import { computed, reactive } from "vue";import { useSemanticType } from "@/components/SensitiveData/useSemanticType";+import { MiniActionButton } from "@/components/v2";import { useSubscriptionV1Store } from "@/store";import type { ComposedDatabase } from "@/types";import FeatureModal from "../FeatureGuard/FeatureModal.vue";diff --git a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vueindex 56bd800e3b..e03854c3e7 100644--- a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue+++ b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue@@ -48,7 +48,7 @@:show-operation="hasPermission && hasSensitiveDataFeature":column-list="filteredColumnList":checked-column-index-list="checkedColumnIndexList"- @click="onRowClick"+ @delete="onColumnRemove"@checked:update="updateCheckedColumnList($event)"/>@@ -106,7 +106,6 @@import { ShieldCheckIcon } from "lucide-vue-next";import { NButton } from "naive-ui";import { computed, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";import { updateColumnConfig } from "@/components/ColumnDataTable/utils";import {FeatureModal,@@ -121,7 +120,6 @@ import { isCurrentColumnException } from "@/components/SensitiveData/utils";import { SearchBox } from "@/components/v2";import {featureToRef,- pushNotification,usePolicyV1Store,useSubscriptionV1Store,useDatabaseCatalog,@@ -163,7 +161,6 @@ const hasPermission = computed(() => {);});-const { t } = useI18n();const policyStore = usePolicyV1Store();const subscriptionStore = useSubscriptionV1Store();@@ -225,7 +222,10 @@ const removeSensitiveColumn = async (sensitiveColumn: MaskData) => {schema: sensitiveColumn.schema,table: sensitiveColumn.table,column: sensitiveColumn.column,- columnCatalog: {},+ columnCatalog: {+ classificationId: "",+ semanticTypeId: "",+ },});await removeMaskingExceptions(sensitiveColumn);};@@ -261,31 +261,6 @@ const removeMaskingExceptions = async (sensitiveColumn: MaskData) => {const onColumnRemove = async (column: MaskData) => {await removeSensitiveColumn(column);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });-};--const onRowClick = async (- item: MaskData,- row: number,- action: "VIEW" | "DELETE" | "EDIT"-) => {- switch (action) {- case "DELETE":- await onColumnRemove(item);- break;- case "EDIT":- state.pendingGrantAccessColumn = [item];- if (isMissingLicenseForInstance.value) {- state.showFeatureModal = true;- return;- }- state.showSensitiveColumnDrawer = true;- break;- }};const onGrantAccessButtonClick = () => {diff --git a/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue b/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vueindex 44b4d2de7a..bc4e9028d8 100644--- a/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue+++ b/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue@@ -1,6 +1,11 @@<template><NPerformantEllipsis v-if="showText" :line-clamp="1">- {{ columnClassification?.title || classification || placeholder }}+ <span v-if="columnClassification">+ {{ columnClassification.title }}+ </span>+ <span v-else class="text-control-placeholder italic">+ {{ placeholder }}+ </span></NPerformantEllipsis><span v-if="level" :class="['ml-1 px-1 py-0.5 rounded text-xs', levelColor]">{{ level.title }}@@ -23,7 +28,7 @@ const props = withDefaults(showText: true,classification: undefined,classificationConfig: undefined,- placeholder: undefined,+ placeholder: "N/A",});diff --git a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vueindex 0ebd19c8c0..26185f97ba 100644--- a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue+++ b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue@@ -1,11 +1,5 @@<template><div class="w-full space-y-4">- <div class="textinfolabel">- {{ $t("settings.sensitive-data.global-rules.description") }}- <LearnMoreLink- url="https://www.bytebase.com/docs/security/mask-data?source=console"- />- </div><div class="flex flex-row items-center justify-end"><div v-if="state.reorderRules" class="flex items-center gap-x-2"><NButton@@ -56,6 +50,12 @@</NButton></div></div>+ <div class="textinfolabel">+ {{ $t("settings.sensitive-data.global-rules.description") }}+ <LearnMoreLink+ url="https://www.bytebase.com/docs/security/mask-data?source=console"+ />+ </div><NoDataPlaceholder v-if="state.maskingRuleItemList.length === 0" /><divv-for="(item, index) in state.maskingRuleItemList"diff --git a/frontend/src/components/SensitiveData/SemanticTypesView.vue b/frontend/src/components/SensitiveData/SemanticTypesView.vueindex f7982f7de5..18afb16a73 100644--- a/frontend/src/components/SensitiveData/SemanticTypesView.vue+++ b/frontend/src/components/SensitiveData/SemanticTypesView.vue@@ -1,8 +1,5 @@<template><div class="w-full space-y-4">- <div class="textinfolabel">- {{ $t("settings.sensitive-data.semantic-types.label") }}- </div><div class="flex items-center justify-end space-x-2"><NButton:disabled="!hasPermission || !hasSensitiveDataFeature"@@ -21,6 +18,9 @@{{ $t("common.add") }}</NButton></div>+ <div class="textinfolabel">+ {{ $t("settings.sensitive-data.semantic-types.label") }}+ </div><SemanticTypesTablev-if="state.semanticItemList.length > 0":readonly="!hasPermission || !hasSensitiveDataFeature"diff --git a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vueindex 56cc525281..f6d72d1efa 100644--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue+++ b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue@@ -3,7 +3,6 @@key="sensitive-column-table":columns="dataTableColumns":data="columnList"- :row-props="rowProps":row-key="itemKey":checked-row-keys="checkedItemKeys"size="small"@@ -12,13 +11,14 @@</template><script lang="tsx" setup>-import { TrashIcon, PencilIcon } from "lucide-vue-next";+import { TrashIcon } from "lucide-vue-next";import { NDataTable, NPopconfirm, type DataTableColumn } from "naive-ui";import { computed, h, ref, watch } from "vue";import { withModifiers } from "vue";import { useI18n } from "vue-i18n";import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";import SemanticTypeCell from "@/components/ColumnDataTable/SemanticTypeCell.vue";+import { updateColumnConfig } from "@/components/ColumnDataTable/utils";import type { MaskData } from "@/components/SensitiveData/types";import { MiniActionButton } from "@/components/v2";import {@@ -39,12 +39,7 @@ const props = defineProps<{}>();const emit = defineEmits<{- (- event: "click",- item: MaskData,- row: number,- action: "VIEW" | "DELETE" | "EDIT"- ): void;+ (event: "delete", item: MaskData): void;(event: "checked:update", list: number[]): void;}>();@@ -110,7 +105,6 @@ const dataTableColumns = computed(() => {schema={item.schema}table={item.table}column={item.column}- readonly={true}/>);},@@ -132,7 +126,7 @@ const dataTableColumns = computed(() => {<ClassificationCellclassification={columnCatalog.classificationId}classificationConfig={classificationConfig.value}- readonly={true}+ onApply={(id: string) => onClassificationIdApply(item, id)}/>);},@@ -159,23 +153,12 @@ const dataTableColumns = computed(() => {key: "operation",title: t("common.operation"),width: "6rem",- render(item, index) {- const editButton = h(- MiniActionButton,- {- onClick: withModifiers(() => {- emit("click", item, index, "EDIT");- }, ["prevent", "stop"]),- },- {- default: () => h(PencilIcon, { class: "w-4 h-4" }),- }- );- const deleteButton = h(+ render(item) {+ return h(NPopconfirm,{onPositiveClick: () => {- emit("click", item, index, "DELETE");+ emit("delete", item);},},{@@ -201,7 +184,6 @@ const dataTableColumns = computed(() => {),});- return [editButton, deleteButton];},});}@@ -221,6 +203,19 @@ const dataTableColumns = computed(() => {return columns;});+const onClassificationIdApply = async (+ item: MaskData,+ classificationId: string+) => {+ await updateColumnConfig({+ database: props.database.name,+ schema: item.schema,+ table: item.table,+ column: item.column,+ columnCatalog: { classificationId },+ });+};+const handleUpdateCheckedRowKeys = (keys: string[]) => {const keysSet = new Set(keys);const checkedIndexList: number[] = [];@@ -232,13 +227,4 @@ const handleUpdateCheckedRowKeys = (keys: string[]) => {});emit("checked:update", checkedIndexList);};--const rowProps = (item: MaskData, index: number) => {- return {- style: props.rowClickable ? "cursor: pointer;" : "",- onClick: () => {- emit("click", item, index, "VIEW");- },- };-};</script>diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 3cad7aec93..a37fc57246 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -817,7 +817,7 @@"never-expires": "Never expires","global-rules": {"self": "Global Masking Rule",- "description": "Use global rule to apply masking levels in batch, e.g. all columns named as \"email\" will be masked with \"Partial\" level.",+ "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 appy the masking algorithm.","condition-order": "Condition order","re-order": "Re-order","delete-rule-tip": "Delete this rule?",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 76fccfb759..8b856c8c9b 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -817,7 +817,7 @@"never-expires": "Nunca expira","global-rules": {"self": "Regla de enmascaramiento global",- "description": "Utilice la regla global para aplicar niveles de enmascaramiento por lotes, p. Todas las columnas denominadas \"correo electrónico\" se enmascararán con el nivel \"Parcial\".",+ "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?",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex c1cf801bb2..be8d73fd22 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -817,7 +817,7 @@"never-expires": "有効期限なし","global-rules": {"self": "グローバルマスキングルール",- "description": "たとえば、列名が email のすべてのフィールドは、部分マスクに設定されます。",+ "description": "グローバル ルールを使用してバッチでマスキングを適用します。たとえば、「email」という名前のすべての列は特定のセマンティック タイプでマスキングされ、マスキング アルゴリズムが適用されます。","condition-order": "条件付きシーケンス","re-order": "並び替え","delete-rule-tip": "このルールを削除しますか?",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 38661a9e51..a3ef2a4d28 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -817,7 +817,7 @@"never-expires": "无过期时间","global-rules": {"self": "全局脱敏规则",- "description": "全局规则用于批量指定脱敏程度,比如所有列名是 email 的字段都被设置为半脱敏。",+ "description": "使用全局规则批量应用屏蔽,例如所有名为“电子邮件”的列将使用特定的语义类型进行屏蔽并应用屏蔽算法。","condition-order": "条件序列","re-order": "排序","delete-rule-tip": "删除这条规则?",diff --git a/frontend/src/router/dashboard/workspace.ts b/frontend/src/router/dashboard/workspace.tsindex 8086c16a61..dc5f3419dc 100644--- a/frontend/src/router/dashboard/workspace.ts+++ b/frontend/src/router/dashboard/workspace.ts@@ -16,6 +16,7 @@ import {WORKSPACE_ROUTE_CUSTOM_APPROVAL,WORKSPACE_ROUTE_RISK_CENTER,WORKSPACE_ROUTE_DATA_MASKING,+ WORKSPACE_ROUTE_SEMANTIC_TYPES,WORKSPACE_ROUTE_DATA_CLASSIFICATION,WORKSPACE_ROUTE_AUDIT_LOG,WORKSPACE_ROUTE_GITOPS,@@ -319,6 +320,16 @@ const workspaceRoutes: RouteRecordRaw[] = [component: () => import("@/views/SettingWorkspaceDataMasking.vue"),props: true,},+ {+ path: "semantic-types",+ name: WORKSPACE_ROUTE_SEMANTIC_TYPES,+ meta: {+ title: () => t("settings.sensitive-data.semantic-types.self"),+ requiredWorkspacePermissionList: () => ["bb.policies.get"],+ },+ component: () => import("@/views/SettingWorkspaceSemanticTypes.vue"),+ props: true,+ },{path: "data-classification",name: WORKSPACE_ROUTE_DATA_CLASSIFICATION,diff --git a/frontend/src/router/dashboard/workspaceRoutes.ts b/frontend/src/router/dashboard/workspaceRoutes.tsindex f7c3d4e257..0a9e53ff35 100644--- a/frontend/src/router/dashboard/workspaceRoutes.ts+++ b/frontend/src/router/dashboard/workspaceRoutes.ts@@ -17,6 +17,7 @@ export const WORKSPACE_ROUTE_SCHEMA_TEMPLATE = "workspace.schema-template";export const WORKSPACE_ROUTE_CUSTOM_APPROVAL = "workspace.custom-approval";export const WORKSPACE_ROUTE_RISK_CENTER = "workspace.risk-center";export const WORKSPACE_ROUTE_DATA_MASKING = "workspace.data-masking";+export const WORKSPACE_ROUTE_SEMANTIC_TYPES = "workspace.semantic-types";export const WORKSPACE_ROUTE_DATA_CLASSIFICATION ="workspace.data-classification";export const WORKSPACE_ROUTE_AUDIT_LOG = "workspace.audit-log";diff --git a/frontend/src/utils/useDashboardSidebar.ts b/frontend/src/utils/useDashboardSidebar.tsindex 002a1e71a3..353cae1694 100644--- a/frontend/src/utils/useDashboardSidebar.ts+++ b/frontend/src/utils/useDashboardSidebar.ts@@ -27,6 +27,7 @@ import {WORKSPACE_ROUTE_CUSTOM_APPROVAL,WORKSPACE_ROUTE_RISK_CENTER,WORKSPACE_ROUTE_DATA_MASKING,+ WORKSPACE_ROUTE_SEMANTIC_TYPES,WORKSPACE_ROUTE_DATA_CLASSIFICATION,WORKSPACE_ROUTE_AUDIT_LOG,WORKSPACE_ROUTE_GITOPS,@@ -273,6 +274,11 @@ export const useDashboardSidebar = () => {name: WORKSPACE_ROUTE_DATA_MASKING,type: "route",},+ {+ title: t("settings.sensitive-data.semantic-types.self"),+ name: WORKSPACE_ROUTE_SEMANTIC_TYPES,+ type: "route",+ },],},{diff --git a/frontend/src/views/SettingWorkspaceDataMasking.vue b/frontend/src/views/SettingWorkspaceDataMasking.vueindex c3a1edfbec..816abcfdcd 100644--- a/frontend/src/views/SettingWorkspaceDataMasking.vue+++ b/frontend/src/views/SettingWorkspaceDataMasking.vue@@ -4,75 +4,18 @@v-if="!hasSensitiveDataFeature"feature="bb.feature.sensitive-data"/>- <NTabs v-model:value="state.selectedTab" type="line">- <NTabPane- name="global-masking-rule"- :tab="$t('settings.sensitive-data.global-rules.self')"- >- <GlobalMaskingRulesView :embedded="embedded" />- </NTabPane>- <NTabPane- name="semantic-types"- :tab="$t('settings.sensitive-data.semantic-types.self')"- >- <SemanticTypesView />- </NTabPane>- </NTabs>+ <GlobalMaskingRulesView :embedded="embedded" /></div></template><script lang="ts" setup>-import { NTabs, NTabPane } from "naive-ui";-import { reactive, watch } from "vue";-import { useRouter, useRoute } from "vue-router";import { FeatureAttention } from "@/components/FeatureGuard";-import {- GlobalMaskingRulesView,- SemanticTypesView,-} from "@/components/SensitiveData";+import { GlobalMaskingRulesView } from "@/components/SensitiveData";import { featureToRef } from "@/store";-const dataMaskingTabList = ["global-masking-rule", "semantic-types"] as const;-type DataMaskingTab = (typeof dataMaskingTabList)[number];-const isDataMaskingTab = (tab: any): tab is DataMaskingTab =>- dataMaskingTabList.includes(tab);--interface LocalState {- selectedTab: DataMaskingTab;-}-defineProps<{embedded?: boolean;}>();-const defaultTab: DataMaskingTab = "global-masking-rule";--const state = reactive<LocalState>({- selectedTab: defaultTab,-});const hasSensitiveDataFeature = featureToRef("bb.feature.sensitive-data");-const router = useRouter();-const route = useRoute();--watch(- () => route.hash,- (hash) => {- const tab = hash.slice(1);- if (isDataMaskingTab(tab)) {- state.selectedTab = tab;- } else {- state.selectedTab = defaultTab;- }- },- {- immediate: true,- }-);--watch(- () => state.selectedTab,- (tab) => {- router.push({ hash: `#${tab}` });- }-);</script>diff --git a/frontend/src/views/SettingWorkspaceSemanticTypes.vue b/frontend/src/views/SettingWorkspaceSemanticTypes.vuenew file mode 100644index 0000000000..b5c8d0b880--- /dev/null+++ b/frontend/src/views/SettingWorkspaceSemanticTypes.vue@@ -0,0 +1,17 @@+<template>+ <div class="w-full space-y-4">+ <FeatureAttention+ v-if="!hasSensitiveDataFeature"+ feature="bb.feature.sensitive-data"+ />+ <SemanticTypesView />+ </div>+</template>++<script lang="tsx" setup>+import { FeatureAttention } from "@/components/FeatureGuard";+import { SemanticTypesView } from "@/components/SensitiveData";+import { featureToRef } from "@/store";++const hasSensitiveDataFeature = featureToRef("bb.feature.sensitive-data");+</script>