mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
[DURACOM-191] Fix issue with edit relationship page
This commit is contained in:
@@ -166,7 +166,7 @@ describe('EditRelationshipComponent', () => {
|
|||||||
comp.url = url;
|
comp.url = url;
|
||||||
comp.fieldUpdate = fieldUpdate1;
|
comp.fieldUpdate = fieldUpdate1;
|
||||||
comp.editItem = item;
|
comp.editItem = item;
|
||||||
comp.relatedItem$ = observableOf(relatedItem);
|
comp.relatedItem$.next(relatedItem);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
@@ -13,9 +13,9 @@ import {
|
|||||||
} from '@ng-bootstrap/ng-bootstrap';
|
} from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {
|
import {
|
||||||
|
BehaviorSubject,
|
||||||
combineLatest as observableCombineLatest,
|
combineLatest as observableCombineLatest,
|
||||||
Observable,
|
Observable,
|
||||||
of,
|
|
||||||
} from 'rxjs';
|
} from 'rxjs';
|
||||||
import {
|
import {
|
||||||
filter,
|
filter,
|
||||||
@@ -45,7 +45,6 @@ import { ListableObjectComponentLoaderComponent } from '../../../../shared/objec
|
|||||||
import { VirtualMetadataComponent } from '../../virtual-metadata/virtual-metadata.component';
|
import { VirtualMetadataComponent } from '../../virtual-metadata/virtual-metadata.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
// eslint-disable-next-line @angular-eslint/component-selector
|
|
||||||
selector: 'ds-edit-relationship',
|
selector: 'ds-edit-relationship',
|
||||||
styleUrls: ['./edit-relationship.component.scss'],
|
styleUrls: ['./edit-relationship.component.scss'],
|
||||||
templateUrl: './edit-relationship.component.html',
|
templateUrl: './edit-relationship.component.html',
|
||||||
@@ -95,7 +94,7 @@ export class EditRelationshipComponent implements OnChanges {
|
|||||||
/**
|
/**
|
||||||
* The related item of this relationship
|
* The related item of this relationship
|
||||||
*/
|
*/
|
||||||
relatedItem$: Observable<Item>;
|
relatedItem$: BehaviorSubject<Item> = new BehaviorSubject<Item>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The view-mode we're currently on
|
* The view-mode we're currently on
|
||||||
@@ -128,16 +127,19 @@ export class EditRelationshipComponent implements OnChanges {
|
|||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
filter((item: Item) => hasValue(item) && isNotEmpty(item.uuid)),
|
filter((item: Item) => hasValue(item) && isNotEmpty(item.uuid)),
|
||||||
);
|
);
|
||||||
this.relatedItem$ = observableCombineLatest(
|
observableCombineLatest([
|
||||||
this.leftItem$,
|
this.leftItem$,
|
||||||
this.rightItem$,
|
this.rightItem$,
|
||||||
).pipe(
|
]).pipe(
|
||||||
map((items: Item[]) =>
|
map((items: Item[]) =>
|
||||||
items.find((item) => item.uuid !== this.editItem.uuid),
|
items.find((item) => item.uuid !== this.editItem.uuid),
|
||||||
),
|
),
|
||||||
);
|
take(1),
|
||||||
|
).subscribe((relatedItem) => {
|
||||||
|
this.relatedItem$.next(relatedItem);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.relatedItem$ = of(this.update.relatedItem);
|
this.relatedItem$.next(this.update.relatedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +148,10 @@ export class EditRelationshipComponent implements OnChanges {
|
|||||||
*/
|
*/
|
||||||
remove(): void {
|
remove(): void {
|
||||||
this.closeVirtualMetadataModal();
|
this.closeVirtualMetadataModal();
|
||||||
observableCombineLatest(
|
observableCombineLatest([
|
||||||
this.leftItem$,
|
this.leftItem$,
|
||||||
this.rightItem$,
|
this.rightItem$,
|
||||||
).pipe(
|
]).pipe(
|
||||||
map((items: Item[]) =>
|
map((items: Item[]) =>
|
||||||
items.map((item) => this.objectUpdatesService
|
items.map((item) => this.objectUpdatesService
|
||||||
.isSelectedVirtualMetadata(this.url, this.relationship.id, item.uuid)),
|
.isSelectedVirtualMetadata(this.url, this.relationship.id, item.uuid)),
|
||||||
|
Reference in New Issue
Block a user