Skip to content

Commit ac2d4de

Browse files
[DURACOM-453] fix error handling in menu provider, update labels
1 parent bca2d61 commit ac2d4de

2 files changed

Lines changed: 23 additions & 20 deletions

File tree

src/app/shared/menu/providers/edit-item-details.menu.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
* http://www.dspace.org/license/
77
*/
88
import { Injectable } from '@angular/core';
9+
import { PaginatedList } from '@dspace/core/data/paginated-list.model';
10+
import { RemoteData } from '@dspace/core/data/remote-data';
911
import { DSpaceObject } from '@dspace/core/shared/dspace-object.model';
10-
import {
11-
getAllSucceededRemoteDataPayload,
12-
getPaginatedListPayload,
13-
} from '@dspace/core/shared/operators';
12+
import { getFirstCompletedRemoteData } from '@dspace/core/shared/operators';
1413
import { EditItemDataService } from '@dspace/core/submission/edititem-data.service';
1514
import { EditItemMode } from '@dspace/core/submission/models/edititem-mode.model';
1615
import { URLCombiner } from '@dspace/core/url-combiner/url-combiner';
@@ -40,20 +39,24 @@ export class EditItemMenuProvider extends DSpaceObjectPageMenuProvider {
4039

4140
public getSectionsForContext(dso: DSpaceObject): Observable<PartialMenuSection[]> {
4241
return this.editItemService.searchEditModesById(dso.id).pipe(
43-
getAllSucceededRemoteDataPayload(),
44-
getPaginatedListPayload(),
45-
map((editModes: EditItemMode[]) => {
46-
return editModes.map(editMode => {
47-
return {
48-
model: {
49-
type: MenuItemType.LINK,
50-
text: `menu.section.${editMode.name}`,
51-
link: new URLCombiner(getEditItemPageRoute(), `${dso.uuid}:${editMode.name}`).toString(),
52-
},
53-
icon: 'pencil-alt',
54-
visible: true,
55-
};
56-
});
42+
getFirstCompletedRemoteData(),
43+
map((editmodesRd: RemoteData<PaginatedList<EditItemMode>>) => {
44+
if (editmodesRd.hasSucceeded) {
45+
const editModes = editmodesRd.payload.page;
46+
return editModes.map(editMode => {
47+
return {
48+
model: {
49+
type: MenuItemType.LINK,
50+
text: `menu.section.${editMode.name}`,
51+
link: new URLCombiner(getEditItemPageRoute(), `${dso.uuid}:${editMode.name}`).toString(),
52+
},
53+
icon: 'pencil-alt',
54+
visible: true,
55+
};
56+
});
57+
} else {
58+
return [];
59+
}
5760
}),
5861
catchError(() => of([])),
5962
);

src/assets/i18n/en.json5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3868,7 +3868,7 @@
38683868

38693869
"mydspace.show.workspace": "Your submissions",
38703870

3871-
"mydspace.show.otherworkspace": "Shared Submissions",
3871+
"mydspace.show.otherWorkspace": "Shared Submissions",
38723872

38733873
"mydspace.show.supervisedWorkspace": "Supervised items",
38743874

@@ -6221,7 +6221,7 @@
62216221

62226222
"workflow.search.results.head": "Workflow tasks",
62236223

6224-
"otherworkspace.search.results.head": "Workspace submissions",
6224+
"otherWorkspace.search.results.head": "Shared workspace",
62256225

62266226
"supervision.search.results.head": "Workflow and Workspace tasks",
62276227

0 commit comments

Comments
 (0)