mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
added baseUrl for info link
This commit is contained in:
@@ -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<Props> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { role } = this.props;
|
||||
const to = `./${encodeURIComponent(role.name)}/info`;
|
||||
const { baseUrl, role } = this.props;
|
||||
const to = `${baseUrl}/${encodeURIComponent(role.name)}/info`;
|
||||
return (
|
||||
<tr>
|
||||
<td>{this.renderLink(to, role.name)}</td>
|
||||
|
||||
@@ -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,7 +13,7 @@ type Props = {
|
||||
|
||||
class PermissionRoleTable extends React.Component<Props> {
|
||||
render() {
|
||||
const { roles, t } = this.props;
|
||||
const { baseUrl, roles, t } = this.props;
|
||||
return (
|
||||
<table className="card-table table is-hoverable is-fullwidth">
|
||||
<thead>
|
||||
@@ -22,7 +23,9 @@ class PermissionRoleTable extends React.Component<Props> {
|
||||
</thead>
|
||||
<tbody>
|
||||
{roles.map((role, index) => {
|
||||
return <PermissionRoleRow key={index} role={role} />;
|
||||
return (
|
||||
<PermissionRoleRow key={index} baseUrl={baseUrl} role={role} />
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -51,7 +51,11 @@ class Config extends React.Component<Props> {
|
||||
<Route
|
||||
path={`${url}/roles`}
|
||||
exact
|
||||
component={GlobalPermissionRoles}
|
||||
render={() => (
|
||||
<GlobalPermissionRoles
|
||||
baseUrl={`${url}/roles`}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<ExtensionPoint
|
||||
name="config.route"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// @flow
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import {withRouter} from "react-router-dom";
|
||||
import { translate } from "react-i18next";
|
||||
import type { History } from "history";
|
||||
import type { Role, PagedCollection } from "@scm-manager/ui-types";
|
||||
@@ -22,8 +23,8 @@ import {
|
||||
} from "@scm-manager/ui-components";
|
||||
import PermissionRoleTable from "../components/table/PermissionRoleTable";
|
||||
import { getRolesLink } from "../../modules/indexResource";
|
||||
|
||||
type Props = {
|
||||
baseUrl: string,
|
||||
roles: Role[],
|
||||
loading: boolean,
|
||||
error: Error,
|
||||
@@ -63,11 +64,11 @@ class GlobalPermissionRoles extends React.Component<Props> {
|
||||
}
|
||||
|
||||
renderPermissionsTable() {
|
||||
const { roles, list, page, t } = this.props;
|
||||
const { baseUrl, roles, list, page, t } = this.props;
|
||||
if (roles && roles.length > 0) {
|
||||
return (
|
||||
<>
|
||||
<PermissionRoleTable roles={roles} />
|
||||
<PermissionRoleTable baseUrl={baseUrl} roles={roles} />
|
||||
<LinkPaginator collection={list} page={page} />
|
||||
</>
|
||||
);
|
||||
@@ -115,7 +116,7 @@ const mapDispatchToProps = dispatch => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(
|
||||
export default withRouter(connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(translate("config")(GlobalPermissionRoles));
|
||||
)(translate("config")(GlobalPermissionRoles)));
|
||||
|
||||
Reference in New Issue
Block a user