diff options
9 files changed, 121 insertions, 73 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts index ba1583d8..1c883519 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/dashboard/dashboard.component.spec.ts @@ -4,7 +4,6 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { DashboardComponent } from './dashboard.component'; import { DashboardModule } from './dashboard.module'; -import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('DashboardComponent', () => { @@ -32,4 +31,11 @@ describe('DashboardComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should test the closeAlert method', () =>{ + component.alerts=[1,2,3,4,5]; + component.closeAlert(2); + expect(component.alerts).toEqual([1,3,4,5]); + }) + }); 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 1b22cf28..9df51b51 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 @@ -42,12 +42,23 @@ import { HttpClient } from '@angular/common/http'; import { RdpCrudInterface } from 'portalsdk-tag-lib'; import { environment } from 'src/environments/environment'; import { AdminService } from '../admin.service'; +import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class MenusService implements RdpCrudInterface { + public statusResponse = new BehaviorSubject(""); + public updatedData = new BehaviorSubject<any>({}); + + loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): import("rxjs").Observable<any[]> { + throw new Error("Method not implemented."); + } + getTotalRowCount() { + throw new Error("Method not implemented."); + } + parentDataList: any; constructor(private http: HttpClient, private adminService: AdminService) { @@ -108,6 +119,7 @@ export class MenusService implements RdpCrudInterface { this.adminService.updateFnMenuItem(postData) .subscribe(_data => { console.log("Response : ", _data); + this.statusResponse.next("200"); }, error => { console.log("Error : ", error); }); @@ -122,6 +134,9 @@ export class MenusService implements RdpCrudInterface { let result = { availableFnMenuItem: data }; this.adminService.deleteMenu(result).subscribe(response => { console.log("Response ", response); + this.statusResponse.next("200"); + }, error =>{ + console.log("Error : ", error); }) } @@ -133,7 +148,15 @@ export class MenusService implements RdpCrudInterface { } } - get(data: any) { - console.log("get method is getting called from AppServie data:: ", data); + get() { + console.log("get method is getting called from AppServie 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); + }) } } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts index 9d931d1d..b0595361 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts @@ -1,34 +1,57 @@ import { Injectable } from '@angular/core'; import { RdpCrudInterface } from 'portalsdk-tag-lib'; import { AdminService } from '../admin.service'; +import { BehaviorSubject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class RoleFunctionsService implements RdpCrudInterface { + public statusResponse = new BehaviorSubject(""); + public updatedData = new BehaviorSubject<any>({}); + + loadTableData(filter: any, sortActive: any, sortDirection: any, pageIndex: any, pageSize: any): import("rxjs").Observable<any[]> { + throw new Error("Method not implemented."); + } + getTotalRowCount() { + throw new Error("Method not implemented."); + } + constructor(private adminService: AdminService) { } add(data: any) { - console.log("Add method is getting called from AppServie data:: ", data); + console.log("Add method is getting called from RoleFunctionService data:: ", data); } - update(data: any) { - console.log("Update method is getting called from MenusService data:: ", data); - this.adminService.saveRoleFunction(data).subscribe(response => { - console.log(response); + update(data: any): any { + console.log("Update method is getting called from RoleFunctionService data:: ", data); + return this.adminService.saveRoleFunction(data).subscribe(response => { + console.log("Success Response ", response); + this.statusResponse.next("200"); + }, error => { + console.log("Error ", error); }) } delete(data: any) { - console.log("Delete method is getting called from AppServie data::>> " + JSON.stringify(data)); + console.log("Delete method is getting called from RoleFunctionService data::>> " + JSON.stringify(data)); this.adminService.deleteRoleFunction(data).subscribe(response => { - console.log("Repsonse : ",response); + console.log("Repsonse : ", response); + this.statusResponse.next("200"); + }) } - get(data: any) { - console.log("get method is getting called from AppServie data:: ", data); + get() { + let response = this.adminService.getRoleFunctionList(); + let editedData; + response.subscribe(res => { + editedData = res; + let data = JSON.parse(JSON.parse(editedData.data).availableRoleFunctions); + console.log("Get Method called : ", data); + this.updatedData.next(data); + }) } } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html index c0611493..846dae52 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html @@ -59,14 +59,16 @@ </div> </div> <div class="form-row"> - <label for="textinputID-3a">Organization User ID</label> + <label for="textinputID-3a">Organization User ID</label> <a style="cursor: hand;" target="_new" + href="http://webphone.att.com/cgi-bin/webphones.pl?id={{profile.orgUserId}}">wephone</a> <input [(ngModel)]="profile.orgUserId" type="text" name="orgUserId" class="form-control" id="orgUserId" style="width: 100%;" disabled="true"> </div> <div class="form-row"> <label for="textinputID-3a">Organization Manager ID</label> - + <a style="cursor: hand;" target="_new" + href="http://webphone.att.com/cgi-bin/webphones.pl?id={{profile.orgManagerUserId}}">wephone</a> <input [(ngModel)]="profile.orgManagerUserId" type="text" name="orgManagerUserId" class="form-control" id="orgManagerUserId" style=" @@ -195,33 +197,7 @@ </div> - <table mat-table [dataSource]="dataSource" matSort> - <ng-container matColumnDef="name"> - <th mat-header-cell *matHeaderCellDef id="heading1"> Name</th> - <td mat-cell *matCellDef="let rowData"> {{rowData.name}} </td> - </ng-container> - - <!--<ng-container matColumnDef="delete"> - <th mat-header-cell *matHeaderCellDef id="heading2"> Delete</th> - <td id="rowheader_t1_{{i}}" mat-cell *matCellDef="let rowData; let i=index;"> - <span class="icon-trash" id="{{i}}-button-role-remove" (click)="removeRole(rowData)"> - <i class="icon ion-md-trash"></i> - </span> - </td> - </ng-container>--> - - <!-- Active Column --> - <ng-container matColumnDef="active"> - <th id="col3" mat-header-cell *matHeaderCellDef>Active ?</th> - <td id="rowheader_t1_{{i}}-userId" mat-cell *matCellDef="let element; let i=index;"> - <mat-slide-toggle [(ngModel)]="element.selected" (change)="toggleRoles(element)"></mat-slide-toggle> - </td> - </ng-container> - - <tr mat-header-row *matHeaderRowDef="userRolesHeader"></tr> - <tr mat-row *matRowDef="let rowData; columns: userRolesHeader;"> - - </table> + <rdp-data-table [data]="ociavailableRoles" [settings]="settings"></rdp-data-table> <span class="ecomp-spinner" *ngIf="showSpinner"></span> </div> </div>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts index 23a2bb07..45210f80 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts @@ -45,6 +45,7 @@ import { NgbModal, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component'; import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib'; @Component({ selector: 'app-self', @@ -92,6 +93,9 @@ export class SelfComponent implements OnInit { selectedTimeZone; finalSelectedRoles: any; + public settings; + public columns: any = []; + ngOnInit() { this.showSpinner = false; @@ -145,7 +149,14 @@ export class SelfComponent implements OnInit { } } - this.dataSource = new MatTableDataSource(this.ociavailableRoles); + console.log("Data : ", this.ociavailableRoles); + this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null)); + this.settings = new DataTableSettings() + this.settings.columns = this.columns; + this.settings.isPaginationEnabled = false; + this.settings.isReadOnly = true; + this.settings.isTableSearchEnabled = false; + this.settings.isToggleEnabled = true; if (this.ociavailableRoles != null) { for (let role of this.ociavailableRoles) { diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts index ede8aa25..d92ce320 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table-edit/rdp-data-table-edit.component.ts @@ -12,6 +12,7 @@ export class RdpDataTableEditComponent implements OnInit { @Input() settings: any; @Input() rowdata: any; @Input() isEditMode: boolean; + @Input() applicationService: any; @Output() passEntry: EventEmitter<any> = new EventEmitter(); modalPopupTitle: string; selectedRowData: any; @@ -35,7 +36,18 @@ export class RdpDataTableEditComponent implements OnInit { } saveChanges() { - this.passEntry.emit(this.rowdata); + this.applicationService.update(this.rowdata); + this.applicationService.statusResponse.subscribe(responseData => { + if (responseData == "200") { + console.log("Success") + this.applicationService.get(); + this.applicationService.updatedData.subscribe(val => { + if (val) { + this.passEntry.emit(val); + } + }) + } + }) this.activeModal.close(); } diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html index a87a7b70..4f98abd5 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html @@ -8,6 +8,7 @@ <i class="icon ion-md-person-add"></i> Add </button> </div> + <span class="rdp-spinner" *ngIf="showSpinner"></span> <!-- <rdp-scroll-container [more]="hasMore()" [scrollOffset]="2500" [scrollDelay]="3000" (scrolled)="handleScroll($event)" [class.full]="full" [class.part]="!full"> --> <table mat-table #table [dataSource]="dataSource" style="width: 100%" matSort> diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts index 7187ca07..b833c6fb 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts @@ -77,7 +77,7 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni showAddButton: boolean = true; result : any; totalRowsCount: any; - + showSpinner: boolean; constructor(public dataTableService: RdpDataTableService, private rdpModal: RdpModalService) { } @@ -221,36 +221,31 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni * @param rowData */ openEditModalPopup(rowData: any) { + this.showSpinner = true; + console.log("Row data : ", rowData); this.cloneObject = Object.assign({}, rowData) - console.log("Copied Object : ", this.cloneObject); - if (this.cloneObject) { - const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' }); - modalRef.componentInstance.title = 'Edit'; - modalRef.componentInstance.settings = this.settings; - if (this.cloneObject != 'undefined' && this.cloneObject) { - modalRef.componentInstance.rowdata = this.cloneObject; - modalRef.componentInstance.isEditMode = true; - this.isEditMode = true; - } else { - modalRef.componentInstance.rowdata = {}; - modalRef.componentInstance.isEditMode = false; - this.isEditMode = false; - } - modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { - if (receivedEntry) { - console.log("Original Object : ", rowData); - let response = this.updateRow(receivedEntry); - console.log("Response form application ",response); - console.log("Entry : ",receivedEntry); - rowData = receivedEntry; - if(this.dataTableService.response == "Success"){ - console.log("Result is success, update the tabel"); - this.columnsInfoList.push(receivedEntry); - console.log("Updtae column info list : ", this.columnsInfoList); - } - } - }); + console.log("Update or Add functionality intialized"); + const modalRef = this.rdpModal.open(RdpDataTableEditComponent, { size: 'lg' }); + modalRef.componentInstance.title = 'Edit'; + modalRef.componentInstance.settings = this.settings; + if (this.cloneObject.data != 'undefined' && this.cloneObject) { + modalRef.componentInstance.rowdata = this.cloneObject; + modalRef.componentInstance.applicationService = this.applicationService; + modalRef.componentInstance.isEditMode = true; + this.isEditMode = true; + } else { + modalRef.componentInstance.rowdata = {}; + modalRef.componentInstance.isEditMode = false; + this.isEditMode = false; } + modalRef.componentInstance.passEntry.subscribe((receivedEntry: any) => { + if (receivedEntry) { + this.data = receivedEntry; + this.setData(this.data); + } + this.showSpinner = false; + }); + } handleScroll = (scrolled: boolean) => { diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/public_api.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/public_api.ts index 47cda350..4856082b 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/public_api.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/public_api.ts @@ -13,4 +13,5 @@ export * from './lib/rdp/rdp-scroll-container/rdp-scroll-container.component'; export * from './lib/rdp/model/column'; export * from './lib/rdp/model/data-table-settings'; export * from './lib/rdp/rdp.module'; -export * from './lib/rdp/shared/rdpCrudInterface';
\ No newline at end of file +export * from './lib/rdp/shared/rdpCrudInterface'; +export * from './lib/rdp/services/rdp-modal.service';
\ No newline at end of file |