From a4ee29d8e5d87529835552e8cd14ab45e7f338cc Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 14:36:29 +0200 Subject: [PATCH 1/9] added no groups found notification --- scm-ui/public/locales/de/groups.json | 3 ++- scm-ui/public/locales/en/groups.json | 3 ++- scm-ui/src/groups/containers/Groups.js | 27 +++++++++++++++++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/scm-ui/public/locales/de/groups.json b/scm-ui/public/locales/de/groups.json index 897cab02d3..bb8eda1cf2 100644 --- a/scm-ui/public/locales/de/groups.json +++ b/scm-ui/public/locales/de/groups.json @@ -10,7 +10,8 @@ }, "groups": { "title": "Gruppen", - "subtitle": "Verwaltung der Gruppen" + "subtitle": "Verwaltung der Gruppen", + "noGroups": "Keine Gruppen gefunden." }, "singleGroup": { "errorTitle": "Fehler", diff --git a/scm-ui/public/locales/en/groups.json b/scm-ui/public/locales/en/groups.json index a54249988a..aff350a458 100644 --- a/scm-ui/public/locales/en/groups.json +++ b/scm-ui/public/locales/en/groups.json @@ -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", diff --git a/scm-ui/src/groups/containers/Groups.js b/scm-ui/src/groups/containers/Groups.js index 78e373e261..8315614b4c 100644 --- a/scm-ui/src/groups/containers/Groups.js +++ b/scm-ui/src/groups/containers/Groups.js @@ -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 { loading={loading || !groups} error={error} > - - {this.renderPaginator()} + {this.renderGroupTable()} {this.renderCreateButton()} {this.renderPageActionCreateButton()} ); } + renderGroupTable() { + const { groups, t } = this.props; + if (groups && groups.length > 0) { + return ( + <> + + {this.renderPaginator()} + + ); + } + return {t("groups.noGroups")}; + } + renderPaginator() { const { list } = this.props; if (list) { @@ -93,12 +106,9 @@ class Groups extends React.Component { renderCreateButton() { if (this.props.canAddGroups) { - return ( - - ); - } else { - return; + return ; } + return null; } renderPageActionCreateButton() { @@ -112,9 +122,8 @@ class Groups extends React.Component { /> ); - } else { - return; } + return null; } } From 24da17e0a917ba0cffe7233c27b3de07dad0678d Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 14:47:37 +0200 Subject: [PATCH 2/9] added no repositories found notification --- scm-ui/public/locales/de/repos.json | 1 + scm-ui/public/locales/en/repos.json | 1 + scm-ui/src/groups/containers/Groups.js | 5 ++--- scm-ui/src/repos/containers/Overview.js | 26 ++++++++++++++++++++----- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 6f7846df72..38adddf7dd 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -37,6 +37,7 @@ "overview": { "title": "Repositories", "subtitle": "Übersicht aller verfügbaren Repositories", + "noRepositories": "Keine Repositories gefunden.", "createButton": "Repository erstellen" }, "create": { diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 89492f427d..84f7fd5740 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -37,6 +37,7 @@ "overview": { "title": "Repositories", "subtitle": "Overview of available repositories", + "noRepositories": "No repositories found.", "createButton": "Create Repository" }, "create": { diff --git a/scm-ui/src/groups/containers/Groups.js b/scm-ui/src/groups/containers/Groups.js index 8315614b4c..d54f4f5be4 100644 --- a/scm-ui/src/groups/containers/Groups.js +++ b/scm-ui/src/groups/containers/Groups.js @@ -2,13 +2,13 @@ import React from "react"; import { connect } from "react-redux"; import { translate } from "react-i18next"; -import type { Group } from "@scm-manager/ui-types"; -import type { PagedCollection } from "@scm-manager/ui-types"; +import type { Group, PagedCollection } from "@scm-manager/ui-types"; import type { History } from "history"; import { Page, PageActions, Button, + Notification, Paginator } from "@scm-manager/ui-components"; import { GroupTable } from "./../components/table"; @@ -24,7 +24,6 @@ import { selectListAsCollection } from "../modules/groups"; import { getGroupsLink } from "../../modules/indexResource"; -import Notification from "@scm-manager/ui-components/src/Notification"; type Props = { groups: Group[], diff --git a/scm-ui/src/repos/containers/Overview.js b/scm-ui/src/repos/containers/Overview.js index 1d672aafb1..b8cffae191 100644 --- a/scm-ui/src/repos/containers/Overview.js +++ b/scm-ui/src/repos/containers/Overview.js @@ -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 { loading={loading} error={error} > - {this.renderList()} + {this.renderOverview()} {this.renderPageActionCreateButton()} ); } - renderList() { - const { collection, fetchReposByLink } = this.props; + renderRepositoryList() { + const { collection, fetchReposByLink, t } = this.props; + + if (collection._embedded && collection._embedded.repositories.length > 0) { + return ( + <> + + + + ); + } + return ( + {t("overview.noRepositories")} + ); + } + + renderOverview() { + const { collection } = this.props; if (collection) { return (
- - + {this.renderRepositoryList()} {this.renderCreateButton()}
); From a05fa8d46f3d377c07c5b7aace7ed9e3e6fabee8 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 14:59:19 +0200 Subject: [PATCH 3/9] added no users found notification --- scm-ui/public/locales/de/users.json | 1 + scm-ui/public/locales/en/users.json | 1 + scm-ui/src/users/containers/Users.js | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scm-ui/public/locales/de/users.json b/scm-ui/public/locales/de/users.json index 96d632e55d..05b5cf142f 100644 --- a/scm-ui/public/locales/de/users.json +++ b/scm-ui/public/locales/de/users.json @@ -24,6 +24,7 @@ "users": { "title": "Benutzer", "subtitle": "Verwaltung der Benutzer", + "noUsers": "Keine Benutzer gefunden.", "createButton": "Benutzer erstellen" }, "singleUser": { diff --git a/scm-ui/public/locales/en/users.json b/scm-ui/public/locales/en/users.json index 91e4efe87f..e6fd822ead 100644 --- a/scm-ui/public/locales/en/users.json +++ b/scm-ui/public/locales/en/users.json @@ -24,6 +24,7 @@ "users": { "title": "Users", "subtitle": "Create, read, update and delete users", + "noUsers": "No users found.", "createButton": "Create User" }, "singleUser": { diff --git a/scm-ui/src/users/containers/Users.js b/scm-ui/src/users/containers/Users.js index 3d88523479..66a4102fa8 100644 --- a/scm-ui/src/users/containers/Users.js +++ b/scm-ui/src/users/containers/Users.js @@ -19,7 +19,8 @@ import { PageActions, Button, CreateButton, - Paginator + Paginator, + Notification } from "@scm-manager/ui-components"; import { UserTable } from "./../components/table"; import type { User, PagedCollection } from "@scm-manager/ui-types"; @@ -75,14 +76,26 @@ class Users extends React.Component { loading={loading || !users} error={error} > - - {this.renderPaginator()} + {this.renderUserTable()} {this.renderCreateButton()} {this.renderPageActionCreateButton()} ); } + renderUserTable() { + const { users, t } = this.props; + if (users && users.length > 0) { + return ( + <> + + {this.renderPaginator()} + + ); + } + return {t("users.noUsers")}; + } + renderPaginator() { const { list } = this.props; if (list) { From df7c915363eb35f16a4aaa94f311270db559e63a Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 15:06:55 +0200 Subject: [PATCH 4/9] 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) { From 818076ac6f270e1befd2b82892a82935286e9d7c Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 15:19:43 +0200 Subject: [PATCH 5/9] 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, From 4a6fd9721fc136b5cd193e8882d6534f786a9f02 Mon Sep 17 00:00:00 2001 From: Florian Scholdei Date: Tue, 9 Apr 2019 15:31:12 +0200 Subject: [PATCH 6/9] added no sources found notification --- scm-ui/public/locales/de/repos.json | 3 +- scm-ui/public/locales/en/repos.json | 3 +- .../src/repos/sources/components/FileTree.js | 86 ++++++++++--------- .../src/repos/sources/containers/Sources.js | 4 +- 4 files changed, 49 insertions(+), 47 deletions(-) diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 0a42e49b6f..4093d1c2e0 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -108,7 +108,8 @@ "lastModified": "Zuletzt bearbeitet", "description": "Beschreibung", "size": "Größe" - } + }, + "noSources": "Keine Sources gefunden." }, "permission": { "title": "Berechtigungen bearbeiten", diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 8b245cb2a6..44d2e09468 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -108,7 +108,8 @@ "lastModified": "Last modified", "description": "Description", "size": "Size" - } + }, + "noSources": "No sources found." }, "permission": { "title": "Edit Permissions", diff --git a/scm-ui/src/repos/sources/components/FileTree.js b/scm-ui/src/repos/sources/components/FileTree.js index 18ef1b01c5..960f6b42d6 100644 --- a/scm-ui/src/repos/sources/components/FileTree.js +++ b/scm-ui/src/repos/sources/components/FileTree.js @@ -5,7 +5,11 @@ import { connect } from "react-redux"; import injectSheet from "react-jss"; import FileTreeLeaf from "./FileTreeLeaf"; import type { Repository, File } from "@scm-manager/ui-types"; -import { ErrorNotification, Loading } from "@scm-manager/ui-components"; +import { + ErrorNotification, + Loading, + Notification +} from "@scm-manager/ui-components"; import { getFetchSourcesFailure, isFetchSourcesPending, @@ -48,16 +52,34 @@ export function findParent(path: string) { class FileTree extends React.Component { render() { - const { - error, - loading, - tree, - revision, - path, - baseUrl, - classes, - t - } = this.props; + const { error, loading, tree } = this.props; + + if (error) { + return ; + } + + if (loading) { + return ; + } + if (!tree) { + return null; + } + + return
{this.renderSourcesTable()}
; + } + + renderSourcesTable() { + const { tree, revision, path, baseUrl, classes, t } = this.props; + + const files = []; + + if (path) { + files.push({ + name: "..", + path: findParent(path), + directory: true + }); + } const compareFiles = function(f1: File, f2: File): number { if (f1.directory) { @@ -75,40 +97,19 @@ class FileTree extends React.Component { } }; - if (error) { - return ; - } - - if (loading) { - return ; - } - if (!tree) { - return null; - } - - const files = []; - - if (path) { - files.push({ - name: "..", - path: findParent(path), - directory: true - }); - } - if (tree._embedded && tree._embedded.children) { files.push(...tree._embedded.children.sort(compareFiles)); } - let baseUrlWithRevision = baseUrl; - if (revision) { - baseUrlWithRevision += "/" + encodeURIComponent(revision); - } else { - baseUrlWithRevision += "/" + encodeURIComponent(tree.revision); - } + if (files && files.length > 0) { + let baseUrlWithRevision = baseUrl; + if (revision) { + baseUrlWithRevision += "/" + encodeURIComponent(revision); + } else { + baseUrlWithRevision += "/" + encodeURIComponent(tree.revision); + } - return ( -
+ return ( @@ -135,8 +136,9 @@ class FileTree extends React.Component { ))}
-
- ); + ); + } + return {t("sources.noSources")}; } } diff --git a/scm-ui/src/repos/sources/containers/Sources.js b/scm-ui/src/repos/sources/containers/Sources.js index 7b87776e73..2d7e1ca468 100644 --- a/scm-ui/src/repos/sources/containers/Sources.js +++ b/scm-ui/src/repos/sources/containers/Sources.js @@ -94,9 +94,7 @@ class Sources extends React.Component { if (currentFileIsDirectory) { return (
-
- {this.renderBranchSelector()} -
+
{this.renderBranchSelector()}
Date: Tue, 9 Apr 2019 15:33:47 +0200 Subject: [PATCH 7/9] specificated no sources/changesets found notification considering branches --- scm-ui/public/locales/de/repos.json | 4 ++-- scm-ui/public/locales/en/repos.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scm-ui/public/locales/de/repos.json b/scm-ui/public/locales/de/repos.json index 4093d1c2e0..47353fa79b 100644 --- a/scm-ui/public/locales/de/repos.json +++ b/scm-ui/public/locales/de/repos.json @@ -69,7 +69,7 @@ "changesets": { "errorTitle": "Fehler", "errorSubtitle": "Changesets konnten nicht abgerufen werden", - "noChangesets": "Keine Changesets gefunden.", + "noChangesets": "Keine Changesets in diesem Branch gefunden.", "branchSelectorLabel": "Branches" }, "changeset": { @@ -109,7 +109,7 @@ "description": "Beschreibung", "size": "Größe" }, - "noSources": "Keine Sources gefunden." + "noSources": "Keine Sources in diesem Branch gefunden." }, "permission": { "title": "Berechtigungen bearbeiten", diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 44d2e09468..45452ae257 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -69,7 +69,7 @@ "changesets": { "errorTitle": "Error", "errorSubtitle": "Could not fetch changesets", - "noChangesets": "No changesets found.", + "noChangesets": "No changesets matching this branch found.", "branchSelectorLabel": "Branches" }, "changeset": { @@ -109,7 +109,7 @@ "description": "Description", "size": "Size" }, - "noSources": "No sources found." + "noSources": "No sources matching this branch found." }, "permission": { "title": "Edit Permissions", From 49775bc6316bb92f97f7ed6ed59552f5dafd11eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Wed, 10 Apr 2019 10:46:49 +0200 Subject: [PATCH 8/9] Change texts --- scm-ui/public/locales/en/repos.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scm-ui/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 45452ae257..0d59b88819 100644 --- a/scm-ui/public/locales/en/repos.json +++ b/scm-ui/public/locales/en/repos.json @@ -69,7 +69,7 @@ "changesets": { "errorTitle": "Error", "errorSubtitle": "Could not fetch changesets", - "noChangesets": "No changesets matching this branch found.", + "noChangesets": "No changesets found for this branch.", "branchSelectorLabel": "Branches" }, "changeset": { @@ -109,7 +109,7 @@ "description": "Description", "size": "Size" }, - "noSources": "No sources matching this branch found." + "noSources": "No sources found for this branch." }, "permission": { "title": "Edit Permissions", From 863ca0afca2b565e991ac68cc9b76fc362d3d74f Mon Sep 17 00:00:00 2001 From: Rene Pfeuffer Date: Wed, 10 Apr 2019 08:47:44 +0000 Subject: [PATCH 9/9] Close branch bugfix/notification_for_empty_table