2019-11-27 11:51:21 +01:00
|
|
|
import {ChangeDetectorRef, Component, OnDestroy, OnInit} from '@angular/core';
|
2019-10-24 09:44:29 +02:00
|
|
|
import {ActivatedRoute, Params, Router} from '@angular/router';
|
|
|
|
import {DomSanitizer, Meta, Title} from '@angular/platform-browser';
|
|
|
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
|
|
|
|
|
|
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
|
|
|
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
|
|
|
|
|
|
|
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
|
|
|
|
import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.component';
|
|
|
|
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
|
|
|
|
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
|
|
|
|
import {StakeholderService} from "../services/stakeholder.service";
|
2019-11-20 13:55:23 +01:00
|
|
|
import {Category, ChartHelper, IndicatorPath, Stakeholder, SubCategory, Topic} from "../utils/entities/stakeholder";
|
2019-10-24 09:44:29 +02:00
|
|
|
import {StatisticsService} from "../utils/services/statistics.service";
|
2019-11-29 14:35:13 +01:00
|
|
|
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
|
2019-11-28 17:27:49 +01:00
|
|
|
import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
|
2019-12-23 14:54:37 +01:00
|
|
|
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
2019-11-29 15:58:52 +01:00
|
|
|
import {FormBuilder, FormControl} from "@angular/forms";
|
2019-12-04 19:25:36 +01:00
|
|
|
import {IDeactivateComponent} from "../openaireLibrary/utils/can-exit.guard";
|
2019-12-06 16:46:38 +01:00
|
|
|
import {Subscription} from "rxjs";
|
2019-12-13 16:48:24 +01:00
|
|
|
import {Session, User} from "../openaireLibrary/login/utils/helper.class";
|
|
|
|
import {MenuItem} from "../openaireLibrary/sharedComponents/menu";
|
|
|
|
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
2019-10-24 09:44:29 +02:00
|
|
|
|
|
|
|
@Component({
|
2019-12-15 13:38:09 +01:00
|
|
|
selector: 'monitor',
|
|
|
|
templateUrl: 'monitor.component.html',
|
2019-10-24 09:44:29 +02:00
|
|
|
})
|
2019-12-04 19:25:36 +01:00
|
|
|
export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent {
|
2019-12-15 13:38:09 +01:00
|
|
|
private static sidebarStatus: {
|
|
|
|
id;
|
|
|
|
status;
|
|
|
|
};
|
|
|
|
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 indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
|
|
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
|
|
|
public activeTopic: Topic = null;
|
|
|
|
public activeCategory: Category = null;
|
|
|
|
public activeSubCategory: SubCategory = null;
|
2020-01-08 12:00:50 +01:00
|
|
|
public sideBarItems: MenuItem[] = [];
|
2019-12-15 13:38:09 +01:00
|
|
|
public errorCodes: ErrorCodes;
|
|
|
|
public stakeholder: Stakeholder;
|
2020-01-08 12:00:50 +01:00
|
|
|
public numberResults: Map<string, number> = new Map<string, number>();
|
|
|
|
public chartsActiveType: Map<string, IndicatorPath> = new Map<string, IndicatorPath>();
|
2019-12-15 13:38:09 +01:00
|
|
|
private errorMessages: ErrorMessagesComponent;
|
|
|
|
properties: EnvProperties;
|
|
|
|
fundingL0;
|
|
|
|
startYear;
|
|
|
|
endYear;
|
|
|
|
|
|
|
|
public keyword: FormControl;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private route: ActivatedRoute,
|
|
|
|
private _router: Router,
|
|
|
|
private _meta: Meta,
|
|
|
|
private _title: Title,
|
|
|
|
private _piwikService: PiwikService,
|
|
|
|
private helper: HelperService,
|
|
|
|
private stakeholderService: StakeholderService,
|
|
|
|
private userManagementService: UserManagementService,
|
|
|
|
private statisticsService: StatisticsService,
|
|
|
|
private layoutService: LayoutService,
|
|
|
|
private seoService: SEOService,
|
|
|
|
private cdr: ChangeDetectorRef,
|
|
|
|
private sanitizer: DomSanitizer, private _fb: FormBuilder) {
|
|
|
|
this.errorCodes = new ErrorCodes();
|
|
|
|
this.errorMessages = new ErrorMessagesComponent();
|
|
|
|
this.status = this.errorCodes.LOADING;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
this.keyword = this._fb.control('');
|
|
|
|
this.keyword.valueChanges.subscribe(value => {
|
|
|
|
console.log("Keyword Changed!");
|
|
|
|
//TODO do a real action
|
|
|
|
});
|
|
|
|
this.route.data
|
|
|
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
|
|
|
let subscription: Subscription;
|
|
|
|
this.route.params.subscribe(params => {
|
|
|
|
if (subscription) {
|
|
|
|
subscription.unsubscribe();
|
|
|
|
}
|
|
|
|
this.properties = data.envSpecific;
|
|
|
|
var url = data.envSpecific.baseLink + this._router.url;
|
|
|
|
if (!this.stakeholder || this.stakeholder.alias !== params['stakeholder']) {
|
|
|
|
this.status = this.errorCodes.LOADING;
|
2020-01-08 12:00:50 +01:00
|
|
|
this.numberResults = new Map<string, number>();
|
|
|
|
this.chartsActiveType = new Map<string, IndicatorPath>();
|
2020-01-10 12:32:23 +01:00
|
|
|
subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
|
|
|
// let stakeholder: Stakeholder = null;
|
|
|
|
// if (params['stakeholder'] == "fwf") {
|
|
|
|
// stakeholder = new Stakeholder(null, "funder", "fwf_________::FWF", "Austrian Science Fund (FWF)", "FWF",
|
|
|
|
// "fwf", true, true, null);
|
|
|
|
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile().topics);
|
|
|
|
// stakeholder.logoUrl = "./assets/fwf.png";
|
|
|
|
// } else if (params['stakeholder'] == "arc") {
|
|
|
|
// stakeholder = new Stakeholder(null, "funder", "arc_________::ARC",
|
|
|
|
// "Australian Research Council (ARC)", "ARC", "arc", true, true, null);
|
|
|
|
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile().topics);
|
|
|
|
// stakeholder.logoUrl = "./assets/arc1.gif";
|
|
|
|
// } else {
|
|
|
|
// stakeholder = new Stakeholder(null, "funder", "ec__________::EC",
|
|
|
|
// "European Commission", "EC",
|
|
|
|
// "ec", true, true, null);
|
|
|
|
// stakeholder = this.stakeholderUtils.createFunderFromDefaultProfile(stakeholder, StakeholderCreator.createFunderDefaultProfile().topics);
|
|
|
|
// stakeholder.logoUrl = "./assets/ec.png";
|
|
|
|
// }
|
2019-12-15 13:38:09 +01:00
|
|
|
if (stakeholder) {
|
|
|
|
this.stakeholder = stakeholder;
|
2020-01-09 15:31:55 +01:00
|
|
|
console.info(this.stakeholder);
|
|
|
|
|
2019-12-15 13:38:09 +01:00
|
|
|
this.seoService.createLinkForCanonicalURL(url, false);
|
|
|
|
this._meta.updateTag({content: url}, "property='og:url'");
|
|
|
|
var description = "Monitor Dashboard | " + this.stakeholder.index_name;
|
|
|
|
var title = "Monitor Dashboard | " + this.stakeholder.index_shortName;
|
|
|
|
this._meta.updateTag({content: description}, "name='description'");
|
|
|
|
this._meta.updateTag({content: description}, "property='og:description'");
|
|
|
|
this._meta.updateTag({content: title}, "property='og:title'");
|
|
|
|
this._title.setTitle(title);
|
|
|
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
|
|
|
this.piwiksub = this._piwikService.trackView(this.properties, title, this.properties.piwikSiteId).subscribe();
|
|
|
|
}
|
|
|
|
//this.getDivContents();
|
|
|
|
this.getPageContents();
|
|
|
|
this.status = this.errorCodes.DONE;
|
|
|
|
this.setView(params);
|
2020-01-08 12:00:50 +01:00
|
|
|
this.layoutService.setOpen(true);
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
2020-01-10 12:32:23 +01:00
|
|
|
}, error => {
|
|
|
|
this.navigateToError();
|
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
this.subscriptions.push(subscription);
|
|
|
|
} else {
|
|
|
|
this.setView(params);
|
|
|
|
}
|
2019-12-23 16:10:27 +01:00
|
|
|
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
2019-12-15 13:38:09 +01:00
|
|
|
this.user = user;
|
|
|
|
this.buildMenu();
|
|
|
|
}, error => {
|
|
|
|
console.log("App couldn't fetch properties");
|
|
|
|
console.log(error);
|
|
|
|
}));
|
2019-10-24 09:44:29 +02:00
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
canExit() {
|
2019-12-23 14:54:37 +01:00
|
|
|
if (this.sideBarItems.length > 0) {
|
2019-12-15 13:38:09 +01:00
|
|
|
let status = [];
|
2019-12-23 14:54:37 +01:00
|
|
|
this.sideBarItems.forEach(item => {
|
2019-12-15 13:38:09 +01:00
|
|
|
status.push(item.open);
|
|
|
|
});
|
|
|
|
MonitorComponent.sidebarStatus = {
|
|
|
|
id: this.activeTopic.alias,
|
|
|
|
status: status
|
|
|
|
};
|
2019-12-04 19:25:36 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get open() {
|
|
|
|
return this.layoutService.open;
|
|
|
|
}
|
|
|
|
|
|
|
|
public toggleOpen(event = null) {
|
|
|
|
if (!event) {
|
|
|
|
this.layoutService.setOpen(!this.open);
|
|
|
|
} else if (event && event['value'] === true) {
|
|
|
|
this.layoutService.setOpen(false);
|
2019-12-04 12:47:20 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private getPageContents() {
|
|
|
|
this.helper.getPageHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => {
|
|
|
|
this.pageContents = contents;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
private getDivContents() {
|
|
|
|
this.helper.getDivHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => {
|
|
|
|
this.divContents = contents;
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
private setView(params: Params) {
|
|
|
|
if (params['topic']) {
|
|
|
|
this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && topic.isPublic && topic.isActive);
|
|
|
|
if (this.activeTopic) {
|
|
|
|
if (params['category']) {
|
|
|
|
this.activeCategory = this.activeTopic.categories.find(category =>
|
|
|
|
(category.alias === params['category']) && category.isPublic && category.isActive);
|
|
|
|
if (!this.activeCategory) {
|
|
|
|
this.navigateToError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.activeCategory = this.activeTopic.categories.find(category => category.isPublic && category.isActive);
|
|
|
|
if (this.activeCategory) {
|
|
|
|
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
|
|
|
subCategory.isPublic && subCategory.isActive);
|
|
|
|
this.setSideBar();
|
|
|
|
if (this.activeSubCategory) {
|
|
|
|
this.setIndicators();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.setSideBar();
|
|
|
|
}
|
|
|
|
return;
|
2019-12-04 12:47:20 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
if (this.activeCategory) {
|
|
|
|
if (params['subCategory']) {
|
|
|
|
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
|
|
|
(subCategory.alias === params['subCategory'] && subCategory.isPublic && subCategory.isActive));
|
|
|
|
if (!this.activeSubCategory) {
|
|
|
|
this.navigateToError();
|
|
|
|
return;
|
2019-12-04 12:47:20 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
} else {
|
|
|
|
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
|
|
|
|
subCategory.isPublic && subCategory.isActive);
|
|
|
|
}
|
|
|
|
if (this.activeSubCategory) {
|
|
|
|
this.setSideBar();
|
|
|
|
this.setIndicators();
|
|
|
|
} else {
|
|
|
|
this.navigateToError();
|
|
|
|
}
|
|
|
|
return;
|
2019-12-04 12:47:20 +01:00
|
|
|
} else {
|
2019-12-15 13:38:09 +01:00
|
|
|
this.activeSubCategory = null;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.navigateToError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.activeTopic = this.stakeholder.topics.find(topic => topic.isPublic && topic.isActive);
|
|
|
|
if (this.activeTopic) {
|
|
|
|
this.activeCategory = this.activeTopic.categories.find(category => category.isPublic && category.isActive);
|
|
|
|
if (this.activeCategory) {
|
|
|
|
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory => subCategory.isPublic && subCategory.isActive);
|
|
|
|
if (this.activeSubCategory) {
|
|
|
|
this.setSideBar();
|
|
|
|
this.setIndicators();
|
|
|
|
} else {
|
|
|
|
this.navigateToError();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.navigateToError();
|
2019-10-24 09:44:29 +02:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
} else {
|
|
|
|
this.navigateToError();
|
|
|
|
}
|
2019-10-24 09:44:29 +02:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private setSideBar() {
|
2019-12-23 14:54:37 +01:00
|
|
|
let items: MenuItem[] = [];
|
2019-12-15 13:38:09 +01:00
|
|
|
this.activeTopic.categories.forEach((category, index) => {
|
|
|
|
if (category.isPublic && category.isActive) {
|
2019-12-23 14:54:37 +01:00
|
|
|
let subItems: MenuItem[] = [];
|
2019-12-15 13:38:09 +01:00
|
|
|
category.subCategories.forEach(subCategory => {
|
|
|
|
if (subCategory.isPublic && subCategory.isActive) {
|
2020-01-08 12:00:50 +01:00
|
|
|
subItems.push(new MenuItem(subCategory.alias, subCategory.name, "", (
|
2019-12-15 13:38:09 +01:00
|
|
|
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias + '/' + subCategory.alias),
|
2020-01-08 12:00:50 +01:00
|
|
|
null, null, [], {}));
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
2019-10-24 09:44:29 +02:00
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
let open = this.activeCategory.alias === category.alias;
|
|
|
|
if (MonitorComponent.sidebarStatus && MonitorComponent.sidebarStatus.id === this.activeTopic.alias) {
|
|
|
|
open = MonitorComponent.sidebarStatus.status[index];
|
2019-12-06 14:52:26 +01:00
|
|
|
}
|
2019-12-23 14:54:37 +01:00
|
|
|
// constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params) {
|
2020-01-08 12:00:50 +01:00
|
|
|
let categoryItem: MenuItem = new MenuItem(category.alias, category.name, "", (
|
2019-12-15 13:38:09 +01:00
|
|
|
'/' + this.stakeholder.alias + '/' + this.activeTopic.alias + '/' + category.alias),
|
2020-01-08 12:00:50 +01:00
|
|
|
null, [], [], {});
|
2019-12-23 14:54:37 +01:00
|
|
|
categoryItem.items = subItems;
|
|
|
|
categoryItem.open = open;
|
|
|
|
items.push(categoryItem);
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
if (items.length === 0) {
|
2020-01-08 12:00:50 +01:00
|
|
|
items.push(new MenuItem('noCategories', 'No categories available yet', "", "", false, [], [], {}));
|
2019-12-04 12:47:20 +01:00
|
|
|
}
|
2019-12-23 14:54:37 +01:00
|
|
|
this.sideBarItems = items;
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private setIndicators() {
|
2020-01-08 12:00:50 +01:00
|
|
|
let urls: Map<string, [number, number][]> = new Map<string, [number, number][]>();
|
|
|
|
this.activeSubCategory.numbers.forEach((section, i) => {
|
|
|
|
section.indicators.forEach((number, j) => {
|
|
|
|
if (number.isActive && number.isPublic) {
|
|
|
|
let url = number.indicatorPaths[0].url;
|
|
|
|
//add fundingLevel0 filter in the query
|
|
|
|
if (this.fundingL0 && number.indicatorPaths[0].filters.get("fundingL0")) {
|
|
|
|
url = url + number.indicatorPaths[0].filters.get("fundingL0").replace(ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix, encodeURIComponent(this.fundingL0));
|
|
|
|
}
|
|
|
|
const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
|
|
|
|
const indexes = urls.get(pair) ? urls.get(pair) : [];
|
|
|
|
indexes.push([i, j]);
|
|
|
|
urls.set(pair, indexes);
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
2020-01-08 12:00:50 +01:00
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
});
|
|
|
|
urls.forEach((indexes, pair) => {
|
|
|
|
pair = JSON.parse(pair);
|
|
|
|
this.statisticsService.getNumbers(pair[0], pair[1]).subscribe(response => {
|
2020-01-08 12:00:50 +01:00
|
|
|
indexes.forEach(([i, j]) => {
|
2019-12-15 13:38:09 +01:00
|
|
|
let result = JSON.parse(JSON.stringify(response));
|
2020-01-08 12:00:50 +01:00
|
|
|
this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => {
|
2019-12-15 13:38:09 +01:00
|
|
|
if (result) {
|
|
|
|
result = result[jsonPath];
|
2019-10-29 12:33:42 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
});
|
2020-01-08 12:00:50 +01:00
|
|
|
this.numberResults.set(i + '-' + j, result);
|
2019-10-24 09:44:29 +02:00
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
})
|
|
|
|
});
|
2020-01-08 12:00:50 +01:00
|
|
|
this.activeSubCategory.charts.forEach((section, i) => {
|
|
|
|
section.indicators.forEach((indicator, j) => {
|
|
|
|
if (indicator.indicatorPaths.length > 0) {
|
|
|
|
indicator.indicatorPaths[0].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[0]);
|
|
|
|
this.chartsActiveType.set(i + '-' + j, indicator.indicatorPaths[0]);
|
|
|
|
}
|
|
|
|
});
|
2019-12-15 13:38:09 +01:00
|
|
|
});
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
}
|
|
|
|
|
|
|
|
public getUrlByStakeHolder(indicatorPath: IndicatorPath) {
|
|
|
|
return this.sanitizer.bypassSecurityTrustResourceUrl(
|
|
|
|
this.statisticsService.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(indicatorPath, this.fundingL0, this.startYear, this.endYear)));
|
|
|
|
}
|
|
|
|
|
2020-01-08 12:00:50 +01:00
|
|
|
public setActiveChart(i: number, j: number, type: string) {
|
|
|
|
let activeChart = this.activeSubCategory.charts[i].indicators[j].indicatorPaths.filter(indicatorPath => indicatorPath.type === type)[0];
|
2019-12-15 13:38:09 +01:00
|
|
|
activeChart.safeResourceUrl = this.getUrlByStakeHolder(activeChart);
|
2020-01-08 12:00:50 +01:00
|
|
|
this.chartsActiveType.set(i + '-' + j, activeChart);
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
private navigateToError() {
|
|
|
|
this._router.navigate(['/error'], {queryParams: {'page': this._router.url}});
|
|
|
|
}
|
|
|
|
|
|
|
|
public navigateTo(stakeholder: string, topic: string, category: string = null, subcategory: string = null) {
|
|
|
|
let url = stakeholder + '/' + topic + ((category) ? ('/'
|
|
|
|
+ category) : '') + ((subcategory) ? ('/' + subcategory) : '');
|
|
|
|
return this._router.navigate([url]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public quote(param: string): string {
|
|
|
|
return StringUtils.quote(param);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnDestroy() {
|
|
|
|
if (this.piwiksub) {
|
|
|
|
this.piwiksub.unsubscribe();
|
2019-10-24 09:44:29 +02:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
2019-12-13 16:48:24 +01:00
|
|
|
buildMenu() {
|
2019-12-15 13:38:09 +01:00
|
|
|
this.userMenuItems = [];
|
2019-12-13 16:48:24 +01:00
|
|
|
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, [], [], {}))
|
2019-12-15 13:38:09 +01:00
|
|
|
|
2019-12-13 16:48:24 +01:00
|
|
|
}
|
2019-12-15 13:38:09 +01:00
|
|
|
if (this.user) {
|
2019-12-13 16:48:24 +01:00
|
|
|
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
|
|
|
}
|
|
|
|
}
|
2020-01-09 15:31:55 +01:00
|
|
|
|
|
|
|
isAdmin(){
|
|
|
|
return this.user && Session.isPortalAdministrator(this.user);
|
|
|
|
}
|
2019-10-24 09:44:29 +02:00
|
|
|
}
|