mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Replaced deprecated rxjs flatMap operator
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { BehaviorSubject, of as observableOf, Observable, Subject } from 'rxjs';
|
||||
import { filter, flatMap, map, startWith, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
||||
import { filter, map, mergeMap, startWith, switchMap, take } from 'rxjs/operators';
|
||||
import { PaginatedSearchOptions } from '../shared/search/paginated-search-options.model';
|
||||
import { SearchService } from '../core/shared/search/search.service';
|
||||
import { SortDirection, SortOptions } from '../core/cache/models/sort-options.model';
|
||||
@@ -15,14 +15,10 @@ import { Bitstream } from '../core/shared/bitstream.model';
|
||||
import { Collection } from '../core/shared/collection.model';
|
||||
import { DSpaceObjectType } from '../core/shared/dspace-object-type.model';
|
||||
import { Item } from '../core/shared/item.model';
|
||||
import {
|
||||
getSucceededRemoteData,
|
||||
redirectOn404Or401,
|
||||
toDSpaceObjectListRD
|
||||
} from '../core/shared/operators';
|
||||
import { getSucceededRemoteData, redirectOn404Or401, toDSpaceObjectListRD } from '../core/shared/operators';
|
||||
|
||||
import { fadeIn, fadeInOut } from '../shared/animations/fade';
|
||||
import { hasNoValue, hasValue, isNotEmpty } from '../shared/empty.util';
|
||||
import { hasValue, isNotEmpty } from '../shared/empty.util';
|
||||
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
|
||||
|
||||
@Component({
|
||||
@@ -69,7 +65,7 @@ export class CollectionPageComponent implements OnInit {
|
||||
this.logoRD$ = this.collectionRD$.pipe(
|
||||
map((rd: RemoteData<Collection>) => rd.payload),
|
||||
filter((collection: Collection) => hasValue(collection)),
|
||||
flatMap((collection: Collection) => collection.logo)
|
||||
mergeMap((collection: Collection) => collection.logo)
|
||||
);
|
||||
|
||||
this.paginationChanges$ = new BehaviorSubject({
|
||||
|
@@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { catchError, filter, first, flatMap, map, take } from 'rxjs/operators';
|
||||
import { catchError, filter, first, map, mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||
import {
|
||||
@@ -85,7 +85,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
|
||||
|
||||
const bundles$: Observable<PaginatedList<Bundle>> = this.item$.pipe(
|
||||
filter((item: Item) => isNotEmpty(item.bundles)),
|
||||
flatMap((item: Item) => item.bundles),
|
||||
mergeMap((item: Item) => item.bundles),
|
||||
getFirstSucceededRemoteDataWithNotEmptyPayload(),
|
||||
catchError((error) => {
|
||||
console.error(error);
|
||||
@@ -102,7 +102,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
bundles$.pipe(
|
||||
take(1),
|
||||
flatMap((list: PaginatedList<Bundle>) => list.page),
|
||||
mergeMap((list: PaginatedList<Bundle>) => list.page),
|
||||
map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) }))
|
||||
).subscribe((entry: BundleBitstreamsMapEntry) => {
|
||||
this.bundleBitstreamsMap.set(entry.id, entry.bitstreams)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { combineLatest as observableCombineLatest, zip as observableZip } from 'rxjs';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { distinctUntilChanged, flatMap, map, switchMap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, map, mergeMap, switchMap } from 'rxjs/operators';
|
||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||
@@ -43,7 +43,7 @@ export const compareArraysUsingIds = <T extends { id: string }>() =>
|
||||
export const relationsToItems = (thisId: string) =>
|
||||
(source: Observable<Relationship[]>): Observable<Item[]> =>
|
||||
source.pipe(
|
||||
flatMap((rels: Relationship[]) =>
|
||||
mergeMap((rels: Relationship[]) =>
|
||||
observableZip(
|
||||
...rels.map((rel: Relationship) => observableCombineLatest(rel.leftItem, rel.rightItem))
|
||||
)
|
||||
|
@@ -5,7 +5,7 @@ import { Observable, of as observableOf } from 'rxjs';
|
||||
import { AppState } from '../app.reducer';
|
||||
import { CommunityDataService } from '../core/data/community-data.service';
|
||||
import { FindListOptions } from '../core/data/request.models';
|
||||
import { map, flatMap } from 'rxjs/operators';
|
||||
import { map, mergeMap } from 'rxjs/operators';
|
||||
import { Community } from '../core/shared/community.model';
|
||||
import { Collection } from '../core/shared/collection.model';
|
||||
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||
@@ -127,6 +127,7 @@ export class CommunityListService {
|
||||
|
||||
/**
|
||||
* Gets all top communities, limited by page, and transforms this in a list of flatNodes.
|
||||
* @param findOptions FindListOptions
|
||||
* @param expandedNodes List of expanded nodes; if a node is not expanded its subCommunities and collections need
|
||||
* not be added to the list
|
||||
*/
|
||||
@@ -148,7 +149,7 @@ export class CommunityListService {
|
||||
return new PaginatedList(newPageInfo, newPage);
|
||||
})
|
||||
);
|
||||
return topComs$.pipe(flatMap((topComs: PaginatedList<Community>) => this.transformListOfCommunities(topComs, 0, null, expandedNodes)));
|
||||
return topComs$.pipe(mergeMap((topComs: PaginatedList<Community>) => this.transformListOfCommunities(topComs, 0, null, expandedNodes)));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -229,7 +230,7 @@ export class CommunityListService {
|
||||
})
|
||||
.pipe(
|
||||
getSucceededRemoteData(),
|
||||
flatMap((rd: RemoteData<PaginatedList<Community>>) =>
|
||||
mergeMap((rd: RemoteData<PaginatedList<Community>>) =>
|
||||
this.transformListOfCommunities(rd.payload, level + 1, communityFlatNode, expandedNodes))
|
||||
);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Inject, Injectable, Injector } from '@angular/core';
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { Actions, Effect, ofType } from '@ngrx/effects';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { catchError, filter, flatMap, map, take } from 'rxjs/operators';
|
||||
import { catchError, filter, map, mergeMap, take } from 'rxjs/operators';
|
||||
|
||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||
import { StoreActionTypes } from '../../store.actions';
|
||||
@@ -11,7 +11,12 @@ import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.
|
||||
|
||||
import { DSpaceRESTv2Service } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { DSpaceSerializer } from '../dspace-rest-v2/dspace.serializer';
|
||||
import { RequestActionTypes, RequestCompleteAction, RequestExecuteAction, ResetResponseTimestampsAction } from './request.actions';
|
||||
import {
|
||||
RequestActionTypes,
|
||||
RequestCompleteAction,
|
||||
RequestExecuteAction,
|
||||
ResetResponseTimestampsAction
|
||||
} from './request.actions';
|
||||
import { RequestError, RestRequest } from './request.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RequestService } from './request.service';
|
||||
@@ -29,14 +34,14 @@ export class RequestEffects {
|
||||
|
||||
@Effect() execute = this.actions$.pipe(
|
||||
ofType(RequestActionTypes.EXECUTE),
|
||||
flatMap((action: RequestExecuteAction) => {
|
||||
mergeMap((action: RequestExecuteAction) => {
|
||||
return this.requestService.getByUUID(action.payload).pipe(
|
||||
take(1)
|
||||
);
|
||||
}),
|
||||
filter((entry: RequestEntry) => hasValue(entry)),
|
||||
map((entry: RequestEntry) => entry.request),
|
||||
flatMap((request: RestRequest) => {
|
||||
mergeMap((request: RestRequest) => {
|
||||
let body = request.body;
|
||||
if (isNotEmpty(request.body) && !request.isMultipart) {
|
||||
const serializer = new DSpaceSerializer(getClassForType(request.body.type));
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { merge as observableMerge, Observable, throwError as observableThrowError } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, partition, take, tap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, find, map, mergeMap, partition, take, tap } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { hasValue, isEmpty, isNotEmpty, isNotUndefined, isUndefined } from '../../shared/empty.util';
|
||||
@@ -45,7 +45,7 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
|
||||
const requestId = this.requestService.generateRequestId();
|
||||
let startTransactionTime = null;
|
||||
const [patchRequest$, emptyRequest$] = partition((request: PatchRequestDefinition) => isNotEmpty(request.body))(hrefObs.pipe(
|
||||
flatMap((endpointURL: string) => {
|
||||
mergeMap((endpointURL: string) => {
|
||||
return this.store.select(jsonPatchOperationsByResourceType(resourceType)).pipe(
|
||||
take(1),
|
||||
filter((operationsList: JsonPatchOperationsResourceEntry) => isUndefined(operationsList) || !(operationsList.commitPending)),
|
||||
@@ -84,7 +84,7 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
|
||||
filter((request: PatchRequestDefinition) => isNotEmpty(request.body)),
|
||||
tap(() => this.store.dispatch(new StartTransactionPatchOperationsAction(resourceType, resourceId, startTransactionTime))),
|
||||
tap((request: PatchRequestDefinition) => this.requestService.configure(request)),
|
||||
flatMap(() => {
|
||||
mergeMap(() => {
|
||||
const [successResponse$, errorResponse$] = partition((response: RestResponse) => response.isSuccessful)(this.requestService.getByUUID(requestId).pipe(
|
||||
getResponseFromEntry(),
|
||||
find((entry: RestResponse) => startTransactionTime < entry.timeAdded),
|
||||
@@ -93,7 +93,7 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
|
||||
return observableMerge(
|
||||
errorResponse$.pipe(
|
||||
tap(() => this.store.dispatch(new RollbacktPatchOperationsAction(resourceType, resourceId))),
|
||||
flatMap((error: ErrorResponse) => observableThrowError(error))),
|
||||
mergeMap((error: ErrorResponse) => observableThrowError(error))),
|
||||
successResponse$.pipe(
|
||||
filter((response: PostPatchSuccessResponse) => isNotEmpty(response)),
|
||||
tap(() => this.store.dispatch(new CommitPatchOperationsAction(resourceType, resourceId))),
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@@ -6,9 +6,9 @@ import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||
import { CookieService } from '../services/cookie.service';
|
||||
import { environment } from '../../../environments/environment';
|
||||
import { AuthService } from '../auth/auth.service';
|
||||
import { Observable, of as observableOf, combineLatest } from 'rxjs';
|
||||
import { map, take, flatMap } from 'rxjs/operators';
|
||||
import { NativeWindowService, NativeWindowRef } from '../services/window.service';
|
||||
import { combineLatest, Observable, of as observableOf } from 'rxjs';
|
||||
import { map, mergeMap, take } from 'rxjs/operators';
|
||||
import { NativeWindowRef, NativeWindowService } from '../services/window.service';
|
||||
|
||||
export const LANG_COOKIE = 'dsLanguage';
|
||||
|
||||
@@ -74,7 +74,7 @@ export class LocaleService {
|
||||
|
||||
return obs$.pipe(
|
||||
take(1),
|
||||
flatMap(([isAuthenticated, isLoaded]) => {
|
||||
mergeMap(([isAuthenticated, isLoaded]) => {
|
||||
// TODO to enabled again when https://github.com/DSpace/dspace-angular/issues/739 will be resolved
|
||||
const epersonLang$: Observable<string[]> = observableOf([]);
|
||||
/* if (isAuthenticated && isLoaded) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { LocaleService, LANG_ORIGIN } from './locale.service';
|
||||
import { LANG_ORIGIN, LocaleService } from './locale.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable, combineLatest, of as observableOf } from 'rxjs';
|
||||
import { take, flatMap, map } from 'rxjs/operators';
|
||||
import { isNotEmpty, isEmpty } from 'src/app/shared/empty.util';
|
||||
import { combineLatest, Observable, of as observableOf } from 'rxjs';
|
||||
import { map, mergeMap, take } from 'rxjs/operators';
|
||||
import { isEmpty, isNotEmpty } from 'src/app/shared/empty.util';
|
||||
|
||||
@Injectable()
|
||||
export class ServerLocaleService extends LocaleService {
|
||||
@@ -20,7 +20,7 @@ export class ServerLocaleService extends LocaleService {
|
||||
|
||||
return obs$.pipe(
|
||||
take(1),
|
||||
flatMap(([isAuthenticated, isLoaded]) => {
|
||||
mergeMap(([isAuthenticated, isLoaded]) => {
|
||||
let epersonLang$: Observable<string[]> = observableOf([]);
|
||||
if (isAuthenticated && isLoaded) {
|
||||
epersonLang$ = this.authService.getAuthenticatedUserFromStore().pipe(
|
||||
|
@@ -21,7 +21,7 @@ import {
|
||||
MetadataRegistrySelectFieldAction,
|
||||
MetadataRegistrySelectSchemaAction
|
||||
} from '../../+admin/admin-registries/metadata-registry/metadata-registry.actions';
|
||||
import { flatMap, map, tap } from 'rxjs/operators';
|
||||
import { map, mergeMap, tap } from 'rxjs/operators';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
@@ -75,7 +75,7 @@ export class RegistryService {
|
||||
map((schemas: PaginatedList<MetadataSchema>) => schemas.page),
|
||||
isNotEmptyOperator(),
|
||||
map((schemas: MetadataSchema[]) => schemas.filter((schema) => schema.prefix === prefix)[0]),
|
||||
flatMap((schema: MetadataSchema) => this.metadataSchemaService.findById(`${schema.id}`, ...linksToFollow))
|
||||
mergeMap((schema: MetadataSchema) => this.metadataSchemaService.findById(`${schema.id}`, ...linksToFollow))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -290,6 +290,8 @@ export class RegistryService {
|
||||
* Retrieve a filtered paginated list of metadata fields
|
||||
* @param query {string} The query to use for the metadata field name, can be part of the fully qualified field,
|
||||
* should start with the start of the schema, element or qualifier (e.g. “dc.ti”, “contributor”, “auth”, “contributor.ot”)
|
||||
* @param options
|
||||
* @param linksToFollow
|
||||
* @returns an observable that emits a remote data object with a page of metadata fields that match the query
|
||||
*/
|
||||
queryMetadataFields(query: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<MetadataField>>): Observable<RemoteData<PaginatedList<MetadataField>>> {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Router, UrlTree } from '@angular/router';
|
||||
import { Observable, combineLatest as observableCombineLatest } from 'rxjs';
|
||||
import { filter, find, flatMap, map, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { combineLatest as observableCombineLatest, Observable } from 'rxjs';
|
||||
import { filter, find, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { hasValue, hasValueOperator, isNotEmpty } from '../../shared/empty.util';
|
||||
import { SearchResult } from '../../shared/search/search-result.model';
|
||||
import { DSOSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
@@ -23,14 +23,14 @@ import { getEndUserAgreementPath } from '../../info/info-routing-paths';
|
||||
export const getRequestFromRequestHref = (requestService: RequestService) =>
|
||||
(source: Observable<string>): Observable<RequestEntry> =>
|
||||
source.pipe(
|
||||
flatMap((href: string) => requestService.getByHref(href)),
|
||||
mergeMap((href: string) => requestService.getByHref(href)),
|
||||
hasValueOperator()
|
||||
);
|
||||
|
||||
export const getRequestFromRequestUUID = (requestService: RequestService) =>
|
||||
(source: Observable<string>): Observable<RequestEntry> =>
|
||||
source.pipe(
|
||||
flatMap((uuid: string) => requestService.getByUUID(uuid)),
|
||||
mergeMap((uuid: string) => requestService.getByUUID(uuid)),
|
||||
hasValueOperator()
|
||||
);
|
||||
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { merge as observableMerge, Observable, throwError as observableThrowError } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import {
|
||||
DeleteRequest, GetRequest,
|
||||
DeleteRequest,
|
||||
PostRequest,
|
||||
RestRequest,
|
||||
SubmissionDeleteRequest,
|
||||
@@ -20,7 +20,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ErrorResponse, RestResponse, SubmissionSuccessResponse } from '../cache/response.models';
|
||||
import { getResponseFromEntry } from '../shared/operators';
|
||||
import {URLCombiner} from '../url-combiner/url-combiner';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
|
||||
/**
|
||||
* The service handling all submission REST requests
|
||||
@@ -96,7 +96,7 @@ export class SubmissionRestService {
|
||||
map((endpointURL: string) => this.getEndpointByIDHref(endpointURL, scopeId)),
|
||||
map((endpointURL: string) => new SubmissionDeleteRequest(requestId, endpointURL)),
|
||||
tap((request: DeleteRequest) => this.requestService.configure(request)),
|
||||
flatMap(() => this.fetchRequest(requestId)),
|
||||
mergeMap(() => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ export class SubmissionRestService {
|
||||
this.requestService.removeByHrefSubstring(request.href);
|
||||
this.requestService.configure(request);
|
||||
}),
|
||||
flatMap(() => this.fetchRequest(requestId)),
|
||||
mergeMap(() => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ export class SubmissionRestService {
|
||||
distinctUntilChanged(),
|
||||
map((endpointURL: string) => new SubmissionPostRequest(requestId, endpointURL, body, options)),
|
||||
tap((request: PostRequest) => this.requestService.configure(request)),
|
||||
flatMap(() => this.fetchRequest(requestId)),
|
||||
mergeMap(() => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ export class SubmissionRestService {
|
||||
distinctUntilChanged(),
|
||||
map((endpointURL: string) => new SubmissionPatchRequest(requestId, endpointURL, body)),
|
||||
tap((request: PostRequest) => this.requestService.configure(request)),
|
||||
flatMap(() => this.fetchRequest(requestId)),
|
||||
mergeMap(() => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, first, flatMap, map } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, map, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../../cache/builders/build-decorators';
|
||||
@@ -22,7 +22,7 @@ import { PaginatedList } from '../../data/paginated-list';
|
||||
import { Vocabulary } from './models/vocabulary.model';
|
||||
import { VOCABULARY } from './models/vocabularies.resource-type';
|
||||
import { VocabularyEntry } from './models/vocabulary-entry.model';
|
||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
|
||||
import { isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
@@ -295,7 +295,7 @@ export class VocabularyService {
|
||||
|
||||
return this.vocabularyEntryDetailDataService.getBrowseEndpoint().pipe(
|
||||
map((href: string) => `${href}/${linkPath}`),
|
||||
flatMap((href) => this.vocabularyEntryDetailDataService.findByHref(href, ...linksToFollow))
|
||||
mergeMap((href) => this.vocabularyEntryDetailDataService.findByHref(href, ...linksToFollow))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ export class VocabularyService {
|
||||
pageInfo.currentPage
|
||||
);
|
||||
return this.vocabularyEntryDetailDataService.getFindAllHref(options, linkPath).pipe(
|
||||
flatMap((href) => this.vocabularyEntryDetailDataService.findAllByHref(href, options, ...linksToFollow))
|
||||
mergeMap((href) => this.vocabularyEntryDetailDataService.findAllByHref(href, options, ...linksToFollow))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { merge as observableMerge, Observable, of as observableOf } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators';
|
||||
|
||||
import { DataService } from '../data/data.service';
|
||||
import { DeleteRequest, FindListOptions, PostRequest, TaskDeleteRequest, TaskPostRequest } from '../data/request.models';
|
||||
import { DeleteRequest, PostRequest, TaskDeleteRequest, TaskPostRequest } from '../data/request.models';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { ProcessTaskResponse } from './models/process-task-response';
|
||||
@@ -80,7 +80,7 @@ export abstract class TasksService<T extends CacheableObject> extends DataServic
|
||||
distinctUntilChanged(),
|
||||
map((endpointURL: string) => new TaskPostRequest(requestId, endpointURL, body, options)),
|
||||
tap((request: PostRequest) => this.requestService.configure(request)),
|
||||
flatMap((request: PostRequest) => this.fetchRequest(requestId)),
|
||||
mergeMap((request: PostRequest) => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export abstract class TasksService<T extends CacheableObject> extends DataServic
|
||||
map((endpointURL: string) => this.getEndpointByIDHref(endpointURL, scopeId)),
|
||||
map((endpointURL: string) => new TaskDeleteRequest(requestId, endpointURL, null, options)),
|
||||
tap((request: DeleteRequest) => this.requestService.configure(request)),
|
||||
flatMap((request: DeleteRequest) => this.fetchRequest(requestId)),
|
||||
mergeMap((request: DeleteRequest) => this.fetchRequest(requestId)),
|
||||
distinctUntilChanged());
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, OnInit, O
|
||||
import { FormGroup } from '@angular/forms';
|
||||
|
||||
import { combineLatest, Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
import { filter, flatMap, map, mergeMap, scan } from 'rxjs/operators';
|
||||
import { filter, map, mergeMap, scan } from 'rxjs/operators';
|
||||
import {
|
||||
DynamicFormControlComponent,
|
||||
DynamicFormControlModel,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { isEqual, isObject } from 'lodash';
|
||||
|
||||
import { DynamicRelationGroupModel} from './dynamic-relation-group.model';
|
||||
import { DynamicRelationGroupModel } from './dynamic-relation-group.model';
|
||||
import { FormBuilderService } from '../../../form-builder.service';
|
||||
import { SubmissionFormsModel } from '../../../../../../core/config/models/config-submission-forms.model';
|
||||
import { FormService } from '../../../../form.service';
|
||||
@@ -226,7 +226,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
|
||||
// If authority
|
||||
this.subs.push(initChipsValue$.pipe(
|
||||
flatMap((valueModel) => {
|
||||
mergeMap((valueModel) => {
|
||||
const returnList: Array<Observable<any>> = [];
|
||||
valueModel.forEach((valueObj) => {
|
||||
const returnObj = Object.keys(valueObj).map((fieldName) => {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, find, flatMap, map } from 'rxjs/operators';
|
||||
import { filter, find, map, mergeMap } from 'rxjs/operators';
|
||||
|
||||
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
@@ -34,7 +34,7 @@ export class ItemSubmitterComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.submitter$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||
filter((rd: RemoteData<WorkflowItem>) => (rd.hasSucceeded && isNotUndefined(rd.payload))),
|
||||
flatMap((rd: RemoteData<WorkflowItem>) => rd.payload.submitter as Observable<RemoteData<EPerson>>),
|
||||
mergeMap((rd: RemoteData<WorkflowItem>) => rd.payload.submitter as Observable<RemoteData<EPerson>>),
|
||||
find((rd: RemoteData<EPerson>) => rd.hasSucceeded && isNotEmpty(rd.payload)),
|
||||
map((rd: RemoteData<EPerson>) => rd.payload));
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { BehaviorSubject, Observable, of as observableOf } from 'rxjs';
|
||||
import { flatMap, map, merge, scan } from 'rxjs/operators';
|
||||
import { map, merge, mergeMap, scan } from 'rxjs/operators';
|
||||
import { findIndex } from 'lodash';
|
||||
|
||||
import { LOAD_MORE_NODE, LOAD_MORE_ROOT_NODE, TreeviewFlatNode, TreeviewNode } from './vocabulary-treeview-node.model';
|
||||
@@ -186,13 +186,13 @@ export class VocabularyTreeviewService {
|
||||
|
||||
this.vocabularyService.getVocabularyEntriesByValue(query, false, this.vocabularyOptions, new PageInfo()).pipe(
|
||||
getFirstSucceededRemoteListPayload(),
|
||||
flatMap((result: VocabularyEntry[]) => (result.length > 0) ? result : observableOf(null)),
|
||||
flatMap((entry: VocabularyEntry) =>
|
||||
mergeMap((result: VocabularyEntry[]) => (result.length > 0) ? result : observableOf(null)),
|
||||
mergeMap((entry: VocabularyEntry) =>
|
||||
this.vocabularyService.findEntryDetailById(entry.otherInformation.id, this.vocabularyName).pipe(
|
||||
getFirstSucceededRemoteDataPayload()
|
||||
)
|
||||
),
|
||||
flatMap((entry: VocabularyEntryDetail) => this.getNodeHierarchy(entry)),
|
||||
mergeMap((entry: VocabularyEntryDetail) => this.getNodeHierarchy(entry)),
|
||||
scan((acc: TreeviewNode[], value: TreeviewNode) => {
|
||||
if (isEmpty(value) || findIndex(acc, (node) => node.item.otherInformation.id === value.item.otherInformation.id) !== -1) {
|
||||
return acc;
|
||||
@@ -256,7 +256,7 @@ export class VocabularyTreeviewService {
|
||||
*/
|
||||
private getNodeHierarchyById(id: string): Observable<string[]> {
|
||||
return this.getById(id).pipe(
|
||||
flatMap((entry: VocabularyEntryDetail) => this.getNodeHierarchy(entry, [], false)),
|
||||
mergeMap((entry: VocabularyEntryDetail) => this.getNodeHierarchy(entry, [], false)),
|
||||
map((node: TreeviewNode) => this.getNodeHierarchyIds(node))
|
||||
);
|
||||
}
|
||||
@@ -349,7 +349,7 @@ export class VocabularyTreeviewService {
|
||||
|
||||
if (node.item.hasOtherInformation() && isNotEmpty(node.item.otherInformation.parent)) {
|
||||
return this.getParentNode(node.item.otherInformation.id).pipe(
|
||||
flatMap((parentItem: VocabularyEntryDetail) => this.getNodeHierarchy(parentItem, [node], toStore))
|
||||
mergeMap((parentItem: VocabularyEntryDetail) => this.getNodeHierarchy(parentItem, [node], toStore))
|
||||
)
|
||||
} else {
|
||||
return observableOf(node);
|
||||
|
@@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';
|
||||
import { filter, flatMap, take } from 'rxjs/operators';
|
||||
import { filter, mergeMap, take } from 'rxjs/operators';
|
||||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
import { ExternalSourceService } from '../../core/data/external-source.service';
|
||||
@@ -179,7 +179,7 @@ export class SubmissionImportExternalComponent implements OnInit, OnDestroy {
|
||||
this.searchConfigService.paginatedSearchOptions.pipe(
|
||||
filter((searchOptions) => searchOptions.query === query),
|
||||
take(1),
|
||||
flatMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions).pipe(
|
||||
mergeMap((searchOptions) => this.externalService.getExternalSourceEntries(this.routeData.sourceId, searchOptions).pipe(
|
||||
getFinishedRemoteData(),
|
||||
take(1)
|
||||
)),
|
||||
|
@@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core';
|
||||
import { DynamicFormControlEvent, DynamicFormControlModel } from '@ng-dynamic-forms/core';
|
||||
|
||||
import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, find, map, mergeMap, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
@@ -158,8 +158,8 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
||||
this.formConfigService.getConfigByHref(this.sectionData.config).pipe(
|
||||
map((configData: ConfigData) => configData.payload),
|
||||
tap((config: SubmissionFormsModel) => this.formConfig = config),
|
||||
flatMap(() =>
|
||||
observableCombineLatest(
|
||||
mergeMap(() =>
|
||||
observableCombineLatest([
|
||||
this.sectionService.getSectionData(this.submissionId, this.sectionData.id, this.sectionData.sectionType),
|
||||
this.submissionObjectService.getHrefByID(this.submissionId).pipe(take(1)).pipe(
|
||||
switchMap((href: string) => {
|
||||
@@ -174,7 +174,7 @@ export class SubmissionSectionformComponent extends SectionModelComponent {
|
||||
switchMap(() => this.submissionObjectService.findById(this.submissionId, followLink('item')).pipe(getSucceededRemoteData(), getRemoteDataPayload()) as Observable<SubmissionObject>)
|
||||
)
|
||||
})
|
||||
)
|
||||
)]
|
||||
)),
|
||||
take(1))
|
||||
.subscribe(([sectionData, workspaceItem]: [WorkspaceitemSectionFormObject, WorkspaceItem]) => {
|
||||
|
@@ -7,7 +7,7 @@ import {
|
||||
} from '@ng-dynamic-forms/core';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, startWith, take } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, find, map, mergeMap, startWith, take } from 'rxjs/operators';
|
||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
@@ -131,7 +131,7 @@ export class SubmissionSectionLicenseComponent extends SectionModelComponent {
|
||||
|
||||
this.licenseText$ = this.collectionDataService.findById(this.collectionId, followLink('license')).pipe(
|
||||
filter((collectionData: RemoteData<Collection>) => isNotUndefined((collectionData.payload))),
|
||||
flatMap((collectionData: RemoteData<Collection>) => (collectionData.payload as any).license),
|
||||
mergeMap((collectionData: RemoteData<Collection>) => (collectionData.payload as any).license),
|
||||
find((licenseData: RemoteData<License>) => isNotUndefined((licenseData.payload))),
|
||||
map((licenseData: RemoteData<License>) => licenseData.payload.text),
|
||||
startWith(''));
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||
import { filter, first, flatMap, take } from 'rxjs/operators';
|
||||
import { filter, first, mergeMap, take } from 'rxjs/operators';
|
||||
import { DynamicFormControlModel, } from '@ng-dynamic-forms/core';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@@ -250,9 +250,9 @@ export class SubmissionSectionUploadFileComponent implements OnChanges, OnInit {
|
||||
this.subscriptions.push(this.formService.isValid(this.formId).pipe(
|
||||
take(1),
|
||||
filter((isValid) => isValid),
|
||||
flatMap(() => this.formService.getFormData(this.formId)),
|
||||
mergeMap(() => this.formService.getFormData(this.formId)),
|
||||
take(1),
|
||||
flatMap((formData: any) => {
|
||||
mergeMap((formData: any) => {
|
||||
// collect bitstream metadata
|
||||
Object.keys((formData.metadata))
|
||||
.filter((key) => isNotEmpty(formData.metadata[key]))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { ChangeDetectorRef, Component, Inject } from '@angular/core';
|
||||
|
||||
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, reduce, take, tap } from 'rxjs/operators';
|
||||
import { distinctUntilChanged, filter, find, map, mergeMap, reduce, take, tap } from 'rxjs/operators';
|
||||
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { hasValue, isNotEmpty, isNotUndefined, isUndefined } from '../../../shared/empty.util';
|
||||
@@ -159,11 +159,11 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
filter((submissionObject: SubmissionObjectEntry) => isNotUndefined(submissionObject) && !submissionObject.isLoading),
|
||||
filter((submissionObject: SubmissionObjectEntry) => isUndefined(this.collectionId) || this.collectionId !== submissionObject.collection),
|
||||
tap((submissionObject: SubmissionObjectEntry) => this.collectionId = submissionObject.collection),
|
||||
flatMap((submissionObject: SubmissionObjectEntry) => this.collectionDataService.findById(submissionObject.collection)),
|
||||
mergeMap((submissionObject: SubmissionObjectEntry) => this.collectionDataService.findById(submissionObject.collection)),
|
||||
filter((rd: RemoteData<Collection>) => isNotUndefined((rd.payload))),
|
||||
tap((collectionRemoteData: RemoteData<Collection>) => this.collectionName = collectionRemoteData.payload.name),
|
||||
// TODO review this part when https://github.com/DSpace/dspace-angular/issues/575 is resolved
|
||||
/* flatMap((collectionRemoteData: RemoteData<Collection>) => {
|
||||
/* mergeMap((collectionRemoteData: RemoteData<Collection>) => {
|
||||
return this.resourcePolicyService.findByHref(
|
||||
(collectionRemoteData.payload as any)._links.defaultAccessConditions.href
|
||||
);
|
||||
@@ -176,8 +176,8 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
? defaultAccessConditionsRemoteData.payload : [defaultAccessConditionsRemoteData.payload];
|
||||
}
|
||||
}),*/
|
||||
flatMap(() => config$),
|
||||
flatMap((config: SubmissionUploadsModel) => {
|
||||
mergeMap(() => config$),
|
||||
mergeMap((config: SubmissionUploadsModel) => {
|
||||
this.required$.next(config.required);
|
||||
this.availableAccessConditionOptions = isNotEmpty(config.accessConditionOptions) ? config.accessConditionOptions : [];
|
||||
|
||||
@@ -203,7 +203,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
mapGroups$.push(
|
||||
this.groupService.findById(accessCondition.selectGroupUUID).pipe(
|
||||
find((rd: RemoteData<Group>) => !rd.isResponsePending && rd.hasSucceeded),
|
||||
flatMap((group: RemoteData<Group>) => group.payload.subgroups),
|
||||
mergeMap((group: RemoteData<Group>) => group.payload.subgroups),
|
||||
find((rd: RemoteData<PaginatedList<Group>>) => !rd.isResponsePending && rd.hasSucceeded),
|
||||
map((rd: RemoteData<PaginatedList<Group>>) => ({
|
||||
accessCondition: accessCondition.name,
|
||||
@@ -215,7 +215,7 @@ export class SubmissionSectionUploadComponent extends SectionModelComponent {
|
||||
});
|
||||
return mapGroups$;
|
||||
}),
|
||||
flatMap((entry) => entry),
|
||||
mergeMap((entry) => entry),
|
||||
reduce((acc: any[], entry: AccessConditionGroupsMapEntry) => {
|
||||
acc.push(entry);
|
||||
return acc;
|
||||
|
Reference in New Issue
Block a user