1 |
59922
|
k.triantaf
|
import {Component, Input, OnInit} from "@angular/core";
|
2 |
59505
|
k.triantaf
|
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
3 |
|
|
import {properties} from "../../environments/environment";
|
4 |
59847
|
argiro.kok
|
import {Subscriber} from "rxjs";
|
5 |
59922
|
k.triantaf
|
import {Title} from "@angular/platform-browser";
|
6 |
59496
|
k.triantaf
|
|
7 |
|
|
@Component({
|
8 |
|
|
selector: 'users',
|
9 |
|
|
templateUrl: 'users.component.html'
|
10 |
|
|
})
|
11 |
59505
|
k.triantaf
|
export class UsersComponent implements OnInit{
|
12 |
|
|
|
13 |
|
|
public alias: string;
|
14 |
|
|
public name: string;
|
15 |
|
|
public type: string;
|
16 |
|
|
public link: string;
|
17 |
|
|
public loading: boolean;
|
18 |
59922
|
k.triantaf
|
public messages: Map<"member" | "manager", string> = new Map<"member"|"manager", string>();
|
19 |
60249
|
k.triantaf
|
public tab: "manager" | "member" = 'manager';
|
20 |
59922
|
k.triantaf
|
private subscription;
|
21 |
59505
|
k.triantaf
|
|
22 |
59922
|
k.triantaf
|
constructor(private stakeholderService: StakeholderService,
|
23 |
|
|
private title: Title) {
|
24 |
59505
|
k.triantaf
|
}
|
25 |
59922
|
k.triantaf
|
|
26 |
59505
|
k.triantaf
|
ngOnInit() {
|
27 |
|
|
this.loading = true;
|
28 |
59847
|
argiro.kok
|
this.subscription = this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
29 |
59505
|
k.triantaf
|
if(stakeholder) {
|
30 |
|
|
this.alias = stakeholder.alias;
|
31 |
|
|
this.name = stakeholder.name;
|
32 |
59922
|
k.triantaf
|
this.title.setTitle(this.name + " | Users");
|
33 |
59505
|
k.triantaf
|
this.type = stakeholder.type;
|
34 |
|
|
this.link = this.getURL(this.alias);
|
35 |
59922
|
k.triantaf
|
this.messages.set("member", 'A member has the right to view the <b>restricted access</b> areas of this indicator\'s profile. ' +
|
36 |
|
|
'A member has <b>no access</b> to the administration part of the profile.');
|
37 |
|
|
this.messages.set("manager", 'A manager has the right to access the administration part of this indicator\'s profile, ' +
|
38 |
|
|
'where he is able to customize and manage indicators, and invite other users as members.');
|
39 |
59505
|
k.triantaf
|
this.loading = false;
|
40 |
|
|
}
|
41 |
|
|
})
|
42 |
|
|
}
|
43 |
|
|
|
44 |
59922
|
k.triantaf
|
ngOnDestroy() {
|
45 |
|
|
if (this.subscription instanceof Subscriber) {
|
46 |
|
|
this.subscription.unsubscribe();
|
47 |
|
|
}
|
48 |
|
|
}
|
49 |
|
|
|
50 |
60249
|
k.triantaf
|
changeTab(tab: "manager" | "member") {
|
51 |
|
|
this.tab = tab;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
59505
|
k.triantaf
|
private getURL(id: string): string {
|
55 |
|
|
return properties.domain + properties.baseLink + "/" + id + "?verify=";
|
56 |
|
|
}
|
57 |
|
|
}
|