From ea7b26746031ac67a3df6f45d3851d7d0e1ba405 Mon Sep 17 00:00:00 2001 From: Sofia Papacharalampous Date: Fri, 31 May 2024 15:36:10 +0300 Subject: [PATCH] breadcrumb fixes --- dmp-frontend/src/app/app-routing.module.ts | 12 ++++++++++++ .../src/app/ui/description/description.routing.ts | 6 +++++- .../listing/description-listing.component.html | 3 --- .../description-listing-item.component.ts | 2 +- .../overview/description-overview.component.ts | 6 ++++++ .../overview/description-overview.routing.ts | 6 ------ dmp-frontend/src/app/ui/dmp/dmp.routing.ts | 6 +++++- .../app/ui/dmp/listing/dmp-listing.component.html | 3 --- .../app/ui/dmp/overview/dmp-overview.component.ts | 8 +++++++- .../src/app/ui/dmp/overview/dmp-overview.routing.ts | 6 ------ .../breadcrumb/navigation-breadcrumb.component.html | 6 ++---- .../breadcrumb/navigation-breadcrumb.component.ts | 5 +++-- 12 files changed, 41 insertions(+), 28 deletions(-) diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 9ae5246d0..e7d82b8c4 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -27,6 +27,9 @@ const appRoutes: Routes = [ permissions: [AppPermission.ViewMyDescriptionPage] }, breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + title: 'GENERAL.TITLES.DESCRIPTIONS' + }), title: 'GENERAL.TITLES.DESCRIPTIONS' } }, @@ -35,6 +38,9 @@ const appRoutes: Routes = [ loadChildren: () => import('./ui/description/description.module').then(m => m.DescriptionModule), data: { breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + title: 'GENERAL.TITLES.EXPLORE' + }), title: 'GENERAL.TITLES.EXPLORE' } }, @@ -46,6 +52,9 @@ const appRoutes: Routes = [ permissions: [AppPermission.ViewMyDmpPage] }, breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + title: 'GENERAL.TITLES.PLANS' + }), title: 'GENERAL.TITLES.PLANS' } }, @@ -54,6 +63,9 @@ const appRoutes: Routes = [ loadChildren: () => import('./ui/dmp/dmp.module').then(m => m.DmpModule), data: { breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + title: 'GENERAL.TITLES.EXPLORE-PLANS' + }), title: 'GENERAL.TITLES.EXPLORE-PLANS' } }, diff --git a/dmp-frontend/src/app/ui/description/description.routing.ts b/dmp-frontend/src/app/ui/description/description.routing.ts index 2b2b32dc9..c720f1973 100644 --- a/dmp-frontend/src/app/ui/description/description.routing.ts +++ b/dmp-frontend/src/app/ui/description/description.routing.ts @@ -1,5 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { BreadcrumbService } from '../misc/breadcrumb/breadcrumb.service'; // import { DescriptionWizardComponent } from './description-wizard/description-wizard.component'; // import { DescriptionOverviewComponent } from './overview/description-overview.component'; @@ -8,7 +9,10 @@ const routes: Routes = [ path: 'overview', loadChildren: () => import('./overview/description-overview.module').then(m => m.DescriptionOverviewModule), data: { - breadcrumb: true + breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + hideNavigationItem: true + }), } }, { diff --git a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html index 7eebe739b..2f195a93c 100644 --- a/dmp-frontend/src/app/ui/description/listing/description-listing.component.html +++ b/dmp-frontend/src/app/ui/description/listing/description-listing.component.html @@ -17,9 +17,6 @@
-
-

{{(isPublic ? 'DESCRIPTION-LISTING.TITLE-EXPLORE' : 'DESCRIPTION-LISTING.TITLE') | translate}}

