diff options
Diffstat (limited to 'ecomp-sdk')
13 files changed, 365 insertions, 90 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/admin.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts index 4892e72a..44df520c 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts @@ -1,22 +1,131 @@ import { TestBed, async } from '@angular/core/testing'; import { AdminService } from './admin.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { environment } from 'src/environments/environment'; +import { HttpClientModule } from '@angular/common/http'; describe('AdminService', () => { - beforeEach(() => - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [] - }) - .compileComponents(); - })); + let service:AdminService; + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,AdminService] + }) + service = TestBed.get(AdminService); + }); it('should be created', () => { const service: AdminService = TestBed.get(AdminService); expect(service).toBeTruthy(); }); + + it('should get getUserPagination', () => { + service.getRoleFunctionList().subscribe((resp) => { + expect(resp).toBe(environment.roleFunctionList); + }); + }) + + it('should test saveRoleFunction',()=>{ + service.saveRoleFunction("roleData").subscribe((resp)=>{ + expect(resp).toBe(environment.addRoleFunction); + }) + }) + + it('should test getUsageList',()=>{ + service.getUsageList().subscribe((resp) => { + expect(resp).toBe(environment.usageList); + }) + }) + + it('should test getCacheRegions',()=>{ + service.getCacheRegions().subscribe((resp) => { + expect(resp).toBe(environment.cachedRegions); + }) + }) + + it('should test getRole',()=>{ + service.getRole(1).subscribe((resp) => { + expect(resp).toBe(environment.cachedRegions); + }) + }) + + it('should test getRole',()=>{ + service.getRole(1).subscribe((resp) => { + expect(resp).toBe(environment.getRole); + }) + }) + + it('should test getFnMenuItems',()=>{ + service.getFnMenuItems().subscribe((resp) => { + expect(resp).toBe(environment.getFnMenuItems); + }) + }) + + it('should test updateFnMenuItem',()=>{ + let menuObj: any + service.updateFnMenuItem(menuObj).subscribe((resp) => { + expect(resp).toBe(environment.updateFnMenuItem); + }) + }) + + it('should test getFunctionCdList',()=>{ + service.getFunctionCdList().subscribe((resp) => { + expect(resp).toBe(environment.getFunctionCdList); + }) + }) + + + it('should test getParentData',()=>{ + service.getParentData().subscribe((resp) => { + expect(resp).toBe(environment.getParentList); + }) + }) + + it('should test deleteRole',()=>{ + let roleData: any + service.deleteRole(roleData).subscribe((resp) => { + expect(resp).toBe(environment.deleteRole); + }) + }) + + it('should test deleteRoleFunction',()=>{ + let roleData: any + service.deleteRoleFunction(roleData).subscribe((resp) => { + expect(resp).toBe(environment.deleteRoleFunction); + }) + }) + + it('should test removeRoleFunction',()=>{ + let roleFunc:any; + let roleId:any; + service.removeRoleFunction(roleFunc,roleId).subscribe((resp) => { + expect(resp).toBe(environment.removeRoleFunction+roleId); + }) + }) + + it('should test saveRole',()=>{ + let roleObj:any; + let roleId:any; + service.saveRole(roleObj,roleId).subscribe((resp) => { + expect(resp).toBe(environment.saveRole+roleId); + }) + }) + + it('should test deleteMenu',()=>{ + let fnMenuItem: any + service.deleteMenu(fnMenuItem).subscribe((resp) => { + expect(resp).toBe(environment.deleteMenu); + }) + }) + + + it('should test getCacheRegionDetails',()=>{ + let cacheName:any + service.getCacheRegionDetails(cacheName).subscribe((resp) => { + expect(resp).toBe(environment.getRegion); + }) + }) + }); 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/analytics/Report_List/Report/definition/definition.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts index 1c56d381..74dc8b5e 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/definition.service.spec.ts @@ -2,15 +2,41 @@ import { TestBed } from '@angular/core/testing'; import { DefinitionService } from './definition.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('DefinitionServiceService', () => { - beforeEach(() => + +let service:DefinitionService; + + beforeEach(() =>{ TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); + imports: [HttpClientTestingModule], + providers:[HttpClientModule,DefinitionService] + }) + service=TestBed.get(DefinitionService); +}); it('should be created', () => { const service: DefinitionService = TestBed.get(DefinitionService); expect(service).toBeTruthy(); }); + + it('should get getDefinitionPageDetails', () => { + let IncomingReportId : number; + let reportMode: string; + service.getDefinitionPageDetails(IncomingReportId,reportMode).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl+IncomingReportId); + }); + }) + + it('should get portDefinitionPageDetails', () => { + let IncomingReportId: number; + let finalPostObj : any; + service.portDefinitionPageDetails(IncomingReportId,finalPostObj).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl+IncomingReportId); + }); + }) + + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts index 42544a72..1dab68ba 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts @@ -1,6 +1,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormFieldsComponent } from './form-fields.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { MatDialogModule, MatSnackBarModule } from '@angular/material'; +import { CommonModule } from '@angular/common'; describe('FormFieldsComponent', () => { let component: FormFieldsComponent; @@ -8,7 +13,9 @@ describe('FormFieldsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormFieldsComponent ] + schemas:[CUSTOM_ELEMENTS_SCHEMA], + declarations: [ FormFieldsComponent ], + imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule] }) .compileComponents(); })); @@ -22,4 +29,25 @@ describe('FormFieldsComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should test isFirst method',()=>{ + expect(component.isFirst(0)).toBe(true); + expect(component.isFirst(2)).toBe(false); + }); + + it('should test isLast method', () =>{ + component.formFieldsListObj.length = 12; + expect(component.isLast(15)).toEqual(false); + }); + + it('should test ngDoCheck method',()=>{ + component.sqlAsDefaultValue=true; + if(component.sqlAsDefaultValue==true){ + expect(component.showDefaultSQLOption).toBe(false); + } + else{ + expect(component.showDefaultSQLOption).toBe(true); + } + }); + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts index 0452c246..acb7a952 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.service.spec.ts @@ -2,15 +2,79 @@ import { TestBed } from '@angular/core/testing'; import { FormFieldsService } from './form-fields.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { environment } from 'src/environments/environment'; describe('FormFieldsService', () => { - beforeEach(() => + let service:FormFieldsService; + beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); + imports: [HttpClientTestingModule], + providers:[HttpClientModule,FormFieldsService] + }) + service=TestBed.get(FormFieldsService); +}); it('should be created', () => { const service: FormFieldsService = TestBed.get(FormFieldsService); expect(service).toBeTruthy(); }); + + it('should get getListOfFormFields', () => { + service.getListOfFormFields().subscribe((resp) => { + expect(resp).toBe(environment.baseUrl); + }); + }) + + it('should get getFormFieldData', () => { + let id:String; + service.getFormFieldData("id").subscribe((resp) => { + expect(resp).toBe(environment.baseUrl+id); + }); + }) + + it('should get postFormFieldData', () => { + let obj : any; + let reportId : string + service.postFormFieldData(obj,reportId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl); + }); + }) + + it('should get addFormFieldData', () => { + let obj : any; + let reportId : string + service.addFormFieldData(obj,reportId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl); + }); + }) + + it('should get deleteFormField', () => { + let id:String; + service.deleteFormField("id").subscribe((resp) => { + expect(resp).toBe(environment.baseUrl+id); + }); + }) + + it('should get verifySQL', () => { + let queryObj : any; + service.verifySQL(queryObj).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl); + }); + }) + + it('should get getFormFieldGroupsData', () => { + let reportId : any; + service.getFormFieldGroupsData(reportId).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl+reportId); + }); + }) + + it('should get postFormFieldGroupsData', () => { + let formFieldGroupObj : any; + service.postFormFieldGroupsData(formFieldGroupObj).subscribe((resp) => { + expect(resp).toBe(environment.baseUrl); + }); + }) + }); 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 |