diff --git a/scm-ui/src/config/components/SystemRoleTag.js b/scm-ui/src/config/components/SystemRoleTag.js new file mode 100644 index 0000000000..735d4a84af --- /dev/null +++ b/scm-ui/src/config/components/SystemRoleTag.js @@ -0,0 +1,35 @@ +//@flow +import React from "react"; +import injectSheet from "react-jss"; +import classNames from "classnames"; +import { translate } from "react-i18next"; + +type Props = { + system?: boolean, + classes: any, + t: string => string +}; + +const styles = { + tag: { + marginLeft: "0.75rem", + verticalAlign: "inherit" + } +}; + +class SystemRoleTag extends React.Component { + render() { + const { system, classes, t } = this.props; + + if (system) { + return ( + + {t("roles.system")} + + ); + } + return null; + } +} + +export default injectSheet(styles)(translate("config")(SystemRoleTag)); diff --git a/scm-ui/src/config/components/table/PermissionRoleRow.js b/scm-ui/src/config/components/table/PermissionRoleRow.js index f42627540c..f556387abf 100644 --- a/scm-ui/src/config/components/table/PermissionRoleRow.js +++ b/scm-ui/src/config/components/table/PermissionRoleRow.js @@ -2,6 +2,7 @@ import React from "react"; import { Link } from "react-router-dom"; import type { Role } from "@scm-manager/ui-types"; +import SystemRoleTag from "../SystemRoleTag"; type Props = { baseUrl: string, @@ -9,8 +10,15 @@ type Props = { }; class PermissionRoleRow extends React.Component { - renderLink(to: string, label: string) { - return {label}; + renderLink(to: string, label: string, system?: boolean) { + if (!system) { + return {label}; + } + return ( + <> + {label} + + ); } render() { @@ -18,7 +26,7 @@ class PermissionRoleRow extends React.Component { const to = `${baseUrl}/${encodeURIComponent(role.name)}/edit`; return ( - {this.renderLink(to, role.name)} + {this.renderLink(to, role.name, !role._links.update)} ); }