added no repositories found notification

This commit is contained in:
Florian Scholdei
2019-04-09 14:47:37 +02:00
parent a4ee29d8e5
commit 24da17e0a9
4 changed files with 25 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ import {
PageActions,
Button,
CreateButton,
Notification,
Paginator
} from "@scm-manager/ui-components";
import RepositoryList from "../components/list";
@@ -72,19 +73,34 @@ class Overview extends React.Component<Props> {
loading={loading}
error={error}
>
{this.renderList()}
{this.renderOverview()}
{this.renderPageActionCreateButton()}
</Page>
);
}
renderList() {
const { collection, fetchReposByLink } = this.props;
renderRepositoryList() {
const { collection, fetchReposByLink, t } = this.props;
if (collection._embedded && collection._embedded.repositories.length > 0) {
return (
<>
<RepositoryList repositories={collection._embedded.repositories} />
<Paginator collection={collection} onPageChange={fetchReposByLink} />
</>
);
}
return (
<Notification type="info">{t("overview.noRepositories")}</Notification>
);
}
renderOverview() {
const { collection } = this.props;
if (collection) {
return (
<div>
<RepositoryList repositories={collection._embedded.repositories} />
<Paginator collection={collection} onPageChange={fetchReposByLink} />
{this.renderRepositoryList()}
{this.renderCreateButton()}
</div>
);