rdp-library fixes 45/101845/1
authorRachitha Ramappa <rachitha.ramappa@att.com>
Mon, 17 Feb 2020 15:16:47 +0000 (20:46 +0530)
committerRachitha Ramappa <rachitha.ramappa@att.com>
Mon, 17 Feb 2020 16:50:55 +0000 (22:20 +0530)
Change-Id: I74439c2a5232e27fe013f37cfc2e32e9ec25a556
Issue-ID: PORTAL-796
Signed-off-by: rachitha.ramappa@att.com
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.ts
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.html
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts
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
ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.html
ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts
ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/public_api.ts

index 1b22cf2..9df51b5 100644 (file)
@@ -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);
+    })
   }
 }
index 9d931d1..b059536 100644 (file)
@@ -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);
+    })
   }
 }
index c061149..846dae5 100644 (file)
                                </div>
                        </div>
                        <div class="form-row">
-                               <label for="textinputID-3a">Organization User ID</label>&nbsp;
+                               <label for="textinputID-3a">Organization User ID</label>&nbsp;<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>
-                               &nbsp;
+                               &nbsp;<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="
                </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
index 23a2bb0..45210f8 100644 (file)
@@ -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) {
index ede8aa2..d92ce32 100644 (file)
@@ -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();
   }
 
index a87a7b7..4f98abd 100644 (file)
@@ -8,6 +8,7 @@
       <i class="icon ion-md-person-add"></i>&nbsp;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>
index 7187ca0..b833c6f 100644 (file)
@@ -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) => {
index 47cda35..4856082 100644 (file)
@@ -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