diff options
author | 2019-09-26 14:30:38 +0000 | |
---|---|---|
committer | 2019-09-26 14:30:38 +0000 | |
commit | 6b065ff814d4b013c231c4518321f414fbec6172 (patch) | |
tree | 8021484a52d14f70cbce03a34bcd3b9191c97df2 | |
parent | c4df8f3822c115df2c53beac8b531e20bb383afd (diff) | |
parent | 71ff35c368938e9c0f7bdfee75f962945556070b (diff) |
Merge "updated sidebar to display menu items even if action is empty"
-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); } |