Right sidebar login option appears only when not on login page

This commit is contained in:
apapachristou 2019-06-06 11:53:30 +03:00
parent 648fe1c139
commit e344f7ce6e
4 changed files with 16 additions and 7 deletions

View File

@ -98,11 +98,10 @@
overflow: hidden;
top: -40px;
width: 100%;
min-height: 13vh;
min-height: 134px;
padding: 25px;
border-radius: 3px;
background: rgb(0, 112, 192);
// box-shadow: 0 4px 20px 0px rgba(0, 0, 0, 0.14), 0 7px 10px -5px rgba(233, 30, 99, 0.4);
display: flex;
flex-direction: column;
align-items: center;

View File

@ -2,7 +2,8 @@
<div mat-dialog-title>
<div class="row">
<div class="col-auto">
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()" [src]="this.getPrincipalAvatar()">
<img mat-card-avatar class="my-mat-card-avatar" *ngIf="this.principalHasAvatar()"
[src]="this.getPrincipalAvatar()">
</div>
<span class="user-label col">{{this.getPrincipalName()}}</span>
</div>
@ -15,7 +16,7 @@
</a>
<mat-divider class="col-12"></mat-divider>
<a mat-button (click)="logout()" class="col-12">
{{'USER-DIALOG.EXIT' | translate}} <mat-icon>exit_to_app</mat-icon>
{{ 'USER-DIALOG.LOG-OUT' | translate }} <mat-icon>exit_to_app</mat-icon>
</a>
</div>
</form>

View File

@ -42,7 +42,7 @@
</a>
</li>
<ng-template #loginoption>
<a class="nav-link login" [routerLink]=" ['/login'] ">
<a class="nav-link login" *ngIf="!isLoginRouteActivated()" [routerLink]=" ['/login'] ">
<i class="material-icons">vpn_key</i>
<p class="login-label">{{ 'GENERAL.ACTIONS.LOG-IN' | translate }}</p>
</a>

View File

@ -1,10 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit} from '@angular/core';
import { MatDialog } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { AuthService } from '../../core/services/auth/auth.service';
import { UserDialogComponent } from '../misc/navigation/user-dialog/user-dialog.component';
import { Principal } from '../../core/model/auth/Principal';
import { AppRole } from '../../core/common/enum/app-role';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
declare interface RouteInfo {
path: string;
@ -52,11 +54,14 @@ export class SidebarComponent implements OnInit {
// historyItems: GroupMenuItem;
publicItems: GroupMenuItem;
groupMenuItems: GroupMenuItem[] = [];
private toggleButton: any;
constructor(
public translate: TranslateService,
private authentication: AuthService,
private dialog: MatDialog) {
private dialog: MatDialog,
public router: Router,
private location: Location) {
}
@ -127,6 +132,10 @@ export class SidebarComponent implements OnInit {
}
}
isLoginRouteActivated(): boolean {
return this.location.path().indexOf('/login') > -1;
}
public logout(): void {
this.authentication.logout();
}