diff --git a/resources/i18n/en.json5 b/resources/i18n/en.json5
index d9e380d198..ba3d1549c1 100644
--- a/resources/i18n/en.json5
+++ b/resources/i18n/en.json5
@@ -139,6 +139,7 @@
"collection.form.tableofcontents": "News (HTML)",
"collection.form.title": "Name",
+ "collection.item-mapper.cancel": "Cancel",
"collection.item-mapper.collection": "Collection: \"{{name}}\"",
"collection.item-mapper.confirm": "Map selected items",
"collection.item-mapper.description": "This is the item mapper tool that allows collection administrators to map items from other collections into this collection. You can search for items from other collections and map them, or browse the list of currently mapped items.",
@@ -152,7 +153,6 @@
"collection.item-mapper.notifications.unmap.success.content": "Successfully removed the mappings of {{amount}} items.",
"collection.item-mapper.notifications.unmap.success.head": "Remove mapping completed",
"collection.item-mapper.remove": "Remove selected item mappings",
- "collection.item-mapper.return": "Return",
"collection.item-mapper.tabs.browse": "Browse",
"collection.item-mapper.tabs.map": "Map",
@@ -252,6 +252,7 @@
"item.edit.item-mapper.buttons.add": "Map item to selected collections",
"item.edit.item-mapper.buttons.remove": "Remove item's mapping for selected collections",
+ "item.edit.item-mapper.cancel": "Cancel",
"item.edit.item-mapper.description": "This is the item mapper tool that allows administrators to map this item to other collections. You can search for collections and map them, or browse the list of collections the item is currently mapped to.",
"item.edit.item-mapper.head": "Item Mapper - Map Item to Collections",
"item.edit.item-mapper.item": "Item: \"{{name}}\"",
@@ -263,7 +264,6 @@
"item.edit.item-mapper.notifications.remove.error.head": "Removal of mapping errors",
"item.edit.item-mapper.notifications.remove.success.content": "Successfully removed mapping of item to {{amount}} collections.",
"item.edit.item-mapper.notifications.remove.success.head": "Removal of mapping completed",
- "item.edit.item-mapper.return": "Return",
"item.edit.item-mapper.tabs.browse": "Browse",
"item.edit.item-mapper.tabs.map": "Map",
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 9e9f9fd8e1..23e23b5c25 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
@@ -14,8 +14,11 @@
[dsoRD$]="collectionItemsRD$"
[paginationOptions]="(searchOptions$ | async)?.pagination"
[confirmButton]="'collection.item-mapper.remove'"
+ [cancelButton]="'collection.item-mapper.cancel'"
+ [dangerConfirm]="true"
[hideCollection]="true"
- (confirm)="mapItems($event, true)">
+ (confirm)="mapItems($event, true)"
+ (cancel)="onCancel()">
@@ -26,7 +29,8 @@
+ [currentUrl]="'./'"
+ [inPlaceSearch]="true">
@@ -37,13 +41,13 @@
[dsoRD$]="mappedItemsRD$"
[paginationOptions]="(searchOptions$ | async)?.pagination"
[confirmButton]="'collection.item-mapper.confirm'"
- (confirm)="mapItems($event)">
+ [cancelButton]="'collection.item-mapper.cancel'"
+ (confirm)="mapItems($event)"
+ (cancel)="onCancel()">
-
-
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 059bd098d4..417b044277 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
@@ -9,7 +9,7 @@ import { SearchConfigurationService } from '../../+search-page/search-service/se
import { PaginatedSearchOptions } from '../../+search-page/paginated-search-options.model';
import { PaginatedList } from '../../core/data/paginated-list';
import { map, switchMap, take, tap } from 'rxjs/operators';
-import { getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/operators';
+import { getRemoteDataPayload, getSucceededRemoteData, toDSpaceObjectListRD } from '../../core/shared/operators';
import { SearchService } from '../../+search-page/search-service/search.service';
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { DSpaceObjectType } from '../../core/shared/dspace-object-type.model';
@@ -242,4 +242,17 @@ export class CollectionItemMapperComponent implements OnInit {
this.tabs.select('browseTab');
}
+ /**
+ * When a cancel event is fired, return to the collection page
+ */
+ onCancel() {
+ this.collectionRD$.pipe(
+ getSucceededRemoteData(),
+ getRemoteDataPayload(),
+ take(1)
+ ).subscribe((collection: Collection) => {
+ this.router.navigate(['/collections/', collection.id])
+ });
+ }
+
}
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 97cbb27871..d4433cd4a2 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
@@ -14,7 +14,10 @@
[dsoRD$]="itemCollectionsRD$"
[paginationOptions]="(searchOptions$ | async)?.pagination"
[confirmButton]="'item.edit.item-mapper.buttons.remove'"
- (confirm)="removeMappings($event)">
+ [cancelButton]="'item.edit.item-mapper.cancel'"
+ [dangerConfirm]="true"
+ (confirm)="removeMappings($event)"
+ (cancel)="onCancel()">
@@ -24,7 +27,8 @@
+ [currentUrl]="'./'"
+ [inPlaceSearch]="true">
@@ -36,13 +40,13 @@
[paginationOptions]="(searchOptions$ | async)?.pagination"
[sortOptions]="(searchOptions$ | async)?.sort"
[confirmButton]="'item.edit.item-mapper.buttons.add'"
- (confirm)="mapCollections($event)">
+ [cancelButton]="'item.edit.item-mapper.cancel'"
+ (confirm)="mapCollections($event)"
+ (cancel)="onCancel()">
-
-
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 3a85a75659..b8073edb39 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
@@ -7,7 +7,7 @@ import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list';
import { Collection } from '../../../core/shared/collection.model';
import { Item } from '../../../core/shared/item.model';
-import { getSucceededRemoteData, toDSpaceObjectListRD } from '../../../core/shared/operators';
+import { getRemoteDataPayload, getSucceededRemoteData, toDSpaceObjectListRD } from '../../../core/shared/operators';
import { ActivatedRoute, Router } from '@angular/router';
import { SearchService } from '../../../+search-page/search-service/search.service';
import { SearchConfigurationService } from '../../../+search-page/search-service/search-configuration.service';
@@ -270,4 +270,17 @@ export class ItemCollectionMapperComponent implements OnInit {
this.tabs.select('browseTab');
}
+ /**
+ * When a cancel event is fired, return to the item page
+ */
+ onCancel() {
+ this.itemRD$.pipe(
+ getSucceededRemoteData(),
+ getRemoteDataPayload(),
+ take(1)
+ ).subscribe((item: Item) => {
+ this.router.navigate(['/items/', item.id])
+ });
+ }
+
}
diff --git a/src/app/+item-page/item-page.module.ts b/src/app/+item-page/item-page.module.ts
index f510ccf19b..2a5d0b6da7 100644
--- a/src/app/+item-page/item-page.module.ts
+++ b/src/app/+item-page/item-page.module.ts
@@ -31,8 +31,8 @@ import { MetadataFieldWrapperComponent } from './field-components/metadata-field
imports: [
CommonModule,
SharedModule,
- EditItemPageModule,
ItemPageRoutingModule,
+ EditItemPageModule,
SearchPageModule
],
declarations: [
diff --git a/src/app/shared/object-select/collection-select/collection-select.component.html b/src/app/shared/object-select/collection-select/collection-select.component.html
index e7c20d268c..3e2ecdaebf 100644
--- a/src/app/shared/object-select/collection-select/collection-select.component.html
+++ b/src/app/shared/object-select/collection-select/collection-select.component.html
@@ -24,5 +24,9 @@
-
+
+
+
+
+
diff --git a/src/app/shared/object-select/item-select/item-select.component.html b/src/app/shared/object-select/item-select/item-select.component.html
index a54afed643..5dbc88e55d 100644
--- a/src/app/shared/object-select/item-select/item-select.component.html
+++ b/src/app/shared/object-select/item-select/item-select.component.html
@@ -28,5 +28,9 @@
-
+
+
+
+
+
diff --git a/src/app/shared/object-select/item-select/item-select.component.ts b/src/app/shared/object-select/item-select/item-select.component.ts
index 2cd5b502df..7dd8239960 100644
--- a/src/app/shared/object-select/item-select/item-select.component.ts
+++ b/src/app/shared/object-select/item-select/item-select.component.ts
@@ -1,4 +1,4 @@
-import { Component} from '@angular/core';
+import { Component, Input } from '@angular/core';
import { Item } from '../../../core/shared/item.model';
import { ObjectSelectService } from '../object-select.service';
import { ObjectSelectComponent } from '../object-select/object-select.component';
@@ -14,6 +14,12 @@ import { isNotEmpty } from '../../empty.util';
*/
export class ItemSelectComponent extends ObjectSelectComponent- {
+ /**
+ * Whether or not to hide the collection column
+ */
+ @Input()
+ hideCollection = false;
+
constructor(protected objectSelectService: ObjectSelectService) {
super(objectSelectService);
}
diff --git a/src/app/shared/object-select/object-select/object-select.component.ts b/src/app/shared/object-select/object-select/object-select.component.ts
index 70099e7328..e3a50b8024 100644
--- a/src/app/shared/object-select/object-select/object-select.component.ts
+++ b/src/app/shared/object-select/object-select/object-select.component.ts
@@ -12,6 +12,9 @@ import { SortOptions } from '../../../core/cache/models/sort-options.model';
*/
export abstract class ObjectSelectComponent implements OnInit, OnDestroy {
+ /**
+ * A unique key used for the object select service
+ */
@Input()
key: string;
@@ -40,8 +43,18 @@ export abstract class ObjectSelectComponent implements OnInit, OnDestro
@Input()
confirmButton: string;
+ /**
+ * The message key used for the cancel button
+ * @type {string}
+ */
@Input()
- hideCollection = false;
+ cancelButton: string;
+
+ /**
+ * An event fired when the cancel button is clicked
+ */
+ @Output()
+ cancel = new EventEmitter();
/**
* EventEmitter to return the selected UUIDs when the confirm button is pressed
@@ -50,6 +63,13 @@ export abstract class ObjectSelectComponent implements OnInit, OnDestro
@Output()
confirm: EventEmitter = new EventEmitter();
+ /**
+ * Whether or not to render the confirm button as danger (for example if confirm deletes objects)
+ * Defaults to false
+ */
+ @Input()
+ dangerConfirm = false;
+
/**
* The list of selected UUIDs
*/
@@ -96,4 +116,11 @@ export abstract class ObjectSelectComponent implements OnInit, OnDestro
});
}
+ /**
+ * Fire a cancel event
+ */
+ onCancel() {
+ this.cancel.emit();
+ }
+
}