Skip to content

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

chore: remove IM integration (#8502)

Danny Xu7b5fae9085b2
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index 418a81dcaf..2954207dd3 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -383,14 +383,6 @@ const routes: Array<RouteRecordRaw> = [
component: () => import("../views/SettingWorkspaceRole.vue"),
props: true,
},
- {
- path: "im-integration",
- name: "setting.workspace.im-integration",
- meta: { title: () => t("settings.sidebar.im-integration") },
- component: () =>
- import("../views/SettingWorkspaceIMIntegration.vue"),
- props: true,
- },
{
path: "sso",
name: "setting.workspace.sso",
@@ -1204,21 +1196,6 @@ router.beforeEach((to, from, next) => {
}
}
- if (to.name?.toString().startsWith("setting.workspace.im-integration")) {
- if (
- !hasWorkspacePermissionV1(
- "bb.permission.workspace.manage-im-integration",
- currentUserV1.value.userRole
- )
- ) {
- next({
- name: "error.403",
- replace: false,
- });
- return;
- }
- }
-
if (to.name?.toString().startsWith("setting.workspace.sso")) {
if (
!hasWorkspacePermissionV1(
diff --git a/frontend/src/views/SettingSidebar.vue b/frontend/src/views/SettingSidebar.vue
index bf202fb459..41f5db4b93 100644
--- a/frontend/src/views/SettingSidebar.vue
+++ b/frontend/src/views/SettingSidebar.vue
@@ -152,13 +152,6 @@
>
{{ $t("settings.sidebar.sso") }}
</router-link>
- <router-link
- v-if="showIMIntegrationItem"
- to="/setting/im-integration"
- class="outline-item group w-full flex items-center truncate pl-11 pr-2 py-1.5"
- >
- {{ $t("settings.sidebar.im-integration") }}
- </router-link>
<router-link
v-if="showMailDeliveryItem"
to="/setting/mail-delivery"
@@ -205,13 +198,6 @@ const showAccessControlItem = computed((): boolean => {
);
});
-const showIMIntegrationItem = computed((): boolean => {
- return hasWorkspacePermissionV1(
- "bb.permission.workspace.manage-im-integration",
- currentUserV1.value.userRole
- );
-});
-
const showSSOItem = computed((): boolean => {
return hasWorkspacePermissionV1(
"bb.permission.workspace.manage-sso",
@@ -227,7 +213,7 @@ const showVCSItem = computed((): boolean => {
});
const showIntegrationSection = computed(() => {
- return showVCSItem.value || showIMIntegrationItem.value || showSSOItem.value;
+ return showVCSItem.value || showSSOItem.value;
});
const showDebugLogItem = computed((): boolean => {
diff --git a/frontend/src/views/SettingWorkspaceIMIntegration.vue b/frontend/src/views/SettingWorkspaceIMIntegration.vue
deleted file mode 100644
index 6f58356bf9..0000000000
--- a/frontend/src/views/SettingWorkspaceIMIntegration.vue
+++ /dev/null
@@ -1,185 +0,0 @@
-<template>
- <div class="w-full mt-4 space-y-4">
- <FeatureAttentionForInstanceLicense feature="bb.feature.im.approval" />
- <div class="textinfolabel">
- {{ $t("settings.im-integration.description") }}
- <a
- class="normal-link inline-flex items-center"
- href="https://www.bytebase.com/docs/administration/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">
- <img class="w-10 h-auto" src="../assets/feishu-logo.webp" alt="" />
- <span class="ml-2 text-lg font-medium">{{
- $t("common.feishu")
- }}</span>
- <FeatureBadge
- :feature="'bb.feature.im.approval'"
- custom-class="ml-2"
- />
- </div>
- <button
- v-if="!state.feishuSetting"
- type="button"
- class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
- @click.prevent="createFeishuIntegration"
- >
- {{ $t("common.create") }}
- </button>
- </div>
- <div
- v-if="state.feishuSetting"
- class="w-full flex flex-col justify-start items-start space-y-2"
- >
- <div class="textlabel">{{ $t("common.application") }} ID</div>
- <BBTextField
- class="w-128 max-w-full mb-2"
- :placeholder="'ex. cli_a3c48b4c45f933xz'"
- :value="state.feishuSetting.appId"
- @input="(e: any) => state.feishuSetting!.appId = e.target.value"
- />
- <div class="mt-4 textlabel">Secret</div>
- <BBTextField
- class="w-128 max-w-full mb-2"
- :placeholder="'ex. MTOc5YmoRYJyDfRXHUzSBeXzTu3w3I3G'"
- :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">{{
- $t("settings.im-integration.enable")
- }}</span>
- <BBSwitch
- v-if="state.feishuSetting.externalApproval"
- :value="state.feishuSetting.externalApproval.enabled"
- @toggle="onFeishuIntegrationEnableToggle"
- />
- </div>
- <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>
-
- <FeatureModal
- feature="bb.feature.im.approval"
- :open="state.showFeatureModal"
- @cancel="state.showFeatureModal = false"
- />
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep, isEqual } from "lodash-es";
-import { computed, onMounted, reactive } from "vue";
-import { useI18n } from "vue-i18n";
-import { BBSwitch } from "@/bbkit";
-import { featureToRef, pushNotification } from "@/store";
-import { useSettingV1Store } from "@/store/modules/v1/setting";
-import {
- AppIMSetting,
- AppIMSetting_IMType,
-} from "@/types/proto/v1/setting_service";
-
-interface LocalState {
- originFeishuSetting?: AppIMSetting;
- feishuSetting?: AppIMSetting;
- showFeatureModal: boolean;
- isLoading: boolean;
-}
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- showFeatureModal: false,
- isLoading: false,
-});
-const settingV1Store = useSettingV1Store();
-const hasIMApprovalFeature = featureToRef("bb.feature.im.approval");
-
-const feishuActionButtonText = computed(() => {
- return state.originFeishuSetting === undefined
- ? t("common.create")
- : t("common.update");
-});
-
-const allowFeishuActionButton = computed(() => {
- return !isEqual(state.originFeishuSetting, state.feishuSetting);
-});
-
-onMounted(() => {
- const setting = settingV1Store.getSettingByName("bb.app.im");
- const appFeishuValue = setting?.value?.appImSettingValue;
- if (appFeishuValue?.imType === AppIMSetting_IMType.FEISHU) {
- state.originFeishuSetting = cloneDeep(appFeishuValue);
- state.feishuSetting = appFeishuValue;
- }
-});
-
-const onFeishuIntegrationEnableToggle = (status: boolean) => {
- if (state.feishuSetting && state.feishuSetting.externalApproval) {
- state.feishuSetting.externalApproval.enabled = status;
- }
-};
-
-const createFeishuIntegration = () => {
- if (!hasIMApprovalFeature.value) {
- state.showFeatureModal = true;
- return;
- }
-
- state.feishuSetting = {
- imType: AppIMSetting_IMType.FEISHU,
- appId: "",
- appSecret: "",
- externalApproval: {
- enabled: true,
- approvalDefinitionId: "",
- },
- };
-};
-
-const updateFeishuIntegration = async () => {
- if (!hasIMApprovalFeature.value) {
- state.showFeatureModal = true;
- return;
- }
-
- state.isLoading = true;
- try {
- await settingV1Store.upsertSetting({
- name: "bb.app.im",
- value: {
- appImSettingValue: state.feishuSetting,
- },
- });
- } catch (error) {
- state.isLoading = false;
- return;
- }
-
- state.isLoading = false;
- state.originFeishuSetting = cloneDeep(state.feishuSetting);
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("settings.im-integration.feishu-updated-tip"),
- });
-};
-</script>