added no users found notification

This commit is contained in:
Florian Scholdei
2019-04-09 14:59:19 +02:00
parent 24da17e0a9
commit a05fa8d46f
3 changed files with 18 additions and 3 deletions

View File

@@ -24,6 +24,7 @@
"users": { "users": {
"title": "Benutzer", "title": "Benutzer",
"subtitle": "Verwaltung der Benutzer", "subtitle": "Verwaltung der Benutzer",
"noUsers": "Keine Benutzer gefunden.",
"createButton": "Benutzer erstellen" "createButton": "Benutzer erstellen"
}, },
"singleUser": { "singleUser": {

View File

@@ -24,6 +24,7 @@
"users": { "users": {
"title": "Users", "title": "Users",
"subtitle": "Create, read, update and delete users", "subtitle": "Create, read, update and delete users",
"noUsers": "No users found.",
"createButton": "Create User" "createButton": "Create User"
}, },
"singleUser": { "singleUser": {

View File

@@ -19,7 +19,8 @@ import {
PageActions, PageActions,
Button, Button,
CreateButton, CreateButton,
Paginator Paginator,
Notification
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import { UserTable } from "./../components/table"; import { UserTable } from "./../components/table";
import type { User, PagedCollection } from "@scm-manager/ui-types"; import type { User, PagedCollection } from "@scm-manager/ui-types";
@@ -75,14 +76,26 @@ class Users extends React.Component<Props> {
loading={loading || !users} loading={loading || !users}
error={error} error={error}
> >
<UserTable users={users} /> {this.renderUserTable()}
{this.renderPaginator()}
{this.renderCreateButton()} {this.renderCreateButton()}
{this.renderPageActionCreateButton()} {this.renderPageActionCreateButton()}
</Page> </Page>
); );
} }
renderUserTable() {
const { users, t } = this.props;
if (users && users.length > 0) {
return (
<>
<UserTable users={users} />
{this.renderPaginator()}
</>
);
}
return <Notification type="info">{t("users.noUsers")}</Notification>;
}
renderPaginator() { renderPaginator() {
const { list } = this.props; const { list } = this.props;
if (list) { if (list) {