From 71ff35c368938e9c0f7bdfee75f962945556070b Mon Sep 17 00:00:00 2001 From: mravula Date: Thu, 19 Sep 2019 16:33:23 -0400 Subject: updated sidebar to display menu items even if action is empty Issue-ID: PORTAL-742 Change-Id: Ia0490d3a936b57aae83c75f8818ad3b517b04984 Signed-off-by: mravula --- .../app/layout/components/sidebar/sidebar.component.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts index 988ebcc1..314245b1 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts @@ -82,8 +82,8 @@ export class SidebarComponent implements OnInit { this.leftParentData = JSON.parse(this.result.data); this.leftChildData = JSON.parse(this.result.data2); - for (var i = 0; i < this.leftParentData.length; i++) { - var parentItem={ + for (let i = 0; i < this.leftParentData.length; i++) { + let parentItem={ name:null, imageSrc:null, href:null, @@ -94,12 +94,14 @@ export class SidebarComponent implements OnInit { parentItem.name = this.leftParentData[i].label; parentItem.imageSrc = this.leftParentData[i].imageSrc; // Add link to items with no subitems - if (this.leftChildData[i].length == 0) - parentItem.href = this.leftParentData[i].action; + if (this.leftChildData[i].length === 0){ + parentItem.href = this.leftParentData[i].action; + }else{ + - for (var j = 0; j < this.leftChildData[i].length; j++) { + for (let j = 0; j < this.leftChildData[i].length; j++) { - var childItem={ + let childItem={ name:null, href:null, router:null @@ -107,12 +109,15 @@ export class SidebarComponent implements OnInit { if (this.leftChildData[i][j].label != null && this.leftChildData[i][j].label.length > 0) { childItem.name = this.leftChildData[i][j].label; + if(null!==this.leftChildData[i][j].action){ if(this.leftChildData[i][j].action.match('v2/*')) childItem.router = '/'+ this.leftChildData[i][j].action; else childItem.href = this.leftChildData[i][j].action; parentItem.menuItems.push(childItem) + } } } + } this.menuData.push(parentItem); console.log(this.menuData); } -- cgit 1.2.3-korg