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