diff --git a/app/components/live/get_services.js b/app/components/live/get_services.js index 4d1e6cc..2a1558c 100644 --- a/app/components/live/get_services.js +++ b/app/components/live/get_services.js @@ -12,7 +12,7 @@ angular.module('adagios.live') regex: '__regex' }) - .factory('getServices', ['$http', 'filterSuffixes', + .service('getServices', ['$http', 'filterSuffixes', function ($http, filterSuffixes) { return function (columns, filters, apiName, additionnalFields) { var filtersQuery = '', @@ -51,4 +51,60 @@ angular.module('adagios.live') throw new Error('getServices : GET Request failed'); }); }; + }]) + + // This service is used to count the number of host open problems + .service('getHostOpenProblems', ['$http', 'getServices', + function ($http, getServices) { + var fields = ['state'], + filters = {}, + apiName = 'hosts', + additionnalQueryFields = {'acknowledged': 0, 'state': 1}; + + return getServices(fields, filters, apiName, additionnalQueryFields) + .error(function () { + throw new Error('getServices : GET Request failed'); + }); + }]) + + // This service is used to count the number of service open problems + .service('getServiceOpenProblems', ['$http', 'getServices', + function ($http, getServices) { + var fields = ['state'], + filters = { "isnot": { "state": [ "0" ], "host_state": [ "2" ] }}, + apiName = 'services', + additionnalQueryFields = {'acknowledged': 0}; + + return getServices(fields, filters, apiName, additionnalQueryFields) + .error(function () { + throw new Error('getServices : GET Request failed'); + }); + }]) + + // This service is used to count the number of host problems + .service('getHostProblems', ['$http', 'getServices', + function ($http, getServices) { + var fields = ['state'], + filters = { 'isnot': {'state': [0]} }, + apiName = 'hosts', + additionnalQueryFields = {}; + + return getServices(fields, filters, apiName, additionnalQueryFields) + .error(function () { + throw new Error('getServices : GET Request failed'); + }); + }]) + + // This service is used to count the number of service problems + .service('getServiceProblems', ['$http', 'getServices', + function ($http, getServices) { + var fields = ['state'], + filters = { 'isnot': {'state': [0]} }, + apiName = 'services', + additionnalQueryFields = {}; + + return getServices(fields, filters, apiName, additionnalQueryFields) + .error(function () { + throw new Error('getServices : GET Request failed'); + }); }]); diff --git a/app/dashboard/dashboard.html b/app/dashboard/dashboard.html index 6ad534d..4db0a83 100644 --- a/app/dashboard/dashboard.html +++ b/app/dashboard/dashboard.html @@ -40,7 +40,10 @@
There are {{nbHostProblems}} host problems.
+
+ There are {{nbHostOpenProblems}} host
+
There are {{nbHostProblems}} host problems.
+
+ There are {{nbServiceOpenProblems}} host
+
There are {{nbHostProblems}} host problems.
+
+ There are {{nbHostProblems}} host
+
There are {{nbHostProblems}} host problems.
+
+ There are {{nbServiceProblems}} service
+
Pas de tableaux encore pour All problems.