added no groups found notification

This commit is contained in:
Florian Scholdei
2019-04-09 14:36:29 +02:00
parent dcf6dfffcf
commit a4ee29d8e5
3 changed files with 22 additions and 11 deletions

View File

@@ -10,7 +10,8 @@
},
"groups": {
"title": "Gruppen",
"subtitle": "Verwaltung der Gruppen"
"subtitle": "Verwaltung der Gruppen",
"noGroups": "Keine Gruppen gefunden."
},
"singleGroup": {
"errorTitle": "Fehler",

View File

@@ -10,7 +10,8 @@
},
"groups": {
"title": "Groups",
"subtitle": "Create, read, update and delete groups"
"subtitle": "Create, read, update and delete groups",
"noGroups": "No groups found."
},
"singleGroup": {
"errorTitle": "Error",

View File

@@ -24,6 +24,7 @@ import {
selectListAsCollection
} from "../modules/groups";
import { getGroupsLink } from "../../modules/indexResource";
import Notification from "@scm-manager/ui-components/src/Notification";
type Props = {
groups: Group[],
@@ -75,14 +76,26 @@ class Groups extends React.Component<Props> {
loading={loading || !groups}
error={error}
>
<GroupTable groups={groups} />
{this.renderPaginator()}
{this.renderGroupTable()}
{this.renderCreateButton()}
{this.renderPageActionCreateButton()}
</Page>
);
}
renderGroupTable() {
const { groups, t } = this.props;
if (groups && groups.length > 0) {
return (
<>
<GroupTable groups={groups} />
{this.renderPaginator()}
</>
);
}
return <Notification type="info">{t("groups.noGroups")}</Notification>;
}
renderPaginator() {
const { list } = this.props;
if (list) {
@@ -93,12 +106,9 @@ class Groups extends React.Component<Props> {
renderCreateButton() {
if (this.props.canAddGroups) {
return (
<CreateGroupButton />
);
} else {
return;
return <CreateGroupButton />;
}
return null;
}
renderPageActionCreateButton() {
@@ -112,9 +122,8 @@ class Groups extends React.Component<Props> {
/>
</PageActions>
);
} else {
return;
}
return null;
}
}