Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 1 | 'use strict'; |
| 2 | (function () { |
| 3 | |
| 4 | const meters = [ |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 5 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 6 | service: 'service-a', |
| 7 | slice: 'slice-a-1', |
| 8 | name: 'network.outgoing.packets.rate', |
| 9 | resource_name: 'resource-1' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 10 | }, |
| 11 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 12 | service: 'service-a', |
| 13 | slice: 'slice-a-1', |
| 14 | name: 'network.incoming.packets.rate', |
| 15 | resource_name: 'resource-1' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 16 | }, |
| 17 | { |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 18 | service: 'service-a', |
| 19 | slice: 'slice-a-1', |
| 20 | name: 'network.incoming.packets.rate', |
| 21 | resource_name: 'resource-2' |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 22 | } |
| 23 | ]; |
| 24 | |
| 25 | const samples = [ |
| 26 | { |
| 27 | meter: 'cpu', |
| 28 | resource_name: 'fakeName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 29 | resource_id: 'fakeTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 30 | timestamp: '2015-12-15T00:34:08', |
| 31 | volume: 110 |
| 32 | }, |
| 33 | { |
| 34 | meter: 'cpu', |
| 35 | resource_name: 'fakeName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 36 | resource_id: 'fakeTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 37 | timestamp: '2015-12-15T00:44:08', |
| 38 | volume: 120 |
| 39 | }, |
| 40 | { |
| 41 | meter: 'cpu', |
| 42 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 43 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 44 | timestamp: '2015-12-15T00:24:08', |
| 45 | volume: 210 |
| 46 | }, |
| 47 | { |
| 48 | meter: 'cpu', |
| 49 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 50 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 51 | timestamp: '2015-12-15T00:34:08', |
| 52 | volume: 220 |
| 53 | }, |
| 54 | { |
| 55 | meter: 'cpu', |
| 56 | resource_name: 'anotherName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 57 | resource_id: 'anotherTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 58 | timestamp: '2015-12-15T00:44:08', |
| 59 | volume: 230 |
| 60 | }, |
| 61 | { |
| 62 | meter: 'cpu', |
| 63 | resource_name: 'thirdName', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 64 | resource_id: 'thirdTenant', |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 65 | timestamp: '2015-12-15T00:44:08', |
| 66 | volume: 310 |
| 67 | } |
| 68 | ]; |
| 69 | |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 70 | const mapping = [ |
| 71 | { |
| 72 | service: 'service-a', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 73 | slices: [ |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 74 | { |
| 75 | project_id: 'id-a-1', |
| 76 | slice: 'slice-a-1' |
| 77 | }, |
| 78 | { |
| 79 | project_id: 'id-a-2', |
| 80 | slice: 'slice-a-2' |
| 81 | } |
| 82 | ] |
| 83 | }, |
| 84 | { |
| 85 | service: 'service-b', |
Matteo Scandolo | 8420f62 | 2016-03-24 11:38:50 -0700 | [diff] [blame] | 86 | slices: [ |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 87 | { |
| 88 | project_id: 'id-b-1', |
| 89 | slice: 'slice-b-1' |
| 90 | }, |
| 91 | { |
| 92 | project_id: 'id-b-2', |
| 93 | slice: 'slice-b-2' |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | ] |
| 98 | |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 99 | angular.module('xos.ceilometerDashboard') |
| 100 | .run(($httpBackend) => { |
| 101 | $httpBackend.whenGET(/metersamples/).respond(samples); |
Matteo Scandolo | 9db064f | 2016-02-08 14:17:42 -0800 | [diff] [blame] | 102 | $httpBackend.whenGET(/xos-slice-service-mapping/).respond(mapping); |
Matteo Scandolo | 1b9ffac | 2015-12-14 17:36:09 -0800 | [diff] [blame] | 103 | $httpBackend.whenGET(/meters/).respond(meters); |
| 104 | }); |
| 105 | })(); |