From 818076ac6f270e1befd2b82892a82935286e9d7c Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 15:19:43 +0200 Subject: [PATCH] added no changesets found notification --- scm-ui/public/locales/de/repos.json | 1 + scm-ui/public/locales/en/repos.json | 1 + scm-ui/src/repos/containers/Changesets.js | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 9979ebf21f..0a42e49b6f 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -69,6 +69,7 @@ "changesets": { "errorTitle": "Fehler", "errorSubtitle": "Changesets konnten nicht abgerufen werden", + "noChangesets": "Keine Changesets gefunden.", "branchSelectorLabel": "Branches" }, "changeset": { diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index eb950b221f..8b245cb2a6 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -69,6 +69,7 @@ "changesets": { "errorTitle": "Error", "errorSubtitle": "Could not fetch changesets", + "noChangesets": "No changesets found.", "branchSelectorLabel": "Branches" }, "changeset": { diff --git a/scm-ui/src/repos/containers/Changesets.js b/scm-ui/src/repos/containers/Changesets.js index 5edc677e60..ce15834f31 100644 --- a/scm-ui/src/repos/containers/Changesets.js +++ b/scm-ui/src/repos/containers/Changesets.js @@ -22,9 +22,11 @@ import { getPageFromMatch, LinkPaginator, ChangesetList, - Loading + Loading, + Notification } from "@scm-manager/ui-components"; import { compose } from "redux"; +import { translate } from "react-i18next"; type Props = { repository: Repository, @@ -41,7 +43,8 @@ type Props = { fetchChangesets: (Repository, Branch, number) => void, // context props - match: any + match: any, + t: string => string }; class Changesets extends React.Component { @@ -52,7 +55,7 @@ class Changesets extends React.Component { } render() { - const { changesets, loading, error } = this.props; + const { changesets, loading, error, t } = this.props; if (error) { return ; @@ -63,7 +66,13 @@ class Changesets extends React.Component { } if (!changesets || changesets.length === 0) { - return null; + return ( +
+ + {t("changesets.noChangesets")} + +
+ ); } return ( <> @@ -115,6 +124,7 @@ const mapStateToProps = (state: any, ownProps: Props) => { }; export default compose( + translate("repos"), withRouter, connect( mapStateToProps,