Reading subscribers from TenantRoot model

Change-Id: Ifdf5df41faddb57ccbd3da2f7de798a8224d932e
diff --git a/src/app/service-graph/components/fine-grained/fine-grained.component.scss b/src/app/service-graph/components/fine-grained/fine-grained.component.scss
index 0a4ca39..c7fcfbc 100644
--- a/src/app/service-graph/components/fine-grained/fine-grained.component.scss
+++ b/src/app/service-graph/components/fine-grained/fine-grained.component.scss
@@ -45,7 +45,8 @@
         stroke: green;
       }
 
-      &.subscriber > rect{
+      &.subscriber > rect,
+      &.tenantroot > rect{
         stroke: red;
       }
     }
diff --git a/src/app/service-graph/components/fine-grained/fine-grained.component.ts b/src/app/service-graph/components/fine-grained/fine-grained.component.ts
index e41adf8..0fbf411 100644
--- a/src/app/service-graph/components/fine-grained/fine-grained.component.ts
+++ b/src/app/service-graph/components/fine-grained/fine-grained.component.ts
@@ -132,7 +132,7 @@
   }
 
   private setupForceLayout() {
-
+    this.$log.debug(`[XosFineGrainedTenancyGraphCtrl] Setup Force Layout`);
     const tick = () => {
       this.nodeGroup.selectAll('g.node')
         .attr({
@@ -147,10 +147,17 @@
           y2: l => l.target.y || 0,
         });
     };
+    const getLinkStrenght = (l: IXosServiceGraphLink) => {
+      if (l.id.indexOf('service') > -1) {
+        return 0.1;
+      }
+      return 1;
+    };
     const svgDim = this.getSvgDimensions();
     this.forceLayout = d3.layout.force()
       .size([svgDim.width, svgDim.heigth])
       .linkDistance(config.force.linkDistance)
+      .linkStrength(l => getLinkStrenght(l))
       .charge(config.force.charge)
       .gravity(config.force.gravity)
       .on('tick', tick);
@@ -206,11 +213,6 @@
         transform: `rotate(45)`
       });
 
-    nodes.append('circle')
-      .attr({
-        r: '4px'
-      });
-
     nodes.append('text')
       .attr({
         'text-anchor': 'middle',
@@ -333,6 +335,7 @@
     this.renderTenantNodes(entering.filter('.tenant'));
     this.renderNetworkNodes(entering.filter('.network'));
     this.renderSubscriberNodes(entering.filter('.subscriber'));
+    this.renderSubscriberNodes(entering.filter('.tenantroot'));
   }
 
   private renderLinks(links: IXosServiceGraphLink[]) {
diff --git a/src/app/service-graph/graph.config.ts b/src/app/service-graph/graph.config.ts
index e94e510..4626c6d 100644
--- a/src/app/service-graph/graph.config.ts
+++ b/src/app/service-graph/graph.config.ts
@@ -23,7 +23,7 @@
 
 export const XosServiceGraphConfig: IXosServiceGraphConfig = {
   force: {
-    linkDistance: 160,
+    linkDistance: 80,
     charge: -60,
     gravity: 0.01
   },
diff --git a/src/app/service-graph/interfaces.ts b/src/app/service-graph/interfaces.ts
index b484534..0c53886 100644
--- a/src/app/service-graph/interfaces.ts
+++ b/src/app/service-graph/interfaces.ts
@@ -69,7 +69,7 @@
 }
 
 export interface IXosServiceGraphLink extends Id3Element {
-  id: number | string;
+  id: string;
   source: number;
   target: number;
   model: IXosTenantModel;
diff --git a/src/app/service-graph/services/graph.store.spec.ts b/src/app/service-graph/services/graph.store.spec.ts
index 27c6ccd..6d50a5a 100644
--- a/src/app/service-graph/services/graph.store.spec.ts
+++ b/src/app/service-graph/services/graph.store.spec.ts
@@ -13,6 +13,7 @@
   service: new Subject<any>(),
   tenant: new Subject<any>(),
   subscriber: new Subject<any>(),
+  tenantroot: new Subject<any>(),
   network: new Subject<any>(),
   servicedependency: new Subject<any>()
 };
diff --git a/src/app/service-graph/services/graph.store.ts b/src/app/service-graph/services/graph.store.ts
index 08ec52b..7908440 100644
--- a/src/app/service-graph/services/graph.store.ts
+++ b/src/app/service-graph/services/graph.store.ts
@@ -98,7 +98,7 @@
         }
       );
 
-    this.SubscriberSubscription = this.XosModelStore.query('Subscriber', '/core/subscribers')
+    this.SubscriberSubscription = this.XosModelStore.query('Tenantroot', '/core/tenantroots')
       .subscribe(
         (res) => {
           this.combineData(res, 'subscribers');
@@ -192,7 +192,8 @@
       targetId = this.d3Id('network', tenant.subscriber_network_id);
     }
     else if (tenant.subscriber_root_id) {
-      targetId = this.d3Id('subscriber', tenant.subscriber_root_id);
+      // FIXME understand what's the correct model for the subscriber
+      targetId = this.d3Id('tenantroot', tenant.subscriber_root_id);
     }
     return targetId;
   }