-
diff --git a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts index eef4fa62f..0b62a5304 100644 --- a/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts @@ -117,7 +117,7 @@ export class DescriptionListingItemComponent extends BaseComponent implements On getItemLink(): string[] { // return this.isPublic ? [`/descriptions/publicEdit/${this.description.id}`] : [`/descriptions/edit/${this.description.id}`]; - return this.isPublic ? ['/descriptions/overview/public/' + this.description.id] : ['/descriptions/overview/' + this.description.id]; + return this.isPublic ? ['/explore-descriptions/overview/public/' + this.description.id] : ['/descriptions/overview/' + this.description.id]; } getDmpLink(): string[] { diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts index 78b7b3573..78c05d3da 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.component.ts @@ -40,6 +40,7 @@ import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; import { nameof } from 'ts-simple-nameof'; import { DescriptionCopyDialogComponent } from '../description-copy-dialog/description-copy-dialog.component'; +import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; @Component({ @@ -92,6 +93,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni private fb: UntypedFormBuilder, private lockService: LockService, private analyticsService: AnalyticsService, + private breadcrumbService: BreadcrumbService ) { super(); } @@ -115,6 +117,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.descriptionService.getSingle(itemId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { + this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); + this.description = data; this.description.dmp.dmpUsers = data.dmp.dmpUsers.filter(x => x.isActive === IsActive.Active); this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); @@ -155,6 +159,8 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni this.descriptionService.getPublicSingle(publicId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { + this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); + this.description = data; this.researchers = this.referenceService.getReferencesForTypes(this.description?.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); // this.users = this.description.dmp.users; diff --git a/dmp-frontend/src/app/ui/description/overview/description-overview.routing.ts b/dmp-frontend/src/app/ui/description/overview/description-overview.routing.ts index f234a3b87..535883cc9 100644 --- a/dmp-frontend/src/app/ui/description/overview/description-overview.routing.ts +++ b/dmp-frontend/src/app/ui/description/overview/description-overview.routing.ts @@ -9,9 +9,6 @@ const routes: Routes = [ component: DescriptionOverviewComponent, data: { breadcrumb: true, - ...BreadcrumbService.generateRouteDataConfiguration({ - hideNavigationItem: true - }), title: 'GENERAL.TITLES.DATASET-OVERVIEW' }, }, @@ -20,9 +17,6 @@ const routes: Routes = [ component: DescriptionOverviewComponent, data: { breadcrumb: true, - ...BreadcrumbService.generateRouteDataConfiguration({ - hideNavigationItem: true - }), title: 'GENERAL.TITLES.DATASET-OVERVIEW' }, } diff --git a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts index 46a213860..591ac8540 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp.routing.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp.routing.ts @@ -1,12 +1,16 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; +import { BreadcrumbService } from '../misc/breadcrumb/breadcrumb.service'; const routes: Routes = [ { path: 'overview', loadChildren: () => import('./overview/dmp-overview.module').then(m => m.DmpOverviewModule), data: { - breadcrumb: true + breadcrumb: true, + ...BreadcrumbService.generateRouteDataConfiguration({ + hideNavigationItem: true + }), } }, { diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html index bb1bc1593..9f269def4 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.html @@ -11,9 +11,6 @@
-
-

{{(isPublic ? 'GENERAL.TITLES.EXPLORE-PLANS' : 'GENERAL.TITLES.PLANS') | translate}}

-
diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts index 60946efe8..b5c7f234f 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.ts @@ -49,6 +49,7 @@ import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; import { DmpFinalizeDialogComponent, DmpFinalizeDialogOutput } from '../dmp-finalize-dialog/dmp-finalize-dialog.component'; import { DmpInvitationDialogComponent } from '../invitation/dialog/dmp-invitation-dialog.component'; import { NewVersionDmpDialogComponent } from '../new-version-dialog/dmp-new-version-dialog.component'; +import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; @Component({ selector: 'app-dmp-overview', @@ -104,10 +105,11 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { public fileTransformerService: FileTransformerService, private referenceTypeService: ReferenceTypeService, private analyticsService: AnalyticsService, + private breadcrumbService: BreadcrumbService ) { super(); } - + ngOnInit() { this.analyticsService.trackPageView(AnalyticsService.DmpOverview); // Gets dmp data using parameter id @@ -122,6 +124,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.dmpService.getSingle(itemId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { + this.breadcrumbService.addIdResolvedValue(data.id.toString(), data.label); + this.dmp = data; this.dmp.dmpUsers = data.dmpUsers.filter(x => x.isActive === IsActive.Active); this.dmp.otherDmpVersions = data.otherDmpVersions?.filter(x => x.isActive === IsActive.Active) || null; @@ -161,6 +165,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit { this.dmpService.getPublicSingle(publicId, this.lookupFields()) .pipe(takeUntil(this._destroyed)) .subscribe(data => { + this.breadcrumbService.addIdResolvedValue(`${data.id}`, data.label); + this.dmp = data; this.researchers = this.referenceService.getReferencesForTypes(this.dmp?.dmpReferences, [this.referenceTypeService.getResearcherReferenceType()]); if (!this.hasDoi()) { diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.routing.ts b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.routing.ts index b37a48e23..089415b03 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.routing.ts +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.routing.ts @@ -9,9 +9,6 @@ const routes: Routes = [ component: DmpOverviewComponent, data: { breadcrumb: true, - ...BreadcrumbService.generateRouteDataConfiguration({ - hideNavigationItem: true - }), title: 'GENERAL.TITLES.PLAN-OVERVIEW' }, }, @@ -20,9 +17,6 @@ const routes: Routes = [ component: DmpOverviewComponent, data: { breadcrumb: true, - ...BreadcrumbService.generateRouteDataConfiguration({ - hideNavigationItem: true - }), title: 'GENERAL.TITLES.PLAN-OVERVIEW' }, } diff --git a/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.html b/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.html index 7506de127..570111810 100644 --- a/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.html +++ b/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.html @@ -6,19 +6,17 @@ - {{ item.title | translate:item.translateParams | appTitleCaseTransform }} + {{ item.title | translate:item.translateParams }} - {{ item.title | translate:item.translateParams | appTitleCaseTransform }} + {{ item.title | translate:item.translateParams }} - - diff --git a/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.ts b/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.ts index fa5cc1048..a5ac88b2f 100644 --- a/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.ts +++ b/dmp-frontend/src/app/ui/misc/breadcrumb/navigation-breadcrumb.component.ts @@ -47,7 +47,7 @@ export class NavigationBreadcrumbComponent extends BaseComponent { takeUntil(this._destroyed), ) .subscribe(breadCrumbs => { - this.breadCrumbs = breadCrumbs + this.breadCrumbs = breadCrumbs; this.cdr.markForCheck(); }); } @@ -145,7 +145,8 @@ export class NavigationBreadcrumbComponent extends BaseComponent { const title = Object.keys(pathParams) .sort((a, b) => b.length - a.length) // avoid param overlapping => :id2 (length 3) should be replaced before :id (length 2) .reduce( - (aggr, current) => aggr.replace(`:${current}`, this.paramToStringDictionary[pathParams[current]] ?? pathParams[current]) + (aggr, current) => this.paramToStringDictionary[pathParams[current]] ?? pathParams[current] + // return aggr.replace(`:${current}`, this.paramToStringDictionary[pathParams[current]] ?? pathParams[current]) , path ?? '' );