Fixed Issue with BreadCrumb Service

This commit is contained in:
Ioannis Kalyvas 2018-10-18 13:21:56 +03:00
parent ed46666a4f
commit c5b6b218b5
8 changed files with 25 additions and 11 deletions

View File

@ -79,7 +79,10 @@ const appRoutes: Routes = [
}, },
{ {
path: 'users', path: 'users',
loadChildren: './users/users.module#UsersModule' loadChildren: './users/users.module#UsersModule',
data: {
breadcrumb: true
},
}, },
{ {
path: 'welcome', path: 'welcome',

View File

@ -12,6 +12,7 @@ import { DataSource } from '@angular/cdk/table';
import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel';
import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { DataTableRequest } from '../../models/data-table/DataTableRequest';
import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel'; import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchCriteriaModel';
import { IBreadCrumbComponent } from '../../shared/components/breadcrumb/definition/IBreadCrumbComponent';
@Component({ @Component({
@ -21,7 +22,6 @@ import { FacetSearchCriteriaModel } from '../../models/facet-search/FacetSearchC
}) })
export class DatasetPublicListingComponent implements OnInit { export class DatasetPublicListingComponent implements OnInit {
@ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatPaginator) _paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
criteria: FacetSearchCriteriaModel; criteria: FacetSearchCriteriaModel;
@ -44,6 +44,7 @@ export class DatasetPublicListingComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.route.params.subscribe(async (params: Params) => { this.route.params.subscribe(async (params: Params) => {
this.dmpId = params['dmpId']; this.dmpId = params['dmpId'];
this.refresh(); this.refresh();

View File

@ -49,7 +49,9 @@ export const DatasetRoutes: Routes = [
{ {
path: 'public', path: 'public',
component: DatasetPublicListingComponent, component: DatasetPublicListingComponent,
//canActivate: [AuthGuard], data: {
breadcrumb: false
}
}, },
{ {
path: 'dmp/:dmpId', path: 'dmp/:dmpId',

View File

@ -1,5 +1,5 @@
<div class="container-fluid"> <div class="container-fluid">
<h3>{{titlePrefix}} {{'DATASET-LISTING.TITLE' | translate}}</h3> <h3>{{titlePrefix}} {{'DMP-PROFILE-LISTING.TITLE' | translate}}</h3>
<app-dmp-profile-criteria-component></app-dmp-profile-criteria-component> <app-dmp-profile-criteria-component></app-dmp-profile-criteria-component>
@ -11,19 +11,19 @@
<!-- Column Definition: Name --> <!-- Column Definition: Name -->
<ng-container cdkColumnDef="label"> <ng-container cdkColumnDef="label">
<mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DATASET-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="label">{{'DMP-PROFILE-LISTING.COLUMNS.NAME' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.label}}</mat-cell> <mat-cell *matCellDef="let row">{{row.label}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: status --> <!-- Column Definition: status -->
<ng-container cdkColumnDef="status"> <ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef mat-sort-header="status">{{'DATASET-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="status">{{'DMP-PROFILE-LISTING.COLUMNS.STATUS' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.status}}</mat-cell> <mat-cell *matCellDef="let row">{{row.status}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: Created --> <!-- Column Definition: Created -->
<ng-container cdkColumnDef="created"> <ng-container cdkColumnDef="created">
<mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DATASET-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header="created">{{'DMP-PROFILE-LISTING.COLUMNS.CREATED' | translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell> <mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container> </ng-container>

View File

@ -29,7 +29,7 @@ export class BreadCrumbResolverService {
} }
public resolve(activatedRoute: ActivatedRoute): Observable<BreadcrumbItem[]> { public resolve(activatedRoute: ActivatedRoute): Observable<BreadcrumbItem[]> {
this.breadCrumbs = Observable.of([]); this.breadCrumbs = null;
const routeComponents = this.getComponentsFromRoute(activatedRoute, []); const routeComponents = this.getComponentsFromRoute(activatedRoute, []);
this.activeComponents.filter(x => routeComponents.indexOf(x.constructor.name) !== -1).forEach(x => { this.activeComponents.filter(x => routeComponents.indexOf(x.constructor.name) !== -1).forEach(x => {
if (x.hasOwnProperty('breadCrumbs')) { if (x.hasOwnProperty('breadCrumbs')) {

View File

@ -7,7 +7,6 @@
</a> </a>
</li> </li>
<mat-icon fxFlex="nogrow">chevron_right</mat-icon> <mat-icon fxFlex="nogrow">chevron_right</mat-icon>
</div> </div>
</div> </div>
</ol> </ol>

View File

@ -30,7 +30,8 @@ export class BreadcrumbComponent implements OnInit {
} }
buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> { buildBreadCrumb(route: ActivatedRoute): Observable<BreadcrumbItem[]> {
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) { navigate(url, params) {

View File

@ -219,6 +219,14 @@
"FINALISE": "Finalise" "FINALISE": "Finalise"
} }
}, },
"DMP-PROFILE-LISTING": {
"TITLE": "DMP Profiles",
"COLUMNS": {
"NAME": "Name",
"STATUS": "Status",
"CREATED": "Created"
}
},
"DYNAMIC-FORM": { "DYNAMIC-FORM": {
"FIELDS": { "FIELDS": {
"LABEL": "Label" "LABEL": "Label"