[Trunk|Connect]: Remove a duplicate here on user-info page.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@56708 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-23 09:58:53 +00:00
parent 7f22bf970d
commit 8a4ea7d70e
2 changed files with 61 additions and 54 deletions

View File

@ -13,91 +13,98 @@ import {SubscribeComponent} from '../utils/subscribe/subscribe.component';
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
@Component({ @Component({
selector: 'openaire-user', selector: 'openaire-user',
template: ` template: `
<div id="tm-main" class="uk-section uk-margin-small-top tm-middle"> <div id="tm-main" class="uk-section uk-margin-small-top tm-middle">
<user [mainComponent]=false></user> <user [mainComponent]=false></user>
<div *ngIf="!server" class=" uk-container uk-container-small uk-position-relative"> <div *ngIf="!server" class=" uk-container uk-container-small uk-position-relative">
<div *ngIf="usercomponent.errorCode == '6'" class="uk-alert uk-alert-warning"> <div *ngIf="usercomponent.errorCode == '6'" class="uk-alert uk-alert-warning">
<span *ngIf="!isSubscribed">For this action you have to login and subscribe to research community. <span *ngIf="!isSubscribed">For this action you have to login and subscribe to research community.
<span *ngIf="subscribe && !subscribeLoading ">Login and Subscribe here <a [class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()" > here</a>.</span> <span *ngIf="subscribe && !subscribeLoading ">Login and Subscribe <a
[class]="'' + (subscribe.loading ? ' uk-disabled' : '')" (click)="subscribeTo()">here</a>.</span>
</span> </span>
<span *ngIf="subscribeLoading ">Subscribing to community....</span> <span *ngIf="subscribeLoading ">Subscribing to community....</span>
<span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span> <span *ngIf="subscribeError ">An error occured while trying to subscribe to community....</span>
</div> </div>
<div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning"> <div *ngIf="usercomponent.errorCode == '7'" class="uk-alert uk-alert-warning">
This action requires authentication. This action requires authentication.
<span *ngIf="!loggedIn"> <span *ngIf="!loggedIn">
Please <a class="" (click)="login()" > sign in</a> to continue. Please <a class="" (click)="login()"> sign in</a> to continue.
</span> </span>
</div>
</div>
</div> </div>
<subscribe [communityId]="communityId" [showTemplate]=false class=""
(subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
</div> `
</div> })
<subscribe [communityId]="communityId" [showTemplate]= false class="" (subscribeEvent)="afterSubscibeEvent($event)"></subscribe>
`
})
export class OpenaireUserComponent { export class OpenaireUserComponent {
@ViewChild(UserComponent) usercomponent:UserComponent; @ViewChild(UserComponent) usercomponent: UserComponent;
@ViewChild(SubscribeComponent) subscribe:SubscribeComponent; @ViewChild(SubscribeComponent) subscribe: SubscribeComponent;
properties:EnvProperties; properties: EnvProperties;
communityId = null; communityId = null;
subscribeLoading:boolean = false; subscribeLoading: boolean = false;
subscribeError:boolean = false; subscribeError: boolean = false;
isSubscribed:boolean = false; isSubscribed: boolean = false;
public server: boolean = true; public server: boolean = true;
constructor(private _subscribeService: SubscribeService, constructor(private _subscribeService: SubscribeService,
private _emailService: EmailService, private route: ActivatedRoute){} private _emailService: EmailService, private route: ActivatedRoute) {
}
public ngOnInit() { public ngOnInit() {
if( typeof document !== 'undefined') { if (typeof document !== 'undefined') {
this.server = false; this.server = false;
} }
this.route.data this.route.data
.subscribe((data: { envSpecific: any }) => { .subscribe((data: { envSpecific: any }) => {
this.route.queryParams.subscribe( this.route.queryParams.subscribe(
communityId => { communityId => {
this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain); this.communityId = ConnectHelper.getCommunityFromDomain(data.envSpecific.domain);
if(!this.communityId) { if (!this.communityId) {
this.communityId = communityId['communityId']; this.communityId = communityId['communityId'];
} }
}); });
}); });
} }
login(){
login() {
this.usercomponent.logIn(); this.usercomponent.logIn();
} }
subscribeTo(){
if(this.subscribe && this.communityId){ subscribeTo() {
if (this.subscribe && this.communityId) {
this.subscribeLoading = true; this.subscribeLoading = true;
this.subscribe.subscribe(); this.subscribe.subscribe();
} }
} }
afterSubscibeEvent($event){
var res = $event.value; afterSubscibeEvent($event) {
this.subscribeLoading = false; var res = $event.value;
if(res == "ok"){ this.subscribeLoading = false;
this.isSubscribed = true; if (res == "ok") {
this.usercomponent.redirect(); this.isSubscribed = true;
}else{ this.usercomponent.redirect();
this.subscribeError = true; } else {
} this.subscribeError = true;
}
} }
loginAndsubscribe(){
loginAndsubscribe() {
} }
} }

View File

@ -56,7 +56,7 @@
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=", "cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
"adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools", "adminToolsAPIURL" :"http://mpagasas.di.uoa.gr:8080/uoa-admin-tools",
"adminToolsCommunity" :"connect", "adminToolsCommunity" :"connect",
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/", "datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",