From df7c915363eb35f16a4aaa94f311270db559e63a Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 15:06:55 +0200 Subject: [PATCH] added no branches found notification --- scm-ui/public/locales/de/repos.json | 1 + scm-ui/public/locales/en/repos.json | 1 + .../branches/containers/BranchesOverview.js | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 38adddf7dd..9979ebf21f 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -47,6 +47,7 @@ "branches": { "overview": { "title": "Übersicht aller verfügbaren Branches", + "noBranches": "Keine Branches gefunden.", "createButton": "Branch erstellen" }, "table": { diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 84f7fd5740..eb950b221f 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -47,6 +47,7 @@ "branches": { "overview": { "title": "Overview of all branches", + "noBranches": "No branches found.", "createButton": "Create Branch" }, "table": { diff --git a/scm-ui/src/repos/branches/containers/BranchesOverview.js b/scm-ui/src/repos/branches/containers/BranchesOverview.js index f8c8be7529..d792c0828a 100644 --- a/scm-ui/src/repos/branches/containers/BranchesOverview.js +++ b/scm-ui/src/repos/branches/containers/BranchesOverview.js @@ -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 { } render() { - const { baseUrl, loading, error, branches, t } = this.props; + const { loading, error, branches, t } = this.props; if (error) { return ; @@ -54,17 +55,24 @@ class BranchesOverview extends React.Component { return ; } - orderBranches(branches); - return ( <> - + {this.renderBranchesTable()} {this.renderCreateButton()} ); } + renderBranchesTable() { + const { baseUrl, branches, t } = this.props; + if (branches && branches.length > 0) { + orderBranches(branches); + return ; + } + return {t("branches.overview.noBranches")}; + } + renderCreateButton() { const { showCreateButton, t } = this.props; if (showCreateButton || true) {