From b8d73b91eaf48cd3ade162fe67da89bfc9853dcc Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Thu, 9 May 2019 15:11:55 +0200 Subject: [PATCH] added baseUrl for info link --- .../components/table/PermissionRoleRow.js | 5 +++-- .../components/table/PermissionRoleTable.js | 17 ++++++++++------- scm-ui/src/config/containers/Config.js | 6 +++++- .../config/containers/GlobalPermissionRoles.js | 11 ++++++----- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/scm-ui/src/config/components/table/PermissionRoleRow.js b/scm-ui/src/config/components/table/PermissionRoleRow.js index 7e3944fc4b..a47d7e7e27 100644 --- a/scm-ui/src/config/components/table/PermissionRoleRow.js +++ b/scm-ui/src/config/components/table/PermissionRoleRow.js @@ -4,6 +4,7 @@ import { Link } from "react-router-dom"; import type { Role } from "@scm-manager/ui-types"; type Props = { + baseUrl: string, role: Role }; @@ -13,8 +14,8 @@ class PermissionRoleRow extends React.Component { } render() { - const { role } = this.props; - const to = `./${encodeURIComponent(role.name)}/info`; + const { baseUrl, role } = this.props; + const to = `${baseUrl}/${encodeURIComponent(role.name)}/info`; return ( {this.renderLink(to, role.name)} diff --git a/scm-ui/src/config/components/table/PermissionRoleTable.js b/scm-ui/src/config/components/table/PermissionRoleTable.js index 436fa2e1d5..3c9dde1cc5 100644 --- a/scm-ui/src/config/components/table/PermissionRoleTable.js +++ b/scm-ui/src/config/components/table/PermissionRoleTable.js @@ -5,6 +5,7 @@ import type { Role } from "@scm-manager/ui-types"; import PermissionRoleRow from "./PermissionRoleRow"; type Props = { + baseUrl: string, roles: Role[], t: string => string @@ -12,18 +13,20 @@ type Props = { class PermissionRoleTable extends React.Component { render() { - const { roles, t } = this.props; + const { baseUrl, roles, t } = this.props; return ( - - - + + + - {roles.map((role, index) => { - return ; - })} + {roles.map((role, index) => { + return ( + + ); + })}
{t("role.form.name")}
{t("role.form.name")}
); diff --git a/scm-ui/src/config/containers/Config.js b/scm-ui/src/config/containers/Config.js index 388b9650d7..53dc62f144 100644 --- a/scm-ui/src/config/containers/Config.js +++ b/scm-ui/src/config/containers/Config.js @@ -51,7 +51,11 @@ class Config extends React.Component { ( + + )} /> { } renderPermissionsTable() { - const { roles, list, page, t } = this.props; + const { baseUrl, roles, list, page, t } = this.props; if (roles && roles.length > 0) { return ( <> - + ); @@ -115,7 +116,7 @@ const mapDispatchToProps = dispatch => { }; }; -export default connect( +export default withRouter(connect( mapStateToProps, mapDispatchToProps -)(translate("config")(GlobalPermissionRoles)); +)(translate("config")(GlobalPermissionRoles)));