mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
Redesign repository overview (#1740)
Change repository overview layout to use single rows instead cards. Also remove quick links and add clone action to repository entry. The default repository link now leads to the sources view. Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import { concat } from "./urls";
|
||||
type UseChangesetsRequest = {
|
||||
branch?: Branch;
|
||||
page?: string | number;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export const changesetQueryKey = (repository: NamespaceAndName, id: string) => {
|
||||
@@ -53,23 +54,29 @@ export const useChangesets = (
|
||||
link = requiredLink(repository, "changesets");
|
||||
}
|
||||
|
||||
if (request?.page) {
|
||||
link = `${link}?page=${request.page}`;
|
||||
if (request?.page || request?.limit) {
|
||||
if (request?.page && request?.limit) {
|
||||
link = `${link}?page=${request.page}&limit=${request.limit}`;
|
||||
} else if (request.page) {
|
||||
link = `${link}?page=${request.page}`;
|
||||
} else if (request.limit) {
|
||||
link = `${link}?limit=${request.limit}`;
|
||||
}
|
||||
}
|
||||
|
||||
const key = branchQueryKey(repository, branch, "changesets", request?.page || 0);
|
||||
return useQuery<ChangesetCollection, Error>(key, () => apiClient.get(link).then(response => response.json()), {
|
||||
onSuccess: changesetCollection => {
|
||||
changesetCollection._embedded.changesets.forEach(changeset => {
|
||||
return useQuery<ChangesetCollection, Error>(key, () => apiClient.get(link).then((response) => response.json()), {
|
||||
onSuccess: (changesetCollection) => {
|
||||
changesetCollection._embedded.changesets.forEach((changeset) => {
|
||||
queryClient.setQueryData(changesetQueryKey(repository, changeset.id), changeset);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useChangeset = (repository: Repository, id: string): ApiResult<Changeset> => {
|
||||
const changesetsLink = requiredLink(repository, "changesets");
|
||||
return useQuery<Changeset, Error>(changesetQueryKey(repository, id), () =>
|
||||
apiClient.get(concat(changesetsLink, id)).then(response => response.json())
|
||||
apiClient.get(concat(changesetsLink, id)).then((response) => response.json())
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user