mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
added no sources found notification
This commit is contained in:
@@ -108,7 +108,8 @@
|
|||||||
"lastModified": "Zuletzt bearbeitet",
|
"lastModified": "Zuletzt bearbeitet",
|
||||||
"description": "Beschreibung",
|
"description": "Beschreibung",
|
||||||
"size": "Größe"
|
"size": "Größe"
|
||||||
}
|
},
|
||||||
|
"noSources": "Keine Sources gefunden."
|
||||||
},
|
},
|
||||||
"permission": {
|
"permission": {
|
||||||
"title": "Berechtigungen bearbeiten",
|
"title": "Berechtigungen bearbeiten",
|
||||||
|
|||||||
@@ -108,7 +108,8 @@
|
|||||||
"lastModified": "Last modified",
|
"lastModified": "Last modified",
|
||||||
"description": "Description",
|
"description": "Description",
|
||||||
"size": "Size"
|
"size": "Size"
|
||||||
}
|
},
|
||||||
|
"noSources": "No sources found."
|
||||||
},
|
},
|
||||||
"permission": {
|
"permission": {
|
||||||
"title": "Edit Permissions",
|
"title": "Edit Permissions",
|
||||||
|
|||||||
@@ -5,7 +5,11 @@ import { connect } from "react-redux";
|
|||||||
import injectSheet from "react-jss";
|
import injectSheet from "react-jss";
|
||||||
import FileTreeLeaf from "./FileTreeLeaf";
|
import FileTreeLeaf from "./FileTreeLeaf";
|
||||||
import type { Repository, File } from "@scm-manager/ui-types";
|
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 {
|
import {
|
||||||
getFetchSourcesFailure,
|
getFetchSourcesFailure,
|
||||||
isFetchSourcesPending,
|
isFetchSourcesPending,
|
||||||
@@ -48,16 +52,34 @@ export function findParent(path: string) {
|
|||||||
|
|
||||||
class FileTree extends React.Component<Props> {
|
class FileTree extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
const {
|
const { error, loading, tree } = this.props;
|
||||||
error,
|
|
||||||
loading,
|
if (error) {
|
||||||
tree,
|
return <ErrorNotification error={error} />;
|
||||||
revision,
|
}
|
||||||
path,
|
|
||||||
baseUrl,
|
if (loading) {
|
||||||
classes,
|
return <Loading />;
|
||||||
t
|
}
|
||||||
} = this.props;
|
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 {
|
const compareFiles = function(f1: File, f2: File): number {
|
||||||
if (f1.directory) {
|
if (f1.directory) {
|
||||||
@@ -75,31 +97,11 @@ 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) {
|
if (tree._embedded && tree._embedded.children) {
|
||||||
files.push(...tree._embedded.children.sort(compareFiles));
|
files.push(...tree._embedded.children.sort(compareFiles));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (files && files.length > 0) {
|
||||||
let baseUrlWithRevision = baseUrl;
|
let baseUrlWithRevision = baseUrl;
|
||||||
if (revision) {
|
if (revision) {
|
||||||
baseUrlWithRevision += "/" + encodeURIComponent(revision);
|
baseUrlWithRevision += "/" + encodeURIComponent(revision);
|
||||||
@@ -108,7 +110,6 @@ class FileTree extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="panel-block">
|
|
||||||
<table className="table table-hover table-sm is-fullwidth">
|
<table className="table table-hover table-sm is-fullwidth">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -135,9 +136,10 @@ class FileTree extends React.Component<Props> {
|
|||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return <Notification type="info">{t("sources.noSources")}</Notification>;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = (state: any, ownProps: Props) => {
|
const mapStateToProps = (state: any, ownProps: Props) => {
|
||||||
|
|||||||
@@ -94,9 +94,7 @@ class Sources extends React.Component<Props> {
|
|||||||
if (currentFileIsDirectory) {
|
if (currentFileIsDirectory) {
|
||||||
return (
|
return (
|
||||||
<div className="panel">
|
<div className="panel">
|
||||||
<div className="panel-heading">
|
<div className="panel-heading">{this.renderBranchSelector()}</div>
|
||||||
{this.renderBranchSelector()}
|
|
||||||
</div>
|
|
||||||
<FileTree
|
<FileTree
|
||||||
repository={repository}
|
repository={repository}
|
||||||
revision={revision}
|
revision={revision}
|
||||||
|
|||||||
Reference in New Issue
Block a user