2019-07-23 14:23:12 +02:00
|
|
|
import {Component, Input} from '@angular/core';
|
2019-09-13 09:01:19 +02:00
|
|
|
import {User} from "../../login/utils/helper.class";
|
|
|
|
import {UserManagementService} from "../../services/user-management.service";
|
2020-03-26 13:18:18 +01:00
|
|
|
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
|
|
|
|
import {Router} from "@angular/router";
|
2020-11-11 15:43:13 +01:00
|
|
|
import {Subscriber} from "rxjs";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
2019-07-23 14:23:12 +02:00
|
|
|
selector: 'my-claims',
|
|
|
|
template: `
|
2020-05-07 19:20:33 +02:00
|
|
|
<div id="tm-main" class=" uk-section uk-padding-remove-top tm-middle">
|
|
|
|
<div class="uk-grid uk-margin-small-top" >
|
2019-07-23 14:23:12 +02:00
|
|
|
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
|
|
|
|
|
2021-02-15 14:19:33 +01:00
|
|
|
<div class="uk-container uk-container-large">
|
2019-10-01 10:26:17 +02:00
|
|
|
<div class="uk-article-title custom-article-title">
|
2019-07-23 14:23:12 +02:00
|
|
|
My links
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class=" ">
|
|
|
|
Manage your links in OpenAIRE
|
|
|
|
</div>
|
|
|
|
<div>
|
2019-09-13 09:01:19 +02:00
|
|
|
<displayClaims *ngIf="user" [user]="user" [enableDelete]=true [myClaims]=true [isAdmin]=false [showUserEmail]=false
|
2019-08-02 16:55:32 +02:00
|
|
|
[claimsInfoURL]=claimsInfoURL [communityId]=communityId
|
|
|
|
[piwikSiteId]="piwikSiteId" title="My links">
|
|
|
|
</displayClaims>
|
2019-07-23 14:23:12 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-12-19 13:53:46 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-23 14:23:12 +02:00
|
|
|
`
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
})
|
2019-07-23 14:23:12 +02:00
|
|
|
export class MyClaimsComponent {
|
|
|
|
@Input() claimsInfoURL: string;
|
2019-07-24 17:46:49 +02:00
|
|
|
@Input() communityId:string;
|
2019-08-02 16:55:32 +02:00
|
|
|
@Input() piwikSiteId = null;
|
2019-09-13 09:01:19 +02:00
|
|
|
@Input() userInfoURL: string;
|
|
|
|
public user: User = null;
|
2018-06-29 13:01:48 +02:00
|
|
|
|
2020-03-26 13:18:18 +01:00
|
|
|
constructor(private userManagementService: UserManagementService, private _router: Router) {}
|
2019-07-23 14:23:12 +02:00
|
|
|
|
2020-11-11 15:43:13 +01:00
|
|
|
sub;
|
|
|
|
ngOnDestroy() {
|
|
|
|
if (this.sub instanceof Subscriber) {
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
2019-09-13 09:01:19 +02:00
|
|
|
ngOnInit() {
|
2020-11-11 15:43:13 +01:00
|
|
|
this.sub = this.userManagementService.getUserInfo().subscribe(user => {
|
2019-09-13 09:01:19 +02:00
|
|
|
this.user = user;
|
2020-03-26 13:18:18 +01:00
|
|
|
if (!user) {
|
|
|
|
this._router.navigate(['/user-info'], {
|
|
|
|
queryParams: {
|
|
|
|
"errorCode": LoginErrorCodes.NOT_VALID,
|
|
|
|
"redirectUrl": this._router.url
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-09-13 09:01:19 +02:00
|
|
|
});
|
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
}
|