mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
update RepositoryRoleDetailsView
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
//@flow
|
|
||||||
import React from "react";
|
|
||||||
import { translate } from "react-i18next";
|
|
||||||
import type { Role } from "@scm-manager/ui-types";
|
|
||||||
import SystemRoleTag from "./SystemRoleTag";
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
role: Role,
|
|
||||||
|
|
||||||
// context props
|
|
||||||
t: string => string,
|
|
||||||
};
|
|
||||||
|
|
||||||
class PermissionRoleDetail extends React.Component<Props> {
|
|
||||||
render() {
|
|
||||||
const { role, t } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="media">
|
|
||||||
<div className="media-content subtitle">
|
|
||||||
<strong>{t("role.name")}:</strong> {role.name}{" "}
|
|
||||||
<SystemRoleTag system={!role._links.update} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default translate("config")(PermissionRoleDetail);
|
|
||||||
37
scm-ui/src/config/roles/components/PermissionRoleDetails.js
Normal file
37
scm-ui/src/config/roles/components/PermissionRoleDetails.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
//@flow
|
||||||
|
import React from "react";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
import type { Role } from "@scm-manager/ui-types";
|
||||||
|
import ExtensionPoint from "@scm-manager/ui-extensions/lib/ExtensionPoint";
|
||||||
|
import PermissionRoleDetailsTable from "./PermissionRoleDetailsTable";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
role: Role,
|
||||||
|
|
||||||
|
// context props
|
||||||
|
t: string => string,
|
||||||
|
};
|
||||||
|
|
||||||
|
class PermissionRoleDetails extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { role } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<PermissionRoleDetailsTable role={role}/>
|
||||||
|
<hr/>
|
||||||
|
<div className="content">
|
||||||
|
<ExtensionPoint
|
||||||
|
name="roles.repositoryRole-details.information"
|
||||||
|
renderAll={true}
|
||||||
|
props={{ role }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translate("roles")(PermissionRoleDetails);
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
//@flow
|
||||||
|
import React from "react";
|
||||||
|
import type { Role } from "@scm-manager/ui-types";
|
||||||
|
import { translate } from "react-i18next";
|
||||||
|
import { compose } from "redux";
|
||||||
|
import injectSheet from "react-jss";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
role: Role,
|
||||||
|
// context props
|
||||||
|
t: string => string
|
||||||
|
};
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
spacing: {
|
||||||
|
padding: "0 !important"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class PermissionRoleDetailsTable extends React.Component<Props> {
|
||||||
|
render() {
|
||||||
|
const { role, t } = this.props;
|
||||||
|
return (
|
||||||
|
<table className="table content">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th>{t("repositoryRole.name")}</th>
|
||||||
|
<td>{role.name}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>{t("repositoryRole.type")}</th>
|
||||||
|
<td>{role.type}</td>
|
||||||
|
</tr>
|
||||||
|
{this.renderVerbs()}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderVerbs() {
|
||||||
|
const { role, t, classes } = this.props;
|
||||||
|
|
||||||
|
let verbs = null;
|
||||||
|
if (role.verbs.length > 0) {
|
||||||
|
verbs = (
|
||||||
|
<tr>
|
||||||
|
<th>{t("repositoryRole.verbs")}</th>
|
||||||
|
<td className={classes.spacing}>
|
||||||
|
<ul>
|
||||||
|
{role.verbs.map(verb => {
|
||||||
|
return <li>{verb}</li>;
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return verbs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default compose(
|
||||||
|
injectSheet(styles),
|
||||||
|
translate("roles")
|
||||||
|
)(PermissionRoleDetailsTable);
|
||||||
@@ -1,22 +1,24 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {
|
import {Loading, ErrorPage, Title} from "@scm-manager/ui-components";
|
||||||
Page,
|
|
||||||
Loading,
|
|
||||||
ErrorPage
|
|
||||||
} from "@scm-manager/ui-components";
|
|
||||||
import { Route } from "react-router";
|
import { Route } from "react-router";
|
||||||
import type { History } from "history";
|
import type { History } from "history";
|
||||||
import { EditRepositoryRoleNavLink, RepositoryRoleDetailNavLink } from "../../components/navLinks";
|
import {
|
||||||
|
EditRepositoryRoleNavLink,
|
||||||
|
} from "../../components/navLinks";
|
||||||
import { translate } from "react-i18next";
|
import { translate } from "react-i18next";
|
||||||
import type { Role } from "@scm-manager/ui-types";
|
import type { Role } from "@scm-manager/ui-types";
|
||||||
import {getRepositoryRolesLink} from "../../../modules/indexResource";
|
import { getRepositoryRolesLink } from "../../../modules/indexResource";
|
||||||
import {ExtensionPoint} from "@scm-manager/ui-extensions";
|
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||||
import {fetchRoleByName, getFetchRoleFailure, getRoleByName, isFetchRolePending} from "../modules/roles";
|
import {
|
||||||
import RepositoryRoleForm from "./RepositoryRoleForm";
|
fetchRoleByName,
|
||||||
import {withRouter} from "react-router-dom";
|
getFetchRoleFailure,
|
||||||
import PermissionRoleDetail from "../components/PermissionRoleDetail";
|
getRoleByName,
|
||||||
|
isFetchRolePending
|
||||||
|
} from "../modules/roles";
|
||||||
|
import { withRouter } from "react-router-dom";
|
||||||
|
import PermissionRoleDetail from "../components/PermissionRoleDetails";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
roleName: string,
|
roleName: string,
|
||||||
@@ -37,8 +39,11 @@ type Props = {
|
|||||||
|
|
||||||
class SingleRepositoryRole extends React.Component<Props> {
|
class SingleRepositoryRole extends React.Component<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.fetchRoleByName(this.props.repositoryRolesLink, this.props.roleName);
|
this.props.fetchRoleByName(
|
||||||
console.log(this.props.match)
|
this.props.repositoryRolesLink,
|
||||||
|
this.props.roleName
|
||||||
|
);
|
||||||
|
console.log(this.props.match);
|
||||||
}
|
}
|
||||||
|
|
||||||
stripEndingSlash = (url: string) => {
|
stripEndingSlash = (url: string) => {
|
||||||
@@ -77,22 +82,26 @@ class SingleRepositoryRole extends React.Component<Props> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page title={role.displayName}>
|
<>
|
||||||
|
<Title title={t("repositoryRoles.title")}/>
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-three-quarters">
|
<div className="column is-three-quarters">
|
||||||
<Route path={url} component={() => <PermissionRoleDetail role={role} />} />
|
<Route
|
||||||
|
path={url}
|
||||||
|
component={() => <PermissionRoleDetail role={role} />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path={`${url}/settings/general`}
|
path={`${url}/settings/general`}
|
||||||
component={() => <EditRepositoryRoleNavLink role={role} />}
|
component={() => <EditRepositoryRoleNavLink role={role} />}
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="user.route"
|
name="roles.route"
|
||||||
props={extensionProps}
|
props={extensionProps}
|
||||||
renderAll={true}
|
renderAll={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Page>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +129,9 @@ const mapDispatchToProps = dispatch => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withRouter(connect(
|
export default withRouter(
|
||||||
|
connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps
|
mapDispatchToProps
|
||||||
)(translate("users")(SingleRepositoryRole)));
|
)(translate("config")(SingleRepositoryRole))
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user