Commit cef5937a authored by Jie Yuan's avatar Jie Yuan
Browse files

add username resolver

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