mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-4504] Changed init api, disabled selected tab only for relationship edit page, fixed the related items checked, fixed the issue regarding the updated item control
This commit is contained in:
@@ -132,7 +132,6 @@ export class RelationshipTypeService extends DataService<RelationshipType> {
|
|||||||
*/
|
*/
|
||||||
searchByEntityType(type: string): Observable<RelationshipType[]> {
|
searchByEntityType(type: string): Observable<RelationshipType[]> {
|
||||||
|
|
||||||
|
|
||||||
return this.searchBy(
|
return this.searchBy(
|
||||||
'byEntityType',
|
'byEntityType',
|
||||||
{
|
{
|
||||||
@@ -142,7 +141,7 @@ export class RelationshipTypeService extends DataService<RelationshipType> {
|
|||||||
fieldValue: type
|
fieldValue: type
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}).pipe(
|
}, true,true,followLink('leftType'),followLink('rightType')).pipe(
|
||||||
getFirstSucceededRemoteData(),
|
getFirstSucceededRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
) as Observable<RelationshipType[]>;
|
) as Observable<RelationshipType[]>;
|
||||||
|
@@ -470,7 +470,7 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
return this.put(object);
|
return this.put(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchByItemsAndType(typeId: string,itemUuid: string,focusSide: string, arrayOfItemIds: string[] ): Observable<Relationship> {
|
searchByItemsAndType(typeId: string,itemUuid: string,relationshipLabel: string, arrayOfItemIds: string[] ): Observable<Relationship[]> {
|
||||||
|
|
||||||
let searchParams = [
|
let searchParams = [
|
||||||
{
|
{
|
||||||
@@ -483,7 +483,7 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'relationshipLabel',
|
fieldName: 'relationshipLabel',
|
||||||
fieldValue: 'isPublicationOfAuthor'
|
fieldValue: relationshipLabel
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// fieldName: 'page',
|
// fieldName: 'page',
|
||||||
@@ -500,17 +500,14 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return this.searchBy(
|
||||||
|
|
||||||
|
|
||||||
return this.getSearchByHref(
|
|
||||||
'byItemsAndType',
|
'byItemsAndType',
|
||||||
{
|
{
|
||||||
searchParams: searchParams
|
searchParams: searchParams
|
||||||
}).pipe(
|
}).pipe(
|
||||||
switchMap((href) => this.findByHref(href)),
|
|
||||||
getFirstSucceededRemoteData(),
|
getFirstSucceededRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
);
|
) as Observable<Relationship[]>;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -140,6 +140,10 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
*/
|
*/
|
||||||
modalRef: NgbModalRef;
|
modalRef: NgbModalRef;
|
||||||
|
|
||||||
|
listOfRelatedItems = [];
|
||||||
|
|
||||||
|
relationshipTypeInfo: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected objectUpdatesService: ObjectUpdatesService,
|
protected objectUpdatesService: ObjectUpdatesService,
|
||||||
protected linkService: LinkService,
|
protected linkService: LinkService,
|
||||||
@@ -210,6 +214,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
const modalComp: DsDynamicLookupRelationModalComponent = this.modalRef.componentInstance;
|
const modalComp: DsDynamicLookupRelationModalComponent = this.modalRef.componentInstance;
|
||||||
modalComp.repeatable = true;
|
modalComp.repeatable = true;
|
||||||
|
modalComp.isEditRelationship = true;
|
||||||
modalComp.listId = this.listId;
|
modalComp.listId = this.listId;
|
||||||
modalComp.item = this.item;
|
modalComp.item = this.item;
|
||||||
modalComp.relationshipType = this.relationshipType;
|
modalComp.relationshipType = this.relationshipType;
|
||||||
@@ -223,12 +228,14 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
modalComp.select = (...selectableObjects: SearchResult<Item>[]) => {
|
modalComp.select = (...selectableObjects: SearchResult<Item>[]) => {
|
||||||
selectableObjects.forEach((searchResult) => {
|
selectableObjects.forEach((searchResult) => {
|
||||||
const relatedItem: Item = searchResult.indexableObject;
|
const relatedItem: Item = searchResult.indexableObject;
|
||||||
this.getFieldUpdatesForRelatedItem(relatedItem)
|
this.getFieldUpdatesForRelatedItemNew(relatedItem)
|
||||||
.subscribe((identifiables) => {
|
.subscribe((isRelated: boolean) => {
|
||||||
identifiables.forEach((identifiable) =>
|
|
||||||
this.objectUpdatesService.removeSingleFieldUpdate(this.url, identifiable.uuid)
|
|
||||||
);
|
// identifiables.forEach((identifiable) =>
|
||||||
if (identifiables.length === 0) {
|
// this.objectUpdatesService.removeSingleFieldUpdate(this.url, identifiable.uuid)
|
||||||
|
// );
|
||||||
|
if (!isRelated) {
|
||||||
this.relationshipService.getNameVariant(this.listId, relatedItem.uuid)
|
this.relationshipService.getNameVariant(this.listId, relatedItem.uuid)
|
||||||
.subscribe((nameVariant) => {
|
.subscribe((nameVariant) => {
|
||||||
const update = {
|
const update = {
|
||||||
@@ -301,7 +308,8 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
return searchResult;
|
return searchResult;
|
||||||
})),
|
})),
|
||||||
).subscribe((items) => {
|
).subscribe((items) => {
|
||||||
this.selectableListService.select(this.listId, items);
|
// console.log(items);
|
||||||
|
// this.selectableListService.select(this.listId, items);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(modalComp);
|
console.log(modalComp);
|
||||||
@@ -312,7 +320,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
* @param relatedItem The item for which to get the existing field updates
|
* @param relatedItem The item for which to get the existing field updates
|
||||||
*/
|
*/
|
||||||
private getFieldUpdatesForRelatedItem(relatedItem: Item): Observable<RelationshipIdentifiable[]> {
|
private getFieldUpdatesForRelatedItem(relatedItem: Item): Observable<RelationshipIdentifiable[]> {
|
||||||
|
console.log("getFieldUpdatesForRelatedItem",relatedItem);
|
||||||
return this.updates$.pipe(
|
return this.updates$.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((updates) => Object.values(updates)
|
map((updates) => Object.values(updates)
|
||||||
@@ -324,14 +332,43 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
identifiables.map((identifiable) => this.getRelatedItem(identifiable.relationship))
|
identifiables.map((identifiable) => this.getRelatedItem(identifiable.relationship))
|
||||||
).pipe(
|
).pipe(
|
||||||
defaultIfEmpty([]),
|
defaultIfEmpty([]),
|
||||||
map((relatedItems) =>
|
map((relatedItems) => {
|
||||||
identifiables.filter((identifiable, index) => relatedItems[index].uuid === relatedItem.uuid)
|
console.log("identifiables",identifiables,relatedItems);
|
||||||
|
return identifiables.filter((identifiable, index) =>
|
||||||
|
{
|
||||||
|
console.log(relatedItems[index].uuid,relatedItems,relatedItem.uuid);
|
||||||
|
return relatedItems[index].uuid === relatedItem.uuid
|
||||||
|
})
|
||||||
|
}
|
||||||
),
|
),
|
||||||
|
tap(res=> console.log("getFieldUpdatesForRelatedItem -> res",res))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private getFieldUpdatesForRelatedItemNew(relatedItem: Item): Observable<boolean> {
|
||||||
|
|
||||||
|
return this.currentItemIsLeftItem$.pipe(
|
||||||
|
take(1),
|
||||||
|
map(isLeft => {
|
||||||
|
if(isLeft){
|
||||||
|
this.relationshipType.leftwardType;
|
||||||
|
let listOfRelatedItems = this.item.allMetadataValues('relation.'+this.relationshipType.leftwardType);
|
||||||
|
return !!listOfRelatedItems.find((uuid) => uuid == relatedItem.uuid);
|
||||||
|
}else{
|
||||||
|
this.relationshipType.rightwardType;
|
||||||
|
let listOfRelatedItems = this.item.allMetadataValues('relation.'+this.relationshipType.rightwardType);
|
||||||
|
return !!listOfRelatedItems.find((uuid) => uuid == relatedItem.uuid);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// return this.relationshipService.searchByItemsAndType(this.relationshipType.id, this.item.uuid, this.relationshipTypeInfo ,[relatedItem.uuid])
|
||||||
|
// .pipe(map((res:any)=> res.page));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the related item for a given relationship
|
* Get the related item for a given relationship
|
||||||
* @param relationship The relationship for which to get the related item
|
* @param relationship The relationship for which to get the related item
|
||||||
@@ -382,6 +419,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// initialize the pagination options
|
// initialize the pagination options
|
||||||
this.paginationConfig = new PaginationComponentOptions();
|
this.paginationConfig = new PaginationComponentOptions();
|
||||||
this.paginationConfig.id = `er${this.relationshipType.id}`;
|
this.paginationConfig.id = `er${this.relationshipType.id}`;
|
||||||
@@ -459,10 +497,12 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
defaultIfEmpty([])
|
defaultIfEmpty([])
|
||||||
)),
|
)),
|
||||||
switchMap((nextFields: RelationshipIdentifiable[]) => {
|
switchMap((nextFields: RelationshipIdentifiable[]) => {
|
||||||
|
console.log("nextFields",nextFields);
|
||||||
// Get a list that contains the unsaved changes for the page, as well as the page of
|
// Get a list that contains the unsaved changes for the page, as well as the page of
|
||||||
// RelationshipIdentifiables, as a single list of FieldUpdates
|
// RelationshipIdentifiables, as a single list of FieldUpdates
|
||||||
return this.objectUpdatesService.getFieldUpdates(this.url, nextFields).pipe(
|
return this.objectUpdatesService.getFieldUpdates(this.url, nextFields).pipe(
|
||||||
map((fieldUpdates: FieldUpdates) => {
|
map((fieldUpdates: FieldUpdates) => {
|
||||||
|
console.log("fieldUpdates",fieldUpdates);
|
||||||
const fieldUpdatesFiltered: FieldUpdates = {};
|
const fieldUpdatesFiltered: FieldUpdates = {};
|
||||||
this.nbAddedFields$.next(0);
|
this.nbAddedFields$.next(0);
|
||||||
// iterate over the fieldupdates and filter out the ones that pertain to this
|
// iterate over the fieldupdates and filter out the ones that pertain to this
|
||||||
@@ -495,6 +535,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
startWith({}),
|
startWith({}),
|
||||||
).subscribe((updates: FieldUpdates) => {
|
).subscribe((updates: FieldUpdates) => {
|
||||||
this.loading$.next(false);
|
this.loading$.next(false);
|
||||||
|
console.log(updates);
|
||||||
this.updates$.next(updates);
|
this.updates$.next(updates);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@@ -81,33 +81,16 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent {
|
|||||||
const label = this.item.firstMetadataValue('dspace.entity.type');
|
const label = this.item.firstMetadataValue('dspace.entity.type');
|
||||||
if (label !== undefined) {
|
if (label !== undefined) {
|
||||||
|
|
||||||
// this.relationshipTypes$ = this.relationshipTypeService.searchByEntityType(label)
|
this.relationshipTypes$ = this.relationshipTypeService.searchByEntityType(label)
|
||||||
// .pipe(
|
.pipe(
|
||||||
// map((relationship:any) => relationship.page),
|
map((relationshipTypes:any) => relationshipTypes.page)
|
||||||
// tap(res => console.log(res))
|
);
|
||||||
// );
|
|
||||||
|
|
||||||
this.entityType$ = this.entityTypeService.getEntityTypeByLabel(label).pipe(
|
this.entityType$ = this.entityTypeService.getEntityTypeByLabel(label).pipe(
|
||||||
getFirstSucceededRemoteData(),
|
getFirstSucceededRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.relationshipTypes$ = this.entityType$.pipe(
|
|
||||||
switchMap((entityType) =>
|
|
||||||
this.entityTypeService.getEntityTypeRelationships(
|
|
||||||
entityType.id,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
followLink('leftType'),
|
|
||||||
followLink('rightType'))
|
|
||||||
.pipe(
|
|
||||||
getFirstSucceededRemoteData(),
|
|
||||||
getRemoteDataPayload(),
|
|
||||||
map((relationshipTypes) => relationshipTypes.page),
|
|
||||||
tap((res)=> console.log(res))
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
this.entityType$ = observableOf(undefined);
|
this.entityType$ = observableOf(undefined);
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,9 @@
|
|||||||
[context]="context"
|
[context]="context"
|
||||||
[query]="query"
|
[query]="query"
|
||||||
[relationshipType]="relationshipType"
|
[relationshipType]="relationshipType"
|
||||||
|
[isLeft]="isLeft"
|
||||||
[item]="item"
|
[item]="item"
|
||||||
|
[isEditRelationship]="isEditRelationship"
|
||||||
(selectObject)="select($event)"
|
(selectObject)="select($event)"
|
||||||
(deselectObject)="deselect($event)"
|
(deselectObject)="deselect($event)"
|
||||||
class="d-block pt-3">
|
class="d-block pt-3">
|
||||||
@@ -42,7 +44,7 @@
|
|||||||
</ds-dynamic-lookup-relation-external-source-tab>
|
</ds-dynamic-lookup-relation-external-source-tab>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-tab>
|
</ngb-tab>
|
||||||
<ngb-tab [title]="'submission.sections.describe.relationship-lookup.selection-tab.tab-title' | translate : {count: (selection$ | async)?.length}">
|
<ngb-tab [disabled]="isEditRelationship" [title]="'submission.sections.describe.relationship-lookup.selection-tab.tab-title' | translate : {count: (selection$ | async)?.length}">
|
||||||
<ng-template ngbTabContent>
|
<ng-template ngbTabContent>
|
||||||
<ds-dynamic-lookup-relation-selection-tab
|
<ds-dynamic-lookup-relation-selection-tab
|
||||||
[selection$]="selection$"
|
[selection$]="selection$"
|
||||||
|
@@ -118,6 +118,11 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
|
|
||||||
currentItemIsLeftItem$ : Observable<boolean>;
|
currentItemIsLeftItem$ : Observable<boolean>;
|
||||||
|
|
||||||
|
isLeft: boolean = false;
|
||||||
|
|
||||||
|
isEditRelationship: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public modal: NgbActiveModal,
|
public modal: NgbActiveModal,
|
||||||
private selectableListService: SelectableListService,
|
private selectableListService: SelectableListService,
|
||||||
@@ -136,13 +141,9 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
// this.currentItemIsLeftItem$.subscribe((isLeft) => {
|
this.currentItemIsLeftItem$.subscribe((isLeft) => {
|
||||||
// if(isLeft){
|
this.isLeft = isLeft;
|
||||||
// console.log(this.relationshipType.leftwardType);
|
});
|
||||||
// }else{
|
|
||||||
// console.log(this.relationshipType.rightwardType);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
this.selection$ = this.selectableListService
|
this.selection$ = this.selectableListService
|
||||||
|
@@ -14,7 +14,7 @@ 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, startWith, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { getFirstSucceededRemoteData } from '../../../../../../core/shared/operators';
|
import { getFirstSucceededRemoteData, getRemoteDataPayload } 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';
|
||||||
@@ -24,6 +24,16 @@ import { RelationshipService } from '../../../../../../core/data/relationship.se
|
|||||||
import { RelationshipType } from '../../../../../../core/shared/item-relationships/relationship-type.model';
|
import { RelationshipType } from '../../../../../../core/shared/item-relationships/relationship-type.model';
|
||||||
import { RelationshipTypeService } from '../../../../../../core/data/relationship-type.service';
|
import { RelationshipTypeService } from '../../../../../../core/data/relationship-type.service';
|
||||||
|
|
||||||
|
import { ItemSearchResult } from '../../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
|
|
||||||
|
import { Relationship } from '../../../../../../core/shared/item-relationships/relationship.model';
|
||||||
|
import {
|
||||||
|
FieldUpdate,
|
||||||
|
FieldUpdates,
|
||||||
|
RelationshipIdentifiable
|
||||||
|
} from '../../../../../../core/data/object-updates/object-updates.reducer';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dynamic-lookup-relation-search-tab',
|
selector: 'ds-dynamic-lookup-relation-search-tab',
|
||||||
styleUrls: ['./dynamic-lookup-relation-search-tab.component.scss'],
|
styleUrls: ['./dynamic-lookup-relation-search-tab.component.scss'],
|
||||||
@@ -76,6 +86,16 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
*/
|
*/
|
||||||
@Input() item: Item;
|
@Input() item: Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if is left type or right type
|
||||||
|
*/
|
||||||
|
@Input() isLeft: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if is being utilized by edit relationship component
|
||||||
|
*/
|
||||||
|
@Input() isEditRelationship: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an event to deselect an object from the list
|
* Send an event to deselect an object from the list
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +162,6 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
* Sets up the pagination and fixed query parameters
|
* Sets up the pagination and fixed query parameters
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
console.log(this.item);
|
|
||||||
this.resetRoute();
|
this.resetRoute();
|
||||||
this.routeService.setParameter('fixedFilterQuery', this.relationship.filter);
|
this.routeService.setParameter('fixedFilterQuery', this.relationship.filter);
|
||||||
this.routeService.setParameter('configuration', this.relationship.searchConfiguration);
|
this.routeService.setParameter('configuration', this.relationship.searchConfiguration);
|
||||||
@@ -150,13 +169,12 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
switchMap((options) => this.lookupRelationService.getLocalResults(this.relationship, options).pipe(
|
switchMap((options) => this.lookupRelationService.getLocalResults(this.relationship, options).pipe(
|
||||||
startWith(undefined),
|
startWith(undefined),
|
||||||
tap(res=> {
|
tap(res=> {
|
||||||
if(!!res && res.state == 'Success'){
|
if(!!res && res.state == 'Success' && this.isEditRelationship){
|
||||||
const idOfItems = res.payload.page.map(itemSearchResult => {
|
const idOfItems = res.payload.page.map(itemSearchResult => {
|
||||||
return itemSearchResult.indexableObject.uuid;
|
return itemSearchResult.indexableObject.uuid;
|
||||||
});
|
});
|
||||||
this.setSelectedIds(idOfItems);
|
this.setSelectedIds(idOfItems,res.payload.page);
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
@@ -226,10 +244,30 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setSelectedIds(idOfItems){
|
setSelectedIds(idOfItems, resultListOfItems) {
|
||||||
console.log(this.relationshipType)
|
let relationType = this.relationshipType.rightwardType;
|
||||||
this.relationshipService.searchByItemsAndType(this.relationshipType.id, this.item.uuid, this.relationship.relationshipType ,idOfItems).subscribe((res)=>{
|
if(this.isLeft){
|
||||||
console.log(res);
|
relationType = this.relationshipType.leftwardType;
|
||||||
|
}
|
||||||
|
this.relationshipService.searchByItemsAndType(this.relationshipType.id, this.item.uuid, relationType ,idOfItems).subscribe((res: any)=>{
|
||||||
|
|
||||||
|
const selectableObject = res.page.map((relationship: Relationship) => {
|
||||||
|
|
||||||
|
let arrUrl = [];
|
||||||
|
if(this.isLeft){
|
||||||
|
arrUrl = relationship._links.rightItem.href.split('/');
|
||||||
|
}else{
|
||||||
|
arrUrl = relationship._links.leftItem.href.split('/');
|
||||||
|
}
|
||||||
|
let uuid = arrUrl[arrUrl.length-1];
|
||||||
|
|
||||||
|
return this.getRelatedItem(uuid,resultListOfItems);
|
||||||
|
|
||||||
|
});
|
||||||
|
// console.log(selectableObject);
|
||||||
|
if(selectableObject.length > 0){
|
||||||
|
this.selectableListService.select(this.listId, selectableObject);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +282,12 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
this.selectableListService.deselectAll(this.listId);
|
this.selectableListService.deselectAll(this.listId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getRelatedItem(uuid,resultList){
|
||||||
|
return resultList.find((resultItem) => {
|
||||||
|
return resultItem.indexableObject.uuid == uuid;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (hasValue(this.subscription)) {
|
if (hasValue(this.subscription)) {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
|
Reference in New Issue
Block a user