import {Component, Input, OnInit} from "@angular/core"; import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service"; import {properties} from "../../environments/environment"; import {Subscriber} from "rxjs"; import {Title} from "@angular/platform-browser"; @Component({ selector: 'users', templateUrl: 'users.component.html' }) export class UsersComponent implements OnInit{ public alias: string; public name: string; public type: string; public link: string; public loading: boolean; public messages: Map<"member" | "manager", string> = new Map<"member"|"manager", string>(); private subscription; constructor(private stakeholderService: StakeholderService, private title: Title) { } ngOnInit() { this.loading = true; this.subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => { if(stakeholder) { this.alias = stakeholder.alias; this.name = stakeholder.name; this.title.setTitle(this.name + " | Users"); this.type = stakeholder.type; this.link = this.getURL(this.alias); this.messages.set("member", 'A member has the right to view the restricted access areas of this indicator\'s profile. ' + 'A member has no access to the administration part of the profile.'); this.messages.set("manager", 'A manager has the right to access the administration part of this indicator\'s profile, ' + 'where he is able to customize and manage indicators, and invite other users as members.'); this.loading = false; } }) } ngOnDestroy() { if (this.subscription instanceof Subscriber) { this.subscription.unsubscribe(); } } private getURL(id: string): string { return properties.domain + properties.baseLink + "/" + id + "?verify="; } }