Topbar bell displays the number of problems
This commit is contained in:
parent
7f3f1c35c3
commit
7408c6575c
@ -20,7 +20,7 @@
|
||||
aria-expanded="false"
|
||||
aria-controls="notificationsPanel">
|
||||
<span class="visuallyhidden">Voir les notifications</span>
|
||||
<i class="ico-bell-alt" data-notifications="{{serviceProblems}}"></i>
|
||||
<i class="ico-bell-alt" data-notifications="{{allProblems}}"></i>
|
||||
</button>
|
||||
|
||||
<div class="topbar__panel--fromleft collapse" id="notificationsPanel">
|
||||
|
@ -2,11 +2,26 @@
|
||||
|
||||
angular.module('adagios.topbar', ['adagios.live'])
|
||||
|
||||
.controller('TopBarCtrl', ['$scope', 'getServiceProblems', function ($scope, getServiceProblems) {
|
||||
getServiceProblems().success(function (data) {
|
||||
$scope.serviceProblems = data.length;
|
||||
});
|
||||
}])
|
||||
.controller('TopBarCtrl', ['$scope', '$interval', 'getServiceProblems', 'getHostProblems', 'addAjaxPromise',
|
||||
function ($scope, $interval, getServiceProblems, getHostProblems, addAjaxPromise) {
|
||||
var getData,
|
||||
hostProblems,
|
||||
serviceProblems;
|
||||
|
||||
getData = function () {
|
||||
getServiceProblems().success(function (data) {
|
||||
serviceProblems = data.length;
|
||||
getHostProblems().success(function (data) {
|
||||
hostProblems = data.length;
|
||||
$scope.allProblems = serviceProblems + hostProblems;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// TODO: Change hardcoded interval when the topbar dashboard will be implemented
|
||||
addAjaxPromise($interval(getData, 10000));
|
||||
getData();
|
||||
}])
|
||||
|
||||
.directive('adgTopbar', function () {
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user