mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
Merge branch 'master' into w2p-61949_object-factory-refactoring
Conflicts: src/app/core/cache/models/normalized-object-factory.ts src/app/core/cache/response.models.ts src/app/core/core.module.ts src/app/core/data/base-response-parsing.service.ts src/app/core/shared/resource-type.ts src/app/core/submission/submission-response-parsing.service.ts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf, race as observableRace } from 'rxjs';
|
||||
import { distinctUntilChanged, flatMap, map, startWith, switchMap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, flatMap, map, startWith, switchMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { hasValue, hasValueOperator, isEmpty, isNotEmpty, isNotUndefined } from '../../../shared/empty.util';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
@@ -205,17 +205,28 @@ export class RemoteDataBuildService {
|
||||
|
||||
return observableCombineLatest(...input).pipe(
|
||||
map((arr) => {
|
||||
// The request of an aggregate RD should be pending if at least one
|
||||
// of the RDs it's based on is still in the state RequestPending
|
||||
const requestPending: boolean = arr
|
||||
.map((d: RemoteData<T>) => d.isRequestPending)
|
||||
.every((b: boolean) => b === true);
|
||||
.find((b: boolean) => b === true);
|
||||
|
||||
const responsePending: boolean = arr
|
||||
// The response of an aggregate RD should be pending if no requests
|
||||
// are still pending and at least one of the RDs it's based
|
||||
// on is still in the state ResponsePending
|
||||
const responsePending: boolean = !requestPending && arr
|
||||
.map((d: RemoteData<T>) => d.isResponsePending)
|
||||
.every((b: boolean) => b === true);
|
||||
.find((b: boolean) => b === true);
|
||||
|
||||
const isSuccessful: boolean = arr
|
||||
.map((d: RemoteData<T>) => d.hasSucceeded)
|
||||
.every((b: boolean) => b === true);
|
||||
let isSuccessful: boolean;
|
||||
// isSuccessful should be undefined until all responses have come in.
|
||||
// We can't know its state beforehand. We also can't say it's false
|
||||
// because that would imply a request failed.
|
||||
if (!(requestPending || responsePending)) {
|
||||
isSuccessful = arr
|
||||
.map((d: RemoteData<T>) => d.hasSucceeded)
|
||||
.every((b: boolean) => b === true);
|
||||
}
|
||||
|
||||
const errorMessage: string = arr
|
||||
.map((d: RemoteData<T>) => d.error)
|
||||
|
Reference in New Issue
Block a user