summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp')
-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
2 files changed, 51 insertions, 14 deletions
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);
})
}
+
}