diff --git a/src/app/curation-form/curation-form.component.ts b/src/app/curation-form/curation-form.component.ts index 4b67580e77..e8fc67c970 100644 --- a/src/app/curation-form/curation-form.component.ts +++ b/src/app/curation-form/curation-form.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { ChangeDetectorRef, Component, Input, OnInit } from '@angular/core'; import { ScriptDataService } from '../core/data/processes/script-data.service'; import { FormControl, FormGroup } from '@angular/forms'; import { getFirstCompletedRemoteData } from '../core/shared/operators'; @@ -40,7 +40,8 @@ export class CurationFormComponent implements OnInit { private notificationsService: NotificationsService, private translateService: TranslateService, private handleService: HandleService, - private router: Router + private router: Router, + private cdr: ChangeDetectorRef ) { } @@ -59,6 +60,7 @@ export class CurationFormComponent implements OnInit { .filter((value) => isNotEmpty(value) && value.includes('=')) .map((value) => value.split('=')[1].trim()); this.form.get('task').patchValue(this.tasks[0]); + this.cdr.detectChanges(); }); } diff --git a/src/app/item-page/edit-item-page/item-curate/item-curate.component.html b/src/app/item-page/edit-item-page/item-curate/item-curate.component.html index f1710924f5..7c7ed41bd9 100644 --- a/src/app/item-page/edit-item-page/item-curate/item-curate.component.html +++ b/src/app/item-page/edit-item-page/item-curate/item-curate.component.html @@ -1,6 +1,7 @@

{{'item.edit.curate.title' |translate:{item: (itemName$ |async)} }}

diff --git a/src/app/item-page/edit-item-page/item-curate/item-curate.component.ts b/src/app/item-page/edit-item-page/item-curate/item-curate.component.ts index 9205246a06..fa1e0287fa 100644 --- a/src/app/item-page/edit-item-page/item-curate/item-curate.component.ts +++ b/src/app/item-page/edit-item-page/item-curate/item-curate.component.ts @@ -1,11 +1,11 @@ -import { Component } from '@angular/core'; -import { filter, map, shareReplay } from 'rxjs/operators'; +import { Component, OnInit } from '@angular/core'; +import { filter, map, take } from 'rxjs/operators'; import { RemoteData } from '../../../core/data/remote-data'; import { Observable } from 'rxjs'; import { ActivatedRoute } from '@angular/router'; import { DSONameService } from '../../../core/breadcrumbs/dso-name.service'; -import { Collection } from '../../../core/shared/collection.model'; import { hasValue } from '../../../shared/empty.util'; +import { Item } from '../../../core/shared/item.model'; /** * Component for managing a collection's curation tasks @@ -14,22 +14,26 @@ import { hasValue } from '../../../shared/empty.util'; selector: 'ds-item-curate', templateUrl: './item-curate.component.html', }) -export class ItemCurateComponent { - dsoRD$: Observable> = this.route.parent.data.pipe( - map((data) => data.dso), - shareReplay(1) - ); - - itemName$: Observable = this.dsoRD$.pipe( - filter((rd: RemoteData) => hasValue(rd)), - map((rd: RemoteData) => { - console.log(rd); - return this.dsoNameService.getName(rd.payload); - }) - ); +export class ItemCurateComponent implements OnInit { + dsoRD$: Observable>; + itemName$: Observable; constructor( private route: ActivatedRoute, private dsoNameService: DSONameService, ) {} + + ngOnInit(): void { + this.dsoRD$ = this.route.parent.data.pipe( + take(1), + map((data) => data.dso), + ); + + this.itemName$ = this.dsoRD$.pipe( + filter((rd: RemoteData) => hasValue(rd)), + map((rd: RemoteData) => { + return this.dsoNameService.getName(rd.payload); + }) + ); + } }