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/de/repos.json b/scm-ui/public/locales/de/repos.json index 6f7846df72..47353fa79b 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": { @@ -46,6 +47,7 @@ "branches": { "overview": { "title": "Übersicht aller verfügbaren Branches", + "noBranches": "Keine Branches gefunden.", "createButton": "Branch erstellen" }, "table": { @@ -67,6 +69,7 @@ "changesets": { "errorTitle": "Fehler", "errorSubtitle": "Changesets konnten nicht abgerufen werden", + "noChangesets": "Keine Changesets in diesem Branch gefunden.", "branchSelectorLabel": "Branches" }, "changeset": { @@ -105,7 +108,8 @@ "lastModified": "Zuletzt bearbeitet", "description": "Beschreibung", "size": "Größe" - } + }, + "noSources": "Keine Sources in diesem Branch gefunden." }, "permission": { "title": "Berechtigungen bearbeiten", 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/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/public/locales/en/repos.json b/scm-ui/public/locales/en/repos.json index 89492f427d..0d59b88819 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": { @@ -46,6 +47,7 @@ "branches": { "overview": { "title": "Overview of all branches", + "noBranches": "No branches found.", "createButton": "Create Branch" }, "table": { @@ -67,6 +69,7 @@ "changesets": { "errorTitle": "Error", "errorSubtitle": "Could not fetch changesets", + "noChangesets": "No changesets found for this branch.", "branchSelectorLabel": "Branches" }, "changeset": { @@ -105,7 +108,8 @@ "lastModified": "Last modified", "description": "Description", "size": "Size" - } + }, + "noSources": "No sources found for this branch." }, "permission": { "title": "Edit Permissions", 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/groups/containers/Groups.js b/scm-ui/src/groups/containers/Groups.js index 78e373e261..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"; @@ -75,14 +75,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 +105,9 @@ class Groups extends React.Component { renderCreateButton() { if (this.props.canAddGroups) { - return ( - - ); - } else { - return; + return ; } + return null; } renderPageActionCreateButton() { @@ -112,9 +121,8 @@ class Groups extends React.Component { /> ); - } else { - return; } + return null; } } 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) { 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, 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()}
); 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()}
{ 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) {