Source Options- Displaying properties 51/92151/1
authorArundathi Patil <arundpil@in.ibm.com>
Sat, 27 Jul 2019 19:40:25 +0000 (01:10 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Sat, 27 Jul 2019 19:40:48 +0000 (01:10 +0530)
Refactored code to display the source properties and not the source
model

Issue-ID: CCSDK-707
Change-Id: I1f17b51581fcc7a601734e4d81074b36878caacf
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts

index 3c76b85..3e8f4f8 100644 (file)
@@ -87,6 +87,7 @@ export class SourcesTemplateComponent implements OnInit {
      this.resources.sources = Object.assign({},originalSources);
  };
     
+ // to remove this method
  selected(sourceValue){
    this.sourcesData= [];//this.sources[value];
    this.apiService.getModelType(sourceValue.value)
@@ -153,25 +154,25 @@ export class SourcesTemplateComponent implements OnInit {
                      if (typeof (dataitem) == "object") {
                         for (let key1 in dataitem) {
                            if (key1 == 'properties') {
-                              let newPropOnj = {}
+                              let newPropObj = {};
+                              newPropObj["name"] = event.item.element.nativeElement.innerText;
+                              newPropObj['data'] = {};
+                              let newSoruceObj = {};
                               for (let key2 in dataitem[key1]) {
-                                 console.log(dataitem[key1][key2]);
-                                 let varType = dataitem[key1][key2].type
-                                 // let property :  varType = 
-                                 newPropOnj[key2] = dataitem[key1][key2];
+                                 newSoruceObj[key2] = '';;
                               }
+                              newPropObj['data']['properties'] = newSoruceObj;
+                              this.sourcesOptions.forEach(sourcesOptionsitem => {
+                                 if (sourcesOptionsitem.name == item.name) {
+                                    sourcesOptionsitem.data = newPropObj['data'];
+                                 }
+                              });
                            }
                         }
                      }
                   });
-                  this.sourcesData = data;
-                  this.sourcesOptions.forEach(sourcesOptionsitem => {
-                     if (sourcesOptionsitem.name == item.name) {
-                        sourcesOptionsitem.data = data;
-                     }
-                  })
-               })
-         }
+            });
+         }  
       });
    }
   }