Topbar bell displays the number of problems
This commit is contained in:
parent
7f3f1c35c3
commit
7408c6575c
@ -20,7 +20,7 @@
|
|||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-controls="notificationsPanel">
|
aria-controls="notificationsPanel">
|
||||||
<span class="visuallyhidden">Voir les notifications</span>
|
<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>
|
</button>
|
||||||
|
|
||||||
<div class="topbar__panel--fromleft collapse" id="notificationsPanel">
|
<div class="topbar__panel--fromleft collapse" id="notificationsPanel">
|
||||||
|
@ -2,10 +2,25 @@
|
|||||||
|
|
||||||
angular.module('adagios.topbar', ['adagios.live'])
|
angular.module('adagios.topbar', ['adagios.live'])
|
||||||
|
|
||||||
.controller('TopBarCtrl', ['$scope', 'getServiceProblems', function ($scope, getServiceProblems) {
|
.controller('TopBarCtrl', ['$scope', '$interval', 'getServiceProblems', 'getHostProblems', 'addAjaxPromise',
|
||||||
|
function ($scope, $interval, getServiceProblems, getHostProblems, addAjaxPromise) {
|
||||||
|
var getData,
|
||||||
|
hostProblems,
|
||||||
|
serviceProblems;
|
||||||
|
|
||||||
|
getData = function () {
|
||||||
getServiceProblems().success(function (data) {
|
getServiceProblems().success(function (data) {
|
||||||
$scope.serviceProblems = data.length;
|
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 () {
|
.directive('adgTopbar', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user