From c5b6b218b5ddb9be8baf4f43923b36aca3ff1185 Mon Sep 17 00:00:00 2001 From: Ioannis Kalyvas Date: Thu, 18 Oct 2018 13:21:56 +0300 Subject: [PATCH] Fixed Issue with BreadCrumb Service --- dmp-frontend/src/app/app-routing.module.ts | 5 ++++- .../dataset-public/dataset-public-listing.component.ts | 3 ++- dmp-frontend/src/app/datasets/dataset.routes.ts | 4 +++- .../dmp-profile-listing.component.html | 10 +++++----- .../services/breadcrumb/breadcrumb-resolver.service.ts | 2 +- .../components/breadcrumb/breadcrumb.component.html | 1 - .../components/breadcrumb/breadcrumb.component.ts | 3 ++- dmp-frontend/src/assets/lang/en.json | 8 ++++++++ 8 files changed, 25 insertions(+), 11 deletions(-) diff --git a/dmp-frontend/src/app/app-routing.module.ts b/dmp-frontend/src/app/app-routing.module.ts index 1b615e573..c7e7d0e6f 100644 --- a/dmp-frontend/src/app/app-routing.module.ts +++ b/dmp-frontend/src/app/app-routing.module.ts @@ -79,7 +79,10 @@ const appRoutes: Routes = [ }, { path: 'users', - loadChildren: './users/users.module#UsersModule' + loadChildren: './users/users.module#UsersModule', + data: { + breadcrumb: true + }, }, { path: 'welcome', diff --git a/dmp-frontend/src/app/datasets/dataset-public/dataset-public-listing.component.ts b/dmp-frontend/src/app/datasets/dataset-public/dataset-public-listing.component.ts index bf2353758..adc5be160 100644 --- a/dmp-frontend/src/app/datasets/dataset-public/dataset-public-listing.component.ts +++ b/dmp-frontend/src/app/datasets/dataset-public/dataset-public-listing.component.ts @@ -12,6 +12,7 @@ import { DataSource } from '@angular/cdk/table'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel'; +import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent'; @Component({ @@ -21,7 +22,6 @@ import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchC }) export class DatasetPublicListingComponent implements OnInit { - @ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; criteria: FacetSearchCriteriaModel; @@ -44,6 +44,7 @@ export class DatasetPublicListingComponent implements OnInit { } ngOnInit() { + this.route.params.subscribe(async (params: Params) => { this.dmpId = params['dmpId']; this.refresh(); diff --git a/dmp-frontend/src/app/datasets/dataset.routes.ts b/dmp-frontend/src/app/datasets/dataset.routes.ts index dfdd64c29..a4813cd12 100644 --- a/dmp-frontend/src/app/datasets/dataset.routes.ts +++ b/dmp-frontend/src/app/datasets/dataset.routes.ts @@ -49,7 +49,9 @@ export const DatasetRoutes: Routes = [ { path: 'public', component: DatasetPublicListingComponent, - //canActivate: [AuthGuard], + data: { + breadcrumb: false + } }, { path: 'dmp/:dmpId', diff --git a/dmp-frontend/src/app/dmp-profiles/dmp-profile-listing/dmp-profile-listing.component.html b/dmp-frontend/src/app/dmp-profiles/dmp-profile-listing/dmp-profile-listing.component.html index 26e5bcf09..5eeccbecc 100644 --- a/dmp-frontend/src/app/dmp-profiles/dmp-profile-listing/dmp-profile-listing.component.html +++ b/dmp-frontend/src/app/dmp-profiles/dmp-profile-listing/dmp-profile-listing.component.html @@ -1,5 +1,5 @@
-

{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}

+

{{titlePrefix}} {{'DMP-PROFILE-LISTING.TITLE' | translate}}

@@ -11,19 +11,19 @@ - {{'DATASET-LISTING.COLUMNS.NAME' | translate}} + {{'DMP-PROFILE-LISTING.COLUMNS.NAME' | translate}} {{row.label}} - {{'DATASET-LISTING.COLUMNS.STATUS' | translate}} + {{'DMP-PROFILE-LISTING.COLUMNS.STATUS' | translate}} {{row.status}} - {{'DATASET-LISTING.COLUMNS.CREATED' | translate}} + {{'DMP-PROFILE-LISTING.COLUMNS.CREATED' | translate}} {{row.created | date:'shortDate'}} @@ -41,4 +41,4 @@ -
\ No newline at end of file + diff --git a/dmp-frontend/src/app/services/breadcrumb/breadcrumb-resolver.service.ts b/dmp-frontend/src/app/services/breadcrumb/breadcrumb-resolver.service.ts index caade0a63..4bc5810c0 100644 --- a/dmp-frontend/src/app/services/breadcrumb/breadcrumb-resolver.service.ts +++ b/dmp-frontend/src/app/services/breadcrumb/breadcrumb-resolver.service.ts @@ -29,7 +29,7 @@ export class BreadCrumbResolverService { } public resolve(activatedRoute: ActivatedRoute): Observable { - this.breadCrumbs = Observable.of([]); + this.breadCrumbs = null; const routeComponents = this.getComponentsFromRoute(activatedRoute, []); this.activeComponents.filter(x => routeComponents.indexOf(x.constructor.name) !== -1).forEach(x => { if (x.hasOwnProperty('breadCrumbs')) { diff --git a/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.html b/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.html index 6aa4bf1f0..f87968072 100644 --- a/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.html +++ b/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.html @@ -7,7 +7,6 @@ chevron_right - diff --git a/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.ts b/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.ts index cd919438c..91988f62a 100644 --- a/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.ts +++ b/dmp-frontend/src/app/shared/components/breadcrumb/breadcrumb.component.ts @@ -30,7 +30,8 @@ export class BreadcrumbComponent implements OnInit { } buildBreadCrumb(route: ActivatedRoute): Observable { - return this.breadCrumbService.resolve(route).map(x => { x.unshift({ label: 'Dashboard', url: '/welcome' }); return x; }); + if (this.breadCrumbService.resolve(route)) { return this.breadCrumbService.resolve(route).map(x => { x.unshift({ label: 'Dashboard', url: '/welcome' }); return x; }); } + return Observable.of([]); } navigate(url, params) { diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index a9e46b817..45a2a5571 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -219,6 +219,14 @@ "FINALISE": "Finalise" } }, + "DMP-PROFILE-LISTING": { + "TITLE": "DMP Profiles", + "COLUMNS": { + "NAME": "Name", + "STATUS": "Status", + "CREATED": "Created" + } + }, "DYNAMIC-FORM": { "FIELDS": { "LABEL": "Label"