You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by he...@apache.org on 2023/09/05 08:03:45 UTC

[shenyu-dashboard] branch master updated: fix: fix the bug of changing the state during the render process and other small bugs (#335)

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

hefengen 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 155384d4 fix: fix the bug of changing the state during the render process and other small bugs (#335)
155384d4 is described below

commit 155384d4b791c1416e5414e85877ad9f2593126b
Author: lulu <11...@users.noreply.github.com>
AuthorDate: Tue Sep 5 03:03:40 2023 -0500

    fix: fix the bug of changing the state during the render process and other small bugs (#335)
    
    * fix bug
    
    * fix:fix the bug of changing state during render process
---
 package.json                      |  1 +
 src/layouts/BasicLayout.js        | 36 +++++++++++++++++++++---------------
 src/layouts/UserLayout.less       |  4 ++--
 src/routes/System/Plugin/index.js |  2 +-
 4 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/package.json b/package.json
index 0f97f6ee..a1598e99 100755
--- a/package.json
+++ b/package.json
@@ -42,6 +42,7 @@
     "react-intl-universal": "^2.4.2",
     "react-json-view": "^1.21.3",
     "react-resizable": "^1.11.0",
+    "react-router-dom": "^6.15.0",
     "redux-logger": "^3.0.6",
     "setprototypeof": "^1.1.0",
     "url-polyfill": "^1.0.10"
diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js
index b6bf0c8f..06708b68 100644
--- a/src/layouts/BasicLayout.js
+++ b/src/layouts/BasicLayout.js
@@ -115,7 +115,8 @@ class BasicLayout extends React.PureComponent {
       localeName: window.sessionStorage.getItem("locale")
         ? window.sessionStorage.getItem("locale")
         : "en-US",
-      pluginsLoaded: false
+      pluginsLoaded: false,
+      processedMenus: []
     };
   }
 
@@ -135,6 +136,7 @@ class BasicLayout extends React.PureComponent {
       });
       return;
     }
+    this.processMenus()
     const { dispatch } = this.props;
     dispatch({
       type: "global/fetchPlatform"
@@ -216,19 +218,9 @@ class BasicLayout extends React.PureComponent {
     });
   };
 
-  render() {
-    const {
-      collapsed,
-      routerData,
-      match,
-      location,
-      plugins,
-      menuTree,
-      permissions,
-      dispatch
-    } = this.props;
-    const { localeName, pluginsLoaded } = this.state;
-    const bashRedirect = this.getBaseRedirect();
+  processMenus() {
+    const { plugins, menuTree, permissions, dispatch } = this.props
+    const { pluginsLoaded } = this.state
     let menus = getMenuData();
     if (menuTree.length > 0) {
       menus = menus.slice(0, 1);
@@ -308,13 +300,27 @@ class BasicLayout extends React.PureComponent {
       }
     });
 
+    this.setState({processedMenus: menus})
+  }
+
+  render() {
+    const {
+      collapsed,
+      routerData,
+      match,
+      location,
+      dispatch
+    } = this.props;
+    const { localeName, processedMenus } = this.state;
+    const bashRedirect = this.getBaseRedirect();
+
     const layout = (
       <Layout>
         <SiderMenu
           logo={logo}
           TitleLogo={TitleLogo}
           dispatch={dispatch}
-          menuData={menus}
+          menuData={processedMenus}
           collapsed={collapsed}
           location={location}
           onCollapse={this.handleMenuCollapse}
diff --git a/src/layouts/UserLayout.less b/src/layouts/UserLayout.less
index 3844dacc..a878d51d 100644
--- a/src/layouts/UserLayout.less
+++ b/src/layouts/UserLayout.less
@@ -22,7 +22,7 @@
   flex-direction: column;
   height: 100vh;
   overflow: auto;
-  background-image: url();
+  // background-image: url();
   background: #ffffff;
 }
 
@@ -78,4 +78,4 @@
   color: #ffffff;
   margin-top: 12px;
   margin-bottom: 40px;
-}
\ No newline at end of file
+}
diff --git a/src/routes/System/Plugin/index.js b/src/routes/System/Plugin/index.js
index f6651541..20f00f5f 100644
--- a/src/routes/System/Plugin/index.js
+++ b/src/routes/System/Plugin/index.js
@@ -359,7 +359,7 @@ export default class Plugin extends Component {
           width: 120,
           render: (text, record) => {
             return record.url
-              ? <Link to={record.url}><div style={{color: "#1890ff", "fontWeight": "bold", "text-decoration-line": "underline"}}>{text || "----"}</div></Link>
+              ? <Link to={record.url}><div style={{color: "#1890ff", "fontWeight": "bold", "textDecorationLine": "underline"}}>{text || "----"}</div></Link>
               : <div style={{color: "#260033", "fontWeight": "bold"}}>{text || "----"}</div>;
           }
         },