mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
Reload partial results
This commit is contained in:
@@ -16,6 +16,7 @@ export type File = {
|
||||
length: number;
|
||||
lastModified?: string;
|
||||
subRepository?: SubRepository; // TODO
|
||||
partialResult: boolean;
|
||||
_links: Links;
|
||||
_embedded: {
|
||||
children: File[] | null | undefined;
|
||||
|
||||
@@ -10,13 +10,27 @@ export const FETCH_SOURCES_SUCCESS = `${FETCH_SOURCES}_${types.SUCCESS_SUFFIX}`;
|
||||
export const FETCH_SOURCES_FAILURE = `${FETCH_SOURCES}_${types.FAILURE_SUFFIX}`;
|
||||
|
||||
export function fetchSources(repository: Repository, revision: string, path: string) {
|
||||
return fetchSourcesWithoutOptionalLoadingState(repository, revision, path, true);
|
||||
}
|
||||
|
||||
export function fetchSourcesWithoutOptionalLoadingState(
|
||||
repository: Repository,
|
||||
revision: string,
|
||||
path: string,
|
||||
dispatchLoading: boolean
|
||||
) {
|
||||
return function(dispatch: any) {
|
||||
if (dispatchLoading) {
|
||||
dispatch(fetchSourcesPending(repository, revision, path));
|
||||
}
|
||||
return apiClient
|
||||
.get(createUrl(repository, revision, path))
|
||||
.then(response => response.json())
|
||||
.then(sources => {
|
||||
.then((sources: File) => {
|
||||
dispatch(fetchSourcesSuccess(repository, revision, path, sources));
|
||||
if (sources._embedded.children && sources._embedded.children.find(c => c.partialResult)) {
|
||||
setTimeout(() => dispatch(fetchSourcesWithoutOptionalLoadingState(repository, revision, path, false)), 1000);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
dispatch(fetchSourcesFailure(repository, revision, path, err));
|
||||
|
||||
@@ -27,6 +27,7 @@ public class FileObjectDto extends HalRepresentation {
|
||||
private SubRepositoryDto subRepository;
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private String revision;
|
||||
private boolean partialResult;
|
||||
|
||||
public FileObjectDto(Links links, Embedded embedded) {
|
||||
super(links, embedded);
|
||||
|
||||
Reference in New Issue
Block a user