diff options
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts | 17 |
1 files 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); } |