mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-21 06:52:11 +01:00
Merged in bugfix/notification_for_empty_table (pull request #230)
bugfix/notification_for_empty_table
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
},
|
||||
"groups": {
|
||||
"title": "Gruppen",
|
||||
"subtitle": "Verwaltung der Gruppen"
|
||||
"subtitle": "Verwaltung der Gruppen",
|
||||
"noGroups": "Keine Gruppen gefunden."
|
||||
},
|
||||
"singleGroup": {
|
||||
"errorTitle": "Fehler",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"users": {
|
||||
"title": "Benutzer",
|
||||
"subtitle": "Verwaltung der Benutzer",
|
||||
"noUsers": "Keine Benutzer gefunden.",
|
||||
"createButton": "Benutzer erstellen"
|
||||
},
|
||||
"singleUser": {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"users": {
|
||||
"title": "Users",
|
||||
"subtitle": "Create, read, update and delete users",
|
||||
"noUsers": "No users found.",
|
||||
"createButton": "Create User"
|
||||
},
|
||||
"singleUser": {
|
||||
|
||||
@@ -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<Props> {
|
||||
loading={loading || !groups}
|
||||
error={error}
|
||||
>
|
||||
<GroupTable groups={groups} />
|
||||
{this.renderPaginator()}
|
||||
{this.renderGroupTable()}
|
||||
{this.renderCreateButton()}
|
||||
{this.renderPageActionCreateButton()}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
renderGroupTable() {
|
||||
const { groups, t } = this.props;
|
||||
if (groups && groups.length > 0) {
|
||||
return (
|
||||
<>
|
||||
<GroupTable groups={groups} />
|
||||
{this.renderPaginator()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
return <Notification type="info">{t("groups.noGroups")}</Notification>;
|
||||
}
|
||||
|
||||
renderPaginator() {
|
||||
const { list } = this.props;
|
||||
if (list) {
|
||||
@@ -93,12 +105,9 @@ class Groups extends React.Component<Props> {
|
||||
|
||||
renderCreateButton() {
|
||||
if (this.props.canAddGroups) {
|
||||
return (
|
||||
<CreateGroupButton />
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
return <CreateGroupButton />;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
renderPageActionCreateButton() {
|
||||
@@ -112,9 +121,8 @@ class Groups extends React.Component<Props> {
|
||||
/>
|
||||
</PageActions>
|
||||
);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<Props> {
|
||||
@@ -52,7 +55,7 @@ class Changesets extends React.Component<Props> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { changesets, loading, error } = this.props;
|
||||
const { changesets, loading, error, t } = this.props;
|
||||
|
||||
if (error) {
|
||||
return <ErrorNotification error={error} />;
|
||||
@@ -63,7 +66,13 @@ class Changesets extends React.Component<Props> {
|
||||
}
|
||||
|
||||
if (!changesets || changesets.length === 0) {
|
||||
return null;
|
||||
return (
|
||||
<div className="panel-block">
|
||||
<Notification type="info">
|
||||
{t("changesets.noChangesets")}
|
||||
</Notification>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
@@ -115,6 +124,7 @@ const mapStateToProps = (state: any, ownProps: Props) => {
|
||||
};
|
||||
|
||||
export default compose(
|
||||
translate("repos"),
|
||||
withRouter,
|
||||
connect(
|
||||
mapStateToProps,
|
||||
|
||||
@@ -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<Props> {
|
||||
loading={loading}
|
||||
error={error}
|
||||
>
|
||||
{this.renderList()}
|
||||
{this.renderOverview()}
|
||||
{this.renderPageActionCreateButton()}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
renderList() {
|
||||
const { collection, fetchReposByLink } = this.props;
|
||||
renderRepositoryList() {
|
||||
const { collection, fetchReposByLink, t } = this.props;
|
||||
|
||||
if (collection._embedded && collection._embedded.repositories.length > 0) {
|
||||
return (
|
||||
<>
|
||||
<RepositoryList repositories={collection._embedded.repositories} />
|
||||
<Paginator collection={collection} onPageChange={fetchReposByLink} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Notification type="info">{t("overview.noRepositories")}</Notification>
|
||||
);
|
||||
}
|
||||
|
||||
renderOverview() {
|
||||
const { collection } = this.props;
|
||||
if (collection) {
|
||||
return (
|
||||
<div>
|
||||
<RepositoryList repositories={collection._embedded.repositories} />
|
||||
<Paginator collection={collection} onPageChange={fetchReposByLink} />
|
||||
{this.renderRepositoryList()}
|
||||
{this.renderCreateButton()}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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<Props> {
|
||||
render() {
|
||||
const {
|
||||
error,
|
||||
loading,
|
||||
tree,
|
||||
revision,
|
||||
path,
|
||||
baseUrl,
|
||||
classes,
|
||||
t
|
||||
} = this.props;
|
||||
const { error, loading, tree } = this.props;
|
||||
|
||||
if (error) {
|
||||
return <ErrorNotification error={error} />;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
}
|
||||
if (!tree) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <div className="panel-block">{this.renderSourcesTable()}</div>;
|
||||
}
|
||||
|
||||
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<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
if (error) {
|
||||
return <ErrorNotification error={error} />;
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return <Loading />;
|
||||
}
|
||||
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 (
|
||||
<div className="panel-block">
|
||||
return (
|
||||
<table className="table table-hover table-sm is-fullwidth">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -135,8 +136,9 @@ class FileTree extends React.Component<Props> {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
}
|
||||
return <Notification type="info">{t("sources.noSources")}</Notification>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,9 +94,7 @@ class Sources extends React.Component<Props> {
|
||||
if (currentFileIsDirectory) {
|
||||
return (
|
||||
<div className="panel">
|
||||
<div className="panel-heading">
|
||||
{this.renderBranchSelector()}
|
||||
</div>
|
||||
<div className="panel-heading">{this.renderBranchSelector()}</div>
|
||||
<FileTree
|
||||
repository={repository}
|
||||
revision={revision}
|
||||
|
||||
@@ -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<Props> {
|
||||
loading={loading || !users}
|
||||
error={error}
|
||||
>
|
||||
<UserTable users={users} />
|
||||
{this.renderPaginator()}
|
||||
{this.renderUserTable()}
|
||||
{this.renderCreateButton()}
|
||||
{this.renderPageActionCreateButton()}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
renderUserTable() {
|
||||
const { users, t } = this.props;
|
||||
if (users && users.length > 0) {
|
||||
return (
|
||||
<>
|
||||
<UserTable users={users} />
|
||||
{this.renderPaginator()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
return <Notification type="info">{t("users.noUsers")}</Notification>;
|
||||
}
|
||||
|
||||
renderPaginator() {
|
||||
const { list } = this.props;
|
||||
if (list) {
|
||||
|
||||
Reference in New Issue
Block a user