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:
Sebastian Sdorra
2021-03-04 10:39:58 +01:00
committed by GitHub
parent bafe84b79a
commit 89548d45bd
36 changed files with 1112 additions and 30 deletions

View File

@@ -26,6 +26,7 @@ import {
ExportInfo,
Link,
Namespace,
Paths,
Repository,
RepositoryCollection,
RepositoryCreation,
@@ -316,3 +317,10 @@ export const useExportRepository = () => {
data
};
};
export const usePaths = (repository: Repository, revision: string): ApiResult<Paths> => {
const link = requiredLink(repository, "paths").replace("{revision}", revision);
return useQuery<Paths, Error>(repoQueryKey(repository, "paths", revision), () =>
apiClient.get(link).then(response => response.json())
);
};