diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
27 files changed, 306 insertions, 70 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..77ced1b1 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 @@ -7,7 +7,7 @@ <ul class="navbar-nav ml-auto"> <li class="nav-item dropdown" ngbDropdown> <a href="javascript:void(0)" class="nav-link" ngbDropdownToggle> - <i class="fa fa-user"></i> {{userFirstName}} <b class="caret"></b> + <i class="icon ion-md-person"></i> {{userFirstName}} <b class="caret"></b> </a> <div class="dropdown-menu-right" ngbDropdownMenu> @@ -16,13 +16,13 @@ <br/> <div ><span class="reg-userEmail-value-spn"> - <div>Email:</div>{{userEmail}}</span></div> + <div style="font-weight: bold;">Email:</div>{{userEmail}}</span></div> <br/> <div ><span class="reg-userEmail-value-spn"> - <div>userId:</div>{{userId}}</span></div> + <div style="font-weight: bold;">User Id:</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.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts index bd9bea48..4b3e1c7c 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts @@ -47,7 +47,6 @@ import { LayoutModule } from '../../layout.module'; import { CookieService } from 'ngx-cookie-service'; import { HeaderService } from 'src/app/shared/services/header/header.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { Router } from '@angular/router'; import 'rxjs/add/observable/of'; import { Observable } from 'rxjs/Observable'; @@ -55,11 +54,8 @@ import { Observable } from 'rxjs/Observable'; describe('HeaderComponent', () => { let headerService:HeaderService; - let cookieService:CookieService; - let router:Router; let component: HeaderComponent; let fixture: ComponentFixture<HeaderComponent>; - let spy: any; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -83,7 +79,6 @@ describe('HeaderComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); headerService = TestBed.get(HeaderService); - cookieService=TestBed.get(CookieService); }); @@ -96,6 +91,10 @@ describe('HeaderComponent', () => { let spy=spyOn(headerService, 'getTopMenuItems').and.returnValue(Observable.of('you object')); component.ngOnInit(); expect(spy).toHaveBeenCalled(); + expect(component.userFirstName).toEqual(component.response.firstName); + expect(component.userEmail).toEqual(component.response.email); + expect(component.userId).toEqual(component.response.userid); + expect(component.userName).toEqual(component.userName); }) }) 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 7bf5c649..8cfcdbe4 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 @@ -38,9 +38,8 @@ import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { HeaderService } from '../../../shared/services/header/header.service'; -import { UserService } from 'src/app/shared/services/user/user.service'; -import { User } from 'src/app/shared/services/user/user'; import { CookieService } from 'ngx-cookie-service'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-header', @@ -57,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 ( @@ -78,7 +86,7 @@ export class HeaderComponent implements OnInit { } this.pushRightClass = 'push-right'; - this.appName= 'ONAP Portal' ; + this.appName= 'Portal SDK' ; let result = this.headerService.getTopMenuItems(); result.subscribe(res => { this.response = res; @@ -103,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/layout/components/sidebar/sidebar.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html index e640f84f..5f8a2ec5 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.html @@ -1,7 +1,11 @@ -<div class="sidebar" [ngClass]="{'siderbar-height': showHeader, 'siderbar-height-noHeader': !showHeader}" > +<div class="sidebar" [ngClass]="{'siderbar-height': showHeader, 'siderbar-height-noHeader': !showHeader, collapsed:collapsed}" > <nav [ngClass]="{sidebarPushRight: isActive, collapsed: collapsed}"> <div class="toggle-button" [ngClass]="{collapsed: collapsed}" (click)="toggleCollapsed()"> - <i class="fa fa-angle-double-{{collapsed?'right':'left'}}"></i> + <!--<i class="fa fa-angle-double-{{collapsed?'right':'left'}}"></i> --> + <i class="icon ion-md-arrow-{{collapsed?'dropright':'dropleft'}}" style="float:right"></i> + <i class="icon ion-md-arrow-{{collapsed?'dropright':'dropleft'}}" style="float:right"></i> + + </div> <div class="list-group" *ngFor="let menu of menuData ; index as item"> @@ -23,7 +27,7 @@ <a href="javascript:void(0)" class="list-group-item" (click)="addExpandClass(menu.name)"> <i class="{{menu.imageSrc}}"></i> - <i style="float: right;" class="icon ion-ios-add-circle-outline"></i> + <i *ngIf = "!collapsed" style="float: right;" class="icon ion-ios-add-circle-outline"></i> <span>{{menu.name}}</span> </a> <li class="nested" [class.expand]="showMenu === menu.name"> @@ -45,4 +49,4 @@ </div> </div> </nav> -</div>
\ No newline at end of file +</div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts index 9bbcfc4e..eaa6a070 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts @@ -59,10 +59,6 @@ describe('SidebarComponent', () => { "data":'"d"', "data2":'"data2"' }; - var stubData2={ - "data":'"d"', - "data2":'" "' - }; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -94,17 +90,15 @@ describe('SidebarComponent', () => { it('should validate on ngOnInit',()=>{ let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData1)); component.ngOnInit(); + expect(component.isActive).toEqual(false); + expect(component.collapsed).toEqual(false); + expect(component.showMenu).toEqual(''); + expect(component.pushRightClass).toEqual('push-right'); + expect(component.leftParentData).toEqual(JSON.parse(component.result.data)); + expect(component.leftChildData).toEqual(JSON.parse(component.result.data2)); expect(spy).toHaveBeenCalled(); }) - }) - - //describe('should test ngOnInit if part',()=>{ - //it('should validate on ngOnInit',()=>{ - //let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData2)); - // component.ngOnInit(); - //expect(spy).toHaveBeenCalled(); - //}) - //}) + }); it('should test addExpandClass if element and showMenu variable value are same', () => { component.showMenu= '1'; @@ -132,15 +126,15 @@ describe('SidebarComponent', () => { it('should test isToggled method',()=>{ expect(component.isToggled()).toBe(false); - }) + }); it('should test toggleSidebar method',()=>{ component.pushRightClass="kumar"; expect(component.toggleSidebar()).toBeUndefined; - }) + }); it('should test on onLoggedout method',()=>{ expect(localStorage.getItem('isLoggedin')).toBeFalsy - }) + }); }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts index 6487d745..fbe38c9d 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts @@ -144,6 +144,8 @@ export class SidebarComponent implements OnInit { } else { this.showMenu = element; } + this.collapsed=false; + this.collapsedEvent.emit(false); } toggleCollapsed() { diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts index eb8b63dd..a32b2e3e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts @@ -56,11 +56,6 @@ describe('MenusComponent', () => { expect(component).toBeTruthy(); }); - // it('should test getFnMenuItems method inside getMenus',()=>{ - // let spy=spyOn(adminService,'getFnMenuItems').and.returnValue(Observable.of(stubData)) - // component.getMenus(); - // expect(spy).toHaveBeenCalled(); - // }) describe('test getMenus',()=>{ it('should test getMenus',()=>{ let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object')) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts index 5d996964..c6fbc8c4 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts @@ -72,12 +72,12 @@ export class MenusComponent implements OnInit { public columns: any = []; activeStatusOptions = [ - {index: 0, value: 'true', name: 'Y'}, - {index: 1, value: 'false', name: 'N'} + {id: '0', name: 'Y'}, + {id: '1', name: 'N'} ]; separatorStatusOptions = [ - {index: 0, value: 'true', name: 'Y'}, - {index: 1, value: 'false', name: 'N'} + {id: '0', name: 'Y'}, + {id: '1', name: 'N'} ]; functionCDselectData = []; parentListSelectData = []; @@ -192,6 +192,7 @@ export class MenusComponent implements OnInit { this.parentList.push({id: _data[i][0], name: _data[i][1]}); } console.log("Actual parent list : ", this.parentList); + this.menuService.getParentList(this.parentList); } }, error => { this.showSpinner = false; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts index aeb8ea49..912b65bb 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts @@ -104,23 +104,32 @@ export class MenusService implements RdpCrudInterface { data.active = this.updateStatus(data.active); data.separator = this.updateStatus(data.separator); let keys = Object.keys(data); + let menuCache = this.menu; keys.forEach(element => { if (data[element] != null || data[element] != undefined) { if (element == 'parentId') { - this.menu[element] = 1; + if (isNaN(data[element])) { + menuCache[element] = this.updateParentNameToID(data[element]); + } else{ + menuCache[element] = data[element]; + } + console.log("Parent Id to update : ", menuCache[element]); } else { - this.menu[element] = data[element]; + menuCache[element] = data[element]; } } }); - let result = { availableFnMenuItem: this.menu }; + let result = { availableFnMenuItem: menuCache }; let postData = JSON.stringify(result); console.log("postData >>>>>>", postData); this.adminService.updateFnMenuItem(postData) .subscribe(_data => { + console.log("Response : ", _data); this.statusResponse.next("200"); + menuCache = this.menu; }, error => { console.log("Error : ", error); + menuCache = this.menu; }); } @@ -130,11 +139,10 @@ export class MenusService implements RdpCrudInterface { console.log(data.active); data.active = this.updateStatus(data.active); data.separator = this.updateStatus(data.separator); - let result = { availableFnMenuItem: data }; - this.adminService.deleteMenu(result).subscribe(response => { + this.adminService.deleteMenu(data).subscribe(response => { console.log("Response ", response); this.statusResponse.next("200"); - }, error =>{ + }, error => { console.log("Error : ", error); }) } @@ -147,15 +155,44 @@ export class MenusService implements RdpCrudInterface { } } + private updateBooleanValue(data) { + if (data) { + return 'Y'; + } else { + return 'N'; + } + } + + parentList: any; + + getParentList(list) { + this.parentList = list; + } + + private updateParentNameToID(data) { + let val; + this.parentList.forEach(ele => { + if (ele['name'] == data) { + val = ele['id']; + } + }); + console.log("ParentId value ", val); + return val; + } + get() { - console.log("get method is getting called from AppServie data:: "); + console.log("get method is getting called from MenuServie data:: "); let response = this.adminService.getFnMenuItems(); let resp; response.subscribe(res => { - console.log("Get Response : ", res); resp = res; - console.log("edited : ",JSON.parse(resp.data).fnMenuItems); - this.updatedData.next(JSON.parse(resp.data).fnMenuItems); + let responseData = JSON.parse(resp.data).fnMenuItems; + responseData.forEach(element => { + element.active = this.updateBooleanValue(element.active); + element.separator = this.updateBooleanValue(element.separator); + }) + this.updatedData.next(responseData); }) } + } 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/definition/dashboard-report-grid/dashboard-report-grid.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.ts index 3cd72584..0c1781bc 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.service.ts @@ -12,6 +12,6 @@ export class DashboardReportGridService { getReportList() : Observable<any> { - return this._http.get(environment.baseUrl + "raptor.htm?action=report.search.execute&r_page=0"); + return this._http.get(environment.baseUrl + "raptor.htm?action=report.search.execute&r_page=0&show_all=true"); } } 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/run/run-report-form-fields/run-report-form-fields.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.html index dc6ef1cd..60eb927f 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.html @@ -21,12 +21,12 @@ <div *ngIf="!showformFiledSpinner" class="stdForm"> <div *ngIf="formFieldList" class="wrapper"> <div *ngFor="let item of formFieldList; let i = index;"> - <div *ngIf="item.fieldType == 'TEXT' && item.validationType !== 'DATE'" + <div *ngIf="item.fieldType == 'TEXT' && item.validationType !== 'DATE' && item.visible" class="fieldWidth"> <label class="labelWidth">{{item.fieldDisplayName}} :</label> <textarea placement="right" ngbTooltip="comma seperated" [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" [(ngModel)]="formFieldListValueArr[i]" class="defaultFontSizeTextArea" id="item.fieldId"></textarea> </div> - <div *ngIf="item.fieldType == 'LIST_BOX'" class="fieldWidth"> + <div *ngIf="item.fieldType == 'LIST_BOX' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <select [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" class="browser-default custom-select defaultFontSize" required="required" @@ -35,7 +35,7 @@ class="defaultFontSize" value="{{listItem.id}}">{{listItem.name}}</option> </select> </div> - <div *ngIf="item.fieldType == 'LIST_MULTI_SELECT'" class="fieldWidth"> + <div *ngIf="item.fieldType == 'LIST_MULTI_SELECT' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <mat-form-field> <mat-select [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" multiple> @@ -44,7 +44,7 @@ </mat-select> </mat-form-field> </div> - <div *ngIf="item.validationType == 'DATE'" class="fieldWidth"> + <div *ngIf="item.validationType == 'DATE' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <mat-form-field><input [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" [matDatepicker]="picker" @@ -71,11 +71,11 @@ <div *ngIf="formFieldList" class="wrapper"> <div *ngFor="let item of toggleFormFieldRenderArr; let i = index;"> - <div *ngIf="item.fieldType == 'TEXT' && item.validationType !== 'DATE'" class="fieldWidth"> + <div *ngIf="item.fieldType == 'TEXT' && item.validationType !== 'DATE' && item.visible" class="fieldWidth"> <label class="labelWidth">{{item.fieldDisplayName}} :</label><textarea placement="right" ngbTooltip="comma seperated" [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" class="defaultFontSizeTextArea" id="item.fieldId"></textarea> </div> - <div *ngIf="item.fieldType == 'LIST_BOX'" class="fieldWidth"> + <div *ngIf="item.fieldType == 'LIST_BOX' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <select [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" class="browser-default custom-select defaultFontSize" required="required" @@ -85,7 +85,7 @@ </select> </div> - <div *ngIf="item.fieldType == 'LIST_MULTI_SELECT'" class="fieldWidth"> + <div *ngIf="item.fieldType == 'LIST_MULTI_SELECT' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <mat-form-field> <mat-select [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" @@ -97,7 +97,7 @@ <br/> </div> - <div *ngIf="item.validationType == 'DATE'" class="fieldWidth"> + <div *ngIf="item.validationType == 'DATE' && item.visible" class="fieldWidth"> <label class="labelWidth" for="reportType">{{item.fieldDisplayName}} :</label> <mat-form-field><input [ngModel]="formFieldListValueMap.get(item.fieldId)" (ngModelChange)="formFieldListValueMap.set(item.fieldId, $event)" [matDatepicker]="picker" class="defaultFontSize" diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.html index 4b647528..69de20bf 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.html @@ -33,7 +33,7 @@ </div> <span *ngIf="download_in_progress" class="ecomp-small-spinner"></span> <div *ngIf="!showDashboardReport"> - <div *ngIf="error == false" [hidden]="isChartAvailable == false" align="center"> + <div *ngIf="error == false && showChart" [hidden]="isChartAvailable == false" align="center"> <iframe #iframe height="500" style="border: none" width="70%"></iframe> </div> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts index a2163054..7e0ac549 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.ts @@ -90,6 +90,7 @@ export class RunReportComponent implements OnInit, AfterViewInit { timeTaken = '...'; saveResponseObj: any; showBackButton = false; + showChart: boolean = false; constructor(private _http: HttpClient, private _route: ActivatedRoute, @@ -361,7 +362,9 @@ export class RunReportComponent implements OnInit, AfterViewInit { if (response['chartWizardAvailable'] === true) { this.isChartAvailable = true; - this.iframe.nativeElement.setAttribute('src', this.chartRunUrl); + if(this.iframe){ + this.iframe.nativeElement.setAttribute('src', this.chartRunUrl); + } } let totalCnt = 0; @@ -437,6 +440,9 @@ export class RunReportComponent implements OnInit, AfterViewInit { } this.dataSource.data = this.displayedRowObj; this.dataSource.sort = this.sort; + if(this.totalRecords >0){ + this.showChart = true; + } } 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/pages/analytics/Report_List/display-area/display-area.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.html new file mode 100644 index 00000000..eb07a769 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.html @@ -0,0 +1,14 @@ + +<div > +<div class="tab-content"> + <h3>{{this.menuId}} Reports</h3> +</div> +<span class="ecomp-spinner" *ngIf="showSpinner"></span> +<div> + +<ng-container *ngFor="let item of finalRowArr"> + <li><a href="javascript:void(0);" (click)="runReport(item.reportURL)">{{item.reportName}}</a></li> +</ng-container> + +</div> +</div> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.scss new file mode 100644 index 00000000..bc189348 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.scss @@ -0,0 +1,10 @@ + +button{ + margin: 0; + font-size: 100%; + vertical-align: middle; + color:white; + background-color: #0568ae +} + +
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.spec.ts new file mode 100644 index 00000000..27329a9b --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.spec.ts @@ -0,0 +1,26 @@ +// import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +// import { DisplayAreaComponent } from './display-area.component'; + +// describe('DisplayAreaComponent', () => { +// let component: DisplayAreaComponent; +// let fixture: ComponentFixture<DisplayAreaComponent>; + +// beforeEach(async(() => { +// TestBed.configureTestingModule({ +// declarations: [ DisplayAreaComponent ] +// }) +// .compileComponents(); +// })); + +// beforeEach(() => { +// fixture = TestBed.createComponent(DisplayAreaComponent); +// component = fixture.componentInstance; +// fixture.detectChanges(); +// }); + +// it('should create', () => { +// expect(component).toBeTruthy(); +// }); +// }); + diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.ts new file mode 100644 index 00000000..e08190e7 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/display-area/display-area.component.ts @@ -0,0 +1,65 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DisplayAreaService } from 'src/app/shared/services/displayArea/display-area.service'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTable, MatTableDataSource } from '@angular/material/table'; + +@Component({ + selector: 'app-display-area', + templateUrl: './display-area.component.html', + styleUrls: ['./display-area.component.scss'] +}) +export class DisplayAreaComponent implements OnInit { + + @ViewChild( MatPaginator, { static: false } as any ) paginator: MatPaginator; + @ViewChild( MatSort, { static: false } as any ) sort: MatSort; + @ViewChild( MatTable, { static: false } as any ) table: MatTable<any>; + menuId:string; + showSpinner: boolean; + dataSource1: any; + displayedColumns = ["reportName", "reportDescr","reportURL"]; + finalGETObj: {}; + finalRowArr: any[]; + rowObj: any; + reportId: string; + + constructor(private _route: ActivatedRoute, private _router: Router, private _displayAreaService: DisplayAreaService) { } + + ngOnInit() { + this._route.params.subscribe(params => { + this.menuId = params['menuId']; + console.log("displayArea " +this.menuId); + this.initializeReportList(this.menuId); + }); + + + + } + + initializeReportList(menuId:string) { + this.showSpinner = true; + this.dataSource1 = new MatTableDataSource(); + this.finalGETObj = new Object(); +//this.finalGETObjRowsArr = new Array(); + this.finalRowArr = new Array(); + this._displayAreaService.getMenuIdSpecificReports(this.menuId) + .subscribe(( responseObj ) => { + this.finalGETObj = responseObj; + for (let entry of responseObj) { + this.rowObj = new Object(); + this.rowObj["reportName"] = entry["reportName"]; + this.rowObj["reportDescr"] = entry["reportDescr"]; + this.rowObj["reportURL"] = entry["reportURL"]; + this.finalRowArr.push( this.rowObj ); + } + this.showSpinner = false; + } ); +} + +runReport( reportId: string ) { + this.reportId = reportId; + this._router.navigate( [reportId] ); +} + +} diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.html index 0295bdd6..7bb6729d 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.html @@ -84,7 +84,7 @@ [length]="dataSource1?.data.length" [pageIndex]="0" [pageSize]="20" - [pageSizeOptions]="[20]"> + [pageSizeOptions]="[20,40,60,80,100]"> </mat-paginator> </div> </div> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.service.ts index 560bd6e1..aad435f5 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.service.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.service.ts @@ -15,6 +15,6 @@ export class ReportListService { return this._http.get(environment.baseUrl + "/raptor.htm?action=report.delete&c_master=" + reportId); } getAllReports():Observable<any>{ - return this._http.get(environment.baseUrl + "raptor.htm?action=report.search.execute&r_page=0"); + return this._http.get(environment.baseUrl + "raptor.htm?action=report.search.execute&r_page=0&show_all=true"); } } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/pages.module.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/pages.module.ts index 37231147..45789f27 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/pages.module.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/pages.module.ts @@ -67,6 +67,7 @@ import { LayoutModule } from '@angular/cdk/layout'; import { DashboardReportGridComponent } from './analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component'; import { DataChartComponent } from './analytics/Report_List/Report/definition/dashboard-report-grid/data-chart/data-chart.component'; import { RunDashboardReportComponent } from './analytics/Report_List/Report/run/run-report/run-dashboard-report/run-dashboard-report.component'; +import { DisplayAreaComponent } from './analytics/Report_List/display-area/display-area.component'; @@ -118,6 +119,7 @@ import { RdpModule } from 'portalsdk-tag-lib'; DashboardReportGridComponent, DataChartComponent, RunDashboardReportComponent, DialogOverviewExampleDialog, + DisplayAreaComponent ], 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 diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.spec.ts new file mode 100644 index 00000000..f8324dac --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.spec.ts @@ -0,0 +1,13 @@ +// import { TestBed } from '@angular/core/testing'; + +// import { DisplayAreaService } from './display-area.service'; + +// describe('DisplayAreaService', () => { +// beforeEach(() => TestBed.configureTestingModule({})); + +// it('should be created', () => { +// const service: DisplayAreaService = TestBed.get(DisplayAreaService); +// expect(service).toBeTruthy(); +// }); +// }); + diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.ts new file mode 100644 index 00000000..71433031 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/services/displayArea/display-area.service.ts @@ -0,0 +1,16 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { environment } from '../../../../environments/environment'; +@Injectable({ + providedIn: 'root' +}) +export class DisplayAreaService { + + constructor(private _http : HttpClient) { } + + getMenuIdSpecificReports(menuId : string) : Observable<any> + { + return this._http.get(environment.baseUrl + "raptor.htm?action=quicklinks.json&quick_links_menu_id=" + menuId); + } +} |