From fa889529a29face3c2300b71b8db99bd462ddea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Mon, 9 Mar 2020 09:48:14 +0100 Subject: [PATCH] Only count files in frontend --- scm-ui/ui-webapp/public/locales/de/repos.json | 2 +- scm-ui/ui-webapp/public/locales/en/repos.json | 2 +- scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx | 6 +++--- scm-ui/ui-webapp/src/repos/sources/modules/sources.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scm-ui/ui-webapp/public/locales/de/repos.json b/scm-ui/ui-webapp/public/locales/de/repos.json index 2b7b0f2ca4..175abf863b 100644 --- a/scm-ui/ui-webapp/public/locales/de/repos.json +++ b/scm-ui/ui-webapp/public/locales/de/repos.json @@ -130,7 +130,7 @@ "notBound": "Keine Erweiterung angebunden." }, "loadMore": "Laden", - "moreEntriesAvailable": "Es werden nur die ersten {{count}} Einträge angezeigt. Es sind weitere Einträge vorhanden." + "moreFilesAvailable": "Es werden nur die ersten {{count}} Dateien angezeigt. Es sind weitere Dateien vorhanden." }, "permission": { "title": "Berechtigungen bearbeiten", diff --git a/scm-ui/ui-webapp/public/locales/en/repos.json b/scm-ui/ui-webapp/public/locales/en/repos.json index d5a5a7fff6..21fe49f95d 100644 --- a/scm-ui/ui-webapp/public/locales/en/repos.json +++ b/scm-ui/ui-webapp/public/locales/en/repos.json @@ -130,7 +130,7 @@ "notBound": "No extension bound." }, "loadMore": "Load", - "moreEntriesAvailable": "These are just the first {{count}} entries. There are more entries available." + "moreFilesAvailable": "These are just the first {{count}} files. There are more files available." }, "permission": { "title": "Edit Permissions", diff --git a/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx b/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx index df70b44500..b10f0878d7 100644 --- a/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx +++ b/scm-ui/ui-webapp/src/repos/sources/components/FileTree.tsx @@ -92,15 +92,15 @@ class FileTree extends React.Component { renderTruncatedInfo = () => { const { hunks, t } = this.props; const lastHunk = hunks[hunks.length - 1]; - const entryCount = hunks + const fileCount = hunks .filter(hunk => hunk?.tree?._embedded?.children) - .map(hunk => hunk.tree._embedded.children.length) + .map(hunk => hunk.tree._embedded.children.filter(c => !c.directory).length) .reduce((a, b) => a + b, 0); if (lastHunk.tree?.truncated) { return (
-
{t("sources.moreEntriesAvailable", { count: entryCount })}
+
{t("sources.moreFilesAvailable", { count: fileCount })}
diff --git a/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts b/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts index 857229f8c2..779a554aa4 100644 --- a/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts +++ b/scm-ui/ui-webapp/src/repos/sources/modules/sources.ts @@ -31,7 +31,7 @@ export function fetchSources(repository: Repository, revision: string, path: str for (let i = 0; i < hunk; ++i) { const sources = getSources(state, repository, revision, path, i); if (sources?._embedded.children) { - offset += sources._embedded.children.length; + offset += sources._embedded.children.filter(c => !c.directory).length; } }