added no branches found notification

This commit is contained in:
Florian Scholdei
2019-04-09 15:06:55 +02:00
parent a05fa8d46f
commit df7c915363
3 changed files with 14 additions and 4 deletions

View File

@@ -47,6 +47,7 @@
"branches": {
"overview": {
"title": "Übersicht aller verfügbaren Branches",
"noBranches": "Keine Branches gefunden.",
"createButton": "Branch erstellen"
},
"table": {

View File

@@ -47,6 +47,7 @@
"branches": {
"overview": {
"title": "Overview of all branches",
"noBranches": "No branches found.",
"createButton": "Create Branch"
},
"table": {

View File

@@ -16,6 +16,7 @@ import {
CreateButton,
ErrorNotification,
Loading,
Notification,
Subtitle
} from "@scm-manager/ui-components";
import BranchTable from "../components/BranchTable";
@@ -44,7 +45,7 @@ class BranchesOverview extends React.Component<Props> {
}
render() {
const { baseUrl, loading, error, branches, t } = this.props;
const { loading, error, branches, t } = this.props;
if (error) {
return <ErrorNotification error={error} />;
@@ -54,17 +55,24 @@ class BranchesOverview extends React.Component<Props> {
return <Loading />;
}
orderBranches(branches);
return (
<>
<Subtitle subtitle={t("branches.overview.title")} />
<BranchTable baseUrl={baseUrl} branches={branches} />
{this.renderBranchesTable()}
{this.renderCreateButton()}
</>
);
}
renderBranchesTable() {
const { baseUrl, branches, t } = this.props;
if (branches && branches.length > 0) {
orderBranches(branches);
return <BranchTable baseUrl={baseUrl} branches={branches} />;
}
return <Notification type="info">{t("branches.overview.noBranches")}</Notification>;
}
renderCreateButton() {
const { showCreateButton, t } = this.props;
if (showCreateButton || true) {