Adds: Breadcrumb on dmp overview page, Fixes: bug on breadcrumbs at page refresh
This commit is contained in:
parent
7844c33b7c
commit
f71f0ed3ff
|
@ -154,14 +154,18 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
if (!this.editMode || this.dmp.status === Status.Inactive) { this.formGroup.disable(); }
|
||||
if (this.isAuthenticated) {
|
||||
// if (!this.isAuthenticated) {
|
||||
this.breadCrumbs = Observable.of([
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: 'DMPs', url: "/plans" });
|
||||
const breadcrumb = await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise();
|
||||
breadCrumbs.push(
|
||||
{
|
||||
parentComponentName: 'DmpListingComponent',
|
||||
label: 'DMPs',
|
||||
url: 'plans',
|
||||
notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
|
||||
}]
|
||||
label: breadcrumb.label,
|
||||
url: breadcrumb.url,
|
||||
// notFoundResolver: [await this.projectService.getSingle(this.dmp.project.id).map(x => ({ label: x.label, url: '/projects/edit/' + x.id }) as BreadcrumbItem).toPromise()]
|
||||
}
|
||||
);
|
||||
this.breadCrumbs = Observable.of(breadCrumbs);
|
||||
}
|
||||
this.associatedUsers = data.associatedUsers;
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild(DmpCriteriaComponent) criteria: DmpCriteriaComponent;
|
||||
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([]);
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of([{ parentComponentName: null, label: 'DMPs', url: "/plans" }]);
|
||||
itemId: string;
|
||||
projectId: string;
|
||||
showProject: boolean;
|
||||
|
@ -58,7 +58,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.criteria.setCriteria({ like: null, projects: [project], groupIds: null, allVersions: false });
|
||||
this.refresh();
|
||||
projectLabel = this.route.snapshot.queryParams.projectLabel;
|
||||
this.breadCrumbs = Observable.of([{ parentComponentName: 'ProjectEditorComponent', label: projectLabel, url: '/projects/edit/' + this.projectId }]);
|
||||
// this.breadCrumbs = Observable.of([{ parentComponentName: 'ProjectEditorComponent', label: projectLabel, url: '/projects/edit/' + this.projectId }]);
|
||||
this.criteria.setRefreshCallback((resetPages) => this.refresh(resetPages));
|
||||
} else {
|
||||
this.itemId = params['groupId'];
|
||||
|
@ -84,6 +84,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
this.titlePrefix = 'for ' + projectLabel;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -131,7 +132,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
}
|
||||
|
||||
rowClicked(dmp: DmpListingModel) {
|
||||
this.router.navigate(['/plans/overview/' + dmp.id]);
|
||||
this.router.navigate(['/plans/overview/' + dmp.id, { dmpLabel: dmp.label }]);
|
||||
// this.router.navigate(['/plans/edit/' + dmp.id]);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import { ConfirmationDialogComponent } from '../../../library/confirmation-dialo
|
|||
import { UiNotificationService, SnackBarNotificationLevel } from '../../../core/services/notification/ui-notification-service';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { ExportMethodDialogComponent } from '../../../library/export-method-dialog/export-method-dialog.component';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-overview',
|
||||
|
@ -24,6 +26,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
|
||||
dmp: DmpOverviewModel;
|
||||
isNew = true;
|
||||
breadCrumbs: Observable<BreadcrumbItem[]> = Observable.of();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -51,6 +54,12 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
.subscribe(data => {
|
||||
this.dmp = data;
|
||||
})
|
||||
if (params['dmpLabel'] !== undefined) {
|
||||
const breadCrumbs = [];
|
||||
breadCrumbs.push({ parentComponentName: null, label: 'DMPs', url: "/plans" });
|
||||
breadCrumbs.push({ parentComponentName: 'DmpListingComponent', label: params['dmpLabel'], url: '/overview/' + itemId });
|
||||
this.breadCrumbs = Observable.of(breadCrumbs);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +84,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
this.router.navigate(['/datasets'], { queryParams: { dmpId: dmpId } });
|
||||
}
|
||||
|
||||
goToUri(uri: string){
|
||||
goToUri(uri: string) {
|
||||
window.open(uri, "_blank");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue