mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 06:53:03 +00:00
Merge remote-tracking branch 'origin/master' into w2p-44024_simple-search-with-select
Conflicts: package.json src/app/core/cache/builders/remote-data-build.service.ts src/app/shared/shared.module.ts
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { CacheableObject } from '../object-cache.reducer';
|
||||
import { ObjectCacheService } from '../object-cache.service';
|
||||
import { RequestService } from '../../data/request.service';
|
||||
import { ResponseCacheService } from '../response-cache.service';
|
||||
import { CoreState } from '../../core.reducers';
|
||||
import { RequestEntry } from '../../data/request.reducer';
|
||||
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
||||
import { ResponseCacheEntry } from '../response-cache.reducer';
|
||||
@@ -20,10 +18,12 @@ import { PageInfo } from '../../shared/page-info.model';
|
||||
|
||||
@Injectable()
|
||||
export class RemoteDataBuildService {
|
||||
constructor(protected objectCache: ObjectCacheService,
|
||||
protected responseCache: ResponseCacheService,
|
||||
protected requestService: RequestService,
|
||||
protected store: Store<CoreState>,) {
|
||||
constructor(
|
||||
protected objectCache: ObjectCacheService,
|
||||
protected responseCache: ResponseCacheService,
|
||||
protected requestService: RequestService
|
||||
|
||||
) {
|
||||
}
|
||||
|
||||
buildSingle<TNormalized extends CacheableObject, TDomain>(href: string,
|
||||
@@ -31,9 +31,9 @@ export class RemoteDataBuildService {
|
||||
const requestHrefObs = this.objectCache.getRequestHrefBySelfLink(href);
|
||||
|
||||
const requestObs = Observable.race(
|
||||
this.store.select<RequestEntry>('core', 'data', 'request', href).filter((entry) => hasValue(entry)),
|
||||
this.requestService.get(href).filter((entry) => hasValue(entry)),
|
||||
requestHrefObs.flatMap((requestHref) =>
|
||||
this.store.select<RequestEntry>('core', 'data', 'request', requestHref)).filter((entry) => hasValue(entry))
|
||||
this.requestService.get(requestHref)).filter((entry) => hasValue(entry))
|
||||
);
|
||||
|
||||
const responseCacheObs = Observable.race(
|
||||
@@ -97,7 +97,7 @@ export class RemoteDataBuildService {
|
||||
).filter((normalized) => hasValue(normalized))
|
||||
.map((normalized: TNormalized) => {
|
||||
return this.build<TNormalized, TDomain>(normalized);
|
||||
});
|
||||
}).distinctUntilChanged();
|
||||
|
||||
return new RemoteData(
|
||||
href,
|
||||
@@ -113,7 +113,7 @@ export class RemoteDataBuildService {
|
||||
|
||||
buildList<TNormalized extends CacheableObject, TDomain>(href: string,
|
||||
normalizedType: GenericConstructor<TNormalized>): RemoteData<TDomain[]> {
|
||||
const requestObs = this.store.select<RequestEntry>('core', 'data', 'request', href)
|
||||
const requestObs = this.requestService.get(href)
|
||||
.filter((entry) => hasValue(entry));
|
||||
const responseCacheObs = this.responseCache.get(href).filter((entry) => hasValue(entry));
|
||||
|
||||
|
Reference in New Issue
Block a user