mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 06:25:45 +01:00
Adds a new extension point repository.overview.listOptions that can be used to set the page size, whether to list archived repositories or not and potentially other options for the repository overview. If no extension is bound, the default values will be used.
Committed-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
This commit is contained in:
committed by
SCM-Manager
parent
34bfe49d3e
commit
6ba792e5bc
@@ -125,6 +125,34 @@ describe("Test repository hooks", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should hide archived repositories", async () => {
|
||||
const queryClient = createInfiniteCachingClient();
|
||||
setIndexLink(queryClient, "repositories", "/repos");
|
||||
fetchMock.get("/api/v2/repos", repositoryCollection, {
|
||||
query: {
|
||||
showArchived: "false"
|
||||
}
|
||||
});
|
||||
|
||||
await expectCollection(queryClient, {
|
||||
showArchived: false
|
||||
});
|
||||
});
|
||||
|
||||
it("should set the page size", async () => {
|
||||
const queryClient = createInfiniteCachingClient();
|
||||
setIndexLink(queryClient, "repositories", "/repos");
|
||||
fetchMock.get("/api/v2/repos", repositoryCollection, {
|
||||
query: {
|
||||
pageSize: "25"
|
||||
}
|
||||
});
|
||||
|
||||
await expectCollection(queryClient, {
|
||||
pageSize: 25
|
||||
});
|
||||
});
|
||||
|
||||
it("should append search query", async () => {
|
||||
const queryClient = createInfiniteCachingClient();
|
||||
setIndexLink(queryClient, "repositories", "/repos");
|
||||
|
||||
@@ -47,6 +47,8 @@ export type UseRepositoriesRequest = {
|
||||
search?: string;
|
||||
page?: number | string;
|
||||
disabled?: boolean;
|
||||
pageSize?: number;
|
||||
showArchived?: boolean;
|
||||
};
|
||||
|
||||
export const useRepositories = (request?: UseRepositoriesRequest): ApiResult<RepositoryCollection> => {
|
||||
@@ -59,6 +61,12 @@ export const useRepositories = (request?: UseRepositoriesRequest): ApiResult<Rep
|
||||
if (request?.search) {
|
||||
queryParams.q = request.search;
|
||||
}
|
||||
if (request?.pageSize) {
|
||||
queryParams.pageSize = request.pageSize.toString();
|
||||
}
|
||||
if (request?.showArchived !== undefined) {
|
||||
queryParams.showArchived = request.showArchived.toString();
|
||||
}
|
||||
if (request?.page) {
|
||||
queryParams.page = request.page.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user