Adds: Logout on view my profile

This commit is contained in:
apapachristou 2019-06-05 10:20:17 +03:00
parent 770fb685a8
commit 18de763606
3 changed files with 26 additions and 7 deletions

View File

@ -6,7 +6,8 @@
<div class="row">
<div class="col-12">
<div class="row profile-card-center-row">
<div class="col-auto"><img mat-card-avatar [src]="userProfile.additionalinfo.avatarUrl"></div>
<div class="col-auto"><img mat-card-avatar [src]="userProfile.additionalinfo.avatarUrl">
</div>
</div>
<div class="row profile-card-center-row">
<mat-card-title class="col-auto">{{userProfile.name}}</mat-card-title>
@ -14,6 +15,11 @@
<div class="row profile-card-center-row">
<mat-card-subtitle class="col-auto">{{userProfile.email}}</mat-card-subtitle>
</div>
<div class="row profile-card-center-row">
<a mat-raised-button (click)="logout()" class="col-3">
{{'USER-DIALOG.LOG-OUT' | translate}} <mat-icon>exit_to_app</mat-icon>
</a>
</div>
</div>
</div>
</mat-card-content>
@ -26,7 +32,8 @@
</div>
<div>
<mat-list>
<mat-list-item class="clickable" (click)="navigateToDmp(dmp)" *ngFor="let dmp of userProfile.associatedDmps">
<mat-list-item class="clickable" (click)="navigateToDmp(dmp)"
*ngFor="let dmp of userProfile.associatedDmps">
<div>
{{dmp.label}}
</div>
@ -37,7 +44,8 @@
</div>
</mat-list-item>
</mat-list>
<button mat-button (click)="showAllDmps()"> {{'USER-PROFILE.DMPS.SHOW-ALL' | translate}}</button>
<button mat-button (click)="showAllDmps()">
{{'USER-PROFILE.DMPS.SHOW-ALL' | translate}}</button>
</div>
</div>
</mat-card-content>
@ -60,7 +68,9 @@
<div class="container">
<div class="row" [formGroup]="formGroup">
<mat-form-field class="col-md-4">
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}" [formControl]="this.formGroup.get('timezone')" matInput [matAutocomplete]="timezone" required>
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.TIMEZONE' | translate}}"
[formControl]="this.formGroup.get('timezone')" matInput [matAutocomplete]="timezone"
required>
<mat-autocomplete #timezone="matAutocomplete">
<mat-option *ngFor="let timezone of timezones | async" [value]="timezone">
{{ timezone | timezoneInfoDisplay }}
@ -68,7 +78,9 @@
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="col-md-4">
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}" [formControl]="this.formGroup.get('culture')" matInput [matAutocomplete]="culture" required>
<input type="text" placeholder="{{'USER-PROFILE.SETTINGS.CULTURE' | translate}}"
[formControl]="this.formGroup.get('culture')" matInput [matAutocomplete]="culture"
required>
<mat-autocomplete #culture="matAutocomplete" [displayWith]="displayFn">
<mat-option *ngFor="let culture of cultures | async" [value]="culture">
{{ culture.displayName }} - {{ culture.nativeName }}
@ -76,7 +88,8 @@
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="col-md-4">
<mat-select placeholder="{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}" [formControl]="this.formGroup.get('language')" required>
<mat-select placeholder="{{'USER-PROFILE.SETTINGS.LANGUAGE' | translate}}"
[formControl]="this.formGroup.get('language')" required>
<mat-option *ngFor="let language of languages" [value]="language">
{{ language.label }}
</mat-option>

View File

@ -38,6 +38,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
private language: TranslateService,
private cultureService: CultureService,
private translate: TranslateService,
private authentication: AuthService
) { super(); }
ngOnInit() {
@ -70,6 +71,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
ngOnDestroy(): void {
}
logout(): void {
this.authentication.logout();
}
getUserRole(dmp: DmpModel) {
if (dmp.creator.id === this.currentUserId) { return this.language.instant('USER-PROFILE.DMPS.CREATOR'); } else if (dmp.associatedUsers.map(x => x.id).indexOf(this.currentUserId) !== -1) { return this.language.instant('USER-PROFILE.DMPS.MEMBER'); }
return '';

View File

@ -752,7 +752,8 @@
},
"USER-DIALOG": {
"USER-PROFILE": "My Profile",
"EXIT": "Exit "
"EXIT": "Exit ",
"LOG-OUT": "Log Out"
},
"USER-PROFILE": {
"SETTINGS": {