updated sidebar to display menu items even if action is empty 37/96037/1
authormravula <mr257h@att.com>
Thu, 19 Sep 2019 20:33:23 +0000 (16:33 -0400)
committermravula <mr257h@att.com>
Thu, 19 Sep 2019 20:33:23 +0000 (16:33 -0400)
Issue-ID: PORTAL-742

Change-Id: Ia0490d3a936b57aae83c75f8818ad3b517b04984
Signed-off-by: mravula <mr257h@att.com>
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.ts

index 988ebcc..314245b 100644 (file)
@@ -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);
         }