[Monitor Dashboard | Trunk]: Add titles on users, general and topics

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59922 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2020-11-19 17:14:12 +00:00
parent 086992a91b
commit 178a17cbbf
4 changed files with 24 additions and 11 deletions

View File

@ -5,6 +5,7 @@ import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
import { Subscription, zip} from "rxjs";
import {EditStakeholderComponent} from "./edit-stakeholder/edit-stakeholder.component";
import {properties} from "../../environments/environment";
import {Title} from "@angular/platform-browser";
@Component({
selector: 'general',
@ -21,7 +22,8 @@ export class GeneralComponent implements OnInit, OnDestroy {
private subscriptions: any[] = [];
@ViewChild('editStakeholderComponent') editStakeholderComponent: EditStakeholderComponent;
constructor(private stakeholderService: StakeholderService) {
constructor(private stakeholderService: StakeholderService,
private title: Title) {
}
ngOnInit() {
@ -29,6 +31,7 @@ export class GeneralComponent implements OnInit, OnDestroy {
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
this.stakeholder = stakeholder;
if(this.stakeholder) {
this.title.setTitle(this.stakeholder.name + " | General");
let data = zip(
this.stakeholderService.getDefaultStakeholders(this.properties.monitorServiceAPIURL),
this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL)

View File

@ -102,7 +102,7 @@ export class TopicComponent implements OnInit, OnDestroy, IDeactivateComponent {
if (this.topicIndex === -1) {
this.navigateToError();
} else {
this.title.setTitle(stakeholder.name);
this.title.setTitle(stakeholder.name + " | Indicators");
this.toggle = true;
}
}

View File

@ -3,5 +3,5 @@
<loading></loading>
</div>
</div>
<dashboard-users *ngIf="!loading && alias" [id]="alias" [name]="name" [type]="type" [link]="link"></dashboard-users>
<dashboard-users *ngIf="!loading && alias" [id]="alias" [name]="name" [type]="type" [link]="link" [messages]="messages"></dashboard-users>

View File

@ -1,7 +1,8 @@
import {Component, OnInit} from "@angular/core";
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',
@ -14,28 +15,37 @@ export class UsersComponent implements OnInit{
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) {
}
subscription;
ngOnDestroy() {
if (this.subscription instanceof Subscriber) {
this.subscription.unsubscribe();
}
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 <b>restricted access</b> areas of this indicator\'s profile. ' +
'A member has <b>no access</b> 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=";
}