Skip to content

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

chore: catalog ui update (#14896)

ecmadao740657e10d60
diff --git a/frontend/src/components/ColumnDataTable/ClassificationCell.vue b/frontend/src/components/ColumnDataTable/ClassificationCell.vue
index 8d21474e25..1225fda2b3 100644
--- a/frontend/src/components/ColumnDataTable/ClassificationCell.vue
+++ b/frontend/src/components/ColumnDataTable/ClassificationCell.vue
@@ -5,12 +5,18 @@
:classification-config="classificationConfig"
/>
<template v-if="!readonly && !disabled">
- <MiniActionButton
- v-if="classification"
- @click.prevent="removeClassification"
- >
- <XIcon class="w-3 h-3" />
- </MiniActionButton>
+ <NPopconfirm v-if="classification" @positive-click="removeClassification">
+ <template #trigger>
+ <MiniActionButton>
+ <XIcon class="w-3 h-3" />
+ </MiniActionButton>
+ </template>
+ <template #default>
+ <div>
+ {{ $t("settings.sensitive-data.remove-classification-tips") }}
+ </div>
+ </template>
+ </NPopconfirm>
<MiniActionButton @click.prevent="openDrawer">
<PencilIcon class="w-3 h-3" />
</MiniActionButton>
@@ -27,6 +33,7 @@
<script lang="ts" setup>
import { PencilIcon, XIcon } from "lucide-vue-next";
+import { NPopconfirm } from "naive-ui";
import { ref } from "vue";
import ClassificationLevelBadge from "@/components/SchemaTemplate/ClassificationLevelBadge.vue";
import { MiniActionButton } from "@/components/v2";
diff --git a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue b/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue
index 5021e7d5e3..a645ce08e9 100644
--- a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue
+++ b/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue
@@ -2,12 +2,22 @@
<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>
- <MiniActionButton
+ <NPopconfirm
v-if="!readonly && semanticType"
- @click.prevent="() => onSemanticTypeApply('')"
+ @positive-click="() => onSemanticTypeApply('')"
>
- <XIcon class="w-3 h-3" />
- </MiniActionButton>
+ <template #trigger>
+ <MiniActionButton v-if="!readonly && semanticType">
+ <XIcon class="w-3 h-3" />
+ </MiniActionButton>
+ </template>
+
+ <template #default>
+ <div>
+ {{ $t("settings.sensitive-data.remove-semantic-type-tips") }}
+ </div>
+ </template>
+ </NPopconfirm>
<MiniActionButton v-if="!readonly" @click.prevent="openSemanticTypeDrawer">
<PencilIcon class="w-3 h-3" />
</MiniActionButton>
@@ -31,6 +41,7 @@
<script lang="ts" setup>
import { PencilIcon, XIcon } from "lucide-vue-next";
+import { NPopconfirm } from "naive-ui";
import { computed, reactive } from "vue";
import { useSemanticType } from "@/components/SensitiveData/useSemanticType";
import { MiniActionButton } from "@/components/v2";
@@ -92,6 +103,7 @@ const onSemanticTypeApply = async (semanticType: string) => {
table: props.table,
column: props.column,
columnCatalog: { semanticType },
+ notification: !semanticType ? "common.removed" : undefined,
});
};
</script>
diff --git a/frontend/src/components/ColumnDataTable/index.vue b/frontend/src/components/ColumnDataTable/index.vue
index b5b117be50..a148c0907c 100644
--- a/frontend/src/components/ColumnDataTable/index.vue
+++ b/frontend/src/components/ColumnDataTable/index.vue
@@ -280,6 +280,7 @@ const onClassificationIdApply = async (
table: props.table.name,
column,
columnCatalog: { classification },
+ notification: !classification ? "common.removed" : undefined,
});
};
</script>
diff --git a/frontend/src/components/ColumnDataTable/utils.ts b/frontend/src/components/ColumnDataTable/utils.ts
index fc03845b3a..d5664b0c1c 100644
--- a/frontend/src/components/ColumnDataTable/utils.ts
+++ b/frontend/src/components/ColumnDataTable/utils.ts
@@ -29,12 +29,14 @@ export const updateColumnConfig = async ({
table,
column,
columnCatalog,
+ notification = "common.updated",
}: {
database: string;
schema: string;
table: string;
column: string;
columnCatalog: Partial<ColumnCatalog>;
+ notification?: string;
}) => {
const dbCatalogStore = useDatabaseCatalogV1Store();
const catalog = await dbCatalogStore.getOrFetchDatabaseCatalog({ database });
@@ -69,16 +71,23 @@ export const updateColumnConfig = async ({
pushNotification({
module: "bytebase",
style: "SUCCESS",
- title: t("common.updated"),
+ title: t(notification),
});
};
-export const updateTableConfig = async (
- database: string,
- schema: string,
- table: string,
- tableCatalog: Partial<TableCatalog>
-) => {
+export const updateTableConfig = async ({
+ database,
+ schema,
+ table,
+ tableCatalog,
+ notification = "common.updated",
+}: {
+ database: string;
+ schema: string;
+ table: string;
+ tableCatalog: Partial<TableCatalog>;
+ notification?: string;
+}) => {
const dbCatalogStore = useDatabaseCatalogV1Store();
const catalog = await dbCatalogStore.getOrFetchDatabaseCatalog({ database });
@@ -111,6 +120,6 @@ export const updateTableConfig = async (
pushNotification({
module: "bytebase",
style: "SUCCESS",
- title: t("common.updated"),
+ title: t(notification),
});
};
diff --git a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
index ada32bd28a..977614a412 100644
--- a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
+++ b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
@@ -215,6 +215,7 @@ const removeSensitiveColumn = async (sensitiveColumn: MaskData) => {
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 95df6391a1..9eccfbf54a 100644
--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
+++ b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue
@@ -13,9 +13,9 @@
<script lang="tsx" setup>
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 { computed, h, ref, watch, withModifiers } from "vue";
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 { updateColumnConfig } from "@/components/ColumnDataTable/utils";
@@ -28,6 +28,7 @@ import {
} from "@/store";
import type { ComposedDatabase } from "@/types";
import { DataClassificationSetting_DataClassificationConfig as DataClassificationConfig } from "@/types/proto/v1/setting_service";
+import { autoDatabaseRoute } from "@/utils";
const props = defineProps<{
database: ComposedDatabase;
@@ -44,6 +45,7 @@ const emit = defineEmits<{
}>();
const { t } = useI18n();
+const router = useRouter();
const checkedColumnIndex = ref<Set<number>>(
new Set(props.checkedColumnIndexList)
);
@@ -99,7 +101,24 @@ const dataTableColumns = computed(() => {
resizable: true,
width: "minmax(min-content, auto)",
render(item) {
- return item.schema ? `${item.schema}.${item.table}` : item.table;
+ return (
+ <div>
+ <RouterLink
+ to={{
+ ...autoDatabaseRoute(router, props.database),
+ query: {
+ schema: item.schema,
+ table: item.table,
+ },
+ hash: "overview",
+ }}
+ class="normal-link"
+ exactActiveClass=""
+ >
+ {item.schema ? `${item.schema}.${item.table}` : item.table}
+ </RouterLink>
+ </div>
+ );
},
},
{
@@ -215,6 +234,7 @@ const onClassificationIdApply = async (
table: item.table,
column: item.column,
columnCatalog: { classification },
+ notification: !classification ? "common.removed" : undefined,
});
};
diff --git a/frontend/src/components/TableDataTable.vue b/frontend/src/components/TableDataTable.vue
index 30491aa95f..59d8fd00b8 100644
--- a/frontend/src/components/TableDataTable.vue
+++ b/frontend/src/components/TableDataTable.vue
@@ -31,7 +31,11 @@ import {
updateTableConfig,
supportSetClassificationFromComment,
} from "@/components/ColumnDataTable/utils";
-import { useSettingV1Store, useDatabaseCatalog, getTableCatalog } from "@/store/modules";
+import {
+ useSettingV1Store,
+ useDatabaseCatalog,
+ getTableCatalog,
+} from "@/store/modules";
import type { ComposedDatabase } from "@/types";
import { Engine } from "@/types/proto/v1/common";
import type { TableMetadata } from "@/types/proto/v1/database_service";
@@ -164,7 +168,11 @@ const columns = computed(() => {
resizable: true,
minWidth: 140,
render: (table) => {
- const tableCatalog = getTableCatalog(databaseCatalog.value, props.schemaName, table.name)
+ const tableCatalog = getTableCatalog(
+ databaseCatalog.value,
+ props.schemaName,
+ table.name
+ );
return h(ClassificationCell, {
classification: tableCatalog.classification,
classificationConfig:
@@ -249,8 +257,13 @@ const onClassificationIdApply = async (
table: string,
classification: string
) => {
- await updateTableConfig(props.database.name, props.schemaName, table, {
- classification,
+ await updateTableConfig({
+ database: props.database.name,
+ schema: props.schemaName,
+ table,
+ tableCatalog: {
+ classification,
+ },
});
};
</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 7869080e79..56c902f08d 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -74,6 +74,7 @@
"edit": "Edit",
"update": "Update",
"updated": "Updated",
+ "removed": "Removed",
"visit": "Visit",
"role": {
"self": "Role"
@@ -811,6 +812,8 @@
},
"sensitive-data": {
"remove-sensitive-column-tips": "Expose this column?",
+ "remove-semantic-type-tips": "Remove the semantic type for this column?",
+ "remove-classification-tips": "Remove the classification for this column?",
"global-masking-rule": "Global Masking Rule",
"grant-access": "Grant Access",
"never-expires": "Never expires",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index a058405bcf..19d7b981cb 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -74,6 +74,7 @@
"edit": "Editar",
"update": "Actualizar",
"updated": "Actualizado",
+ "removed": "Remoto",
"visit": "Visitar",
"role": {
"self": "Rol"
@@ -811,6 +812,8 @@
},
"sensitive-data": {
"remove-sensitive-column-tips": "¿Exponer esta columna?",
+ "remove-semantic-type-tips": "¿Eliminar el tipo semántico de esta columna?",
+ "remove-classification-tips": "¿Eliminar la clasificación de esta columna?",
"global-masking-rule": "Regla De Enmascaramiento Global",
"grant-access": "Autorizará el acceso",
"never-expires": "Nunca expira",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 5207a6b90b..9c51ce9075 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -74,6 +74,7 @@
"edit": "編集",
"update": "更新する",
"updated": "更新しました",
+ "removed": "削除されました",
"visit": "アクセス",
"role": {
"self": "役割"
@@ -811,6 +812,8 @@
},
"sensitive-data": {
"remove-sensitive-column-tips": "このデータ列の感度を下げなくなりますか?",
+ "remove-semantic-type-tips": "この列のセマンティック タイプを削除しますか?",
+ "remove-classification-tips": "この列の分類を削除しますか?",
"global-masking-rule": "グローバルマスキングルール",
"grant-access": "許可されたアクセス",
"never-expires": "有効期限なし",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 4242c2bdf4..2cf7720932 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -74,6 +74,7 @@
"edit": "编辑",
"update": "更新",
"updated": "已更新",
+ "removed": "已移除",
"visit": "访问",
"role": {
"self": "角色"
@@ -811,6 +812,8 @@
},
"sensitive-data": {
"remove-sensitive-column-tips": "不再对此列数据脱敏?",
+ "remove-semantic-type-tips": "删除此列的语义类型吗?",
+ "remove-classification-tips": "删除此列的分类吗?",
"global-masking-rule": "全局脱敏规则",
"grant-access": "授权访问",
"never-expires": "无过期时间",