Fix role-verification display if a dashboard is private or restricted.
This commit is contained in:
parent
1719469e56
commit
6709deb903
|
@ -2,25 +2,26 @@
|
|||
<loading [full]="true"></loading>
|
||||
</div>
|
||||
<div *ngIf="!loading" [class.monitor]="isFrontPage">
|
||||
<div *ngIf="!isHidden" class="sidebar_main_swipe uk-background-default" [class.sidebar_main_active]="open && (hasSidebar || hasAdminMenu || hasInternalSidebar)"
|
||||
<div class="sidebar_main_swipe uk-background-default" [class.sidebar_main_active]="open && (hasSidebar || hasAdminMenu || hasInternalSidebar)"
|
||||
[class.sidebar_mini]="!open && (hasSidebar || hasAdminMenu || hasInternalSidebar)">
|
||||
<div id="modal-container"></div>
|
||||
<navbar *ngIf="hasHeader" portal="monitor_dashboard" [header]="menuHeader" [userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user"></navbar>
|
||||
<div>
|
||||
<dashboard-sidebar *ngIf="stakeholder && isFrontPage && hasSidebar && !hasInternalSidebar" queryParamsHandling="merge" [items]="sideBarItems"
|
||||
[activeItem]="activeTopic?activeTopic.alias:null" [activeSubItem]="activeCategory?activeCategory.alias:null"></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu && !hasInternalSidebar" [items]="adminMenuItems" [specialMenuItem]="specialSideBarMenuItem"></dashboard-sidebar>
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<bottom id="bottom" *ngIf="isFrontPage" [centered]="true" [properties]="properties" [showMenuItems]="true"></bottom>
|
||||
<role-verification *ngIf="stakeholder" [id]="stakeholder.alias" [name]="stakeholder.name" [type]="stakeholder.type" [userInfoLinkPrefix]="(stakeholder?stakeholder.alias:'')"></role-verification>
|
||||
<notification-sidebar *ngIf="user && notificationGroupsInitialized" [entities]="entities"
|
||||
[user]="user" [availableGroups]="notificationGroups" service="monitor"></notification-sidebar>
|
||||
</div>
|
||||
<div *ngIf="view" class="preview uk-text-small uk-flex uk-flex-middle">
|
||||
<span>You are currently in a <span class="uk-text-bold">"Preview"</span> mode. <span class="uk-visible@m"><a (click)="removeView()">The current view</a> of this dashboard may differ.</span></span>
|
||||
</div>
|
||||
<ng-container *ngIf="!isHidden">
|
||||
<navbar *ngIf="hasHeader" portal="monitor_dashboard" [header]="menuHeader" [userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user"></navbar>
|
||||
<div>
|
||||
<dashboard-sidebar *ngIf="stakeholder && isFrontPage && hasSidebar && !hasInternalSidebar" queryParamsHandling="merge" [items]="sideBarItems"
|
||||
[activeItem]="activeTopic?activeTopic.alias:null" [activeSubItem]="activeCategory?activeCategory.alias:null"></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu && !hasInternalSidebar" [items]="adminMenuItems" [specialMenuItem]="specialSideBarMenuItem"></dashboard-sidebar>
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<bottom id="bottom" *ngIf="isFrontPage" [centered]="true" [properties]="properties" [showMenuItems]="true"></bottom>
|
||||
<notification-sidebar *ngIf="user && notificationGroupsInitialized" [entities]="entities"
|
||||
[user]="user" [availableGroups]="notificationGroups" service="monitor"></notification-sidebar>
|
||||
</div>
|
||||
<div *ngIf="view" class="preview uk-text-small uk-flex uk-flex-middle">
|
||||
<span>You are currently in a <span class="uk-text-bold">"Preview"</span> mode. <span class="uk-visible@m"><a (click)="removeView()">The current view</a> of this dashboard may differ.</span></span>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
<div *ngIf="isHidden" class="private-data uk-light dark">
|
||||
<div class="uk-section uk-section-small uk-container uk-container-small uk-text-center">
|
||||
|
@ -46,4 +47,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<role-verification *ngIf="stakeholder" [id]="stakeholder.alias" [name]="stakeholder.name" [type]="stakeholder.type" [userInfoLink]="monitorLink + '/user-info'"></role-verification>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@ import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
|
|||
import {Role, Session, User} from './openaireLibrary/login/utils/helper.class';
|
||||
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
||||
import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {BehaviorSubject, Subscriber} from "rxjs";
|
||||
import {BehaviorSubject, Subscriber, Subscription} from "rxjs";
|
||||
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
||||
import {
|
||||
|
@ -33,6 +33,7 @@ import {StringUtils} from "./openaireLibrary/utils/string-utils.class";
|
|||
export class AppComponent implements OnInit, OnDestroy {
|
||||
properties: EnvProperties = properties;
|
||||
user: User;
|
||||
updateStakeholder: boolean = true;
|
||||
params: BehaviorSubject<Params> = new BehaviorSubject<Params>(null);
|
||||
data: BehaviorSubject<Data> = new BehaviorSubject<Data>(null);
|
||||
hasSidebar: boolean = false;
|
||||
|
@ -68,6 +69,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
loading: boolean = true;
|
||||
paramsResolved: boolean = false;
|
||||
innerWidth;
|
||||
paramsSubscription: Subscription;
|
||||
private subscriptions: any[] = [];
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
|
@ -134,42 +136,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
this.layoutService.setSmallScreen((this.innerWidth && this.innerWidth <= 640));
|
||||
this.layoutService.setOpen(!(this.innerWidth && this.innerWidth <= 640));
|
||||
this.subscriptions.push(this.params.subscribe(params => {
|
||||
if (this.paramsResolved) {
|
||||
this.loading = true;
|
||||
if (params && params['stakeholder']) {
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['stakeholder']).subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
LinksResolver.setProperties(this.stakeholder.alias);
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type);
|
||||
this.buildMenu();
|
||||
this.setActives(params);
|
||||
this.setSideBar();
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
LinksResolver.resetProperties();
|
||||
this.navigateToError();
|
||||
this.buildMenu();
|
||||
this.loading = false;
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
this.buildMenu();
|
||||
this.setActives(params);
|
||||
this.loading = false;
|
||||
}
|
||||
} else {
|
||||
LinksResolver.resetProperties();
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.stakeholder = null;
|
||||
this.buildMenu();
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
this.subscriptions.push(this.data.subscribe(data => {
|
||||
if (data && data.portal) {
|
||||
this.setProperties(data.portal);
|
||||
|
@ -177,18 +144,58 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
}));
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.updateStakeholder = true;
|
||||
if (user) {
|
||||
this.user = user;
|
||||
this.buildMenu();
|
||||
if (!this.notificationGroupsInitialized) {
|
||||
this.setNotificationGroups();
|
||||
}
|
||||
} else if(this.user) {
|
||||
this.user = user;
|
||||
this.buildMenu();
|
||||
this.notificationGroupsInitialized = false;
|
||||
this.notificationGroups = [];
|
||||
}
|
||||
if(this.paramsSubscription) {
|
||||
this.paramsSubscription.unsubscribe();
|
||||
}
|
||||
this.paramsSubscription = this.params.subscribe(params => {
|
||||
if (this.paramsResolved) {
|
||||
this.loading = true;
|
||||
if (params && params['stakeholder']) {
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder'] || this.updateStakeholder) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['stakeholder'], this.updateStakeholder).subscribe(stakeholder => {
|
||||
if (stakeholder) {
|
||||
this.stakeholder = stakeholder;
|
||||
console.log(this.stakeholder);
|
||||
this.updateStakeholder = false;
|
||||
LinksResolver.setProperties(this.stakeholder.alias);
|
||||
this.setProperties(this.stakeholder.alias, this.stakeholder.type);
|
||||
this.buildMenu();
|
||||
this.setActives(params);
|
||||
this.setSideBar();
|
||||
this.loading = false;
|
||||
} else {
|
||||
this.stakeholder = null;
|
||||
LinksResolver.resetProperties();
|
||||
this.navigateToError();
|
||||
this.buildMenu();
|
||||
this.loading = false;
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
this.buildMenu();
|
||||
this.setActives(params);
|
||||
this.loading = false;
|
||||
}
|
||||
} else {
|
||||
LinksResolver.resetProperties();
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.stakeholder = null;
|
||||
this.buildMenu();
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -236,6 +243,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
public ngOnDestroy() {
|
||||
if(this.paramsSubscription) {
|
||||
this.paramsSubscription.unsubscribe();
|
||||
}
|
||||
this.subscriptions.forEach(value => {
|
||||
if (value instanceof Subscriber) {
|
||||
value.unsubscribe();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit da144c1c77012fa4489dd84f013d499f9df8f72a
|
||||
Subproject commit 53400f774505b7461ba5773f3d2d40cfc7091e34
|
Loading…
Reference in New Issue