diff --git a/scm-ui/src/config/containers/GlobalPermissionRoles.js b/scm-ui/src/config/containers/GlobalPermissionRoles.js index 63c8385daa..e9fb0bb47f 100644 --- a/scm-ui/src/config/containers/GlobalPermissionRoles.js +++ b/scm-ui/src/config/containers/GlobalPermissionRoles.js @@ -3,7 +3,7 @@ import React from "react"; import { connect } from "react-redux"; import { translate } from "react-i18next"; import type { History } from "history"; -import type {Role, PagedCollection} from "@scm-manager/ui-types"; +import type { Role, PagedCollection } from "@scm-manager/ui-types"; import { fetchRolesByPage, getRolesFromState, @@ -35,20 +35,15 @@ type Props = { // context objects t: string => string, history: History, - location: any, // dispatch functions - fetchRolesByPage: (link: string, page: number, filter?: string) => void + fetchRolesByPage: (link: string, page: number) => void }; class GlobalPermissionRoles extends React.Component { componentDidMount() { - const { fetchRolesByPage, rolesLink, page, location } = this.props; - fetchRolesByPage( - rolesLink, - page, - urls.getQueryStringFromLocation(location) - ); + const { fetchRolesByPage, rolesLink, page } = this.props; + fetchRolesByPage(rolesLink, page); } render() { @@ -68,28 +63,24 @@ class GlobalPermissionRoles extends React.Component { } renderPermissionsTable() { - const { roles, list, page, location, t } = this.props; + const { roles, list, page, t } = this.props; if (roles && roles.length > 0) { return ( <> - + ); } - return {t("roles.noPermissionRoles")}; + return ( + {t("roles.noPermissionRoles")} + ); } renderCreateButton() { const { canAddRoles, t } = this.props; if (canAddRoles) { - return ( - - ); + return ; } return null; } @@ -118,8 +109,8 @@ const mapStateToProps = (state, ownProps) => { const mapDispatchToProps = dispatch => { return { - fetchRolesByPage: (link: string, page: number, filter?: string) => { - dispatch(fetchRolesByPage(link, page, filter)); + fetchRolesByPage: (link: string, page: number) => { + dispatch(fetchRolesByPage(link, page)); } }; }; diff --git a/scm-ui/src/config/modules/roles.js b/scm-ui/src/config/modules/roles.js index af81190bb4..7ea871ff09 100644 --- a/scm-ui/src/config/modules/roles.js +++ b/scm-ui/src/config/modules/roles.js @@ -33,7 +33,7 @@ export const DELETE_ROLE_PENDING = `${DELETE_ROLE}_${types.PENDING_SUFFIX}`; export const DELETE_ROLE_SUCCESS = `${DELETE_ROLE}_${types.SUCCESS_SUFFIX}`; export const DELETE_ROLE_FAILURE = `${DELETE_ROLE}_${types.FAILURE_SUFFIX}`; -const CONTENT_TYPE_ROLE = "application/vnd.scmm-role+json;v=2"; +const CONTENT_TYPE_ROLE = "application/vnd.scmm-repositoryRole+json;v=2"; // fetch roles export function fetchRolesPending(): Action { @@ -184,7 +184,7 @@ export function createRole(link: string, role: Role, callback?: () => void) { }; } -// modify group +// modify role export function modifyRolePending(role: Role): Action { return { type: MODIFY_ROLE_PENDING, @@ -371,7 +371,10 @@ function byNamesReducer(state: any = {}, action: any = {}) { return reducerByName(state, action.payload.name, action.payload); case DELETE_ROLE_SUCCESS: - return deleteRoleInRolesByNames(state, action.payload.name); + return deleteRoleInRolesByNames( + state, + action.payload.name + ); default: return state; @@ -404,7 +407,7 @@ export const selectListAsCollection = (state: Object): PagedCollection => { }; export const isPermittedToCreateRoles = (state: Object): boolean => { - return selectListEntry(state).roleCreatePermission; + return !!selectListEntry(state).roleCreatePermission; }; export function getRolesFromState(state: Object) {