Skip to content

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

chore: configure the semantic type in frontend (#8303)

ecmadaob8bba92120c2
diff --git a/backend/store/setting.go b/backend/store/setting.go
index 6d1eef33bf..e1c60b5fcd 100644
--- a/backend/store/setting.go
+++ b/backend/store/setting.go
@@ -42,7 +42,16 @@ var (
// Currently, we do not persist the algorithm setting, in order to use it conveniently, we hard code it here.
// TODO(zp): remove the following hard code when we persist the algorithm setting.
mockAlgorithmSetting = &v1pb.MaskingAlgorithmSetting{
- Algorithms: []*v1pb.MaskingAlgorithmSetting_MaskingAlgorithm{},
+ Algorithms: []*v1pb.MaskingAlgorithmSetting_MaskingAlgorithm{
+ {
+ Id: "substitution",
+ Title: "Substitution algorithm",
+ },
+ {
+ Id: "hash-md5",
+ Title: "MD5 encryption",
+ },
+ },
}
)
diff --git a/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue b/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue
index 0cc1310b78..fc4bd2e019 100644
--- a/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue
+++ b/frontend/src/components/SchemaTemplate/ClassificationLevelBadge.vue
@@ -10,8 +10,8 @@ import { computed } from "vue";
import { DataClassificationSetting_DataClassificationConfig } from "@/types/proto/v1/setting_service";
const props = defineProps<{
- classification: string;
- classificationConfig: DataClassificationSetting_DataClassificationConfig;
+ classification?: string;
+ classificationConfig?: DataClassificationSetting_DataClassificationConfig;
}>();
const bgColorList = [
diff --git a/frontend/src/components/SensitiveData/DataFeatureView.vue b/frontend/src/components/SensitiveData/DataFeatureView.vue
deleted file mode 100644
index 5f35d90339..0000000000
--- a/frontend/src/components/SensitiveData/DataFeatureView.vue
+++ /dev/null
@@ -1,4 +0,0 @@
-<template>
- <div class="w-full mt-4 space-y-4"></div>
-</template>
-<script lang="ts" setup></script>
diff --git a/frontend/src/components/SensitiveData/SemanticTypesView.vue b/frontend/src/components/SensitiveData/SemanticTypesView.vue
new file mode 100644
index 0000000000..fcc168f10b
--- /dev/null
+++ b/frontend/src/components/SensitiveData/SemanticTypesView.vue
@@ -0,0 +1,369 @@
+<template>
+ <div class="w-full mt-4 space-y-4">
+ <div class="flex items-center justify-end">
+ <NButton
+ type="primary"
+ :disabled="!hasPermission || !hasSensitiveDataFeature"
+ @click="onAdd"
+ >
+ {{ $t("settings.sensitive-data.semantic-types.add-type") }}
+ </NButton>
+ </div>
+ <div class="space-y-5 divide-y-2 pb-10 divide-gray-100">
+ <BBTable
+ ref="tableRef"
+ :column-list="tableHeaderList"
+ :data-source="state.semanticItemList"
+ :show-header="true"
+ :custom-header="true"
+ :left-bordered="true"
+ :right-bordered="true"
+ :top-bordered="true"
+ :bottom-bordered="true"
+ :compact-section="true"
+ :row-clickable="false"
+ >
+ <template #header>
+ <BBTableHeaderCell
+ v-for="header in tableHeaderList"
+ :key="header.title"
+ :title="header.title"
+ />
+ </template>
+ <template
+ #body="{ rowData, row }: { rowData: SemanticItem, row: number }"
+ >
+ <BBTableCell class="bb-grid-cell">
+ <h3 v-if="rowData.mode === 'NORMAL'">
+ {{ rowData.item.title }}
+ </h3>
+ <NInput
+ v-else
+ :value="rowData.item.title"
+ size="small"
+ type="text"
+ :placeholder="
+ $t('settings.sensitive-data.semantic-types.table.semantic-type')
+ "
+ @input="(val: string) => onInput(row, (data) => data.item.title = val)"
+ />
+ </BBTableCell>
+ <BBTableCell class="bb-grid-cell">
+ <h3 v-if="rowData.mode === 'NORMAL'">
+ {{ rowData.item.description }}
+ </h3>
+ <NInput
+ v-else
+ :value="rowData.item.description"
+ size="small"
+ type="text"
+ :placeholder="
+ $t('settings.sensitive-data.semantic-types.table.description')
+ "
+ @input="(val: string) => onInput(row, (data) => data.item.description = val)"
+ />
+ </BBTableCell>
+ <BBTableCell class="bb-grid-cell">
+ <h3 v-if="rowData.mode === 'NORMAL'">
+ {{ getAlgorithmById(rowData.item.fullMaskAlgorithmId)?.label }}
+ </h3>
+ <NSelect
+ v-else
+ :value="rowData.item.fullMaskAlgorithmId"
+ :options="algorithmList"
+ :consistent-menu-width="false"
+ :placeholder="
+ $t('custom-approval.security-rule.condition.select-value')
+ "
+ :disabled="!hasPermission || !hasSensitiveDataFeature"
+ size="small"
+ style="min-width: 7rem; width: auto; overflow-x: hidden"
+ @update:value="(val: string) => onInput(row, (data) => data.item.fullMaskAlgorithmId = val)"
+ />
+ </BBTableCell>
+ <BBTableCell class="bb-grid-cell">
+ <h3 v-if="rowData.mode === 'NORMAL'">
+ {{ getAlgorithmById(rowData.item.partialMaskAlgorithmId)?.label }}
+ </h3>
+ <NSelect
+ v-else
+ :value="rowData.item.partialMaskAlgorithmId"
+ :options="algorithmList"
+ :consistent-menu-width="false"
+ :placeholder="
+ $t('custom-approval.security-rule.condition.select-value')
+ "
+ :disabled="!hasPermission || !hasSensitiveDataFeature"
+ size="small"
+ style="min-width: 7rem; width: auto; overflow-x: hidden"
+ @update:value="(val: string) => onInput(row, (data) => data.item.partialMaskAlgorithmId = val)"
+ />
+ </BBTableCell>
+ <BBTableCell v-if="hasPermission" class="bb-grid-cell w-6">
+ <div class="flex justify-end items-center space-x-2">
+ <NPopconfirm
+ v-if="rowData.mode === 'EDIT'"
+ @positive-click="onRemove(row)"
+ >
+ <template #trigger>
+ <button
+ class="p-1 hover:bg-gray-300 rounded cursor-pointer disabled:cursor-not-allowed disabled:hover:bg-white disabled:text-gray-400"
+ :disabled="!hasPermission"
+ @click.stop=""
+ >
+ <heroicons-outline:trash class="w-4 h-4" />
+ </button>
+ </template>
+
+ <div class="whitespace-nowrap">
+ {{
+ $t("settings.sensitive-data.semantic-types.table.delete")
+ }}
+ </div>
+ </NPopconfirm>
+
+ <NButton
+ v-if="rowData.mode !== 'NORMAL'"
+ size="small"
+ @click="onCancel(row)"
+ >
+ {{ $t("common.cancel") }}
+ </NButton>
+ <NButton
+ v-if="rowData.mode !== 'NORMAL'"
+ type="primary"
+ :disabled="isConfirmDisabled(rowData) || !hasPermission"
+ size="small"
+ @click.stop="onConfirm(row)"
+ >
+ {{ $t("common.confirm") }}
+ </NButton>
+
+ <button
+ v-if="rowData.mode === 'NORMAL'"
+ class="p-1 hover:bg-gray-300 rounded cursor-pointer disabled:cursor-not-allowed disabled:hover:bg-white disabled:text-gray-400"
+ :disabled="!hasPermission"
+ @click.stop="rowData.mode = 'EDIT'"
+ >
+ <heroicons-outline:pencil class="w-4 h-4" />
+ </button>
+ </div>
+ </BBTableCell>
+ </template>
+ </BBTable>
+ </div>
+ </div>
+</template>
+<script lang="ts" setup>
+import { NPopconfirm, NButton, NSelect, NInput } from "naive-ui";
+import type { SelectOption } from "naive-ui";
+import { v4 as uuidv4 } from "uuid";
+import { computed, reactive, onMounted } from "vue";
+import { useI18n } from "vue-i18n";
+import type { BBTableColumn } from "@/bbkit/types";
+import {
+ featureToRef,
+ pushNotification,
+ useCurrentUserV1,
+ useSettingV1Store,
+} from "@/store";
+import { SemanticTypesSetting_SemanticType } from "@/types/proto/v1/setting_service";
+import { hasWorkspacePermissionV1 } from "@/utils";
+
+type SemanticItemMode = "NORMAL" | "CREATE" | "EDIT";
+
+interface SemanticItem {
+ mode: SemanticItemMode;
+ dirty: boolean;
+ item: SemanticTypesSetting_SemanticType;
+}
+
+interface LocalState {
+ semanticItemList: SemanticItem[];
+ processing: boolean;
+}
+
+const { t } = useI18n();
+const state = reactive<LocalState>({
+ semanticItemList: [],
+ processing: false,
+});
+
+const settingStore = useSettingV1Store();
+const currentUserV1 = useCurrentUserV1();
+const hasPermission = computed(() => {
+ return hasWorkspacePermissionV1(
+ "bb.permission.workspace.manage-sensitive-data",
+ currentUserV1.value.userRole
+ );
+});
+const hasSensitiveDataFeature = featureToRef("bb.feature.sensitive-data");
+
+const algorithmList = computed((): SelectOption[] => {
+ return (
+ settingStore.getSettingByName("bb.workspace.masking-algorithms")?.value
+ ?.maskingAlgorithmSettingValue?.algorithms ?? []
+ ).map((algorithm) => ({
+ label: algorithm.title,
+ value: algorithm.id,
+ }));
+});
+
+onMounted(async () => {
+ const semanticTypeSetting = await settingStore.getOrFetchSettingByName(
+ "bb.workspace.semantic-types",
+ true
+ );
+ state.semanticItemList = (
+ semanticTypeSetting?.value?.semanticTypesSettingValue?.types ?? []
+ ).map((semanticType) => {
+ return {
+ dirty: false,
+ item: semanticType,
+ mode: "NORMAL",
+ };
+ });
+});
+
+const tableHeaderList = computed(() => {
+ const list: BBTableColumn[] = [
+ {
+ title: t("settings.sensitive-data.semantic-types.table.semantic-type"),
+ },
+ {
+ title: t("settings.sensitive-data.semantic-types.table.description"),
+ },
+ {
+ title: t(
+ "settings.sensitive-data.semantic-types.table.full-masking-algorithm"
+ ),
+ },
+ {
+ title: t(
+ "settings.sensitive-data.semantic-types.table.partial-masking-algorithm"
+ ),
+ },
+ ];
+ if (hasPermission.value) {
+ // operation.
+ list.push({
+ title: "",
+ });
+ }
+ return list;
+});
+
+const getAlgorithmById = (algorithmId: string) => {
+ return algorithmList.value.find((a) => a.value === algorithmId);
+};
+
+const onAdd = () => {
+ const defaultAlgorithm =
+ algorithmList.value.length > 0 ? algorithmList.value[0].value : "";
+ state.semanticItemList.push({
+ mode: "CREATE",
+ dirty: false,
+ item: SemanticTypesSetting_SemanticType.fromJSON({
+ id: uuidv4(),
+ fullMaskAlgorithmId: defaultAlgorithm,
+ partialMaskAlgorithmId: defaultAlgorithm,
+ }),
+ });
+};
+
+const onRemove = async (index: number) => {
+ const item = state.semanticItemList[index];
+ if (!item) {
+ return;
+ }
+ state.semanticItemList.splice(index, 1);
+ if (item.mode === "CREATE") {
+ return;
+ }
+
+ await settingStore.upsertSetting({
+ name: "bb.workspace.semantic-types",
+ value: {
+ semanticTypesSettingValue: {
+ types: state.semanticItemList.map((data) => data.item),
+ },
+ },
+ });
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t("common.deleted"),
+ });
+};
+
+const onConfirm = async (index: number) => {
+ const item = state.semanticItemList[index];
+ state.semanticItemList[index] = {
+ ...item,
+ dirty: false,
+ mode: "NORMAL",
+ };
+
+ await settingStore.upsertSetting({
+ name: "bb.workspace.semantic-types",
+ value: {
+ semanticTypesSettingValue: {
+ types: state.semanticItemList.map((data) => data.item),
+ },
+ },
+ });
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: t(`common.${item.mode === "CREATE" ? "created" : "updated"}`),
+ });
+};
+
+const onCancel = (index: number) => {
+ const item = state.semanticItemList[index];
+
+ if (item.mode === "CREATE") {
+ state.semanticItemList.splice(index, 1);
+ } else {
+ const semanticTypeSetting = settingStore.getSettingByName(
+ "bb.workspace.semantic-types"
+ );
+ const origin = (
+ semanticTypeSetting?.value?.semanticTypesSettingValue?.types ?? []
+ ).find((s) => s.id === item.item.id);
+ if (!origin) {
+ return;
+ }
+ state.semanticItemList[index] = {
+ item: origin,
+ mode: "NORMAL",
+ dirty: false,
+ };
+ }
+};
+
+const onInput = (index: number, callback: (item: SemanticItem) => void) => {
+ const item = state.semanticItemList[index];
+ if (!item) {
+ return;
+ }
+ callback(item);
+ item.dirty = true;
+};
+
+const isConfirmDisabled = (data: SemanticItem): boolean => {
+ if (
+ !data.item.title ||
+ !data.item.fullMaskAlgorithmId ||
+ !data.item.partialMaskAlgorithmId
+ ) {
+ return true;
+ }
+ if (data.mode === "EDIT" && !data.dirty) {
+ return true;
+ }
+ return false;
+};
+</script>
diff --git a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
index 12759e54eb..fd65162cc0 100644
--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
+++ b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
@@ -141,7 +141,7 @@ const emit = defineEmits<{
event: "click",
item: SensitiveColumn,
row: number,
- action: "VIEW" | "DELETE" | "EDIT" | "SELECT"
+ action: "VIEW" | "DELETE" | "EDIT"
): void;
(event: "checked:update", list: number[]): void;
}>();
diff --git a/frontend/src/components/SensitiveData/index.ts b/frontend/src/components/SensitiveData/index.ts
index 34d522267e..ea29ef52db 100644
--- a/frontend/src/components/SensitiveData/index.ts
+++ b/frontend/src/components/SensitiveData/index.ts
@@ -1,5 +1,5 @@
-import DataFeatureView from "./DataFeatureView.vue";
import GlobalMaskingRulesView from "./GlobalMaskingRulesView.vue";
+import SemanticTypesView from "./SemanticTypesView.vue";
import SensitiveColumnView from "./SensitiveColumnView.vue";
-export { SensitiveColumnView, GlobalMaskingRulesView, DataFeatureView };
+export { SensitiveColumnView, GlobalMaskingRulesView, SemanticTypesView };
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 9243a8e52b..d3afb7abc1 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -626,10 +626,10 @@
"remove-sensitive-column-tips": "Expose this column?",
"sensitive-column-list": "Explict masked column list",
"global-masking-rule": "Global Masking Rule",
- "semantic-types": "Semantic Types",
"grant-access": "Grant Access",
"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.",
"condition-order": "Condition order",
"add-rule": "Add rule",
@@ -637,6 +637,17 @@
"delete-rule-tip": "Delete this rule?",
"check-rules": "Check global rules"
},
+ "semantic-types": {
+ "self": "Semantic Types",
+ "add-type": "Add type",
+ "table": {
+ "semantic-type": "Semantic type",
+ "description": "Description",
+ "full-masking-algorithm": "Full-masking algorithm",
+ "partial-masking-algorithm": "Partial-masking algorithm",
+ "delete": "Delete this semantic type?"
+ }
+ },
"column-detail": {
"masking-setting-for-column": "Masking Setting for \"{column}\"",
"access-user-list": "Access User List",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 98695d6050..12739d012d 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -625,10 +625,10 @@
"remove-sensitive-column-tips": "¿Exponer esta columna?",
"sensitive-column-list": "Lista de columnas enmascaradas explícitas",
"global-masking-rule": "Regla de enmascaramiento global",
- "semantic-types": "Tipos semánticos",
"grant-access": "Autorizará el acceso",
"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\".",
"condition-order": "Orden de condición",
"add-rule": "Agregar regla",
@@ -636,6 +636,17 @@
"delete-rule-tip": "¿Eliminar esta regla?",
"check-rules": "Check global rules"
},
+ "semantic-types": {
+ "self": "Tipos semánticos",
+ "add-type": "Agregar tipo",
+ "table": {
+ "semantic-type": "Tipo semántico",
+ "description": "Descripción",
+ "full-masking-algorithm": "Algoritmo de enmascaramiento completo",
+ "partial-masking-algorithm": "Algoritmo de enmascaramiento parcial",
+ "delete": "¿Eliminar este tipo semántico?"
+ }
+ },
"column-detail": {
"masking-setting-for-column": "Configuración de enmascaramiento para \"{columna}\"",
"access-user-list": "Acceder a la lista de usuarios",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index caf86c19b9..f645439dfc 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -624,10 +624,10 @@
"remove-sensitive-column-tips": "不再对此列数据脱敏?",
"sensitive-column-list": "被显式标记的脱敏列",
"global-masking-rule": "全局脱敏规则",
- "semantic-types": "语义类型",
"grant-access": "授权访问",
"never-expires": "无过期时间",
"global-rules": {
+ "self": "全局脱敏规则",
"description": "全局规则用于批量指定脱敏程度,比如所有列名是 email 的字段都被设置为半脱敏。",
"condition-order": "条件序列",
"add-rule": "添加规则",
@@ -635,6 +635,17 @@
"delete-rule-tip": "删除这条规则?",
"check-rules": "查看全局配置"
},
+ "semantic-types": {
+ "self": "语义类型",
+ "add-type": "新增类型",
+ "table": {
+ "semantic-type": "语义类型",
+ "description": "描述",
+ "full-masking-algorithm": "全脱敏算法",
+ "partial-masking-algorithm": "半脱敏算法",
+ "delete": "删除这个语义类型?"
+ }
+ },
"column-detail": {
"masking-setting-for-column": "\"{column}\" 脱敏设置",
"access-user-list": "用户访问列表",
diff --git a/frontend/src/store/modules/v1/setting.ts b/frontend/src/store/modules/v1/setting.ts
index c4476bd350..36031c99db 100644
--- a/frontend/src/store/modules/v1/setting.ts
+++ b/frontend/src/store/modules/v1/setting.ts
@@ -52,23 +52,25 @@ export const useSettingV1Store = defineStore("setting_v1", {
);
},
async fetchSettingByName(name: SettingName, silent = false) {
- const setting = await settingServiceClient.getSetting(
- {
- name: `${settingNamePrefix}${name}`,
- },
- {
- silent,
- }
- );
- this.settingMapByName.set(setting.name, setting);
- return setting;
+ try {
+ const setting = await settingServiceClient.getSetting(
+ {
+ name: `${settingNamePrefix}${name}`,
+ },
+ { silent }
+ );
+ this.settingMapByName.set(setting.name, setting);
+ return setting;
+ } catch {
+ return;
+ }
},
- getOrFetchSettingByName(name: SettingName) {
+ getOrFetchSettingByName(name: SettingName, silent = false) {
const setting = this.getSettingByName(name);
if (setting) {
return setting;
}
- return this.fetchSettingByName(name);
+ return this.fetchSettingByName(name, silent);
},
getSettingByName(name: SettingName) {
return this.settingMapByName.get(`${settingNamePrefix}${name}`);
diff --git a/frontend/src/types/setting.ts b/frontend/src/types/setting.ts
index 5601e87bc0..fab636ced7 100644
--- a/frontend/src/types/setting.ts
+++ b/frontend/src/types/setting.ts
@@ -10,6 +10,7 @@ export type SettingName =
| "bb.enterprise.trial"
| "bb.workspace.schema-template"
| "bb.workspace.data-classification"
- | "bb.workspace.semantic-category";
+ | "bb.workspace.semantic-types"
+ | "bb.workspace.masking-algorithms";
export const defaultTokenDurationInHours = 7 * 24;
diff --git a/frontend/src/views/SchemaTemplate/ColumnTypes.vue b/frontend/src/views/SchemaTemplate/ColumnTypes.vue
index e102c0abf0..298044dbe3 100644
--- a/frontend/src/views/SchemaTemplate/ColumnTypes.vue
+++ b/frontend/src/views/SchemaTemplate/ColumnTypes.vue
@@ -239,7 +239,7 @@ const getOrFetchSchemaTemplate = async () => {
"bb.workspace.schema-template"
);
const columnTypes =
- setting.value?.schemaTemplateSettingValue?.columnTypes || [];
+ setting?.value?.schemaTemplateSettingValue?.columnTypes || [];
const mysqlColumnTypes = columnTypes.find(
(item) => item.engine === Engine.MYSQL
);
@@ -248,7 +248,7 @@ const getOrFetchSchemaTemplate = async () => {
);
return {
fieldTemplates:
- setting.value?.schemaTemplateSettingValue?.fieldTemplates || [],
+ setting?.value?.schemaTemplateSettingValue?.fieldTemplates || [],
mysqlColumnTypes,
postgresqlColumnTypes,
};
@@ -349,27 +349,8 @@ const handleMySQLTypesChange = async () => {
}
}
- const setting = await settingStore.getOrFetchSettingByName(
- "bb.workspace.schema-template"
- );
- setting.value!.schemaTemplateSettingValue = SchemaTemplateSetting.fromPartial(
- {
- ...setting.value?.schemaTemplateSettingValue,
- columnTypes: uniqBy(
- [
- columnTypeTemplateForMySQL.value,
- ...(setting.value?.schemaTemplateSettingValue?.columnTypes || []),
- ],
- "engine"
- ),
- }
- );
- await settingStore.upsertSetting({
- name: "bb.workspace.schema-template",
- value: {
- schemaTemplateSettingValue: setting.value?.schemaTemplateSettingValue,
- },
- });
+ await upsertSchemaTemplateSetting(columnTypeTemplateForMySQL.value);
+
pushNotification({
module: "bytebase",
style: "SUCCESS",
@@ -445,31 +426,36 @@ const handlePostgreSQLTypesChange = async () => {
}
}
+ await upsertSchemaTemplateSetting(columnTypeTemplateForPostgreSQL.value);
+
+ pushNotification({
+ module: "bytebase",
+ style: "SUCCESS",
+ title: "Success to update column types",
+ });
+};
+
+const upsertSchemaTemplateSetting = async (
+ columnType: SchemaTemplateSetting_ColumnType
+) => {
const setting = await settingStore.getOrFetchSettingByName(
"bb.workspace.schema-template"
);
- setting.value!.schemaTemplateSettingValue = SchemaTemplateSetting.fromPartial(
- {
- ...setting.value?.schemaTemplateSettingValue,
- columnTypes: uniqBy(
- [
- columnTypeTemplateForPostgreSQL.value,
- ...(setting.value?.schemaTemplateSettingValue?.columnTypes || []),
- ],
- "engine"
- ),
- }
- );
+ const schemaTemplateSettingValue = SchemaTemplateSetting.fromPartial({
+ ...setting?.value?.schemaTemplateSettingValue,
+ columnTypes: uniqBy(
+ [
+ columnType,
+ ...(setting?.value?.schemaTemplateSettingValue?.columnTypes || []),
+ ],
+ "engine"
+ ),
+ });
await settingStore.upsertSetting({
name: "bb.workspace.schema-template",
value: {
- schemaTemplateSettingValue: setting.value?.schemaTemplateSettingValue,
+ schemaTemplateSettingValue,
},
});
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: "Success to update column types",
- });
};
</script>
diff --git a/frontend/src/views/SettingWorkspaceSensitiveData.vue b/frontend/src/views/SettingWorkspaceSensitiveData.vue
index e6fa7ce093..bf96393452 100644
--- a/frontend/src/views/SettingWorkspaceSensitiveData.vue
+++ b/frontend/src/views/SettingWorkspaceSensitiveData.vue
@@ -20,7 +20,7 @@
<GlobalMaskingRulesView />
</BBTabPanel>
<BBTabPanel :active="state.selectedIndex === 2">
- <DataFeatureView />
+ <SemanticTypesView />
</BBTabPanel>
</div>
</BBTab>
@@ -35,7 +35,7 @@ import type { BBTabItem } from "@/bbkit/types";
import {
SensitiveColumnView,
GlobalMaskingRulesView,
- DataFeatureView,
+ SemanticTypesView,
} from "@/components/SensitiveData";
import { featureToRef } from "@/store";
import { isDev } from "@/utils";
@@ -58,13 +58,13 @@ const tabItemList = computed((): BBTabItem[] => {
id: "sensitive-column-list",
},
{
- title: t("settings.sensitive-data.global-masking-rule"),
+ title: t("settings.sensitive-data.global-rules.self"),
id: "global-masking-rule",
},
];
if (isDev()) {
tabList.push({
- title: t("settings.sensitive-data.semantic-types"),
+ title: t("settings.sensitive-data.semantic-types.self"),
id: "semantic-types",
});
}