From 517ebae463a597708e0b7b14bb160c2e333b52b2 Mon Sep 17 00:00:00 2001 From: Konstantina Galouni Date: Thu, 12 Dec 2019 14:20:03 +0000 Subject: [PATCH] [Trunk | Monitor Dashboard]: 1. app.component: Add view and functionality for login/logout. 2. assets/monitor-custom.css: Class 'loginLink' added. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57865 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/app.component.html | 23 +++++++++++++++++++---- src/app/app.component.ts | 17 ++++++++++++++++- src/assets/env-properties.json | 4 ++-- src/assets/monitor-custom.css | 5 +++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 7597d54..97868ea 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -4,10 +4,25 @@ BETA -
- - - + +
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0f475bf..ebd61a9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -10,11 +10,12 @@ import { import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service'; -import {User} from './openaireLibrary/login/utils/helper.class'; +import {Session, User} from './openaireLibrary/login/utils/helper.class'; import {UserManagementService} from "./openaireLibrary/services/user-management.service"; import {StakeholderService} from "./services/stakeholder.service"; import {Subscriber} from "rxjs"; import {LayoutService} from "./library/sharedComponents/sidebar/layout.service"; +import {MenuItem} from "./openaireLibrary/sharedComponents/menu"; @Component({ @@ -27,6 +28,7 @@ export class AppComponent implements OnInit, OnDestroy { loginCheck: boolean = false; hasSidebar: boolean = false; hasHeader: boolean = false; + userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})]; private subscriptions: any[] = []; constructor(private route: ActivatedRoute, @@ -72,6 +74,7 @@ export class AppComponent implements OnInit, OnDestroy { this.subscriptions.push(this.userManagementService.getUserInfo(this.properties.userInfoUrl).subscribe(user => { this.user = user; this.loginCheck = true; + this.buildMenu(); }, error => { console.log("App couldn't fetch properties"); console.log(error); @@ -98,4 +101,16 @@ export class AppComponent implements OnInit, OnDestroy { this.layoutService.setOpen(false); } } + + + buildMenu() { + if (Session.isPortalAdministrator(this.user)) { + this.userMenuItems.push(new MenuItem("", "Manage helptexts", + ((this.properties.environment == "beta") ? "https://beta.admin.connect.openaire.eu" : "https://admin.explore.openaire.eu") + "/dashboard?communityId=openaire", "", true, [], [], {})) + + } + if(this.user) { + this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {})); + } + } } diff --git a/src/assets/env-properties.json b/src/assets/env-properties.json index e7cb764..9ff715b 100644 --- a/src/assets/env-properties.json +++ b/src/assets/env-properties.json @@ -37,9 +37,9 @@ "piwikBaseUrl" :"https://analytics.openaire.eu/piwik.php?idsite=", "piwikSiteId" : "80", - "loginUrl" :"http://rudie.di.uoa.gr:8080/dnet-login/openid_connect_login", + "loginUrl" :"http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_connect_login", - "userInfoUrl" : "http://rudie.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=", + "userInfoUrl" : "http://scoobydoo.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=", "logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=", diff --git a/src/assets/monitor-custom.css b/src/assets/monitor-custom.css index 8676e83..e0dbe4a 100644 --- a/src/assets/monitor-custom.css +++ b/src/assets/monitor-custom.css @@ -100,3 +100,8 @@ .stakeholderPage #style_switcher{ top:200px; } + +.loginLink, .loginLink:hover{ + color: white; + font-weight: bold; +} \ No newline at end of file