[CST-4504] Merged conflicts

This commit is contained in:
Rezart Vata
2021-10-01 18:16:46 +02:00
2 changed files with 15 additions and 20 deletions

View File

@@ -164,7 +164,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
ngOnInit(): void { ngOnInit(): void {
if ( !!this.currentItemIsLeftItem$ ) { if (!!this.currentItemIsLeftItem$) {
this.currentItemIsLeftItem$.subscribe((isLeft) => { this.currentItemIsLeftItem$.subscribe((isLeft) => {
this.isLeft = isLeft; this.isLeft = isLeft;
}); });

View File

@@ -13,8 +13,8 @@ import { SearchService } from '../../../../../../core/shared/search/search.servi
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { SelectableListService } from '../../../../../object-list/selectable-list/selectable-list.service'; import { SelectableListService } from '../../../../../object-list/selectable-list/selectable-list.service';
import { hasValue } from '../../../../../empty.util'; import { hasValue } from '../../../../../empty.util';
import { map, startWith, switchMap, take, tap } from 'rxjs/operators'; import { map, mapTo, startWith, switchMap, take, tap } from 'rxjs/operators';
import { getFirstSucceededRemoteData, getRemoteDataPayload } from '../../../../../../core/shared/operators'; import { getFirstSucceededRemoteData } from '../../../../../../core/shared/operators';
import { RouteService } from '../../../../../../core/services/route.service'; import { RouteService } from '../../../../../../core/services/route.service';
import { CollectionElementLinkType } from '../../../../../object-collection/collection-element-link.type'; import { CollectionElementLinkType } from '../../../../../object-collection/collection-element-link.type';
import { Context } from '../../../../../../core/shared/context.model'; import { Context } from '../../../../../../core/shared/context.model';
@@ -23,14 +23,8 @@ import { PaginationService } from '../../../../../../core/pagination/pagination.
import { RelationshipService } from '../../../../../../core/data/relationship.service'; import { RelationshipService } from '../../../../../../core/data/relationship.service';
import { RelationshipType } from '../../../../../../core/shared/item-relationships/relationship-type.model'; import { RelationshipType } from '../../../../../../core/shared/item-relationships/relationship-type.model';
import { ItemSearchResult } from '../../../../../../shared/object-collection/shared/item-search-result.model';
import { Relationship } from '../../../../../../core/shared/item-relationships/relationship.model'; import { Relationship } from '../../../../../../core/shared/item-relationships/relationship.model';
import { import { result } from 'lodash';
FieldUpdate,
FieldUpdates,
RelationshipIdentifiable
} from '../../../../../../core/data/object-updates/object-updates.reducer';
@Component({ @Component({
@@ -165,7 +159,6 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
this.routeService.setParameter('configuration', this.relationship.searchConfiguration); this.routeService.setParameter('configuration', this.relationship.searchConfiguration);
this.resultsRD$ = this.searchConfigService.paginatedSearchOptions.pipe( this.resultsRD$ = this.searchConfigService.paginatedSearchOptions.pipe(
switchMap((options) => this.lookupRelationService.getLocalResults(this.relationship, options).pipe( switchMap((options) => this.lookupRelationService.getLocalResults(this.relationship, options).pipe(
startWith(undefined),
tap( res => { tap( res => {
if ( !!res && res.hasSucceeded && this.isEditRelationship ) { if ( !!res && res.hasSucceeded && this.isEditRelationship ) {
const idOfItems = res.payload.page.map( itemSearchResult => { const idOfItems = res.payload.page.map( itemSearchResult => {
@@ -173,7 +166,8 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
}); });
this.setSelectedIds(idOfItems,res.payload.page); this.setSelectedIds(idOfItems,res.payload.page);
} }
}) }),
startWith(undefined),
)) ))
); );
} }
@@ -230,16 +224,17 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
map((resultsRD) => resultsRD.payload.page), map((resultsRD) => resultsRD.payload.page),
tap(() => this.selectAllLoading = false), tap(() => this.selectAllLoading = false),
switchMap((results) => this.selection$.pipe(
take(1),
tap((selection: SearchResult<Item>[]) => {
const filteredResults = results.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0);
this.selectObject.emit(...filteredResults);
}),
mapTo(results)
))
).subscribe((results) => { ).subscribe((results) => {
this.selection$
.pipe(take(1))
.subscribe((selection: SearchResult<Item>[]) => {
const filteredResults = results.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0);
this.selectObject.emit(...filteredResults);
});
this.selectableListService.select(this.listId, results); this.selectableListService.select(this.listId, results);
} });
);
} }
/** /**