[Admin | Trunk]: change send invitation on managers component to get name of community and link of portal
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@59349 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
d6e119ebb9
commit
e0b2d8454e
|
@ -4,6 +4,8 @@ import {Subscription} from 'rxjs/Rx';
|
|||
import {ActivatedRoute} from '@angular/router';
|
||||
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
|
||||
import {FormBuilder, FormControl, Validators} from '@angular/forms';
|
||||
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
|
||||
import {properties} from '../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'managers',
|
||||
|
@ -21,11 +23,13 @@ export class ManagersComponent implements OnInit, OnDestroy {
|
|||
public error: string;
|
||||
public selectedUser: string = null;
|
||||
public invited: FormControl;
|
||||
public communityName: string;
|
||||
@ViewChild('inviteManagerModal') inviteManagerModal: AlertModal;
|
||||
@ViewChild('deleteManagerModal') deleteManagerModal: AlertModal;
|
||||
@ViewChild('deletePendingModal') deletePendingModal: AlertModal;
|
||||
|
||||
constructor(private userRegistryService: UserRegistryService,
|
||||
private communityService: CommunityService,
|
||||
private fb: FormBuilder,
|
||||
private route: ActivatedRoute) {
|
||||
}
|
||||
|
@ -34,6 +38,9 @@ export class ManagersComponent implements OnInit, OnDestroy {
|
|||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
if (params && params['communityId']) {
|
||||
this.communityId = params['communityId'];
|
||||
this.subs.push(this.communityService.getCommunity(properties, properties.communityAPI + this.communityId).subscribe(community => {
|
||||
this.communityName = community.title;
|
||||
}));
|
||||
this.subs.push(this.userRegistryService.getManagersEmail('community', this.communityId).subscribe(managers => {
|
||||
this.managers = managers;
|
||||
this.loadManagers = false;
|
||||
|
@ -107,7 +114,11 @@ export class ManagersComponent implements OnInit, OnDestroy {
|
|||
|
||||
inviteManager() {
|
||||
this.loadManagers = true;
|
||||
this.userRegistryService.invite('community', this.communityId, this.invited.value).subscribe(invitation => {
|
||||
let details = {
|
||||
name: this.communityName,
|
||||
link: this.getURL()
|
||||
}
|
||||
this.userRegistryService.invite('community', this.communityId, this.invited.value, details).subscribe(invitation => {
|
||||
this.error = null;
|
||||
if(!this.pending.includes(this.invited.value)) {
|
||||
this.pending.push(this.invited.value);
|
||||
|
@ -118,4 +129,12 @@ export class ManagersComponent implements OnInit, OnDestroy {
|
|||
this.loadManagers = false;
|
||||
})
|
||||
}
|
||||
|
||||
private getURL(): string {
|
||||
if(properties.environment != "production") {
|
||||
return 'https://beta.' + this.communityId + ".openaire.eu/verify";
|
||||
} else {
|
||||
return 'https://' + this.communityId + ".openaire.eu/verify";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue