From 937687c41433073bf51a9abdbfa2aeca69909fc8 Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Mon, 5 Feb 2024 12:48:23 +0100 Subject: [PATCH] fix routing, update issue, adapt labels --- .../suggestions-notification.component.ts | 1 + .../suggestions-popup/suggestions-popup.component.ts | 4 ++-- src/app/suggestion-notifications/suggestions.service.ts | 2 +- src/app/suggestions-page/suggestions-page.component.ts | 4 ++-- .../workflowitems-edit-page-routing-paths.ts | 5 +++++ src/assets/i18n/en.json5 | 4 ++-- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/suggestion-notifications/suggestions-notification/suggestions-notification.component.ts b/src/app/suggestion-notifications/suggestions-notification/suggestions-notification.component.ts index e2afe8f07c..e123f8f87f 100644 --- a/src/app/suggestion-notifications/suggestions-notification/suggestions-notification.component.ts +++ b/src/app/suggestion-notifications/suggestions-notification/suggestions-notification.component.ts @@ -29,6 +29,7 @@ export class SuggestionsNotificationComponent implements OnInit { ) { } ngOnInit() { + this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction(); this.suggestionsRD$ = this.suggestionTargetsStateService.getCurrentUserSuggestionTargets(); } diff --git a/src/app/suggestion-notifications/suggestions-popup/suggestions-popup.component.ts b/src/app/suggestion-notifications/suggestions-popup/suggestions-popup.component.ts index 762f80085a..0b2176ea89 100644 --- a/src/app/suggestion-notifications/suggestions-popup/suggestions-popup.component.ts +++ b/src/app/suggestion-notifications/suggestions-popup/suggestions-popup.component.ts @@ -3,7 +3,7 @@ import { TranslateService } from '@ngx-translate/core'; import { SuggestionTargetsStateService } from '../suggestion-targets/suggestion-targets.state.service'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { SuggestionsService } from '../suggestions.service'; -import { takeUntil } from 'rxjs/operators'; +import { take, takeUntil } from 'rxjs/operators'; import { SuggestionTarget } from '../../core/suggestion-notifications/models/suggestion-target.model'; import { isNotEmpty } from '../../shared/empty.util'; import { combineLatest, Subject } from 'rxjs'; @@ -36,7 +36,7 @@ export class SuggestionsPopupComponent implements OnInit, OnDestroy { public initializePopup() { const notifier = new Subject(); this.subscription = combineLatest([ - this.suggestionTargetsStateService.getCurrentUserSuggestionTargets(), + this.suggestionTargetsStateService.getCurrentUserSuggestionTargets().pipe(take(2)), this.suggestionTargetsStateService.hasUserVisitedSuggestions() ]).pipe(takeUntil(notifier)).subscribe(([suggestions, visited]) => { this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction(); diff --git a/src/app/suggestion-notifications/suggestions.service.ts b/src/app/suggestion-notifications/suggestions.service.ts index 565f8f94db..874659eab5 100644 --- a/src/app/suggestion-notifications/suggestions.service.ts +++ b/src/app/suggestion-notifications/suggestions.service.ts @@ -154,7 +154,7 @@ export class SuggestionsService { * The EPerson id for which to retrieve suggestion targets */ public retrieveCurrentUserSuggestions(userUuid: string): Observable { - return this.researcherProfileService.findById(userUuid).pipe( + return this.researcherProfileService.findById(userUuid, true).pipe( getFirstSucceededRemoteDataPayload(), mergeMap((profile: ResearcherProfile) => { if (isNotEmpty(profile)) { diff --git a/src/app/suggestions-page/suggestions-page.component.ts b/src/app/suggestions-page/suggestions-page.component.ts index ec560dc3ec..2005646010 100644 --- a/src/app/suggestions-page/suggestions-page.component.ts +++ b/src/app/suggestions-page/suggestions-page.component.ts @@ -23,7 +23,7 @@ import { WorkspaceItem } from '../core/submission/models/workspaceitem.model'; import {FindListOptions} from '../core/data/find-list-options.model'; import {redirectOn4xx} from '../core/shared/authorized.operators'; import { - getWorkflowItemEditRoute + getWorkspaceItemEditRoute } from '../workflowitems-edit-page/workflowitems-edit-page-routing-paths'; @Component({ @@ -193,7 +193,7 @@ export class SuggestionsPageComponent implements OnInit { approveAndImport(event: SuggestionApproveAndImport) { this.suggestionService.approveAndImport(this.workspaceItemService, event.suggestion, event.collectionId) .subscribe((workspaceitem: WorkspaceItem) => { - const content = this.translateService.instant('suggestion.approveAndImport.success', { url: getWorkflowItemEditRoute(workspaceitem.id) }); + const content = this.translateService.instant('suggestion.approveAndImport.success', { url: getWorkspaceItemEditRoute(workspaceitem.id) }); this.notificationService.success('', content, {timeOut:0}, true); this.suggestionTargetsStateService.dispatchRefreshUserSuggestionsAction(); this.updatePage(); diff --git a/src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts b/src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts index 326eebe4a7..a4d4a0f2c9 100644 --- a/src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts +++ b/src/app/workflowitems-edit-page/workflowitems-edit-page-routing-paths.ts @@ -28,9 +28,14 @@ export function getWorkspaceItemDeleteRoute(wsiId: string) { return new URLCombiner(getWorkspaceItemModuleRoute(), wsiId, WORKSPACE_ITEM_DELETE_PATH).toString(); } +export function getWorkspaceItemEditRoute(wsiId: string) { + return new URLCombiner(getWorkspaceItemModuleRoute(), wsiId, WORKSPACE_ITEM_EDIT_PATH).toString(); +} + export const WORKFLOW_ITEM_EDIT_PATH = 'edit'; export const WORKFLOW_ITEM_DELETE_PATH = 'delete'; export const WORKFLOW_ITEM_VIEW_PATH = 'view'; export const WORKFLOW_ITEM_SEND_BACK_PATH = 'sendback'; export const ADVANCED_WORKFLOW_PATH = 'advanced'; export const WORKSPACE_ITEM_DELETE_PATH = 'delete'; +export const WORKSPACE_ITEM_EDIT_PATH = 'edit'; diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index bb82085a4a..1aebe0430e 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -24,9 +24,9 @@ "404.page-not-found": "page not found", - "admin.notifications.publicationclaim.breadcrumbs": "Suggestions", + "admin.notifications.publicationclaim.breadcrumbs": "Publication Claim", - "admin.notifications.publicationclaim.page.title": "Suggestions", + "admin.notifications.publicationclaim.page.title": "Publication Claim", "error-page.description.401": "unauthorized",