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 // context objects
t: string => string, t: string => string,
history: History, history: History,
location: any,
// dispatch functions // dispatch functions
fetchRolesByPage: (link: string, page: number, filter?: string) => void fetchRolesByPage: (link: string, page: number) => void
}; };
class GlobalPermissionRoles extends React.Component<Props> { class GlobalPermissionRoles extends React.Component<Props> {
componentDidMount() { componentDidMount() {
const { fetchRolesByPage, rolesLink, page, location } = this.props; const { fetchRolesByPage, rolesLink, page } = this.props;
fetchRolesByPage( fetchRolesByPage(rolesLink, page);
rolesLink,
page,
urls.getQueryStringFromLocation(location)
);
} }
render() { render() {
@@ -68,28 +63,24 @@ class GlobalPermissionRoles extends React.Component<Props> {
} }
renderPermissionsTable() { renderPermissionsTable() {
const { roles, list, page, location, t } = this.props; const { roles, list, page, t } = this.props;
if (roles && roles.length > 0) { if (roles && roles.length > 0) {
return ( return (
<> <>
<PermissionRoleTable roles={roles} /> <PermissionRoleTable roles={roles} />
<LinkPaginator <LinkPaginator collection={list} page={page} />
collection={list}
page={page}
filter={urls.getQueryStringFromLocation(location)}
/>
</> </>
); );
} }
return <Notification type="info">{t("roles.noPermissionRoles")}</Notification>; return (
<Notification type="info">{t("roles.noPermissionRoles")}</Notification>
);
} }
renderCreateButton() { renderCreateButton() {
const { canAddRoles, t } = this.props; const { canAddRoles, t } = this.props;
if (canAddRoles) { if (canAddRoles) {
return ( return <CreateButton label={t("roles.createButton")} link="/create" />;
<CreateButton label={t("roles.createButton")} link="/create" />
);
} }
return null; return null;
} }
@@ -118,8 +109,8 @@ const mapStateToProps = (state, ownProps) => {
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { return {
fetchRolesByPage: (link: string, page: number, filter?: string) => { fetchRolesByPage: (link: string, page: number) => {
dispatch(fetchRolesByPage(link, page, filter)); 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_SUCCESS = `${DELETE_ROLE}_${types.SUCCESS_SUFFIX}`;
export const DELETE_ROLE_FAILURE = `${DELETE_ROLE}_${types.FAILURE_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 // fetch roles
export function fetchRolesPending(): Action { 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 { export function modifyRolePending(role: Role): Action {
return { return {
type: MODIFY_ROLE_PENDING, type: MODIFY_ROLE_PENDING,
@@ -371,7 +371,10 @@ function byNamesReducer(state: any = {}, action: any = {}) {
return reducerByName(state, action.payload.name, action.payload); return reducerByName(state, action.payload.name, action.payload);
case DELETE_ROLE_SUCCESS: case DELETE_ROLE_SUCCESS:
return deleteRoleInRolesByNames(state, action.payload.name); return deleteRoleInRolesByNames(
state,
action.payload.name
);
default: default:
return state; return state;
@@ -404,7 +407,7 @@ export const selectListAsCollection = (state: Object): PagedCollection => {
}; };
export const isPermittedToCreateRoles = (state: Object): boolean => { export const isPermittedToCreateRoles = (state: Object): boolean => {
return selectListEntry(state).roleCreatePermission; return !!selectListEntry(state).roleCreatePermission;
}; };
export function getRolesFromState(state: Object) { export function getRolesFromState(state: Object) {