mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
add permissions to menu of repository
This commit is contained in:
23
scm-ui/src/repos/components/PermissionsNavLink.js
Normal file
23
scm-ui/src/repos/components/PermissionsNavLink.js
Normal file
@@ -0,0 +1,23 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { NavLink } from "../../components/navigation";
|
||||
import { translate } from "react-i18next";
|
||||
import type { Repository } from "../types/Repositories";
|
||||
|
||||
type Props = { permissionUrl: string, t: string => string, repository: Repository };
|
||||
|
||||
class PermissionsNavLink extends React.Component<Props> {
|
||||
hasPermissionsLink = () => {
|
||||
return this.props.repository._links.permissions;
|
||||
};
|
||||
render() {
|
||||
if (!this.hasPermissionsLink()) {
|
||||
return null;
|
||||
}
|
||||
const { permissionUrl, t } = this.props;
|
||||
return <NavLink to={permissionUrl} label={t("repository-root.permissions")}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("repos")(PermissionsNavLink);
|
||||
Reference in New Issue
Block a user