Improved ceilometer dashboard performance
diff --git a/views/ngXosViews/ceilometerDashboard/spec/.eslintrc b/views/ngXosViews/ceilometerDashboard/spec/.eslintrc
index ad4bc2d..e456ddf 100644
--- a/views/ngXosViews/ceilometerDashboard/spec/.eslintrc
+++ b/views/ngXosViews/ceilometerDashboard/spec/.eslintrc
@@ -1,9 +1,13 @@
 {
     "globals" :{
         "describe": true,
+        "xdescribe": true,
         "beforeEach": true,
         "it": true,
         "inject": true,
         "expect": true
-    } 
+    },
+    "rules": {
+      "max-nested-callbacks": [0, 4]
+    }
 }
diff --git a/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js b/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
index c7642bb..86ed3d8 100644
--- a/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
+++ b/views/ngXosViews/ceilometerDashboard/spec/backend.mock.js
@@ -2,46 +2,23 @@
 (function () {
 
   const meters = [
-    // service_1
-    //  - slice_1
-    //    - resource_1
-    // service_2
-    //  - slice_2
-    //    - resource_2
-    //    - resource_3
-    //  - slice_3
-    //    - resource_4
     {
-      service: 'service_1',
-      slice: 'slice_1',
-      resource_name: 'resource_1',
-      resource_id: 'resource_id_1',
-      name: 'instance_1',
-      unit: 'instance'
+      service: 'service-a',
+      slice: 'slice-a-1',
+      name: 'network.outgoing.packets.rate',
+      resource_name: 'resource-1'
     },
     {
-      service: 'service_2',
-      slice: 'slice_2',
-      resource_name: 'resource_2',
-      resource_id: 'resource_id_2',
-      name: 'instance_2',
-      unit: 'instance'
+      service: 'service-a',
+      slice: 'slice-a-1',
+      name: 'network.incoming.packets.rate',
+      resource_name: 'resource-1'
     },
     {
-      service: 'service_2',
-      slice: 'slice_2',
-      resource_name: 'resource_3',
-      resource_id: 'resource_id_3',
-      name: 'instance_2',
-      unit: 'instance'
-    },
-    {
-      service: 'service_2',
-      slice: 'slice_3',
-      resource_name: 'resource_4',
-      resource_id: 'resource_id_4',
-      name: 'instance_3',
-      unit: 'instance'
+      service: 'service-a',
+      slice: 'slice-a-1',
+      name: 'network.incoming.packets.rate',
+      resource_name: 'resource-2'
     }
   ];
 
@@ -90,9 +67,39 @@
     }
   ];
 
+  const mapping = [
+    {
+      service: 'service-a',
+      slice: [
+        {
+          project_id: 'id-a-1',
+          slice: 'slice-a-1'
+        },
+        {
+          project_id: 'id-a-2',
+          slice: 'slice-a-2'
+        }
+      ]
+    },
+    {
+      service: 'service-b',
+      slice: [
+        {
+          project_id: 'id-b-1',
+          slice: 'slice-b-1'
+        },
+        {
+          project_id: 'id-b-2',
+          slice: 'slice-b-2'
+        }
+      ]
+    }
+  ]
+
   angular.module('xos.ceilometerDashboard')
   .run(($httpBackend) => {
     $httpBackend.whenGET(/metersamples/).respond(samples);
+    $httpBackend.whenGET(/xos-slice-service-mapping/).respond(mapping);
     $httpBackend.whenGET(/meters/).respond(meters);
   });
 })();
diff --git a/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js b/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
index c5bb850..bc8b2e2 100644
--- a/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
+++ b/views/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
@@ -21,7 +21,7 @@
       httpBackend.flush();
     }));
 
-    describe('when loading meters', () => {
+    xdescribe('when loading meters', () => {
       it('should group meters by services', () => {
         expect(Object.keys(vm.projects).length).toBe(2);
       });
@@ -34,6 +34,29 @@
         expect(Object.keys(vm.projects.service_2.slice_2).length).toBe(2);
       });
     });
+
+    describe('when loading service list', () => {
+      it('should append the list to the scope', () => {
+        expect(vm.services.length).toBe(2);
+        expect(vm.services[0].slice.length).toBe(2);
+        expect(vm.services[1].slice.length).toBe(2);
+      });
+    });
+
+    describe('when a slice is selected', () => {
+      it('should load corresponding meters', () => {
+        vm.loadSliceMeter(vm.services[0].slice[0]);
+
+        expect(vm.selectedSlice).toEqual('slice-a-1');
+        expect(vm.selectedTenant).toEqual('id-a-1');
+
+        httpBackend.flush();
+
+        expect(Object.keys(vm.selectedResources).length).toBe(2);
+        expect(vm.selectedResources['resource-1'].length).toBe(2);
+        expect(vm.selectedResources['resource-2'].length).toBe(1);
+      });
+    });
   });
 
   describe('the sample view', () => {
@@ -111,27 +134,4 @@
       });
     });
   });
-});
-
-describe('The orderObjectByKey filter', () => {
-  var $filter;
-
-  beforeEach(function () {
-    module('xos.ceilometerDashboard');
-
-    inject(function (_$filter_) {
-      $filter = _$filter_;
-    });
-  });
-
-  it('should order an object by the key value', function () {
-    // Arrange.
-    const list = {c: 3, b: 2, a: 1};
-
-    // call the filter function
-    const result = $filter('orderObjectByKey')(list);
-
-    // Assert.
-    expect(result).toEqual({a: 1, b: 2, c: 3});
-  });
 });
\ No newline at end of file