[Monitor Dashboard | Trunk]: Move sidebar and header to app component
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59048 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f87575779f
commit
b69e50e978
|
@ -11,19 +11,19 @@ const routes: Routes = [
|
|||
path: 'reload',
|
||||
loadChildren: './reload/libReload.module#LibReloadModule',
|
||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||
data: {hasSidebar: false, hasAdminMenu: false}
|
||||
data: {hasSidebar: false}
|
||||
},
|
||||
{
|
||||
path: 'user-info',
|
||||
loadChildren: './login/libUser.module#LibUserModule',
|
||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||
data: {hasAdminMenu: false, hasSidebar: false}
|
||||
data: {hasSidebar: false}
|
||||
},
|
||||
{
|
||||
path: 'error',
|
||||
component: OpenaireErrorPageComponent,
|
||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||
data: {hasSidebar: false, hasAdminMenu: false}
|
||||
data: {hasSidebar: false}
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
|
|
|
@ -1,42 +1,35 @@
|
|||
<!--disable_transitions -->
|
||||
<div class="sidebar_main_swipe " [class.sidebar_main_active]="open && hasSidebar" [class.sidebar_mini]="!open &&
|
||||
hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
||||
<div *ngIf="hasHeader" id="header_main" [class.header_full]="!hasSidebar">
|
||||
<img *ngIf="(!open || !hasSidebar) && (properties.environment =='beta' || properties.environment
|
||||
=='development')"
|
||||
class="badge"
|
||||
[src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
|
||||
[alt]="properties.environment">
|
||||
<nav class="uk-navbar uk-light">
|
||||
<!--<div class="uk-navbar-left uk-margin-small-left">
|
||||
<div class="uk-light uk-margin-small-top">
|
||||
<div *ngIf="stakeHolder" class="uk-text-bold uk-h4 uk-margin-remove-bottom" >{{stakeHolder.name}}</div>
|
||||
|
||||
</div>
|
||||
</div>-->
|
||||
<div *ngIf="stakeHolder" class="uk-navbar-left">
|
||||
<a class="uk-logo uk-navbar-item ng-star-inserted uk-link "
|
||||
[routerLink]="'/'+stakeHolder.alias"
|
||||
routerlinkactive="uk-link">
|
||||
<img *ngIf="stakeHolder.logoUrl" [src]="stakeHolder.logoUrl"
|
||||
class=" logo uk-responsive-height uk-margin-small-bottom">
|
||||
|
||||
</a>
|
||||
<div class="sidebar_main_swipe" [class.sidebar_main_active]="open && hasSidebar"
|
||||
[class.sidebar_mini]="!open && hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
||||
<div *ngIf="hasHeader" id="header_main" [class.light_header]="isFrontPage" [class.header_full]="!hasSidebar">
|
||||
<img
|
||||
*ngIf="(!open || !hasSidebar) && (properties.environment === 'beta' || properties.environment === 'development')"
|
||||
class="badge"
|
||||
[src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
|
||||
[alt]="properties.environment">
|
||||
<nav class="uk-navbar" [class.uk-light]="!isFrontPage">
|
||||
<div *ngIf="stakeholder" class="uk-navbar-left">
|
||||
<ul class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-right">
|
||||
<li>
|
||||
<div class="uk-text-capitalize uk-h4 uk-margin-remove" >
|
||||
<!--<span class="uk-visible@m">
|
||||
{{'OpenAIRE Monitor '+(stakeholder.type == 'ri'?'Research Initiative':stakeholder.type)+
|
||||
' - ' }}</span>-->
|
||||
<span> {{stakeHolder.name}}</span>
|
||||
|
||||
<a class="uk-logo uk-navbar-item uk-link uk-margin-left "
|
||||
[routerLink]="'/'+stakeholder.alias">
|
||||
<img *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl" class=" logo uk-responsive-height">
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="uk-text-capitalize uk-h4 uk-margin-remove">
|
||||
<span> {{stakeholder.name}}</span>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="uk-navbar-right">
|
||||
<ul class="uk-navbar-nav user_actions">
|
||||
<li *ngIf="isFrontPage" title="It is comming soon. Stay tuned!">
|
||||
<a class="login" [routerLink]="(isAdmin()?['/admin']:null)">
|
||||
Manage
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<user-mini *ngIf="properties"
|
||||
[user]="user" [dashboard]="true"
|
||||
|
@ -48,16 +41,21 @@ hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</div>
|
||||
<dashboard-sidebar *ngIf="stakeholder && isFrontPage" [items]="sideBarItems"
|
||||
[activeItem]="activeTopic?activeTopic.alias:null" [showHeader]=true
|
||||
headerName="Monitor"
|
||||
[searchLink]="(properties.showContent)?properties.baseLink+'/search/'+stakeholder.alias+'/find/research-outcomes':null"
|
||||
[headerUrl]="properties.baseLink"
|
||||
></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu" [items]="adminMenuItems" headerName="Monitor"
|
||||
headerDashboard="Administration Panel" [headerUrl]="properties.baseLink"
|
||||
></dashboard-sidebar>
|
||||
<div *ngIf="hasSidebar" id="hide_controls">
|
||||
<div id="toggle" [class.sidebar_main_open]="open" (click)="toggleOpen($event)">
|
||||
<i class="material-icons">play_circle_filled</i>
|
||||
<span *ngIf="open" class="uk-margin-small-left">Hide Controls</span>
|
||||
<i class="material-icons">play_circle_filled</i>
|
||||
<span *ngIf="open" class="uk-margin-small-left">Hide Controls</span>
|
||||
</div>
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
|
|
|
@ -8,7 +8,7 @@ import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder
|
|||
import {BehaviorSubject, Subscriber} from "rxjs";
|
||||
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
||||
import {Stakeholder} from "./openaireLibrary/monitor/entities/stakeholder";
|
||||
import {Stakeholder, Topic} from "./openaireLibrary/monitor/entities/stakeholder";
|
||||
import {properties} from "../environments/environment";
|
||||
|
||||
|
||||
|
@ -23,11 +23,14 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
hasSidebar: boolean = false;
|
||||
hasHeader: boolean = false;
|
||||
hasAdminMenu: boolean = false;
|
||||
hasMiniMenu:boolean = false;
|
||||
isFrontPage:boolean = false;
|
||||
userMenuItems: MenuItem[] = [];
|
||||
hasMiniMenu: boolean = false;
|
||||
isFrontPage: boolean = false;
|
||||
isViewPublic: boolean = false;
|
||||
sideBarItems: MenuItem[] = [];
|
||||
userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
||||
adminMenuItems: MenuItem[] = [];
|
||||
stakeHolder:Stakeholder = null;
|
||||
stakeholder: Stakeholder = null;
|
||||
activeTopic: Topic = null;
|
||||
private subscriptions: any[] = [];
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
|
@ -50,10 +53,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(properties);
|
||||
this.subscriptions.push(this.layoutService.hasSidebar.subscribe(hasSidebar => {
|
||||
this.hasSidebar = hasSidebar;
|
||||
if(this.hasSidebar === false) {
|
||||
if (this.hasSidebar === false) {
|
||||
this.layoutService.setOpen(false);
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
|
@ -74,26 +76,42 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.isFrontPage = isFrontPage;
|
||||
this.cdr.detectChanges();
|
||||
}));
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.isViewPublic = (params['view'] == 'public');
|
||||
});
|
||||
this.layoutService.setOpen(false);
|
||||
this.propertiesService.loadEnvironment()
|
||||
.then(properties => {
|
||||
this.properties = properties;
|
||||
this.subscriptions.push(this.params.subscribe( params => {
|
||||
this.subscriptions.push(this.params.subscribe(params => {
|
||||
if (params && params['stakeholder']) {
|
||||
if (!this.stakeholderService.stakeholder ||
|
||||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
||||
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
|
||||
this.stakeholderService.setStakeholder(stakeholder);
|
||||
this.layoutService.setOpen(true);
|
||||
this.stakeHolder = stakeholder;
|
||||
this.stakeholder = stakeholder;
|
||||
if (params && params['topic'] && !this.activeTopic) {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
|
||||
} else {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
|
||||
}
|
||||
this.setSideBar();
|
||||
}, error => {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.navigateToError();
|
||||
});
|
||||
} else {
|
||||
if (params && params['topic']) {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
|
||||
} else {
|
||||
this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
this.layoutService.setOpen(true);
|
||||
this.stakeHolder = null;
|
||||
this.stakeholder = null;
|
||||
}
|
||||
}));
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
|
@ -105,7 +123,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public ngOnDestroy() {
|
||||
this.subscriptions.forEach(value => {
|
||||
if (value instanceof Subscriber) {
|
||||
|
@ -117,28 +135,44 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
private navigateToError() {
|
||||
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||
}
|
||||
|
||||
|
||||
public get open() {
|
||||
return this.layoutService.open;
|
||||
}
|
||||
|
||||
|
||||
public toggleOpen(event: MouseEvent) {
|
||||
event.preventDefault();
|
||||
this.layoutService.setOpen(!this.open);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private setSideBar() {
|
||||
let items: MenuItem[] = [];
|
||||
this.stakeholder.topics.forEach((topic) => {
|
||||
if (this.isPublicOrIsMember(topic.isPublic) && topic.isActive) {
|
||||
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + topic.alias),
|
||||
null, [], [], {});
|
||||
topicItem.icon = topic.icon;
|
||||
items.push(topicItem);
|
||||
}
|
||||
});
|
||||
if (items.length === 0) {
|
||||
items.push(new MenuItem('noTopics', 'No topics available yet', "", "", false, [], [], {}));
|
||||
}
|
||||
this.sideBarItems = items;
|
||||
}
|
||||
|
||||
buildMenu() {
|
||||
this.userMenuItems = [];
|
||||
/* if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
||||
"", "/helptexts", true, [], [], {communityId:'openaire'}))
|
||||
|
||||
}*/
|
||||
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || Session.isCommunityCurator(this.user)) {
|
||||
/* if (Session.isPortalAdministrator(this.user)) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
||||
"", "/helptexts", true, [], [], {communityId:'openaire'}))
|
||||
|
||||
}*/
|
||||
if (this.isAdmin()) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage profiles",
|
||||
"", "/admin", true, [], [], {}))
|
||||
|
||||
|
||||
}
|
||||
if (this.user) {
|
||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
||||
|
@ -160,4 +194,22 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.adminMenuItems.push(monitorOptions);*/
|
||||
}
|
||||
}
|
||||
|
||||
isAdmin() {
|
||||
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
|
||||
}
|
||||
|
||||
public isPublicOrIsMember(isPublic: boolean): boolean {
|
||||
if (isPublic) {
|
||||
return true;
|
||||
} else {
|
||||
if (this.isViewPublic) { // preview for not members
|
||||
return false;
|
||||
} else if (this.isAdmin()) {
|
||||
// if user is member, return true
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import {RouterModule} from '@angular/router';
|
|||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {MonitorComponent} from "./monitor.component";
|
||||
import {CanExitGuard} from "../openaireLibrary/utils/can-exit.guard";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -13,29 +12,25 @@ import {CanExitGuard} from "../openaireLibrary/utils/can-exit.guard";
|
|||
path: ':stakeholder',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
||||
data: {hasHeader: false}
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
path: ':stakeholder/:topic',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
||||
data: {hasHeader: false}
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
path: ':stakeholder/:topic/:category',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
||||
data: {hasHeader: false}
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
},
|
||||
{
|
||||
path: ':stakeholder/:topic/:category/:subCategory',
|
||||
component: MonitorComponent,
|
||||
canActivate: [FreeGuard],
|
||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
||||
data: {hasHeader: false}
|
||||
canDeactivate: [PreviousRouteRecorder]
|
||||
}
|
||||
])
|
||||
]
|
||||
|
|
|
@ -1,60 +1,4 @@
|
|||
<div class=" stakeholderPage">
|
||||
<div id="header_main" class=" light_header">
|
||||
<nav class="uk-navbar">
|
||||
<div *ngIf="stakeholder" class="uk-navbar-left">
|
||||
<a class="uk-logo uk-navbar-item ng-star-inserted uk-link uk-margin-left "
|
||||
[routerLink]="'/'+stakeholder.alias"
|
||||
routerlinkactive="uk-link">
|
||||
<img *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl" class=" logo uk-responsive-height">
|
||||
|
||||
</a>
|
||||
<ul class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-right">
|
||||
<li>
|
||||
<div class="uk-text-capitalize uk-h4 uk-margin-remove">
|
||||
<!--<span class="uk-visible@m">
|
||||
{{'OpenAIRE Monitor '+(stakeholder.type == 'ri'?'Research Initiative':stakeholder.type)+
|
||||
' - ' }}</span>-->
|
||||
<span> {{stakeholder.name}}</span>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div *ngIf="stakeholder"
|
||||
class="uk-navbar-right uk-margin-right">
|
||||
<ul *ngIf="!privateStakeholder"
|
||||
class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-right">
|
||||
<li title="It is comming soon. Stay tuned!">
|
||||
<a class="login" [routerLink]="(isAdmin()?['/admin']:null)">
|
||||
Manage
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-left">
|
||||
<li>
|
||||
<user-mini *ngIf="properties"
|
||||
[user]="user" [dashboard]="true"
|
||||
[logInUrl]=properties.loginUrl [logOutUrl]=properties.logoutUrl
|
||||
[cookieDomain]=properties.cookieDomain
|
||||
[userMenuItems]=userMenuItems>
|
||||
</user-mini>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<dashboard-sidebar *ngIf=" stakeholder" [items]="sideBarItems"
|
||||
[activeItem]="activeTopic?activeTopic.alias:null"
|
||||
[activeSubItem]="activeSubCategory?activeSubCategory.alias:null" [showHeader]=true
|
||||
headerName="Monitor"
|
||||
[searchLink]="(properties.showContent)?properties.baseLink+'/search/'+stakeholder.alias+'/find/research-outcomes':null"
|
||||
[headerUrl]="properties.baseLink"
|
||||
></dashboard-sidebar>
|
||||
<div id="page_content">
|
||||
<div id="page_content">
|
||||
<div class="uk-navbar-container uk-sticky uk-sticky-fixed" style="top: 70px; position:
|
||||
fixed; width: 100%">
|
||||
<nav class=" ">
|
||||
|
@ -62,8 +6,7 @@
|
|||
<ul *ngIf="activeTopic && activeTopic.categories.length > 1"
|
||||
class="categoriesTabs uk-tab uk-padding uk-padding-remove-bottom uk-padding-remove-left uk-margin-remove">
|
||||
<ng-template ngFor [ngForOf]="activeTopic.categories" let-category let-i="index">
|
||||
<li *ngIf="isPublicOrIsMember(category.isPublic) && category.isActive"
|
||||
[ngClass]="(category.alias === activeCategory.alias)?'uk-active':''">
|
||||
<li *ngIf="isPublicOrIsMember(category.isPublic) && category.isActive" [class.uk-active]="category.alias === activeCategory.alias">
|
||||
<a (click)="navigateTo(stakeholder.alias,activeTopic.alias, category.alias)"
|
||||
class="uk-margin-remove-bottom uk-h4"
|
||||
><span>{{category.name}}</span></a>
|
||||
|
@ -218,8 +161,7 @@
|
|||
<i *ngIf="!isAdmin() " class="material-icons uk-text-muted">settings</i>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div *ngIf="stakeholder && !privateStakeholder" id="style_switcher" class="filters_switcher"
|
||||
<div *ngIf="stakeholder && !privateStakeholder" id="style_switcher" class="filters_switcher"
|
||||
title="It is comming soon. Stay tuned!">
|
||||
<div id="style_switcher_toggle">
|
||||
<i class=" uk-text-muted">
|
||||
|
@ -236,6 +178,5 @@
|
|||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -28,27 +28,19 @@ import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
|
|||
templateUrl: 'monitor.component.html',
|
||||
styleUrls:['monitor.component.css']
|
||||
})
|
||||
export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
||||
private static sidebarStatus: {
|
||||
id;
|
||||
status;
|
||||
};
|
||||
export class MonitorComponent implements OnInit, OnDestroy {
|
||||
public user: User;
|
||||
public userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
||||
public subscriptions: any[] = [];
|
||||
public piwiksub: any;
|
||||
public pageContents = null;
|
||||
public divContents = null;
|
||||
public status: number;
|
||||
public loading: boolean = true;
|
||||
public isViewPublic: boolean = false;
|
||||
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
||||
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||
public activeTopic: Topic = null;
|
||||
public activeCategory: Category = null;
|
||||
public activeSubCategory: SubCategory = null;
|
||||
public sideBarItems: MenuItem[] = [];
|
||||
public topBarItems: MenuItem[] = [];
|
||||
public errorCodes: ErrorCodes;
|
||||
public stakeholder: Stakeholder;
|
||||
public numberResults: Map<string, number> = new Map<string, number>();
|
||||
|
@ -93,7 +85,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.user = user;
|
||||
|
||||
this.route.params.subscribe(params => {
|
||||
this.loading = true;
|
||||
this.activeTopic = null;
|
||||
this.activeCategory = null;
|
||||
this.activeSubCategory = null;
|
||||
|
@ -106,8 +97,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.route.queryParams.subscribe(params => {
|
||||
this.isViewPublic = (params['view'] == 'public');
|
||||
});
|
||||
this.buildMenu();
|
||||
|
||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||
this.status = this.errorCodes.LOADING;
|
||||
this.numberResults = new Map<string, number>();
|
||||
|
@ -150,20 +139,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
});
|
||||
}
|
||||
|
||||
canExit() {
|
||||
if (this.sideBarItems.length > 0) {
|
||||
let status = [];
|
||||
this.sideBarItems.forEach(item => {
|
||||
status.push(item.open);
|
||||
});
|
||||
MonitorComponent.sidebarStatus = {
|
||||
id: this.activeTopic.alias,
|
||||
status: status
|
||||
};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public get open() {
|
||||
return this.layoutService.open;
|
||||
}
|
||||
|
@ -196,12 +171,9 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
if (this.activeCategory) {
|
||||
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
||||
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
||||
this.setSideBar();
|
||||
if (this.activeSubCategory) {
|
||||
this.setIndicators();
|
||||
}
|
||||
} else {
|
||||
this.setSideBar();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -218,7 +190,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
||||
}
|
||||
if (this.activeSubCategory) {
|
||||
this.setSideBar();
|
||||
this.setIndicators();
|
||||
} else {
|
||||
this.navigateToError();
|
||||
|
@ -241,54 +212,10 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.setIndicators();
|
||||
}
|
||||
}
|
||||
this.setSideBar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setSideBar() {
|
||||
let items: MenuItem[] = [];
|
||||
this.stakeholder.topics.forEach((topic) => {
|
||||
if (this.isPublicOrIsMember(topic.isPublic) && topic.isActive) {
|
||||
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + topic.alias ),
|
||||
null, [], [], {});
|
||||
topicItem.icon = topic.icon;
|
||||
items.push(topicItem);
|
||||
}
|
||||
});
|
||||
let categoryItems: MenuItem[] = [];
|
||||
this.activeTopic.categories.forEach((category, index) => {
|
||||
if (this.isPublicOrIsMember(category.isPublic) && category.isActive) {
|
||||
let subItems: MenuItem[] = [];
|
||||
/*category.subCategories.forEach(subCategory => {
|
||||
if (this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive) {
|
||||
subItems.push(new MenuItem(subCategory.alias, subCategory.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias),
|
||||
null, null, [], {}));
|
||||
}
|
||||
});*/
|
||||
let open = this.activeCategory.alias === category.alias;
|
||||
if (MonitorComponent.sidebarStatus && MonitorComponent.sidebarStatus.id === this.activeTopic.alias) {
|
||||
open = MonitorComponent.sidebarStatus.status[index];
|
||||
}
|
||||
// constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params) {
|
||||
let categoryItem: MenuItem = new MenuItem(category.alias, category.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias),
|
||||
null, [], [], {});
|
||||
categoryItem.items = subItems;
|
||||
categoryItem.open = open;
|
||||
categoryItems.push(categoryItem);
|
||||
}
|
||||
});
|
||||
this.topBarItems = categoryItems;
|
||||
if (items.length === 0) {
|
||||
items.push(new MenuItem('noCategories', 'No categories available yet', "", "", false, [], [], {}));
|
||||
}
|
||||
this.sideBarItems = items;
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
private setIndicators() {
|
||||
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
||||
this.activeSubCategory.numbers.forEach((section, i) => {
|
||||
|
@ -363,30 +290,11 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
|||
this.piwiksub.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
this.userMenuItems.push(new MenuItem("", "Manage profiles", "", "/admin", false, [], [], {}));
|
||||
}
|
||||
if (this.user) {
|
||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
||||
}
|
||||
}
|
||||
|
||||
isAdmin(){
|
||||
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
|
||||
}
|
||||
|
||||
isLoggedIn() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
|
||||
public isPublicOrIsMember(isPublic: boolean): boolean {
|
||||
if (isPublic) {
|
||||
return true;
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
}
|
||||
.stakeholderPage .uk-navbar-container{
|
||||
background-color: white !important;
|
||||
padding-left: 0px;
|
||||
padding-left: 0;
|
||||
|
||||
}
|
||||
.stakeholderPage .uk-navbar-center .uk-logo{
|
||||
max-height: 80px;
|
||||
max-height: var(--header-height);
|
||||
}
|
||||
|
||||
.stakeholderPage .uk-navbar ul li.uk-active a{
|
||||
|
|
|
@ -227,8 +227,15 @@ body.dashboard {
|
|||
height: var(--header-height);
|
||||
}
|
||||
|
||||
.dashboard #header_main > .uk-navbar > * {
|
||||
vertical-align: middle;
|
||||
.dashboard #header_main > .uk-navbar .user_actions > li > * {
|
||||
display: -webkit-box;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
min-height: var(--header-height);
|
||||
}
|
||||
|
||||
.dashboard #header_main #sidebar_main_toggle {
|
||||
|
|
Loading…
Reference in New Issue