Number of problems display real data
This commit is contained in:
parent
dd0db2a0dc
commit
94b88729c3
@ -12,7 +12,7 @@ angular.module('adagios.live')
|
|||||||
regex: '__regex'
|
regex: '__regex'
|
||||||
})
|
})
|
||||||
|
|
||||||
.factory('getServices', ['$http', 'filterSuffixes',
|
.service('getServices', ['$http', 'filterSuffixes',
|
||||||
function ($http, filterSuffixes) {
|
function ($http, filterSuffixes) {
|
||||||
return function (columns, filters, apiName, additionnalFields) {
|
return function (columns, filters, apiName, additionnalFields) {
|
||||||
var filtersQuery = '',
|
var filtersQuery = '',
|
||||||
@ -51,4 +51,60 @@ angular.module('adagios.live')
|
|||||||
throw new Error('getServices : GET Request failed');
|
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');
|
||||||
|
});
|
||||||
}]);
|
}]);
|
||||||
|
@ -40,7 +40,10 @@
|
|||||||
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
|
<div role="tabpanel" class="problems tab-pane active" id="openProblems">
|
||||||
<header class="main__content__header clearfix">
|
<header class="main__content__header clearfix">
|
||||||
<h2 class="main__content__title">{{dashboardTables[0].title}}</h2>
|
<h2 class="main__content__title">{{dashboardTables[0].title}}</h2>
|
||||||
<p class="main__content__alert state--error">There are {{nbHostProblems}} host problems.</p>
|
<p class="main__content__alert state--error">
|
||||||
|
There are {{nbHostOpenProblems}} host
|
||||||
|
<ng-pluralize count="nbHostOpenProblems" when="{'0':'problem', '1': 'problem', 'other': 'problems'}"/>
|
||||||
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<adg-table cells-text="{{dashboardTables[0].CellsText}}"
|
<adg-table cells-text="{{dashboardTables[0].CellsText}}"
|
||||||
@ -55,7 +58,10 @@
|
|||||||
|
|
||||||
<header class="main__content__header clearfix">
|
<header class="main__content__header clearfix">
|
||||||
<h2 class="main__content__title">{{dashboardTables[1].title}}</h2>
|
<h2 class="main__content__title">{{dashboardTables[1].title}}</h2>
|
||||||
<p class="main__content__alert state--error">There are {{nbHostProblems}} host problems.</p>
|
<p class="main__content__alert state--error">
|
||||||
|
There are {{nbServiceOpenProblems}} host
|
||||||
|
<ng-pluralize count="nbServiceOpenProblems" when="{'0':'problem', '1': 'problem', 'other': 'problems'}"/>
|
||||||
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<adg-table cells-text="{{dashboardTables[1].CellsText}}"
|
<adg-table cells-text="{{dashboardTables[1].CellsText}}"
|
||||||
@ -73,7 +79,10 @@
|
|||||||
<div role="tabpanel" class="problems tab-pane" id="allProblems">
|
<div role="tabpanel" class="problems tab-pane" id="allProblems">
|
||||||
<header class="main__content__header clearfix">
|
<header class="main__content__header clearfix">
|
||||||
<h2 class="main__content__title">{{dashboardTables[2].title}}</h2>
|
<h2 class="main__content__title">{{dashboardTables[2].title}}</h2>
|
||||||
<p class="main__content__alert state--error">There are {{nbHostProblems}} host problems.</p>
|
<p class="main__content__alert state--error">
|
||||||
|
There are {{nbHostProblems}} host
|
||||||
|
<ng-pluralize count="nbHostProblems" when="{'0':'problem', '1': 'problem', 'other': 'problems'}"/>
|
||||||
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<adg-table cells-text="{{dashboardTables[2].CellsText}}"
|
<adg-table cells-text="{{dashboardTables[2].CellsText}}"
|
||||||
@ -87,7 +96,10 @@
|
|||||||
|
|
||||||
<header class="main__content__header clearfix">
|
<header class="main__content__header clearfix">
|
||||||
<h2 class="main__content__title">{{dashboardTables[3].title}}</h2>
|
<h2 class="main__content__title">{{dashboardTables[3].title}}</h2>
|
||||||
<p class="main__content__alert state--error">There are {{nbHostProblems}} host problems.</p>
|
<p class="main__content__alert state--error">
|
||||||
|
There are {{nbServiceProblems}} service
|
||||||
|
<ng-pluralize count="nbServiceProblems" when="{'0':'problem', '1': 'problem', 'other': 'problems'}"/>
|
||||||
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<adg-table cells-text="{{dashboardTables[3].CellsText}}"
|
<adg-table cells-text="{{dashboardTables[3].CellsText}}"
|
||||||
@ -98,7 +110,6 @@
|
|||||||
no-repeat-cell="{{dashboardTables[3].NoRepeatCell}}"
|
no-repeat-cell="{{dashboardTables[3].NoRepeatCell}}"
|
||||||
refresh-interval="{{dashboardRefreshInterval}}"
|
refresh-interval="{{dashboardRefreshInterval}}"
|
||||||
table-id="3"></adg-table>
|
table-id="3"></adg-table>
|
||||||
<p>Pas de tableaux encore pour All problems.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -15,13 +15,12 @@ angular.module('adagios.view.dashboard', ['ngRoute',
|
|||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('DashboardCtrl', ['$scope', '$routeParams', 'dashboardConfig', 'getServices', 'tableConfig', 'TableConfigObj', 'TacticalConfigObj',
|
.controller('DashboardCtrl', ['$scope', '$routeParams', 'dashboardConfig', 'getServices', 'tableConfig',
|
||||||
function ($scope, $routeParams, dashboardConfig, getServices, tableConfig, TableConfigObj, TacticalConfigObj) {
|
'TableConfigObj', 'TacticalConfigObj', 'getHostOpenProblems', 'getServiceOpenProblems', 'getHostProblems',
|
||||||
|
'getServiceProblems',
|
||||||
var fields = ['state'],
|
function ($scope, $routeParams, dashboardConfig, getServices, tableConfig, TableConfigObj,
|
||||||
filters = {'isnot' : { 'state' : ['0'] }},
|
TacticalConfigObj, getHostOpenProblems, getServiceOpenProblems, getHostProblems, getServiceProblems) {
|
||||||
apiName = 'hosts',
|
var components = [],
|
||||||
components = [],
|
|
||||||
component,
|
component,
|
||||||
config,
|
config,
|
||||||
viewName,
|
viewName,
|
||||||
@ -55,10 +54,21 @@ angular.module('adagios.view.dashboard', ['ngRoute',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getServices(fields, filters, apiName)
|
getHostOpenProblems.success(function (data) {
|
||||||
.success(function (data) {
|
$scope.nbHostOpenProblems = data.length;
|
||||||
$scope.nbHostProblems = data.length;
|
});
|
||||||
});
|
|
||||||
|
getServiceOpenProblems.success(function (data) {
|
||||||
|
$scope.nbServiceOpenProblems = data.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
getHostProblems.success(function (data) {
|
||||||
|
$scope.nbHostProblems = data.length;
|
||||||
|
});
|
||||||
|
|
||||||
|
getServiceProblems.success(function (data) {
|
||||||
|
$scope.nbServiceProblems = data.length;
|
||||||
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) {
|
.run(['readConfig', 'dashboardConfig', function (readConfig, dashboardConfig) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user