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

@@ -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<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));
}
};
};