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

dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 1197f641 fix: use absolute plugin routes from Home (#675)
1197f641 is described below

commit 1197f641230eae9321dba26ac5c03bc8506e5847
Author: Carlos Acosta <[email protected]>
AuthorDate: Sun Sep 27 00:28:09 2026 -0500

    fix: use absolute plugin routes from Home (#675)
    
    Co-authored-by: Aeontra <aeontra@localhost>
---
 src/routes/Home/index.js      |  2 +-
 src/routes/Home/index.test.js | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/routes/Home/index.js b/src/routes/Home/index.js
index 1b6bc188..6102fbf4 100644
--- a/src/routes/Home/index.js
+++ b/src/routes/Home/index.js
@@ -88,7 +88,7 @@ export default class Home extends Component {
 
   pluginOnClick = (plugin) => {
     const { dispatch } = this.props;
-    dispatch(routerRedux.push(`plug/${plugin.role}/${plugin.name}`));
+    dispatch(routerRedux.push(`/plug/${plugin.role}/${plugin.name}`));
   };
 
   getEventLogTitle = (log) => {
diff --git a/src/routes/Home/index.test.js b/src/routes/Home/index.test.js
new file mode 100644
index 00000000..f32edeab
--- /dev/null
+++ b/src/routes/Home/index.test.js
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { routerRedux } from "dva/router";
+import ConnectedHome from "./index";
+
+jest.mock("../../services/api", () => ({
+  activePluginSnapshotByNamespace: jest.fn(() => Promise.resolve()),
+  getNewEventRecodLogList: jest.fn(() => Promise.resolve()),
+}));
+jest.mock("../../utils/IntlUtils", () => ({
+  getIntlContent: (key) => key,
+}));
+
+const Home = ConnectedHome.WrappedComponent;
+
+it("navigates plugin tags with an absolute route", () => {
+  const dispatch = jest.fn();
+  const component = new Home({ dispatch });
+
+  component.pluginOnClick({ role: "Mcp", name: "mcpServer" });
+
+  expect(dispatch).toHaveBeenCalledWith(
+    routerRedux.push("/plug/Mcp/mcpServer"),
+  );
+});

Reply via email to