Skip to content

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

feat: set IM approval as enterprise plan in frontend (#3363)

boojack6ab8aba6af05
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index d00ad948ac..638a0efb83 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1434,6 +1434,10 @@
"title": "LGTM check",
"desc": "Check if the issue has an \"LGTM\" comment."
},
+ "bb-feature-im-approval": {
+ "title": "IM Approval",
+ "desc": "Approval issue with IM integration."
+ },
"bb-feature-sql-review": {
"title": "SQL review policy",
"desc": "Customize the SQL review policy for different environments, can only use limited rules in the free plan."
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index ba5df8a955..931325bda8 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1434,6 +1434,10 @@
"title": "LGTM 检查",
"desc": "检查工单是否有 \"LGTM\" 评论。"
},
+ "bb-feature-im-approval": {
+ "title": "IM 集成",
+ "desc": "通过集成 IM 来批准工单。"
+ },
"bb-feature-sql-review": {
"title": "Schema 审核策略",
"desc": "给不同的环境定制 schema 审核策略,免费版仅可使用部分规则。"
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 6136f1de53..76f652db56 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -12,6 +12,7 @@ export type FeatureType =
| "bb.feature.data-source"
| "bb.feature.dba-workflow"
| "bb.feature.lgtm"
+ | "bb.feature.im.approval"
| "bb.feature.multi-tenancy"
| "bb.feature.online-migration"
| "bb.feature.schema-drift"
@@ -83,6 +84,7 @@ export const FEATURE_MATRIX: Map<FeatureType, boolean[]> = new Map([
["bb.feature.data-source", [false, false, false]],
["bb.feature.dba-workflow", [false, false, true]],
["bb.feature.lgtm", [false, false, true]],
+ ["bb.feature.im.approval", [false, false, true]],
["bb.feature.multi-tenancy", [false, false, true]],
["bb.feature.online-migration", [false, true, true]],
["bb.feature.schema-drift", [false, true, true]],
diff --git a/frontend/src/views/SettingWorkspaceIMIntegration.vue b/frontend/src/views/SettingWorkspaceIMIntegration.vue
index 810c67ae7a..a5ca46d5ed 100644
--- a/frontend/src/views/SettingWorkspaceIMIntegration.vue
+++ b/frontend/src/views/SettingWorkspaceIMIntegration.vue
@@ -7,6 +7,7 @@
<span class="ml-2 text-lg font-medium">{{
$t("common.feishu")
}}</span>
+ <heroicons-solid:sparkles class="ml-2 w-5 h-auto text-accent" />
</div>
<button
v-if="!state.feishuSetting"
@@ -35,9 +36,18 @@
:value="state.feishuSetting.appSecret"
@input="(e: any) => state.feishuSetting!.appSecret = e.target.value"
/>
+ <div
+ class="!mt-4 !mb-2 w-128 max-w-full flex flex-row justify-start items-center"
+ >
+ <span class="textlabel mr-4">Enable</span>
+ <BBSwitch
+ :value="state.feishuSetting.externalApproval.enabled"
+ @toggle="onFeishuIntegrationEnableToggle"
+ />
+ </div>
<button
type="button"
- class="btn-primary inline-flex justify-center py-2 px-4 mt-2"
+ class="btn-primary inline-flex justify-center py-2 px-4 mt-4"
@click.prevent="updateFeishuIntegration"
>
{{ $t("common.update") }}
@@ -45,21 +55,32 @@
</div>
</div>
</div>
+
+ <FeatureModal
+ v-if="state.showFeatureModal"
+ feature="bb.feature.im.approval"
+ @cancel="state.showFeatureModal = false"
+ />
</template>
<script lang="ts" setup>
import { onMounted, reactive } from "vue";
-import { pushNotification, useSettingStore } from "@/store";
+import { featureToRef, pushNotification, useSettingStore } from "@/store";
import { SettingAppIMValue } from "@/types/setting";
import { useI18n } from "vue-i18n";
+import { BBSwitch } from "@/bbkit";
interface LocalState {
feishuSetting?: SettingAppIMValue;
+ showFeatureModal: boolean;
}
const { t } = useI18n();
-const state = reactive<LocalState>({});
+const state = reactive<LocalState>({
+ showFeatureModal: false,
+});
const settingStore = useSettingStore();
+const hasIMApprovalFeature = featureToRef("bb.feature.im.approval");
onMounted(() => {
const setting = settingStore.getSettingByName("bb.app.im");
@@ -71,7 +92,18 @@ onMounted(() => {
}
});
+const onFeishuIntegrationEnableToggle = (status: boolean) => {
+ if (state.feishuSetting) {
+ state.feishuSetting.externalApproval.enabled = status;
+ }
+};
+
const createFeishuIntegration = async () => {
+ if (!hasIMApprovalFeature.value) {
+ state.showFeatureModal = true;
+ return;
+ }
+
state.feishuSetting = {
imType: "im.feishu",
appId: "",
@@ -87,6 +119,11 @@ const createFeishuIntegration = async () => {
};
const updateFeishuIntegration = async () => {
+ if (!hasIMApprovalFeature.value) {
+ state.showFeatureModal = true;
+ return;
+ }
+
await settingStore.updateSettingByName({
name: "bb.app.im",
value: JSON.stringify(state.feishuSetting),