[Monitor | Trunk]: Add header on app component

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor@59593 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-10-14 11:23:40 +00:00
parent 60ecf12f07
commit 222d1d1f75
1 changed files with 13 additions and 20 deletions

View File

@ -10,13 +10,13 @@ import {UserManagementService} from "./openaireLibrary/services/user-management.
import {properties} from "../environments/environment";
import {BehaviorSubject, Subscriber} from "rxjs";
import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder.service";
import {Stakeholder} from "./openaireLibrary/monitor/entities/stakeholder";
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
@Component({
selector: 'app-root',
template: `
<div class="monitorApp">
<navbar *ngIf="properties && showMenu" portal="monitor" [onlyTop]=false [stakeholder]="stakeholder"
<navbar *ngIf="properties && showMenu && header" [header]="header" [onlyTop]="false"
[userMenuItems]=userMenuItems [menuItems]=menuItems [user]="user"
[showMenu]=showMenu [properties]="properties"></navbar>
<div class="custom-main-content">
@ -50,7 +50,8 @@ export class AppComponent {
user: User;
params: BehaviorSubject<Params> = new BehaviorSubject<Params>(null);
url: string;
stakeholder: Stakeholder = null;
header: Header;
logoPath: string = 'assets/common-assets/';
private subscriptions: any[] = [];
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
@ -75,6 +76,15 @@ export class AppComponent {
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
this.setUserMenu();
this.header = {
route: "/",
url: null,
title: 'monitor',
logoUrl: this.logoPath + 'logo-large-monitor.png',
logoSmallUrl:this.logoPath + 'logo-small-monitor.png',
position:'left',
badge:true
};
this.buildMenu();
}));
}
@ -110,23 +120,6 @@ export class AppComponent {
this.showMenu = true;
}
public buildStakeholderMenu() {
this.menuItems = [];
this.menuItems.push({
rootItem: new MenuItem("", "Dashboard",
this.properties.domain + properties.baseLink + "/dashboard/" + this.stakeholder.alias , "", true, [], [], {}),
items: []
});
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || Session.isCommunityCurator(this.user)) {
this.menuItems.push({
rootItem: new MenuItem("", "Manage",
this.properties.domain + properties.baseLink + "/dashboard/admin/" + this.stakeholder.alias , "", true, [], [], {}),
items: []
});
}
this.showMenu = true;
}
public setUserMenu() {
this.userMenuItems = [];
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || Session.isCommunityCurator(this.user)) {