You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by de...@apache.org on 2022/12/19 11:26:54 UTC
[shenyu-dashboard] branch master updated: Add link from plugin to pluginList (#255)
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 e3142244 Add link from plugin to pluginList (#255)
e3142244 is described below
commit e31422448ba85440aa51583f5783279d47ab5647
Author: gentlehao <39...@users.noreply.github.com>
AuthorDate: Mon Dec 19 19:26:48 2022 +0800
Add link from plugin to pluginList (#255)
* plugin link2 pluginList#4174
* Menu automatic change#4174
---
src/components/SiderMenu/SiderMenu.js | 18 ++++++++++++++++--
src/routes/System/Plugin/index.js | 5 +++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/components/SiderMenu/SiderMenu.js b/src/components/SiderMenu/SiderMenu.js
index 7880c1be..675a80d1 100644
--- a/src/components/SiderMenu/SiderMenu.js
+++ b/src/components/SiderMenu/SiderMenu.js
@@ -18,7 +18,7 @@
import React, { PureComponent } from "react";
import { Layout, Menu, Icon, Switch } from "antd";
import pathToRegexp from "path-to-regexp";
-import { Link } from "dva/router";
+import { withRouter, Link } from "dva/router";
import styles from "./index.less";
import { urlToList } from "../_utils/pathTools";
import { getCurrentLocale, getIntlContent } from "../../utils/IntlUtils";
@@ -77,7 +77,7 @@ export const getMenuMatchKeys = (flatMenuKeys, paths) =>
[]
);
-export default class SiderMenu extends PureComponent {
+class SiderMenu extends PureComponent {
constructor(props) {
super(props);
this.flatMenuKeys = getFlatMenuKeys(props.menuData);
@@ -89,6 +89,16 @@ export default class SiderMenu extends PureComponent {
};
}
+ componentDidMount() {
+ this.props.history.listen(location => {
+ if (this.props.location.pathname !== location.pathname) {
+ this.setState({
+ openKeys: this.getDefaultCollapsedSubMenus(this.props)
+ });
+ }
+ });
+ }
+
componentWillReceiveProps(nextProps) {
const { location, menuData } = this.props;
this.flatMenuKeys = getFlatMenuKeys(menuData);
@@ -339,6 +349,8 @@ export default class SiderMenu extends PureComponent {
theme={this.state.theme}
mode={this.state.mode}
style={{ padding: "16px 0", width: "100%" }}
+ selectedKeys={selectedKeys}
+ openKeys={openKeys}
>
{this.getNavMenuItems(menuData)}
</Menu>
@@ -346,3 +358,5 @@ export default class SiderMenu extends PureComponent {
);
}
}
+
+export default withRouter(SiderMenu);
diff --git a/src/routes/System/Plugin/index.js b/src/routes/System/Plugin/index.js
index da2b68cf..c6234477 100644
--- a/src/routes/System/Plugin/index.js
+++ b/src/routes/System/Plugin/index.js
@@ -16,6 +16,7 @@
*/
import React, { Component } from "react";
+import { Link } from "dva/router";
import { Table, Input, Button, message, Popconfirm, Select, Popover, Tag, Typography } from "antd";
import { connect } from "dva";
import { resizableComponents } from "../../../utils/resizable";
@@ -369,8 +370,8 @@ export default class Plugin extends Component {
key: "name",
ellipsis: true,
width: 120,
- render: text => {
- return <div style={{color: "#260033","fontWeight":"bold"}}>{text || "----"}</div>;
+ render: (text, record) => {
+ return <Link to={`/plug/${record.role}/${text}`} style={{color: "#260033","fontWeight":"bold"}}>{text || "----"}</Link>;
}
},
{