Commit cef5937a authored by Jie Yuan's avatar Jie Yuan

add username resolver

parent b3e4f7bf
......@@ -54,6 +54,7 @@ export class AuthService {
//console.log(this.sharedHeaderString);
//console.log(response);
sessionStorage.setItem('authHeader',this.sharedHeaderString);
sessionStorage.setItem('currentUser', response['email']);
console.log('login success');
} else if (response['authService'] === 'AAI') {
this.headerBuilder('');
......@@ -170,6 +171,7 @@ aaiAuthentication(token) {
if (response['authService'] === 'AAI') {
this.loginSuccess();
sessionStorage.setItem('authHeader',this.sharedHeaderString);
sessionStorage.setItem('currentUser', response['email']);
console.log(this.sharedHeaderString);
console.log(response);
console.log('#####################');
......
......@@ -73,7 +73,7 @@
   
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">Username</button>
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">{{username}}</button>
<mat-menu #menuuser="matMenu">
<button mat-menu-item>Profile</button>
<button mat-menu-item (click)="onLogout()">Logout</button>
......
......@@ -35,6 +35,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
eoscSiteNames: string[];
gocdbSiteNames: string[];
dpmtSiteNames: string[];
username: string;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
......@@ -48,6 +49,7 @@ export class FulltableComponent implements OnInit , DoCheck, AfterViewInit{
) {
console.log('fulltable constructor');
this.username = sessionStorage.getItem("currentUser");
const source = sessionStorage.getItem('currentServiceSource');
......
......@@ -70,7 +70,7 @@
&nbsp; &nbsp;
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">Username</button>
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">{{username}}</button>
<mat-menu #menuuser="matMenu">
<button mat-menu-item>Profile</button>
<button mat-menu-item>Logout</button>
......
......@@ -25,13 +25,14 @@ export class HostnameComponent implements OnInit, OnDestroy {
gocdbSiteNames: string[];
dpmtSiteNames: string[];
sidebarOpen:boolean = true;
username: string;
constructor(private siteService: SiteShortService, public router: Router,
public route: ActivatedRoute, public authService: AuthService) {
// this.siteName = '';
// this.hostList = [];
this.siteName = this.siteService.currentSite;
this.username = sessionStorage.getItem("currentUser");
console.log('now in hostname component');
console.log(this.siteName);
console.log(this.hostList);
......
......@@ -70,7 +70,7 @@
&nbsp; &nbsp;
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">Username</button>
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">{{username}}</button>
<mat-menu #menuuser="matMenu">
<button mat-menu-item>Profile</button>
<button mat-menu-item (click)="onLogout">Logout</button>
......
......@@ -19,13 +19,14 @@ export class ServiceComponentHistoryComponent implements OnInit, OnDestroy {
eoscSiteNames: string[];
gocdbSiteNames: string[];
dpmtSiteNames: string[];
username: string;
constructor(private servComponentService: ServiceComponentService,
private siteService: SiteService,
public router: Router,
public route: ActivatedRoute,
public authService: AuthService) {
this.username = sessionStorage.getItem("currentUser");
const sessionData = sessionStorage.getItem('currentServComp');
if (sessionData !== null) {
this.servComp = JSON.parse(sessionData);
......
......@@ -14,10 +14,12 @@ export class ServiceComponentComponent implements OnInit, OnDestroy {
// export class ServiceCompComponent implements OnDestroy {
servComps: ServiceComponent[];
servName: string;
username: string;
constructor(private servComponentService: ServiceComponentService, private siteService: SiteShortService,
public router: Router,
public route: ActivatedRoute) {
this.username = sessionStorage.getItem("currentUser");
//this.servComp = new ServiceComponent('default');
//this.servComp = servComponentService.getSelectedServComp();
this.servName = this.siteService.currentService;
......
......@@ -69,7 +69,7 @@
&nbsp; &nbsp;
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">Username</button>
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">{{username}}</button>
<mat-menu #menuuser="matMenu">
<button mat-menu-item>Profile</button>
<button mat-menu-item (click)="onLogout()">Logout</button>
......
......@@ -25,6 +25,7 @@ export class SiteComponent implements OnInit, OnDestroy {
shorthomeUrl: string;
shortgiisUrl: string;
previousView: string;
username: string;
constructor(private siteService: SiteService,
public router: Router,
......@@ -34,6 +35,7 @@ export class SiteComponent implements OnInit, OnDestroy {
private domSanitizer: DomSanitizer
) {
console.log('in site view constructor');
this.username = sessionStorage.getItem("currentUser");
this.matIconRegistry.addSvgIcon(
`hosts`,
this.domSanitizer.bypassSecurityTrustResourceUrl("../../../assets/hosts.svg")
......
......@@ -76,7 +76,7 @@
&nbsp; &nbsp;
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">Username</button>
<button class="menu-button" mat-button [matMenuTriggerFor]="menuuser">{{username}}</button>
<mat-menu #menuuser="matMenu">
<button mat-menu-item>Profile</button>
<button mat-menu-item (click)="onLogout()">Logout</button>
......
......@@ -34,6 +34,7 @@ export class TableComponent implements OnInit, DoCheck,AfterViewInit {
eoscSiteNames: string[];
gocdbSiteNames: string[];
dpmtSiteNames: string[];
username: string;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
......@@ -45,6 +46,8 @@ export class TableComponent implements OnInit, DoCheck,AfterViewInit {
public authService: AuthService
) {
console.log('table constructor');
this.username = sessionStorage.getItem("currentUser");
const stmp = sessionStorage.getItem('currentSiteShortSource');
console.log(stmp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment