diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
7 files changed, 61 insertions, 7 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.html index 04701ca7..59ab1c4e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.html @@ -22,7 +22,7 @@ <div>userId:</div>{{userId}}</span></div> <br/> <div id="reg-logout-div" style="padding-top: 8px"> - <a href="logout.htm" id="allLogout" class="btn btn-primary"> + <a href="{{logOutURL}}" id="allLogout" class="btn btn-primary"> Log out </a> </div> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts index 1e447c72..994c53a5 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts @@ -39,6 +39,7 @@ import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { HeaderService } from '../../../shared/services/header/header.service'; import { CookieService } from 'ngx-cookie-service'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-header', @@ -55,9 +56,18 @@ export class HeaderComponent implements OnInit { userName; appName:string; showHeader:boolean = true; + logOutURL = environment.baseUrl; - constructor(public router: Router,public headerService: HeaderService,public cookieService: CookieService) { + constructor(public router: Router,public headerService: HeaderService,public cookieService: CookieService) { + + if(window.location.pathname.split('/').length > 3) { + var portNum = ( window.location.port === '' || window.location.port === '0' ) ? '' : ':'+ window.location.port; + this.logOutURL = window.location.protocol + "//" + window.location.hostname + portNum + window.location.pathname.substring(0, this.nthIndex(window.location.pathname, "/", 2) + 0) + '/logout.htm'; + } else { + this.logOutURL = environment.baseUrl + 'logout.htm'; + } + this.router.events.subscribe(val => { if ( @@ -101,4 +111,13 @@ export class HeaderComponent implements OnInit { onLoggedout() { localStorage.removeItem('isLoggedin'); } + + nthIndex(str, pat, n) { + var L = str.length, i = -1; + while (n-- && i++ < L) { + i = str.indexOf(pat, i); + if (i < 0) break; + } + return i; + } } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.ts index 2a8561e6..25f5109c 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/columns/column-list/column-list.component.ts @@ -114,7 +114,7 @@ export class ColumnListComponent implements OnInit { } ngOnInit() { - + this.showSpinner = true; this.displayTable = true; this._columnService.getColumnList() .subscribe((response) => { diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts index fc34cccd..e3bab3bb 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.ts @@ -76,16 +76,20 @@ export class FormFieldsComponent implements OnInit { } ngOnInit() { + this.showSpinner = true; this._formFieldsService.getListOfFormFields() .subscribe((responseFormFields) => { + this.showSpinner = true; for (let m = 0; m < responseFormFields.length; m++) { responseFormFields[m]["orderSeq"] = m + 1; this.formFieldsListObj.push(responseFormFields[m]); } - + this.showSpinner = false; this._formFieldsService.getFormFieldGroupsData(this.reportId1) .subscribe((responseGroupsData) => { + this.showSpinner = true; this.Groups = JSON.parse(responseGroupsData["formFieldGroupsJSON"]); + this.showSpinner = false; }); }); } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.ts index 47ec2383..a90a1f8e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/log/log.component.ts @@ -22,7 +22,7 @@ export class LogComponent implements OnInit { } ngOnInit() { - + this.showSpinner = true; if(this.reportType === "Dashboard") { this.stepNo= "3"; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.ts index 62c7d7a4..897aa03e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/sql/sql.component.ts @@ -46,6 +46,7 @@ export class SQLComponent implements OnInit { } ngOnInit() { + this.showSpinner = true; this.showSaveSQLDialog = false; this.SQLPostResponse = true; this.ValidatePostResponse = {}; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts index 50973763..1539877c 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.ts @@ -42,9 +42,22 @@ import { HttpHandler, HttpRequest, HttpHeaders, + HttpErrorResponse } from '@angular/common/http'; -import { Observable } from 'rxjs'; +import { Observable, throwError} from 'rxjs'; import { v4 as uuid } from 'uuid'; +import { catchError } from 'rxjs/internal/operators/catchError'; +import { environment } from '../../../environments/environment'; + +function nthIndex(str, pat, n) { + var L = str.length, i = -1; + while (n-- && i++ < L) { + i = str.indexOf(pat, i); + if (i < 0) break; + } + return i; +} + export class HeaderInterceptor implements HttpInterceptor { intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const headerSettings: { [name: string]: string | string[]; } = {}; @@ -58,6 +71,23 @@ export class HeaderInterceptor implements HttpInterceptor { const newHeader = new HttpHeaders(headerSettings); const clonedRequest = req.clone({ headers: newHeader, withCredentials: true }); // Pass the cloned request instead of the original request to the next handle - return next.handle(clonedRequest); + //return next.handle(clonedRequest); + var url = ''; + return next.handle(clonedRequest).pipe( + catchError(error => { + if ( error instanceof HttpErrorResponse ) { + if ( error.status === 0 ) { // If 0(302) Redirect to Login Page + if(window.location.pathname.split('/').length > 3) { + var portNum = ( window.location.port === '' || window.location.port === '0' ) ? '' : ':'+ window.location.port; + url = window.location.protocol + "//" + window.location.hostname + portNum + window.location.pathname.substring(0, nthIndex(window.location.pathname, "/", 2) + 0) + '/login.htm'; + window.open( url, '_self' ); + } else { + window.open( environment.baseUrl + 'login.htm', '_self' ); + } + } + } + return throwError(error); + }) + ); } }
\ No newline at end of file |