[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',
|
path: 'reload',
|
||||||
loadChildren: './reload/libReload.module#LibReloadModule',
|
loadChildren: './reload/libReload.module#LibReloadModule',
|
||||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||||
data: {hasSidebar: false, hasAdminMenu: false}
|
data: {hasSidebar: false}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'user-info',
|
path: 'user-info',
|
||||||
loadChildren: './login/libUser.module#LibUserModule',
|
loadChildren: './login/libUser.module#LibUserModule',
|
||||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||||
data: {hasAdminMenu: false, hasSidebar: false}
|
data: {hasSidebar: false}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'error',
|
path: 'error',
|
||||||
component: OpenaireErrorPageComponent,
|
component: OpenaireErrorPageComponent,
|
||||||
resolve: {envSpecific: EnvironmentSpecificResolver},
|
resolve: {envSpecific: EnvironmentSpecificResolver},
|
||||||
data: {hasSidebar: false, hasAdminMenu: false}
|
data: {hasSidebar: false}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'admin',
|
path: 'admin',
|
||||||
|
|
|
@ -1,42 +1,35 @@
|
||||||
<!--disable_transitions -->
|
<!--disable_transitions -->
|
||||||
<div class="sidebar_main_swipe " [class.sidebar_main_active]="open && hasSidebar" [class.sidebar_mini]="!open &&
|
<div class="sidebar_main_swipe" [class.sidebar_main_active]="open && hasSidebar"
|
||||||
hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
[class.sidebar_mini]="!open && hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
||||||
<div *ngIf="hasHeader" id="header_main" [class.header_full]="!hasSidebar">
|
<div *ngIf="hasHeader" id="header_main" [class.light_header]="isFrontPage" [class.header_full]="!hasSidebar">
|
||||||
<img *ngIf="(!open || !hasSidebar) && (properties.environment =='beta' || properties.environment
|
<img
|
||||||
=='development')"
|
*ngIf="(!open || !hasSidebar) && (properties.environment === 'beta' || properties.environment === 'development')"
|
||||||
class="badge"
|
class="badge"
|
||||||
[src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
|
[src]="'assets/common-assets/'+(properties.environment =='beta'?'beta_flag.svg':'prototype_flag.svg')"
|
||||||
[alt]="properties.environment">
|
[alt]="properties.environment">
|
||||||
<nav class="uk-navbar uk-light">
|
<nav class="uk-navbar" [class.uk-light]="!isFrontPage">
|
||||||
<!--<div class="uk-navbar-left uk-margin-small-left">
|
<div *ngIf="stakeholder" class="uk-navbar-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>
|
|
||||||
<ul class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-right">
|
<ul class="uk-navbar-nav user_actions uk-padding uk-padding-remove-vertical uk-padding-remove-right">
|
||||||
<li>
|
<li>
|
||||||
<div class="uk-text-capitalize uk-h4 uk-margin-remove" >
|
<a class="uk-logo uk-navbar-item uk-link uk-margin-left "
|
||||||
<!--<span class="uk-visible@m">
|
[routerLink]="'/'+stakeholder.alias">
|
||||||
{{'OpenAIRE Monitor '+(stakeholder.type == 'ri'?'Research Initiative':stakeholder.type)+
|
<img *ngIf="stakeholder.logoUrl" [src]="stakeholder.logoUrl" class=" logo uk-responsive-height">
|
||||||
' - ' }}</span>-->
|
</a>
|
||||||
<span> {{stakeHolder.name}}</span>
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="uk-text-capitalize uk-h4 uk-margin-remove">
|
||||||
|
<span> {{stakeholder.name}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-navbar-right">
|
<div class="uk-navbar-right">
|
||||||
<ul class="uk-navbar-nav user_actions">
|
<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>
|
<li>
|
||||||
<user-mini *ngIf="properties"
|
<user-mini *ngIf="properties"
|
||||||
[user]="user" [dashboard]="true"
|
[user]="user" [dashboard]="true"
|
||||||
|
@ -48,9 +41,14 @@ hasMiniMenu && hasSidebar" [class.stakeholderPage]="isFrontPage">
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</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"
|
<dashboard-sidebar *ngIf="hasAdminMenu" [items]="adminMenuItems" headerName="Monitor"
|
||||||
headerDashboard="Administration Panel" [headerUrl]="properties.baseLink"
|
headerDashboard="Administration Panel" [headerUrl]="properties.baseLink"
|
||||||
></dashboard-sidebar>
|
></dashboard-sidebar>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder
|
||||||
import {BehaviorSubject, Subscriber} from "rxjs";
|
import {BehaviorSubject, Subscriber} from "rxjs";
|
||||||
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||||
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
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";
|
import {properties} from "../environments/environment";
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,14 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
hasSidebar: boolean = false;
|
hasSidebar: boolean = false;
|
||||||
hasHeader: boolean = false;
|
hasHeader: boolean = false;
|
||||||
hasAdminMenu: boolean = false;
|
hasAdminMenu: boolean = false;
|
||||||
hasMiniMenu:boolean = false;
|
hasMiniMenu: boolean = false;
|
||||||
isFrontPage:boolean = false;
|
isFrontPage: boolean = false;
|
||||||
userMenuItems: MenuItem[] = [];
|
isViewPublic: boolean = false;
|
||||||
|
sideBarItems: MenuItem[] = [];
|
||||||
|
userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
||||||
adminMenuItems: MenuItem[] = [];
|
adminMenuItems: MenuItem[] = [];
|
||||||
stakeHolder:Stakeholder = null;
|
stakeholder: Stakeholder = null;
|
||||||
|
activeTopic: Topic = null;
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
|
@ -50,10 +53,9 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
console.log(properties);
|
|
||||||
this.subscriptions.push(this.layoutService.hasSidebar.subscribe(hasSidebar => {
|
this.subscriptions.push(this.layoutService.hasSidebar.subscribe(hasSidebar => {
|
||||||
this.hasSidebar = hasSidebar;
|
this.hasSidebar = hasSidebar;
|
||||||
if(this.hasSidebar === false) {
|
if (this.hasSidebar === false) {
|
||||||
this.layoutService.setOpen(false);
|
this.layoutService.setOpen(false);
|
||||||
}
|
}
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
|
@ -74,26 +76,42 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.isFrontPage = isFrontPage;
|
this.isFrontPage = isFrontPage;
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
}));
|
}));
|
||||||
|
this.route.queryParams.subscribe(params => {
|
||||||
|
this.isViewPublic = (params['view'] == 'public');
|
||||||
|
});
|
||||||
this.layoutService.setOpen(false);
|
this.layoutService.setOpen(false);
|
||||||
this.propertiesService.loadEnvironment()
|
this.propertiesService.loadEnvironment()
|
||||||
.then(properties => {
|
.then(properties => {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.subscriptions.push(this.params.subscribe( params => {
|
this.subscriptions.push(this.params.subscribe(params => {
|
||||||
if (params && params['stakeholder']) {
|
if (params && params['stakeholder']) {
|
||||||
if (!this.stakeholderService.stakeholder ||
|
if (!this.stakeholderService.stakeholder ||
|
||||||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
|
||||||
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
|
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
|
||||||
this.stakeholderService.setStakeholder(stakeholder);
|
this.stakeholderService.setStakeholder(stakeholder);
|
||||||
this.layoutService.setOpen(true);
|
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 => {
|
}, error => {
|
||||||
|
this.stakeholderService.setStakeholder(null);
|
||||||
this.navigateToError();
|
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 {
|
} else {
|
||||||
this.stakeholderService.setStakeholder(null);
|
this.stakeholderService.setStakeholder(null);
|
||||||
this.layoutService.setOpen(true);
|
this.layoutService.setOpen(true);
|
||||||
this.stakeHolder = null;
|
this.stakeholder = null;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||||
|
@ -127,15 +145,31 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.layoutService.setOpen(!this.open);
|
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() {
|
buildMenu() {
|
||||||
this.userMenuItems = [];
|
this.userMenuItems = [];
|
||||||
/* if (Session.isPortalAdministrator(this.user)) {
|
/* if (Session.isPortalAdministrator(this.user)) {
|
||||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
||||||
"", "/helptexts", true, [], [], {communityId:'openaire'}))
|
"", "/helptexts", true, [], [], {communityId:'openaire'}))
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
if (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || Session.isCommunityCurator(this.user)) {
|
if (this.isAdmin()) {
|
||||||
this.userMenuItems.push(new MenuItem("", "Manage profiles",
|
this.userMenuItems.push(new MenuItem("", "Manage profiles",
|
||||||
"", "/admin", true, [], [], {}))
|
"", "/admin", true, [], [], {}))
|
||||||
|
|
||||||
|
@ -160,4 +194,22 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.adminMenuItems.push(monitorOptions);*/
|
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 {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||||
import {MonitorComponent} from "./monitor.component";
|
import {MonitorComponent} from "./monitor.component";
|
||||||
import {CanExitGuard} from "../openaireLibrary/utils/can-exit.guard";
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -13,29 +12,25 @@ import {CanExitGuard} from "../openaireLibrary/utils/can-exit.guard";
|
||||||
path: ':stakeholder',
|
path: ':stakeholder',
|
||||||
component: MonitorComponent,
|
component: MonitorComponent,
|
||||||
canActivate: [FreeGuard],
|
canActivate: [FreeGuard],
|
||||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
canDeactivate: [PreviousRouteRecorder]
|
||||||
data: {hasHeader: false}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':stakeholder/:topic',
|
path: ':stakeholder/:topic',
|
||||||
component: MonitorComponent,
|
component: MonitorComponent,
|
||||||
canActivate: [FreeGuard],
|
canActivate: [FreeGuard],
|
||||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
canDeactivate: [PreviousRouteRecorder]
|
||||||
data: {hasHeader: false}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':stakeholder/:topic/:category',
|
path: ':stakeholder/:topic/:category',
|
||||||
component: MonitorComponent,
|
component: MonitorComponent,
|
||||||
canActivate: [FreeGuard],
|
canActivate: [FreeGuard],
|
||||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
canDeactivate: [PreviousRouteRecorder]
|
||||||
data: {hasHeader: false}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':stakeholder/:topic/:category/:subCategory',
|
path: ':stakeholder/:topic/:category/:subCategory',
|
||||||
component: MonitorComponent,
|
component: MonitorComponent,
|
||||||
canActivate: [FreeGuard],
|
canActivate: [FreeGuard],
|
||||||
canDeactivate: [PreviousRouteRecorder, CanExitGuard],
|
canDeactivate: [PreviousRouteRecorder]
|
||||||
data: {hasHeader: false}
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,60 +1,4 @@
|
||||||
<div class=" stakeholderPage">
|
<div id="page_content">
|
||||||
<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 class="uk-navbar-container uk-sticky uk-sticky-fixed" style="top: 70px; position:
|
<div class="uk-navbar-container uk-sticky uk-sticky-fixed" style="top: 70px; position:
|
||||||
fixed; width: 100%">
|
fixed; width: 100%">
|
||||||
<nav class=" ">
|
<nav class=" ">
|
||||||
|
@ -62,8 +6,7 @@
|
||||||
<ul *ngIf="activeTopic && activeTopic.categories.length > 1"
|
<ul *ngIf="activeTopic && activeTopic.categories.length > 1"
|
||||||
class="categoriesTabs uk-tab uk-padding uk-padding-remove-bottom uk-padding-remove-left uk-margin-remove">
|
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">
|
<ng-template ngFor [ngForOf]="activeTopic.categories" let-category let-i="index">
|
||||||
<li *ngIf="isPublicOrIsMember(category.isPublic) && category.isActive"
|
<li *ngIf="isPublicOrIsMember(category.isPublic) && category.isActive" [class.uk-active]="category.alias === activeCategory.alias">
|
||||||
[ngClass]="(category.alias === activeCategory.alias)?'uk-active':''">
|
|
||||||
<a (click)="navigateTo(stakeholder.alias,activeTopic.alias, category.alias)"
|
<a (click)="navigateTo(stakeholder.alias,activeTopic.alias, category.alias)"
|
||||||
class="uk-margin-remove-bottom uk-h4"
|
class="uk-margin-remove-bottom uk-h4"
|
||||||
><span>{{category.name}}</span></a>
|
><span>{{category.name}}</span></a>
|
||||||
|
@ -218,8 +161,7 @@
|
||||||
<i *ngIf="!isAdmin() " class="material-icons uk-text-muted">settings</i>
|
<i *ngIf="!isAdmin() " class="material-icons uk-text-muted">settings</i>
|
||||||
</div>
|
</div>
|
||||||
</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!">
|
title="It is comming soon. Stay tuned!">
|
||||||
<div id="style_switcher_toggle">
|
<div id="style_switcher_toggle">
|
||||||
<i class=" uk-text-muted">
|
<i class=" uk-text-muted">
|
||||||
|
@ -236,6 +178,5 @@
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,27 +28,19 @@ import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
|
||||||
templateUrl: 'monitor.component.html',
|
templateUrl: 'monitor.component.html',
|
||||||
styleUrls:['monitor.component.css']
|
styleUrls:['monitor.component.css']
|
||||||
})
|
})
|
||||||
export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
export class MonitorComponent implements OnInit, OnDestroy {
|
||||||
private static sidebarStatus: {
|
|
||||||
id;
|
|
||||||
status;
|
|
||||||
};
|
|
||||||
public user: User;
|
public user: User;
|
||||||
public userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
|
||||||
public subscriptions: any[] = [];
|
public subscriptions: any[] = [];
|
||||||
public piwiksub: any;
|
public piwiksub: any;
|
||||||
public pageContents = null;
|
public pageContents = null;
|
||||||
public divContents = null;
|
public divContents = null;
|
||||||
public status: number;
|
public status: number;
|
||||||
public loading: boolean = true;
|
|
||||||
public isViewPublic: boolean = false;
|
public isViewPublic: boolean = false;
|
||||||
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
||||||
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||||
public activeTopic: Topic = null;
|
public activeTopic: Topic = null;
|
||||||
public activeCategory: Category = null;
|
public activeCategory: Category = null;
|
||||||
public activeSubCategory: SubCategory = null;
|
public activeSubCategory: SubCategory = null;
|
||||||
public sideBarItems: MenuItem[] = [];
|
|
||||||
public topBarItems: MenuItem[] = [];
|
|
||||||
public errorCodes: ErrorCodes;
|
public errorCodes: ErrorCodes;
|
||||||
public stakeholder: Stakeholder;
|
public stakeholder: Stakeholder;
|
||||||
public numberResults: Map<string, number> = new Map<string, number>();
|
public numberResults: Map<string, number> = new Map<string, number>();
|
||||||
|
@ -93,7 +85,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.loading = true;
|
|
||||||
this.activeTopic = null;
|
this.activeTopic = null;
|
||||||
this.activeCategory = null;
|
this.activeCategory = null;
|
||||||
this.activeSubCategory = null;
|
this.activeSubCategory = null;
|
||||||
|
@ -106,8 +97,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe(params => {
|
||||||
this.isViewPublic = (params['view'] == 'public');
|
this.isViewPublic = (params['view'] == 'public');
|
||||||
});
|
});
|
||||||
this.buildMenu();
|
|
||||||
|
|
||||||
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
||||||
this.status = this.errorCodes.LOADING;
|
this.status = this.errorCodes.LOADING;
|
||||||
this.numberResults = new Map<string, number>();
|
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() {
|
public get open() {
|
||||||
return this.layoutService.open;
|
return this.layoutService.open;
|
||||||
}
|
}
|
||||||
|
@ -196,12 +171,9 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
if (this.activeCategory) {
|
if (this.activeCategory) {
|
||||||
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
||||||
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
||||||
this.setSideBar();
|
|
||||||
if (this.activeSubCategory) {
|
if (this.activeSubCategory) {
|
||||||
this.setIndicators();
|
this.setIndicators();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.setSideBar();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +190,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
|
||||||
}
|
}
|
||||||
if (this.activeSubCategory) {
|
if (this.activeSubCategory) {
|
||||||
this.setSideBar();
|
|
||||||
this.setIndicators();
|
this.setIndicators();
|
||||||
} else {
|
} else {
|
||||||
this.navigateToError();
|
this.navigateToError();
|
||||||
|
@ -241,54 +212,10 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent
|
||||||
this.setIndicators();
|
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() {
|
private setIndicators() {
|
||||||
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
||||||
this.activeSubCategory.numbers.forEach((section, i) => {
|
this.activeSubCategory.numbers.forEach((section, i) => {
|
||||||
|
@ -364,29 +291,10 @@ 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) {
|
|
||||||
this.userMenuItems.push(new MenuItem("", "Manage profiles", "", "/admin", false, [], [], {}));
|
|
||||||
}
|
|
||||||
if (this.user) {
|
|
||||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isAdmin(){
|
isAdmin(){
|
||||||
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
|
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoggedIn() {
|
|
||||||
return this.user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public isPublicOrIsMember(isPublic: boolean): boolean {
|
public isPublicOrIsMember(isPublic: boolean): boolean {
|
||||||
if (isPublic) {
|
if (isPublic) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -42,11 +42,11 @@
|
||||||
}
|
}
|
||||||
.stakeholderPage .uk-navbar-container{
|
.stakeholderPage .uk-navbar-container{
|
||||||
background-color: white !important;
|
background-color: white !important;
|
||||||
padding-left: 0px;
|
padding-left: 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
.stakeholderPage .uk-navbar-center .uk-logo{
|
.stakeholderPage .uk-navbar-center .uk-logo{
|
||||||
max-height: 80px;
|
max-height: var(--header-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stakeholderPage .uk-navbar ul li.uk-active a{
|
.stakeholderPage .uk-navbar ul li.uk-active a{
|
||||||
|
|
|
@ -227,8 +227,15 @@ body.dashboard {
|
||||||
height: var(--header-height);
|
height: var(--header-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #header_main > .uk-navbar > * {
|
.dashboard #header_main > .uk-navbar .user_actions > li > * {
|
||||||
vertical-align: middle;
|
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 {
|
.dashboard #header_main #sidebar_main_toggle {
|
||||||
|
|
Loading…
Reference in New Issue