mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
Filepath search (#1568)
Add search for files to the sources view. The search is only for finding file paths. It does not search any file metadata nor the content. Results get a rating, where file names are rated higher than file paths. The results are sorted by the score and the first 50 results are displayed. Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
@@ -30,6 +30,7 @@ import CodeActionBar from "../../codeSection/components/CodeActionBar";
|
||||
import replaceBranchWithRevision from "../ReplaceBranchWithRevision";
|
||||
import { useSources } from "@scm-manager/ui-api";
|
||||
import { useHistory, useLocation, useParams } from "react-router-dom";
|
||||
import FileSearchButton from "../../codeSection/components/FileSearchButton";
|
||||
import { isEmptyDirectory, isRootFile } from "../utils/files";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -106,8 +107,14 @@ const Sources: FC<Props> = ({ repository, branches, selectedBranch, baseUrl }) =
|
||||
const renderBreadcrumb = () => {
|
||||
const permalink = file?.revision ? replaceBranchWithRevision(location.pathname, file.revision) : null;
|
||||
|
||||
const buttons = [];
|
||||
if (repository._links.paths) {
|
||||
buttons.push(<FileSearchButton baseUrl={baseUrl} revision={revision || file.revision} />);
|
||||
}
|
||||
|
||||
return (
|
||||
<Breadcrumb
|
||||
preButtons={buttons}
|
||||
repository={repository}
|
||||
revision={revision || file.revision}
|
||||
path={path || ""}
|
||||
|
||||
Reference in New Issue
Block a user