fix issue with breadcrumb

This commit is contained in:
FrancescoMolinaro
2024-01-26 13:42:58 +01:00
parent 0caacd98da
commit 9056e9830d
3 changed files with 26 additions and 20 deletions

View File

@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
import { I18nBreadcrumbsService } from '../../core/breadcrumbs/i18n-breadcrumbs.service';
import { AdminNotifyDashboardComponent } from './admin-notify-dashboard.component';
import {
SiteAdministratorGuard
@@ -19,11 +18,11 @@ import {
{
canActivate: [SiteAdministratorGuard],
path: '',
component: AdminNotifyDashboardComponent,
pathMatch: 'full',
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyDashboardComponent,
pathMatch: 'full',
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
@@ -31,11 +30,11 @@ import {
},
{
path: 'inbound',
component: AdminNotifyIncomingComponent,
canActivate: [SiteAdministratorGuard],
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyIncomingComponent,
canActivate: [SiteAdministratorGuard],
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
@@ -43,11 +42,11 @@ import {
},
{
path: 'outbound',
component: AdminNotifyOutgoingComponent,
canActivate: [SiteAdministratorGuard],
resolve: {
breadcrumb: I18nBreadcrumbResolver,
},
component: AdminNotifyOutgoingComponent,
canActivate: [SiteAdministratorGuard],
data: {
title: 'admin.notify.dashboard.page.title',
breadcrumbKey: 'admin.notify.dashboard',
@@ -55,10 +54,6 @@ import {
}
])
],
providers: [
I18nBreadcrumbResolver,
I18nBreadcrumbsService,
]
})
/**
* Routing module for the Notifications section of the admin sidebar

View File

@@ -16,6 +16,7 @@
<div>
<ds-themed-search
#searchComponent
[configuration]="selectedSearchConfig$ | async"
[showViewModes]="false"
[searchEnabled]="false"

View File

@@ -1,4 +1,10 @@
import { Component, Inject, Input, OnInit } from '@angular/core';
import {
ChangeDetectorRef,
Component,
Inject,
Input,
OnInit, ViewChild
} from '@angular/core';
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
import { Context } from '../../../../core/shared/context.model';
import { SearchConfigurationService } from '../../../../core/shared/search/search-configuration.service';
@@ -6,6 +12,7 @@ import { Observable } from 'rxjs';
import { ActivatedRoute, ActivatedRouteSnapshot, Router } from '@angular/router';
import { ViewMode } from '../../../../core/shared/view-mode.model';
import { map } from 'rxjs/operators';
import { ThemedSearchComponent } from '../../../../shared/search/themed-search.component';
@Component({
selector: 'ds-admin-notify-logs-result',
@@ -22,28 +29,31 @@ export class AdminNotifyLogsResultComponent implements OnInit{
@Input()
defaultConfiguration: string;
@ViewChild('searchComponent') searchComponent: ThemedSearchComponent;
public selectedSearchConfig$: Observable<string>;
public isInbound$: Observable<boolean>;
protected readonly context = Context.CoarNotify;
constructor(@Inject(SEARCH_CONFIG_SERVICE) public searchConfigService: SearchConfigurationService,
private router: Router,
private route: ActivatedRoute) {
private route: ActivatedRoute,
protected cdRef: ChangeDetectorRef) {
}
ngOnInit() {
// override the route reuse strategy to prevent issue on result loading
this.router.routeReuseStrategy.shouldReuseRoute = () => {
return false;
};
this.selectedSearchConfig$ = this.searchConfigService.getCurrentConfiguration(this.defaultConfiguration);
this.isInbound$ = this.selectedSearchConfig$.pipe(
map(config => config.startsWith('NOTIFY.incoming'))
);
}
public resetDefaultConfiguration() {
// we prevent cache use on reset so that the result are rendered properly
this.searchComponent.useCachedVersionIfAvailable = false;
this.router.navigate([this.getResolvedUrl(this.route.snapshot)], {
queryParams: {
configuration: this.defaultConfiguration,