corrected content type + removed unsupported filter

This commit is contained in:
Florian Scholdei
2019-05-09 14:55:28 +02:00
parent 96fcb55c65
commit 7db1e4aad0
2 changed files with 19 additions and 25 deletions

View File

@@ -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<Props> {
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<Props> {
}
renderPermissionsTable() {
const { roles, list, page, location, t } = this.props;
const { roles, list, page, t } = this.props;
if (roles && roles.length > 0) {
return (
<>
<PermissionRoleTable roles={roles} />
<LinkPaginator
collection={list}
page={page}
filter={urls.getQueryStringFromLocation(location)}
/>
<LinkPaginator collection={list} page={page} />
</>
);
}
return <Notification type="info">{t("roles.noPermissionRoles")}</Notification>;
return (
<Notification type="info">{t("roles.noPermissionRoles")}</Notification>
);
}
renderCreateButton() {
const { canAddRoles, t } = this.props;
if (canAddRoles) {
return (
<CreateButton label={t("roles.createButton")} link="/create" />
);
return <CreateButton label={t("roles.createButton")} link="/create" />;
}
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));
}
};
};

View File

@@ -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) {