2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
2019-10-23 15:47:08 +02:00
|
|
|
import { WithTranslation, withTranslation } from "react-i18next";
|
2019-10-20 18:02:52 +02:00
|
|
|
import { Repository } from "@scm-manager/ui-types";
|
2019-10-23 15:47:08 +02:00
|
|
|
import { NavLink } from "@scm-manager/ui-components";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
type Props = WithTranslation & {
|
2019-10-19 16:38:07 +02:00
|
|
|
permissionUrl: 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;
|
2019-10-21 10:57:56 +02:00
|
|
|
return <NavLink to={permissionUrl} label={t("repositoryRoot.menu.permissionsNavLink")} />;
|
2019-10-19 16:38:07 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-23 15:47:08 +02:00
|
|
|
export default withTranslation("repos")(PermissionsNavLink);
|