50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import {Component, OnInit} from "@angular/core";
|
|
import {Title} from "@angular/platform-browser";
|
|
import {ActivatedRoute} from "@angular/router";
|
|
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
|
|
import {Subscriber} from "rxjs";
|
|
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
|
|
|
|
@Component({
|
|
selector: 'users-subscribers',
|
|
template: `
|
|
<subscribers [id]="community.communityId" [type]="'community'" [name]="community.shortTitle"
|
|
[inviteDisableMessage]="inviteDisableMessage">
|
|
<users-tabs tab="member"></users-tabs>
|
|
</subscribers>
|
|
`
|
|
})
|
|
export class UsersSubscribersComponent implements OnInit {
|
|
public community: CommunityInfo;
|
|
public loading: boolean;
|
|
public inviteDisableMessage: string;
|
|
private subscriptions: any[] = [];
|
|
|
|
constructor(private communityService: CommunityService,
|
|
private route: ActivatedRoute,
|
|
private title: Title) {
|
|
}
|
|
|
|
ngOnInit() {
|
|
this.loading = true;
|
|
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
|
|
if(community) {
|
|
this.community = community;
|
|
this.title.setTitle(this.community.shortTitle.toUpperCase() + " | Subscribers");
|
|
if(community.status !== "all") {
|
|
this.inviteDisableMessage = "Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations."
|
|
}
|
|
this.loading = false;
|
|
}
|
|
}));
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.subscriptions.forEach(value => {
|
|
if (value instanceof Subscriber) {
|
|
value.unsubscribe();
|
|
}
|
|
});
|
|
}
|
|
}
|