[CORD-879] Using ServiceDependency to draw the Coarse Graph

Change-Id: I33ea9ae78e041d329e99b8ae34c10ea335d217a9
diff --git a/src/app/service-graph/services/graph.store.ts b/src/app/service-graph/services/graph.store.ts
index 2266329..08ec52b 100644
--- a/src/app/service-graph/services/graph.store.ts
+++ b/src/app/service-graph/services/graph.store.ts
@@ -25,7 +25,8 @@
     services: [],
     tenants: [],
     networks: [],
-    subscribers: []
+    subscribers: [],
+    servicedependencys: []
   });
 
   private emptyGraph: IXosServiceGraph = {
@@ -42,6 +43,7 @@
   private tenants;
   private subscribers;
   private networks;
+  private servicedependencys;
 
   // debounced functions
   private handleData;
@@ -51,6 +53,7 @@
   private TenantSubscription: Subscription;
   private SubscriberSubscription: Subscription;
   private NetworkSubscription: Subscription;
+  private ServiceDependencySubscription: Subscription;
 
   constructor (
     private $log: ng.ILogService,
@@ -65,8 +68,6 @@
     this.handleData = this.XosDebouncer.debounce(this._handleData, 500, this, false);
 
     // observe models and populate graphData
-    // TODO get Nodes (model that represent compute nodes in a pod)
-    // TODO get Instances (model that represent deployed VMs)
     this.ServiceSubscription = this.XosModelStore.query('Service', '/core/services')
       .subscribe(
         (res) => {
@@ -77,6 +78,16 @@
         }
       );
 
+    this.ServiceDependencySubscription = this.XosModelStore.query('ServiceDependency', '/core/servicedependencys')
+      .subscribe(
+        (res) => {
+          this.combineData(res, 'servicedependencys');
+        },
+        (err) => {
+          this.$log.error(`[XosServiceGraphStore] Service Observable: `, err);
+        }
+      );
+
     this.TenantSubscription = this.XosModelStore.query('Tenant', '/core/tenants')
       .subscribe(
         (res) => {
@@ -129,7 +140,7 @@
     return this.d3CoarseGraph.asObservable();
   }
 
-  private combineData(data: any, type: 'services'|'tenants'|'subscribers'|'networks') {
+  private combineData(data: any, type: 'services'|'tenants'|'subscribers'|'networks'|'servicedependencys') {
     switch (type) {
       case 'services':
         this.services = data;
@@ -143,6 +154,9 @@
       case 'networks':
         this.networks = data;
         break;
+      case 'servicedependencys':
+        this.servicedependencys = data;
+        break;
     }
     this.handleData(this.services, this.tenants);
   }
@@ -152,7 +166,8 @@
       services: this.services,
       tenants: this.tenants,
       subscribers: this.subscribers,
-      networks: this.networks
+      networks: this.networks,
+      servicedependencys: this.servicedependencys
     });
   }
 
@@ -209,8 +224,7 @@
   private graphDataToCoarseGraph(data: IXosCoarseGraphData) {
 
     try {
-      const links: IXosServiceGraphLink[] = _.chain(data.tenants)
-        .filter((t: IXosTenantModel) => t.kind === 'coarse')
+      const links: IXosServiceGraphLink[] = _.chain(data.servicedependencys)
         .map((t: IXosTenantModel) => {
           return {
             id: t.id,