You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/01/19 05:27:31 UTC

(incubator-devlake) branch main updated: fix: be plugin unload error (#6847)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new f27a80977 fix: be plugin unload error (#6847)
f27a80977 is described below

commit f27a80977b26c19f7518cf4dedbece9f053132bf
Author: 青湛 <0x...@gmail.com>
AuthorDate: Fri Jan 19 18:27:26 2024 +1300

    fix: be plugin unload error (#6847)
---
 config-ui/src/api/plugin/index.ts     |  5 +++++
 config-ui/src/routes/layout/loader.ts | 16 ++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/config-ui/src/api/plugin/index.ts b/config-ui/src/api/plugin/index.ts
index 4f6633b38..054c539e5 100644
--- a/config-ui/src/api/plugin/index.ts
+++ b/config-ui/src/api/plugin/index.ts
@@ -16,11 +16,16 @@
  *
  */
 
+import { request } from '@/utils';
+
 import * as jira from './jira';
 import * as tapd from './tapd';
 import * as webhook from './webhook';
 
+export const list = (): Promise<[{ plugin: string }]> => request('/plugins');
+
 export const plugin = {
+  list,
   jira,
   tapd,
   webhook,
diff --git a/config-ui/src/routes/layout/loader.ts b/config-ui/src/routes/layout/loader.ts
index 003db2041..2bba5a86a 100644
--- a/config-ui/src/routes/layout/loader.ts
+++ b/config-ui/src/routes/layout/loader.ts
@@ -16,6 +16,8 @@
  *
  */
 
+import { intersection } from 'lodash';
+
 import API from '@/api';
 import { getRegisterPlugins } from '@/plugins';
 
@@ -24,19 +26,21 @@ type Props = {
 };
 
 export const layoutLoader = async ({ request }: Props) => {
-  let plugins = [];
+  let fePlugins = getRegisterPlugins();
+  const bePlugins = await API.plugin.list();
 
   try {
     const envPlugins = import.meta.env.DEVLAKE_PLUGINS.split(',').filter(Boolean);
-    plugins = getRegisterPlugins().filter((plugin) => !envPlugins.length || envPlugins.includes(plugin));
-  } catch (err) {
-    plugins = getRegisterPlugins();
-  }
+    fePlugins = fePlugins.filter((plugin) => !envPlugins.length || envPlugins.includes(plugin));
+  } catch (err) {}
 
   const res = await API.version(request.signal);
 
   return {
     version: res.version,
-    plugins,
+    plugins: intersection(
+      fePlugins,
+      bePlugins.map((it) => it.plugin),
+    ),
   };
 };