Skip to content

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

feat(frontend): move audit log to enterprise version (#4675)

Liu Ji1deeeda38fc0
diff --git a/backend/legacyapi/plan.go b/backend/legacyapi/plan.go
index 2764e1bca8..41c7184def 100644
--- a/backend/legacyapi/plan.go
+++ b/backend/legacyapi/plan.go
@@ -61,6 +61,9 @@ const (
// FeatureWatermark enables full-screen watermark.
FeatureWatermark FeatureType = "bb.feature.watermark"
+ // FeatureAuditLog enables viewing audit logs.
+ FeatureAuditLog FeatureType = "bb.feature.audit-log"
+
// Branding.
// FeatureBranding enables customized branding.
@@ -160,9 +163,11 @@ func (e FeatureType) Name() string {
return "SSO"
case FeatureRBAC:
return "RBAC"
- // Branding
case FeatureWatermark:
return "Watermark"
+ case FeatureAuditLog:
+ return "Audit log"
+ // Branding
case FeatureBranding:
return "Branding"
// Change Workflow
@@ -237,6 +242,7 @@ var FeatureMatrix = map[FeatureType][3]bool{
FeatureSSO: {false, false, true},
FeatureRBAC: {false, true, true},
FeatureWatermark: {false, false, true},
+ FeatureAuditLog: {false, false, true},
// Branding
FeatureBranding: {false, false, true},
// Change Workflow
diff --git a/frontend/src/bbkit/BBComboBox.vue b/frontend/src/bbkit/BBComboBox.vue
index ae423d1ade..191570e89b 100644
--- a/frontend/src/bbkit/BBComboBox.vue
+++ b/frontend/src/bbkit/BBComboBox.vue
@@ -5,7 +5,7 @@
ref="button"
class="btn-select relative pl-3 pr-10"
:class="[
- disabled && 'bg-control-bg opacity-50 !cursor-not-allowed',
+ disabled && '!bg-control-bg opacity-50 !cursor-not-allowed',
state.open && 'ring-1 ring-control border-control',
]"
v-bind="$attrs"
@@ -119,7 +119,7 @@ const props = withDefaults(
value: undefined,
placeholder: "",
disabled: false,
- filter: async (options) => options,
+ filter: async (options: ItemType[]) => options,
}
);
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 78463fc49a..fdc3dfba30 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1667,6 +1667,10 @@
"title": "Watermark",
"desc": "Display visible watermarks on pages, including username and ID."
},
+ "bb-feature-audit-log": {
+ "title": "Audit log",
+ "desc": "Record and query operations performed by users in workspace."
+ },
"bb-feature-schema-drift": {
"title": "Schema drift",
"desc": "@:{'subscription.upgrade'} to unlock schema drift auto-detection."
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index b6f01272a3..0b8c5c791d 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1668,6 +1668,10 @@
"title": "水印设置",
"desc": "在页面上显示水印,包含用户名和 ID。"
},
+ "bb-feature-audit-log": {
+ "title": "审计日志",
+ "desc": "记录和查询工作空间中的用户执行的操作。"
+ },
"bb-feature-schema-drift": {
"title": "Schema 偏差",
"desc": "@:{'subscription.upgrade'}来解锁 schema 偏差异常的自动检测。"
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index b3ceabb8b8..d6f7fcb128 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -7,6 +7,7 @@ export type FeatureType =
| "bb.feature.sso"
| "bb.feature.rbac"
| "bb.feature.watermark"
+ | "bb.feature.audit-log"
// Branding
| "bb.feature.branding"
// Change Workflow
diff --git a/frontend/src/views/SettingWorkspaceAccessControl.vue b/frontend/src/views/SettingWorkspaceAccessControl.vue
index 3e70151e21..3aa1cc14c7 100644
--- a/frontend/src/views/SettingWorkspaceAccessControl.vue
+++ b/frontend/src/views/SettingWorkspaceAccessControl.vue
@@ -21,7 +21,7 @@
<div>
<button
class="btn-primary whitespace-nowrap"
- :disabled="!allowAdmin"
+ :disabled="!allowAdmin || !hasAccessControlFeature"
@click="state.showAddRuleModal = true"
>
{{ $t("settings.access-control.add-rule") }}
@@ -29,7 +29,7 @@
</div>
</div>
- <div class="relative min-h-[12rem]">
+ <div v-if="hasAccessControlFeature" class="relative min-h-[12rem]">
<BBTable
:column-list="COLUMN_LIST"
:data-source="activePolicyList"
@@ -144,9 +144,6 @@
</span>
</div>
</BBTableCell>
- <BBTableCell>
- {{ humanizeTs(policy.updatedTs) }}
- </BBTableCell>
<BBTableCell>
<div class="flex items-center justify-center">
<NPopconfirm @positive-click="handleRemove(policy)">
@@ -176,6 +173,20 @@
<BBSpin />
</div>
</div>
+
+ <template v-else>
+ <BBTable
+ :column-list="COLUMN_LIST"
+ :data-source="[]"
+ :show-header="true"
+ :left-bordered="true"
+ :right-bordered="true"
+ :row-clickable="false"
+ />
+ <div class="w-full h-full flex flex-col items-center justify-center">
+ <img src="../assets/illustration/no-data.webp" class="max-h-[30vh]" />
+ </div>
+ </template>
</div>
<FeatureModal
diff --git a/frontend/src/views/SettingWorkspaceAuditLog.vue b/frontend/src/views/SettingWorkspaceAuditLog.vue
index 56a3efe625..6639199fc4 100644
--- a/frontend/src/views/SettingWorkspaceAuditLog.vue
+++ b/frontend/src/views/SettingWorkspaceAuditLog.vue
@@ -1,8 +1,14 @@
<template>
- <div>
+ <div class="w-full mt-4 space-y-4">
+ <FeatureAttention
+ v-if="!hasAuditLogFeature"
+ feature="bb.feature.audit-log"
+ :description="$t('subscription.features.bb-feature-audit-log.desc')"
+ />
<div class="flex justify-end items-center mt-1">
<MemberSelect
class="w-52"
+ :disabled="!hasAuditLogFeature"
:show-all="true"
:show-system-bot="true"
:selected-id="selectedPrincipalId"
@@ -10,12 +16,14 @@
/>
<div class="w-52 ml-2">
<TypeSelect
+ :disabled="!hasAuditLogFeature"
:selected-type-list="selectedAuditTypeList"
@update-selected-type-list="selectAuditType"
/>
</div>
</div>
<PagedAuditLogTable
+ v-if="hasAuditLogFeature"
:activity-find="{
typePrefix:
selectedAuditTypeList.length > 0
@@ -31,6 +39,13 @@
<AuditLogTable :audit-log-list="list" @view-detail="handleViewDetail" />
</template>
</PagedAuditLogTable>
+ <template v-else>
+ <AuditLogTable :audit-log-list="[]" />
+ <div class="w-full h-full flex flex-col items-center justify-center">
+ <img src="../assets/illustration/no-data.webp" class="max-h-[30vh]" />
+ </div>
+ </template>
+
<BBDialog
ref="dialog"
:title="$t('audit-log.audit-log-detail')"
@@ -81,6 +96,7 @@ import { NGrid, NGi } from "naive-ui";
import { useI18n } from "vue-i18n";
import { BBDialog } from "@/bbkit";
import { AuditActivityType, PrincipalId, EMPTY_ID } from "@/types";
+import { featureToRef } from "@/store";
const dialog = ref<InstanceType<typeof BBDialog> | null>(null);
const state = reactive({
@@ -92,6 +108,8 @@ const { t } = useI18n();
const router = useRouter();
const route = useRoute();
+const hasAuditLogFeature = featureToRef("bb.feature.audit-log");
+
const logKeyMap = {
createdTs: t("audit-log.table.created-time"),
level: t("audit-log.table.level"),
diff --git a/frontend/src/views/SettingWorkspaceSensitiveData.vue b/frontend/src/views/SettingWorkspaceSensitiveData.vue
index 354c6caf8e..df2f3aeedb 100644
--- a/frontend/src/views/SettingWorkspaceSensitiveData.vue
+++ b/frontend/src/views/SettingWorkspaceSensitiveData.vue
@@ -1,10 +1,17 @@
<template>
<div class="w-full mt-4 space-y-4">
+ <FeatureAttention
+ v-if="!hasSensitiveDataFeature"
+ feature="bb.feature.sensitive-data"
+ :description="$t('subscription.features.bb-feature-sensitive-data.desc')"
+ />
+
<div class="textinfolabel">
{{ $t("settings.sensitive-data.description") }}
</div>
<BBGrid
+ v-if="hasSensitiveDataFeature"
:column-list="COLUMN_LIST"
:data-source="state.sensitiveColumnList"
class="border"
@@ -55,6 +62,13 @@
</div>
</template>
</BBGrid>
+
+ <template v-else>
+ <BBGrid :column-list="COLUMN_LIST" :data-source="[]" class="border" />
+ <div class="w-full h-full flex flex-col items-center justify-center">
+ <img src="../assets/illustration/no-data.webp" class="max-h-[30vh]" />
+ </div>
+ </template>
</div>
<FeatureModal