diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
index af4153220f..8cdd99e70f 100644
--- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
+++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.html
@@ -2,7 +2,7 @@
{{'collection.edit.item-mapper.head' | translate}}
-
+
{{'collection.edit.item-mapper.description' | translate}}
diff --git a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts
index f824c99b37..c4d3f07167 100644
--- a/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts
+++ b/src/app/+collection-page/collection-item-mapper/collection-item-mapper.component.ts
@@ -1,12 +1,13 @@
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { ChangeDetectionStrategy, Component, Inject, OnInit, ViewChild } from '@angular/core';
+import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
import { ActivatedRoute, Router } from '@angular/router';
import { RemoteData } from '../../core/data/remote-data';
import { Collection } from '../../core/shared/collection.model';
import { PaginatedList } from '../../core/data/paginated-list.model';
-import { map, startWith, switchMap, take } from 'rxjs/operators';
+import { filter, map, startWith, switchMap, take } from 'rxjs/operators';
import {
getRemoteDataPayload,
getFirstSucceededRemoteData,
@@ -19,7 +20,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s
import { ItemDataService } from '../../core/data/item-data.service';
import { TranslateService } from '@ngx-translate/core';
import { CollectionDataService } from '../../core/data/collection-data.service';
-import { isNotEmpty } from '../../shared/empty.util';
+import { hasValue, isNotEmpty } from '../../shared/empty.util';
import { SEARCH_CONFIG_SERVICE } from '../../+my-dspace-page/my-dspace-page.component';
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
@@ -58,6 +59,7 @@ export class CollectionItemMapperComponent implements OnInit {
* The collection to map items to
*/
collectionRD$: Observable>;
+ collectionName$: Observable;
/**
* Search options
@@ -101,11 +103,22 @@ export class CollectionItemMapperComponent implements OnInit {
private notificationsService: NotificationsService,
private itemDataService: ItemDataService,
private collectionDataService: CollectionDataService,
- private translateService: TranslateService) {
+ private translateService: TranslateService,
+ private dsoNameService: DSONameService) {
}
ngOnInit(): void {
- this.collectionRD$ = this.route.data.pipe(map((data) => data.dso)).pipe(getFirstSucceededRemoteData()) as Observable>;
+ this.collectionRD$ = this.route.data.pipe(
+ take(1),
+ map((data) => data.dso),
+ );
+
+ this.collectionName$ = this.collectionRD$.pipe(
+ filter((rd: RemoteData) => hasValue(rd)),
+ map((rd: RemoteData) => {
+ return this.dsoNameService.getName(rd.payload);
+ })
+ );
this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
this.loadItemLists();
}
diff --git a/src/app/+collection-page/edit-collection-page/edit-collection-page.routing.module.ts b/src/app/+collection-page/edit-collection-page/edit-collection-page.routing.module.ts
index 818f064104..e41f0ebda4 100644
--- a/src/app/+collection-page/edit-collection-page/edit-collection-page.routing.module.ts
+++ b/src/app/+collection-page/edit-collection-page/edit-collection-page.routing.module.ts
@@ -1,5 +1,6 @@
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
+import { CollectionItemMapperComponent } from '../collection-item-mapper/collection-item-mapper.component';
import { EditCollectionPageComponent } from './edit-collection-page.component';
import { CollectionMetadataComponent } from './collection-metadata/collection-metadata.component';
import { CollectionRolesComponent } from './collection-roles/collection-roles.component';
@@ -86,7 +87,12 @@ import { ResourcePolicyEditComponent } from '../../shared/resource-policies/edit
data: { title: 'collection.edit.tabs.authorizations.title', showBreadcrumbs: true }
}
]
- }
+ },
+ {
+ path: 'mapper',
+ component: CollectionItemMapperComponent,
+ data: { title: 'collection.edit.tabs.item-mapper.title', showBreadcrumbs: true }
+ },
]
}
])
diff --git a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts
index 3acbd77c40..20056a9ea4 100644
--- a/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts
+++ b/src/app/+item-page/edit-item-page/edit-item-page.routing.module.ts
@@ -90,6 +90,11 @@ import { ItemPageWithdrawGuard } from './item-page-withdraw.guard';
path: 'versionhistory',
component: ItemVersionHistoryComponent,
data: { title: 'item.edit.tabs.versionhistory.title', showBreadcrumbs: true }
+ },
+ {
+ path: 'mapper',
+ component: ItemCollectionMapperComponent,
+ data: { title: 'item.edit.tabs.item-mapper.title', showBreadcrumbs: true }
}
]
},
diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html
index 43bf7ecd02..a65111eaec 100644
--- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html
+++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.html
@@ -2,7 +2,7 @@
{{'item.edit.item-mapper.head' | translate}}
-
+
{{'item.edit.item-mapper.description' | translate}}
diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts
index d134da18d0..12c694517d 100644
--- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts
+++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.spec.ts
@@ -7,7 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
-import { of } from 'rxjs';
+import { of as observableOf } from 'rxjs/internal/observable/of';
import { SortDirection, SortOptions } from '../../../core/cache/models/sort-options.model';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { ItemDataService } from '../../../core/data/item-data.service';
@@ -26,7 +26,6 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { SearchFormComponent } from '../../../shared/search-form/search-form.component';
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
-import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
import { ObjectSelectServiceStub } from '../../../shared/testing/object-select-service.stub';
@@ -59,7 +58,7 @@ describe('ItemCollectionMapperComponent', () => {
name: 'test-item'
});
const mockItemRD: RemoteData- = createSuccessfulRemoteDataObject(mockItem);
- const mockSearchOptions = of(new PaginatedSearchOptions({
+ const mockSearchOptions = observableOf(new PaginatedSearchOptions({
pagination: Object.assign(new PaginationComponentOptions(), {
id: 'search-page-configuration',
pageSize: 10,
@@ -82,7 +81,7 @@ describe('ItemCollectionMapperComponent', () => {
mapToCollection: () => createSuccessfulRemoteDataObject$({}),
removeMappingFromCollection: () => createSuccessfulRemoteDataObject$({}),
getMappedCollectionsEndpoint: () => of('rest/api/mappedCollectionsEndpoint'),
- getMappedCollections: () => of(mockCollectionsRD),
+ getMappedCollections: () => observableOf(mockCollectionsRD),
/* tslint:disable:no-empty */
clearMappedCollectionsRequests: () => {}
/* tslint:enable:no-empty */
@@ -91,14 +90,20 @@ describe('ItemCollectionMapperComponent', () => {
findAllByHref: () => of(mockCollectionsRD)
};
const searchServiceStub = Object.assign(new SearchServiceStub(), {
- search: () => of(mockCollectionsRD),
+ search: () => observableOf(mockCollectionsRD),
/* tslint:disable:no-empty */
clearDiscoveryRequests: () => {}
/* tslint:enable:no-empty */
});
- const activatedRouteStub = new ActivatedRouteStub({}, { dso: mockItemRD });
+ const activatedRouteStub = {
+ parent: {
+ data: observableOf({
+ dso: mockItemRD
+ })
+ }
+ };
const translateServiceStub = {
- get: () => of('test-message of item ' + mockItem.name),
+ get: () => observableOf('test-message of item ' + mockItem.name),
onLangChange: new EventEmitter(),
onTranslationChange: new EventEmitter(),
onDefaultLangChange: new EventEmitter()
diff --git a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts
index b78fe49897..6f55c6e9c3 100644
--- a/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts
+++ b/src/app/+item-page/edit-item-page/item-collection-mapper/item-collection-mapper.component.ts
@@ -1,6 +1,7 @@
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable } from 'rxjs';
import { ChangeDetectionStrategy, Component, OnInit, ViewChild } from '@angular/core';
+import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
import { CollectionDataService } from '../../../core/data/collection-data.service';
import { fadeIn, fadeInOut } from '../../../shared/animations/fade';
import { RemoteData } from '../../../core/data/remote-data';
@@ -15,12 +16,12 @@ import {
getAllSucceededRemoteData
} from '../../../core/shared/operators';
import { ActivatedRoute, Router } from '@angular/router';
-import { map, startWith, switchMap, take } from 'rxjs/operators';
+import { filter, map, startWith, switchMap, take } from 'rxjs/operators';
import { ItemDataService } from '../../../core/data/item-data.service';
import { TranslateService } from '@ngx-translate/core';
import { NotificationsService } from '../../../shared/notifications/notifications.service';
import { DSpaceObjectType } from '../../../core/shared/dspace-object-type.model';
-import { isNotEmpty } from '../../../shared/empty.util';
+import { hasValue, isNotEmpty } from '../../../shared/empty.util';
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
import { SearchService } from '../../../core/shared/search/search.service';
@@ -51,6 +52,7 @@ export class ItemCollectionMapperComponent implements OnInit {
* The item to map to collections
*/
itemRD$: Observable>;
+ itemName$: Observable;
/**
* Search options
@@ -88,11 +90,22 @@ export class ItemCollectionMapperComponent implements OnInit {
private notificationsService: NotificationsService,
private itemDataService: ItemDataService,
private collectionDataService: CollectionDataService,
- private translateService: TranslateService) {
+ private translateService: TranslateService,
+ private dsoNameService: DSONameService) {
}
ngOnInit(): void {
- this.itemRD$ = this.route.data.pipe(map((data) => data.dso)).pipe(getFirstSucceededRemoteData()) as Observable>;
+ this.itemRD$ = this.route.parent.data.pipe(
+ take(1),
+ map((data) => data.dso),
+ );
+
+ this.itemName$ = this.itemRD$.pipe(
+ filter((rd: RemoteData
- ) => hasValue(rd)),
+ map((rd: RemoteData
- ) => {
+ return this.dsoNameService.getName(rd.payload);
+ })
+ );
this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
this.loadCollectionLists();
}
diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5
index 603acb3f48..0ec88e8ecd 100644
--- a/src/assets/i18n/en.json5
+++ b/src/assets/i18n/en.json5
@@ -649,6 +649,10 @@
+ "collection.edit.tabs.mapper.head": "Item Mapper",
+
+ "collection.edit.tabs.item-mapper.title": "Collection Edit - Item Mapper",
+
"collection.edit.item-mapper.cancel": "Cancel",
"collection.edit.item-mapper.collection": "Collection: \"{{name}}\"",
@@ -1462,6 +1466,9 @@
"item.edit.breadcrumbs": "Edit Item",
+ "item.edit.tabs.mapper.head": "Collection Mapper",
+
+ "item.edit.tabs.item-mapper.title": "Item Edit - Collection Mapper",
"item.edit.item-mapper.buttons.add": "Map item to selected collections",