[Trunk|Library]

Connect subscriber Guard:
        add community parameter
Login:
        User component:add variable if the component is the main one, remove connect specific errorCode
        user menu: add divider before logout
        Helper: add 2 more connect specific error codes
Navigation Bar:
        set height-medium for dropdown menus
        Connect - communities: show title only when logo is not available


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55365 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-04-15 14:08:08 +00:00
parent 0bfad9455c
commit 1bb6fbe7ca
6 changed files with 23 additions and 21 deletions

View File

@ -17,7 +17,7 @@ export class ConnectSubscriberGuard implements CanActivate, CanLoad {
let errorCode = LoginErrorCodes.NOT_SUBSCRIBER;
if (!Session.isLoggedIn()) {
errorCode = LoginErrorCodes.NOT_LOGIN;
this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path}});
this.router.navigate(['/user-info'], {queryParams: {'errorCode': errorCode, 'redirectUrl': path, communityId:community}});
return false;
} else {
const obs = this.propertiesService.subscribeEnvironment().mergeMap(properties => {
@ -30,7 +30,8 @@ export class ConnectSubscriberGuard implements CanActivate, CanLoad {
.subscribe(() => this.router.navigate(['/user-info'], {
queryParams: {
'errorCode': errorCode,
'redirectUrl': path
'redirectUrl': path,
communityId:community
}
}));
return obs;

View File

@ -1,5 +1,5 @@
<div id="tm-main" class=" uk-section uk-margin-small-top tm-middle" >
<div [id]="(mainComponent)?'tm-main':''" [class]="(mainComponent)?'uk-section uk-margin-small-top tm-middle':''" >
<div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
@ -48,9 +48,7 @@
<div *ngIf="errorCode == '5'" class="uk-alert uk-alert-warning">
There is no research community selected.
</div>
<div *ngIf="errorCode == '6'" class="uk-alert uk-alert-warning">
For this action you have to subscribe to research community first. Subscribe <a routerLink="/">here</a>.
</div>
<div *ngIf="!loggedIn && errorMessage.length > 0" class="uk-alert uk-alert-danger">{{errorMessage}}</div>

View File

@ -1,4 +1,4 @@
import {Component, ElementRef} from '@angular/core';
import {Component, ElementRef, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser';
@ -25,6 +25,7 @@ export class UserComponent {
public routerHelper:RouterHelper = new RouterHelper();
public loginUrl;
properties:EnvProperties;
@Input() mainComponent = false;
constructor( private router: Router,
private route: ActivatedRoute,

View File

@ -33,6 +33,7 @@ import{EnvProperties} from '../utils/properties/env-properties';
<a *ngIf="item.route.length == 0 && item.url.length > 0" href="{{item.url}}" target="_blank" >{{item.title}}</a>
</li>
</ng-container>
<li class="uk-nav-divider"></li>
<li><a (click)="logOut()" id="logout" >Log out</a></li>
</ul>
</div>
@ -61,6 +62,7 @@ import{EnvProperties} from '../utils/properties/env-properties';
<a *ngIf="item.route.length == 0 && item.url.length > 0" href="{{item.url}}" >{{item.title}}</a>
</li>
</ng-container>
<li class="uk-nav-divider"></li>
<li><a (click)="logOut()" id="logout" >Log out</a></li>
</ul>
</li>

View File

@ -5,5 +5,5 @@ export class LoginErrorCodes {
public static NOT_CONNECT_ADMIN = 4;
public static NO_COMMUNITY = 5;
public static NOT_SUBSCRIBER = 6;
public static ACTION_REQUIRES_LOGIN = 7;
}

View File

@ -11,12 +11,12 @@
<img src="{{logoPath}}logo-small-{{portal}}.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
<a *ngIf="community && !homeurl" class="uk-navbar-item uk-logo" [href]="'https://'+(environment =='beta'?'beta.':'')+community.id+'.openaire.eu'" target="_blank">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
<a *ngIf="community && homeurl" class="uk-navbar-item uk-logo" routerLinkActive="uk-link" routerLink="/" >
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" alt=" " class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
</div>
@ -113,13 +113,13 @@
<a *ngIf="community && homeurl" routerLinkActive="uk-link" routerLink="/" class="uk-logo uk-navbar-item">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" alt=" " class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
<a *ngIf="community && !homeurl" [href]="'https://'+(environment =='beta'?'beta.':'')+community.id+'.openaire.eu'" target="_blank" class="uk-logo uk-navbar-item">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" alt=" " class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
</div>
<div class="uk-navbar-left uk-visible@m uk-hidden@l uk-width-1-3">
@ -127,12 +127,12 @@
<img src="{{logoPath}}logo-small-{{portal}}.png" alt="OpenAIRE" class="uk-responsive-height">
</a>
<a *ngIf="community && homeurl" routerLinkActive="uk-link" routerLink="/" class="uk-logo uk-navbar-item">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" alt=" " class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
<a *ngIf="community && !homeurl" [href]="'https://'+(environment =='beta'?'beta.':'')+community.id+'.openaire.eu'" target="_blank" class="uk-logo uk-navbar-item">
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" alt=" " class="uk-responsive-height">
<div class="uk-margin-left uk-text-large"> {{community.name}} </div>
<img *ngIf="community.logoUrl && community.logoUrl.length > 0" src="{{community.logoUrl}}" [alt]=community.name class="uk-responsive-height">
<div *ngIf="!community.logoUrl || community.logoUrl.length == 0" class="uk-margin-left uk-text-large"> {{community.name}} </div>
</a>
</div>
@ -149,7 +149,7 @@
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left" style="top: 80px; left: 0px;" id="{{menu.rootItem.id}}" (click)="onClick(menu.rootItem.id)">
<div class="uk-navbar-dropdown-grid uk-child-width-1-1 uk-grid uk-grid-stack" uk-grid="">
<div class="uk-first-column">
<div class="uk-first-column uk-height-max-medium uk-overflow-auto">
<ul class="uk-nav uk-navbar-dropdown-nav">
<ng-container *ngFor="let submenu of menu.items">
<li *ngIf="isEnabled(submenu.entitiesRequired,showEntity) && isEnabled(submenu.routeRequired, showPage) && (submenu.route.length > 0 || submenu.url.length > 0)">