summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRachitha Ramappa <rachitha.ramappa@att.com>2020-04-09 20:34:21 +0530
committerRachitha Ramappa <rachitha.ramappa@att.com>2020-04-09 20:34:31 +0530
commite799a2cae0e4d099ccc7cf077adf27f6c36c73b9 (patch)
tree92097268555c26ef0e577eb0fdf1246acc6ac7eb
parent200d61e4d44593aa453d82c74c7fcd61a99c93e0 (diff)
Menu page edit and delete issue fix
Change-Id: Ibfb4533375e32a7eb4a0d7ae0aff9dbe13054e41 Issue-ID: PORTAL-867 Signed-off-by: rachitha.ramappa@att.com
-rw-r--r--ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgzbin356592 -> 360247 bytes
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts9
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts56
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts9
-rw-r--r--ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts9
5 files changed, 68 insertions, 15 deletions
diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
index d0576c6e..ae63bfb4 100644
--- a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
+++ b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz
Binary files differ
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 9df51b51..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,24 +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;
});
}
@@ -131,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);
})
}
@@ -148,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/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
index 24cb2e6f..5fd507ff 100644
--- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
+++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts
@@ -60,7 +60,6 @@ export class RdpSelectEditorComponent implements OnInit {
@Input() data: any[];
@Output() changedColumnValue = new EventEmitter<any>();
columnValue: any;
-
constructor() { }
ngOnInit() {
@@ -68,12 +67,20 @@ export class RdpSelectEditorComponent implements OnInit {
let rowObj = JSON.parse(this.rowdata);
let column = this.columntitle;
this.columnValue = rowObj[column];
+ for(let i=0; i<this.data.length; i++){
+ if(this.data[i]['id'] == this.columnValue){
+ this.columnValue = this.data[i].name;
+ break;
+ }
+ }
} else {
this.columnValue = null;
}
+ console.log("Select title: ",this.columntitle+" Select Value: ",this.columnValue);
}
detectChange(changedValue) {
+ console.log("Changed value : ", changedValue);
this.changedColumnValue.emit(changedValue);
}
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 954d0941..983a2726 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
@@ -224,6 +224,15 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni
deleteRow(data: any) {
this.dataTableService.delete(this.applicationService, data);
+ this.applicationService.statusResponse.subscribe(response => {
+ console.log("Response : ",response);
+ if(response == 200){
+ this.applicationService.get();
+ this.applicationService.updatedData.subscribe(updatedResponse =>{
+ this.setData(updatedResponse);
+ })
+ }
+ })
}
applyFilter(filterValue: string) {