mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 14:33:03 +00:00
fixup! Fix change detection issue
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<div class="container mt-3">
|
||||
<h3>{{'item.edit.curate.title' |translate:{item: (itemName$ |async)} }}</h3>
|
||||
<ds-curation-form
|
||||
[dsoHandle]="(dsoRD$|async)?.payload.handle"
|
||||
*ngIf="dsoRD$ | async as dsoRD"
|
||||
[dsoHandle]="dsoRD?.payload.handle"
|
||||
></ds-curation-form>
|
||||
</div>
|
||||
|
@@ -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<RemoteData<Collection>> = this.route.parent.data.pipe(
|
||||
map((data) => data.dso),
|
||||
shareReplay(1)
|
||||
);
|
||||
|
||||
itemName$: Observable<string> = this.dsoRD$.pipe(
|
||||
filter((rd: RemoteData<Collection>) => hasValue(rd)),
|
||||
map((rd: RemoteData<Collection>) => {
|
||||
console.log(rd);
|
||||
return this.dsoNameService.getName(rd.payload);
|
||||
})
|
||||
);
|
||||
export class ItemCurateComponent implements OnInit {
|
||||
dsoRD$: Observable<RemoteData<Item>>;
|
||||
itemName$: Observable<string>;
|
||||
|
||||
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<Item>) => hasValue(rd)),
|
||||
map((rd: RemoteData<Item>) => {
|
||||
return this.dsoNameService.getName(rd.payload);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user