Vincent Fournier 844d9e0e6e Clean config.js and remove container
Change-Id: Ieeb6980232c02ec72a6a0caa707dddbacb008a6f
2015-08-26 16:45:55 -04:00

40 lines
1.7 KiB
JavaScript

'use strict';
angular.module('bansho.topbar', ['bansho.surveil'])
.directive('banshoTopbar', function () {
return {
restrict: 'E',
templateUrl: 'components/topbar/topbar.html',
controller: ['$compile', '$element', '$scope', 'authService', 'themeManager', 'viewsTemplate', 'sharedData', 'configManager',
function ($compile, $element, $scope, authService, themeManager, viewsTemplate, sharedData, configManager) {
$scope.logout = function () {
authService.logout();
};
$scope.switchTheme = function () {
themeManager.switchTheme();
};
$scope.setSize = function (size) {
themeManager.setSize(size);
};
authService.registerOnLogin(function () {
$scope.nbHosts = sharedData.getDataFromInputSource('statusHostsOpenProblems', true, null, true, function (nbHosts) {
$scope.nbHosts = nbHosts;
$scope.allProblems = $scope.nbServices + $scope.nbHosts;
});
sharedData.getDataFromInputSource('statusServicesOpenProblems', true, null, true, function (nbServices) {
$scope.nbServices = nbServices;
$scope.allProblems = $scope.nbServices + $scope.nbHosts;
});
$scope.components = configManager.getConfigData('topbar').components;
$compile($element.contents())($scope);
});
}]
};
});