Skip to content

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

chore: update IM integration UI (#3415)

boojack632c846cfcef
diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.ts
index 56e313ccf0..3a1d10c2e2 100644
--- a/frontend/src/bbkit/index.ts
+++ b/frontend/src/bbkit/index.ts
@@ -28,6 +28,7 @@ import {
} from "./BBTable";
import BBTabPanel from "./BBTabPanel.vue";
import BBTextField from "./BBTextField.vue";
+import BBBetaBadge from "./BBBetaBadge.vue";
export {
BBAlert,
@@ -58,4 +59,5 @@ export {
BBTableHeaderCell,
BBTableSearch,
BBTextField,
+ BBBetaBadge,
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index fdaddbb82a..3be5ee0a15 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -382,6 +382,8 @@
"system-bot": "System Bot"
},
"im-integration": {
+ "enable": "Enable",
+ "description": "Allow users to approve issues from IM directly.",
"feishu-updated-tip": "Successfully updated the Feishu integration"
},
"general": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 845055b559..3f8f198d97 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -382,6 +382,8 @@
"system-bot": "机器人助手"
},
"im-integration": {
+ "enable": "启用",
+ "description": "可以让用户在 IM 里直接审批工单。",
"feishu-updated-tip": "飞书配置更新成功"
},
"general": {
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index 543843e360..89025dba80 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -70,9 +70,11 @@
<router-link
v-if="showIMIntegrationItem"
to="/setting/im-integration"
- class="outline-item group w-full flex items-center pl-11 pr-2 py-2"
- >{{ $t("settings.sidebar.im-integration") }}</router-link
+ class="outline-item group w-full flex items-center truncate pl-11 pr-2 py-2"
>
+ {{ $t("settings.sidebar.im-integration") }}
+ <BBBetaBadge class="ml-1" />
+ </router-link>
<router-link
v-if="showVCSItem"
to="/setting/version-control"
diff --git a/frontend/src/views/SettingWorkspaceIMIntegration.vue b/frontend/src/views/SettingWorkspaceIMIntegration.vue
index e343b4c6a9..664bca963a 100644
--- a/frontend/src/views/SettingWorkspaceIMIntegration.vue
+++ b/frontend/src/views/SettingWorkspaceIMIntegration.vue
@@ -1,5 +1,16 @@
<template>
<div class="w-full mt-4 space-y-4">
+ <div class="textinfolabel">
+ {{ $t("settings.im-integration.description") }}
+ <a
+ class="normal-link inline-flex items-center"
+ href="https://www.bytebase.com/docs/administration/webhook-integration/external-approval?source=console"
+ target="__BLANK"
+ >
+ {{ $t("common.learn-more") }}
+ <heroicons-outline:external-link class="w-4 h-4 ml-1" />
+ </a>
+ </div>
<div class="w-full flex flex-col justify-start items-start space-y-2">
<div class="w-full flex flex-row justify-start items-center">
<div class="flex flex-row justify-start items-center">
@@ -39,20 +50,25 @@
<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>
+ <span class="textlabel mr-4">{{
+ $t("settings.im-integration.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-4"
- :disabled="!allowFeishuActionButton"
- @click.prevent="updateFeishuIntegration"
- >
- {{ feishuActionButtonText }}
- </button>
+ <div class="flex flex-row justify-center">
+ <button
+ type="button"
+ class="btn-primary inline-flex justify-center py-2 px-4"
+ :disabled="!allowFeishuActionButton || state.isLoading"
+ @click.prevent="updateFeishuIntegration"
+ >
+ {{ feishuActionButtonText }}
+ </button>
+ <BBSpin v-if="state.isLoading" class="ml-1" />
+ </div>
</div>
</div>
</div>
@@ -67,20 +83,22 @@
<script lang="ts" setup>
import { cloneDeep, isEqual } from "lodash-es";
import { computed, onMounted, reactive } from "vue";
+import { useI18n } from "vue-i18n";
import { featureToRef, pushNotification, useSettingStore } from "@/store";
import { SettingAppIMValue } from "@/types/setting";
-import { useI18n } from "vue-i18n";
import { BBSwitch } from "@/bbkit";
interface LocalState {
originFeishuSetting?: SettingAppIMValue;
feishuSetting?: SettingAppIMValue;
showFeatureModal: boolean;
+ isLoading: boolean;
}
const { t } = useI18n();
const state = reactive<LocalState>({
showFeatureModal: false,
+ isLoading: false,
});
const settingStore = useSettingStore();
const hasIMApprovalFeature = featureToRef("bb.feature.im.approval");
@@ -125,7 +143,7 @@ const createFeishuIntegration = () => {
appId: "",
appSecret: "",
externalApproval: {
- enabled: false,
+ enabled: true,
},
};
};
@@ -136,10 +154,16 @@ const updateFeishuIntegration = async () => {
return;
}
- await settingStore.updateSettingByName({
- name: "bb.app.im",
- value: JSON.stringify(state.feishuSetting),
- });
+ state.isLoading = true;
+ try {
+ await settingStore.updateSettingByName({
+ name: "bb.app.im",
+ value: JSON.stringify(state.feishuSetting),
+ });
+ } catch (error) {
+ state.isLoading = false;
+ return;
+ }
state.originFeishuSetting = cloneDeep(state.feishuSetting);
pushNotification({