diff --git a/scm-ui-components/packages/ui-components/src/buttons/Button.js b/scm-ui-components/packages/ui-components/src/buttons/Button.js index 2102bb540a..5e80db1e45 100644 --- a/scm-ui-components/packages/ui-components/src/buttons/Button.js +++ b/scm-ui-components/packages/ui-components/src/buttons/Button.js @@ -12,6 +12,8 @@ export type ButtonProps = { fullWidth?: boolean, className?: string, children?: React.Node, + + // context props classes: any }; diff --git a/scm-ui-components/packages/ui-types/src/RepositoryPermissions.js b/scm-ui-components/packages/ui-types/src/RepositoryPermissions.js index ed3c925283..14a2298fbe 100644 --- a/scm-ui-components/packages/ui-types/src/RepositoryPermissions.js +++ b/scm-ui-components/packages/ui-types/src/RepositoryPermissions.js @@ -1,14 +1,15 @@ //@flow import type {Links} from "./hal"; +export type PermissionCreateEntry = { + name: string, + role?: string, + verbs?: string[], + groupPermission: boolean +} + export type Permission = PermissionCreateEntry & { _links: Links }; -export type PermissionCreateEntry = { - name: string, - verbs: string[], - groupPermission: boolean -} - export type PermissionCollection = Permission[]; diff --git a/scm-ui-components/packages/ui-types/src/RepositoryRole.js b/scm-ui-components/packages/ui-types/src/RepositoryRole.js index 8b8ffc933f..195bdfe05c 100644 --- a/scm-ui-components/packages/ui-types/src/RepositoryRole.js +++ b/scm-ui-components/packages/ui-types/src/RepositoryRole.js @@ -1,10 +1,13 @@ // @flow +import type {Links} from "./hal"; + export type RepositoryRole = { name: string, verbs: string[], type?: string, creationDate?: string, lastModified?: string, + _links: Links }; diff --git a/scm-ui-components/packages/ui-types/src/Role.js b/scm-ui-components/packages/ui-types/src/Role.js deleted file mode 100644 index 00e794b886..0000000000 --- a/scm-ui-components/packages/ui-types/src/Role.js +++ /dev/null @@ -1,12 +0,0 @@ -//@flow - -import type { Links } from "./hal"; - -export type Role = { - name: string, - verbs: string[], - creationDate?: number, - lastModified?: number, - system: boolean, - _links: Links -}; diff --git a/scm-ui-components/packages/ui-types/src/index.js b/scm-ui-components/packages/ui-types/src/index.js index 0272b1e2cb..4024710300 100644 --- a/scm-ui-components/packages/ui-types/src/index.js +++ b/scm-ui-components/packages/ui-types/src/index.js @@ -16,7 +16,6 @@ export type { Changeset } from "./Changesets"; export type { Tag } from "./Tags"; export type { Config } from "./Config"; -export type { Role } from "./Role"; export type { IndexResources } from "./IndexResources"; diff --git a/scm-ui/public/locales/de/config.json b/scm-ui/public/locales/de/config.json index cfa610042f..71ab66ff22 100644 --- a/scm-ui/public/locales/de/config.json +++ b/scm-ui/public/locales/de/config.json @@ -6,12 +6,22 @@ "errorTitle": "Fehler", "errorSubtitle": "Unbekannter Einstellungen Fehler" }, - "roles": { + "repositoryRole": { "navLink": "Berechtigungsrollen", "title": "Berechtigungsrollen", "noPermissionRoles": "Keine Berechtigungsrollen gefunden.", "system": "System", "createButton": "Berechtigungsrolle erstellen", + "name": "Name", + "type": "Typ", + "verbs": "Verben", + "button": { + "edit": "Bearbeiten" + }, + "create": { + "name": "Name" + }, + "edit": "Berechtigungsrolle bearbeiten", "form": { "subtitle": "Berechtigungsrolle bearbeiten", "name": "Name", @@ -19,6 +29,10 @@ "submit": "Speichern" } }, + "role": { + "name": "Name", + "system": "System" + }, "config-form": { "submit": "Speichern", "submit-success-notification": "Einstellungen wurden erfolgreich geƤndert!", diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index f4ee071613..4ba7a725e6 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -119,6 +119,7 @@ "error-subtitle": "Unbekannter Fehler bei Berechtigung", "name": "Benutzer oder Gruppe", "role": "Rolle", + "custom": "CUSTOM", "permissions": "Berechtigung", "group-permission": "Gruppenberechtigung", "user-permission": "Benutzerberechtigung", diff --git a/scm-ui/public/locales/en/config.json b/scm-ui/public/locales/en/config.json index e4ecc39874..bdb245544a 100644 --- a/scm-ui/public/locales/en/config.json +++ b/scm-ui/public/locales/en/config.json @@ -6,11 +6,22 @@ "errorTitle": "Error", "errorSubtitle": "Unknown Config Error" }, - "roles": { + "repositoryRole": { "navLink": "Permission Roles", "title": "Permission Roles", "noPermissionRoles": "No permission roles found.", + "system": "System", "createButton": "Create Permission Role", + "name": "Name", + "type": "Type", + "verbs": "Verbs", + "edit": "Edit Permission Role", + "button": { + "edit": "Edit" + }, + "create": { + "name": "Name" + }, "form": { "subtitle": "Edit Permission Role", "name": "Name", diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 7344547d49..9a2e83f983 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -122,6 +122,7 @@ "error-subtitle": "Unknown permissions error", "name": "User or group", "role": "Role", + "custom": "CUSTOM", "permissions": "Permissions", "group-permission": "Group Permission", "user-permission": "User Permission", diff --git a/scm-ui/src/config/containers/Config.js b/scm-ui/src/config/containers/Config.js index c405d7b164..496dce4611 100644 --- a/scm-ui/src/config/containers/Config.js +++ b/scm-ui/src/config/containers/Config.js @@ -1,7 +1,7 @@ // @flow import React from "react"; import { translate } from "react-i18next"; -import { Route } from "react-router"; +import { Route, Switch } from "react-router-dom"; import { ExtensionPoint } from "@scm-manager/ui-extensions"; import type { History } from "history"; import { connect } from "react-redux"; @@ -10,9 +10,9 @@ import type { Links } from "@scm-manager/ui-types"; import { Page, Navigation, NavLink, Section } from "@scm-manager/ui-components"; import { getLinks } from "../../modules/indexResource"; import GlobalConfig from "./GlobalConfig"; -import PermissionRolesOverview from "../roles/containers/PermissionRolesOverview"; -import PermissionRoleRoot from "../roles/containers/PermissionRoleRoot"; -import CreatePermissionRole from "../roles/containers/CreatePermissionRole"; +import RepositoryRoles from "../roles/containers/RepositoryRoles"; +import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole"; +import CreateRepositoryRole from "../roles/containers/CreateRepositoryRole"; type Props = { links: Links, @@ -37,7 +37,7 @@ class Config extends React.Component { matchesRoles = (route: any) => { const url = this.matchedUrl(); - const regex = new RegExp(`${url}/role/.+/info`); + const regex = new RegExp(`${url}/role/`); return route.location.pathname.match(regex); }; @@ -54,25 +54,44 @@ class Config extends React.Component {
- - } - /> - } - /> - } - /> - + + + ( + + )} + /> + } + /> + ( + + )} + /> + ( + + )} + /> + +
@@ -83,9 +102,8 @@ class Config extends React.Component { /> string +}; + +const styles = { + spacing: { + padding: "0 !important" + } +}; + +class AvailableVerbs extends React.Component { + render() { + const { role, t, classes } = this.props; + + let verbs = null; + if (role.verbs.length > 0) { + verbs = ( + + +
    + {role.verbs.map(verb => { + return ( +
  • {t("verbs.repository." + verb + ".displayName")}
  • + ); + })} +
+ + + ); + } + return verbs; + } +} + +export default compose( + injectSheet(styles), + translate("plugins") +)(AvailableVerbs); diff --git a/scm-ui/src/config/roles/components/PermissionRoleDetail.js b/scm-ui/src/config/roles/components/PermissionRoleDetail.js deleted file mode 100644 index 496443eef2..0000000000 --- a/scm-ui/src/config/roles/components/PermissionRoleDetail.js +++ /dev/null @@ -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 { - render() { - const { role, t } = this.props; - - return ( -
-
- {t("role.name")}: {role.name}{" "} - -
-
- ); - } -} - -export default translate("config")(PermissionRoleDetail); diff --git a/scm-ui/src/config/roles/components/PermissionRoleDetails.js b/scm-ui/src/config/roles/components/PermissionRoleDetails.js new file mode 100644 index 0000000000..1977ddde2a --- /dev/null +++ b/scm-ui/src/config/roles/components/PermissionRoleDetails.js @@ -0,0 +1,52 @@ +//@flow +import React from "react"; +import { translate } from "react-i18next"; +import type { RepositoryRole } from "@scm-manager/ui-types"; +import ExtensionPoint from "@scm-manager/ui-extensions/lib/ExtensionPoint"; +import PermissionRoleDetailsTable from "./PermissionRoleDetailsTable"; +import { Button, Subtitle } from "@scm-manager/ui-components"; + +type Props = { + role: RepositoryRole, + url: string, + + // context props + t: string => string +}; + +class PermissionRoleDetails extends React.Component { + renderEditButton() { + const { t, url } = this.props; + if (!!this.props.role._links.update) { + return ( +