mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 23:43:01 +00:00
55946: Finished edit-item-page and start of collection mapper
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { ItemDataService } from '../../core/data/item-data.service';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
import { getSucceededRemoteData } from '../../core/shared/operators';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-edit-item-page',
|
||||
@@ -23,33 +20,16 @@ import { map } from 'rxjs/operators';
|
||||
*/
|
||||
export class EditItemPageComponent implements OnInit {
|
||||
|
||||
objectKeys = Object.keys;
|
||||
|
||||
/**
|
||||
* The item to edit
|
||||
*/
|
||||
itemRD$: Observable<RemoteData<Item>>;
|
||||
statusData$: Observable<any>;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.itemRD$ = this.route.data.map((data) => data.item);
|
||||
this.statusData$ = this.itemRD$.pipe(
|
||||
getSucceededRemoteData(),
|
||||
map((itemRD: RemoteData<Item>) => itemRD.payload),
|
||||
map((item: Item) => Object.assign({
|
||||
id: item.id,
|
||||
handle: item.handle,
|
||||
lastModified: item.lastModified
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
getItemPage(): string {
|
||||
return this.router.url.substr(0, this.router.url.lastIndexOf('/'));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user