Fixed diagnostic dashboard

Change-Id: Ic46da11d822fd5b4e381a5846dfe4203d03a8849
diff --git a/views/ngXosViews/diagnostic/src/icons/diagnostic-icon-active.png b/views/ngXosViews/diagnostic/src/icons/diagnostic-icon-active.png
new file mode 100644
index 0000000..1c83da9
--- /dev/null
+++ b/views/ngXosViews/diagnostic/src/icons/diagnostic-icon-active.png
Binary files differ
diff --git a/views/ngXosViews/diagnostic/src/icons/diagnostic-icon.png b/views/ngXosViews/diagnostic/src/icons/diagnostic-icon.png
new file mode 100644
index 0000000..b5d91ed
--- /dev/null
+++ b/views/ngXosViews/diagnostic/src/icons/diagnostic-icon.png
Binary files differ
diff --git a/views/ngXosViews/diagnostic/src/js/chart_data_service.js b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
index 63923e8..7526025 100644
--- a/views/ngXosViews/diagnostic/src/js/chart_data_service.js
+++ b/views/ngXosViews/diagnostic/src/js/chart_data_service.js
@@ -91,9 +91,10 @@
 
     this.getSubscriberTag = (subscriber) => {
       const tags = {
-        cTag: subscriber.c_tag,
-        sTag: subscriber.s_tag
+        cTag: subscriber.related.c_tag,
+        sTag: subscriber.related.s_tag
       };
+      console.log(subscriber);
       
       this.addSubscriberTag(tags);
       // add tags info to current subscriber
@@ -102,9 +103,7 @@
     };
 
     this.getSubscriberIP = (subscriber) => {
-      // const ip = JSON.parse(this.currentServiceChain.children[0].children[0].tenant.service_specific_attribute).wan_container_ip;
-      // const ip = this.currentServiceChain.children[0].children[0].tenant.wan_container_ip;
-      this.logicTopologyData.children[0].subscriberIP = subscriber.wan_container_ip;
+      this.logicTopologyData.children[0].subscriberIP = subscriber.related.wan_container_ip;
     };
 
     this.selectSubscriber = (subscriber) => {
diff --git a/views/ngXosViews/diagnostic/src/js/diagnostic.js b/views/ngXosViews/diagnostic/src/js/diagnostic.js
index 7d97fdb..47f5e8e 100644
--- a/views/ngXosViews/diagnostic/src/js/diagnostic.js
+++ b/views/ngXosViews/diagnostic/src/js/diagnostic.js
@@ -6,7 +6,7 @@
       restrict: 'E',
       templateUrl: 'templates/diagnostic.tpl.html',
       controllerAs: 'vm',
-      controller: function(ChartData, Subscribers, ServiceRelation, $rootScope, $log){
+      controller: function(ChartData, Subscribers, SubscribersWithDevice, ServiceRelation, $rootScope){
 
         this.loader = true;
         this.error = false;
@@ -43,7 +43,7 @@
           .then((serviceChain) => {
             this.serviceChain = serviceChain;
             ChartData.currentServiceChain = serviceChain;
-            return Subscribers.getWithDevices({id: subscriber.id}).$promise;
+            return SubscribersWithDevice.get({id: subscriber.id}).$promise;
           })
           .then((subscriber) => {
             this.selectedSubscriber = subscriber;
diff --git a/views/ngXosViews/diagnostic/src/js/rest_services.js b/views/ngXosViews/diagnostic/src/js/rest_services.js
index fa2fc8f..50a276c 100644
--- a/views/ngXosViews/diagnostic/src/js/rest_services.js
+++ b/views/ngXosViews/diagnostic/src/js/rest_services.js
@@ -163,80 +163,30 @@
       }
     });
   })
-  .service('Subscribers', function($resource, $q, SubscriberDevice){
-    return $resource('/xoslib/cordsubscriber/:id', {id: '@id'}, {
-      update: {
-        method: 'PUT',
-        isArray: false
-      },
-      queryWithDevices: {
-        method: 'GET',
-        isArray: true,
-        interceptor: {
-          response: function(res){
+  // TODO extend the resource in xosLib
+  .service('SubscribersWithDevice', function($http, $q, Subscribers){
 
-            /**
-            * For each subscriber retrieve devices and append them
-            */
+    this.get = (s) => {
+      const d = $q.defer();
+      let subscriber;
 
-            let deferred = $q.defer();
+      Subscribers.get({id: s.id}).$promise
+      .then(res => {
+        subscriber = res;
+        return $http.get(`/api/tenant/cord/subscriber/${subscriber.id}/devices/`);
+      })
+      .then(res => {
+        res.data.map(d => d.type = 'device');
+        subscriber.devices = res.data;
+        subscriber.type = 'subscriber';
+        d.resolve(subscriber);
+      })
+      .catch(err => {
+        d.reject(err);
+      });
+      return {$promise: d.promise};
+    };
 
-            let requests = [];
-
-            angular.forEach(res.data, (subscriber) => {
-              requests.push(SubscriberDevice.query({id: subscriber.id}).$promise);
-            })
-
-            $q.all(requests)
-            .then((list) => {
-
-              // adding devices
-
-              res.data.map((subscriber, i) => {
-                subscriber.devices = list[i];
-                subscriber.type = 'subscriber';
-
-                subscriber.devices.map(d => d.type = 'device')
-
-                return subscriber;
-              });
-
-              // faking to have 2 subscriber
-              // res.data.push(angular.copy(res.data[0]));
-
-              deferred.resolve(res.data);
-            })
-
-            return deferred.promise;
-          }
-        }
-      },
-      getWithDevices: {
-        method: 'GET',
-        isArray: false,
-        interceptor: {
-          response: (res) => {
-            let d = $q.defer();
-
-            SubscriberDevice.query({id: res.data.id}).$promise
-            .then(devices => {
-              devices.map(d => d.type = 'device');
-              res.data.devices = devices;
-              res.data.type = 'subscriber';
-              d.resolve(res.data);
-            })
-            .catch(err => {
-              d.reject(err);
-            });
-
-            return d.promise;
-          }
-        }
-      }
-    });
-  })
-  .service('SubscriberDevice', function($resource){
-    return $resource('/xoslib/rs/subscriber/:id/users/', {id: '@id'});
   })
   .service('ServiceRelation', function($q, _, Services, Tenant, Slice, Instances){
 
diff --git a/views/ngXosViews/diagnostic/src/js/serviceTopology.js b/views/ngXosViews/diagnostic/src/js/serviceTopology.js
index 832e6fa..cf0b34f 100644
--- a/views/ngXosViews/diagnostic/src/js/serviceTopology.js
+++ b/views/ngXosViews/diagnostic/src/js/serviceTopology.js
@@ -11,7 +11,7 @@
       bindToController: true,
       controllerAs: 'vm',
       template: '',
-      controller: function($element, $window, $scope, d3, serviceTopologyConfig, ServiceRelation, Slice, Instances, Subscribers, ServiceTopologyHelper){
+      controller: function($element, $window, $scope, d3, serviceTopologyConfig, ServiceRelation, Instances, Subscribers, ServiceTopologyHelper){
 
         const el = $element[0];