[Monitor Dashboard | Trunk]: Reset user menu items before build
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57884 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
d7a84cb3aa
commit
5da23e9673
|
@ -17,7 +17,6 @@ import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
|||
export class AppComponent implements OnInit, OnDestroy {
|
||||
properties: EnvProperties;
|
||||
user: User;
|
||||
loginCheck: boolean = false;
|
||||
hasSidebar: boolean = false;
|
||||
hasHeader: boolean = false;
|
||||
userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
||||
|
@ -65,7 +64,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}));
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe(user => {
|
||||
this.user = user;
|
||||
this.loginCheck = true;
|
||||
this.buildMenu();
|
||||
}, error => {
|
||||
console.log("App couldn't fetch properties");
|
||||
|
@ -96,6 +94,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
|
||||
|
||||
buildMenu() {
|
||||
this.userMenuItems = [];
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
||||
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {}))
|
||||
|
|
|
@ -88,7 +88,7 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
let subscription: Subscription;
|
||||
this.route.params.subscribe(params => {
|
||||
if(subscription) {
|
||||
if (subscription) {
|
||||
subscription.unsubscribe();
|
||||
}
|
||||
this.properties = data.envSpecific;
|
||||
|
@ -198,7 +198,7 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
if (params['category']) {
|
||||
this.activeCategory = this.activeTopic.categories.find(category =>
|
||||
(category.alias === params['category']) && category.isPublic && category.isActive);
|
||||
if(!this.activeCategory) {
|
||||
if (!this.activeCategory) {
|
||||
this.navigateToError();
|
||||
return;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
if (params['subCategory']) {
|
||||
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
||||
(subCategory.alias === params['subCategory'] && subCategory.isPublic && subCategory.isActive));
|
||||
if(!this.activeSubCategory) {
|
||||
if (!this.activeSubCategory) {
|
||||
this.navigateToError();
|
||||
return;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
subItems, null, open));
|
||||
}
|
||||
});
|
||||
if(items.length === 0) {
|
||||
if (items.length === 0) {
|
||||
items.push(new Item('noCategories', 'No categories available yet', null, [], null, false));
|
||||
}
|
||||
this.sideBar = new Sidebar(items, null);
|
||||
|
@ -360,12 +360,13 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
}
|
||||
|
||||
buildMenu() {
|
||||
this.userMenuItems = [];
|
||||
if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
||||
((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {}))
|
||||
|
||||
}
|
||||
if(this.user) {
|
||||
if (this.user) {
|
||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue