diff --git a/Gruntfile.js b/Gruntfile.js index 0d411f4..db446fb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -18,13 +18,13 @@ module.exports = function (grunt) { clean: { dist: [ - '<%= project.dist %>/assets/', - '<%= project.dist %>/bower_components/', - '<%= project.dist %>/components/', - '<%= project.dist %>/js/', - '<%= project.dist %>/templates/', - '<%= project.dist %>/index.html' - ], + '<%= project.dist %>/assets/', + '<%= project.dist %>/bower_components/', + '<%= project.dist %>/components/', + '<%= project.dist %>/js/', + '<%= project.dist %>/templates/', + '<%= project.dist %>/index.html' + ], tmp: ['<%= project.tmp %>/'] }, @@ -84,31 +84,31 @@ module.exports = function (grunt) { }, jshint: { // configure the task - options: { - node: true, - loopfunc: true, - globals: { - document: true, - angular: true, - jQuery: true, - $: true, - describe: true, - it: true, - expect: true, - beforeEach: true, - inject: true - }, - force: true - }, - all: [ - 'karma.conf.js', - 'Gruntfile.js', - '<%= project.app %>/app.js', - '<%= project.app %>/**/*.js', - '!<%= project.app %>/bower_components/**', - '!<%= project.app %>/**/live.js', - '!<%= project.app %>/**/adagios.js' - ] + options: { + node: true, + loopfunc: true, + globals: { + document: true, + angular: true, + jQuery: true, + $: true, + describe: true, + it: true, + expect: true, + beforeEach: true, + inject: true + }, + force: true + }, + all: [ + 'karma.conf.js', + 'Gruntfile.js', + '<%= project.app %>/app.js', + '<%= project.app %>/**/*.js', + '!<%= project.app %>/bower_components/**', + '!<%= project.app %>/**/live.js', + '!<%= project.app %>/**/adagios.js' + ] }, useminPrepare: { @@ -166,8 +166,8 @@ module.exports = function (grunt) { '<%= project.app %>/components/live/surveil.js', '<%= project.assets %>/sass/{,*/}*.{scss,sass}' ], - tasks: ['production:surveil'] - }, + tasks: ['production:surveil'] + }, options: { livereload: true } diff --git a/app/app.js b/app/app.js index 1fb4a0b..8ec0950 100644 --- a/app/app.js +++ b/app/app.js @@ -2,7 +2,8 @@ angular.module('bansho', [ 'ngRoute', - 'angular.filter', + 'ngCookies', + 'angular.filter', 'bansho.config', 'bansho.authentication', 'bansho.utils.promiseManager', diff --git a/app/assets/js/scripts.js b/app/assets/js/scripts.js index e00113b..b88172a 100644 --- a/app/assets/js/scripts.js +++ b/app/assets/js/scripts.js @@ -1,22 +1,22 @@ var AdagiosUI = (function() { "use strict"; - // States for UI modifications - var state = { - visible: 'state--visible', - hidden: 'state--hidden', - current: 'state--current', - open: 'state--open', - fadeIn: 'state--fadein', - fadeOut: 'state--fadeout', - hasChild: 'state--haschild' - }; + // States for UI modifications + var state = { + visible: 'state--visible', + hidden: 'state--hidden', + current: 'state--current', + open: 'state--open', + fadeIn: 'state--fadein', + fadeOut: 'state--fadeout', + hasChild: 'state--haschild' + }; - // Breakpoints for the responsive web design - var mquery = { - phone: 480, - tablet: 959 - }; + // Breakpoints for the responsive web design + var mquery = { + phone: 480, + tablet: 959 + }; var test = function() { console.log(); @@ -37,12 +37,12 @@ var AdagiosUI = (function() { }); }; - return { - state: state, - test: test, - mquery: mquery, + return { + state: state, + test: test, + mquery: mquery, syncBkgCheckbox : syncBkgCheckbox, closeSidebar : closeSidebar - }; + }; })(); diff --git a/app/assets/sass/app.scss b/app/assets/sass/app.scss index 5f0022c..73ba480 100644 --- a/app/assets/sass/app.scss +++ b/app/assets/sass/app.scss @@ -55,3 +55,8 @@ @import '../../components/topbar/topbar'; @import '../../components/sidebar/sidebar'; @import '../../components/tactical/tactical'; + +//----------------------------------*\ +// TEMPORARY MODULES +//----------------------------------*/ +@import 'temporary'; diff --git a/app/assets/sass/global/_default.scss b/app/assets/sass/global/_default.scss index c74d4ff..88a119f 100644 --- a/app/assets/sass/global/_default.scss +++ b/app/assets/sass/global/_default.scss @@ -207,7 +207,7 @@ table { //overflow-x:auto; //@include medium-and-up-screen { - // display:table; + // display:table; // overflow-x:visible; //} } diff --git a/app/assets/sass/global/_helpers.scss b/app/assets/sass/global/_helpers.scss index e7d9c68..8b4e935 100644 --- a/app/assets/sass/global/_helpers.scss +++ b/app/assets/sass/global/_helpers.scss @@ -34,15 +34,15 @@ position: absolute; width: 1px; - &.focusable:active, - &.focusable:focus { - clip: auto; - height: auto; - margin: 0; - overflow: visible; - position: static; - width: auto; - } + &.focusable:active, + &.focusable:focus { + clip: auto; + height: auto; + margin: 0; + overflow: visible; + position: static; + width: auto; + } } diff --git a/app/assets/sass/modules-objects/_panes.scss b/app/assets/sass/modules-objects/_panes.scss index 41aa5ab..d426c9b 100644 --- a/app/assets/sass/modules-objects/_panes.scss +++ b/app/assets/sass/modules-objects/_panes.scss @@ -10,7 +10,7 @@ @include medium-and-up-screen { border:0; - display:table; + display:table; min-height:0; overflow-x:visible; width:100%; diff --git a/app/assets/sass/temporary.scss b/app/assets/sass/temporary.scss new file mode 100644 index 0000000..d567286 --- /dev/null +++ b/app/assets/sass/temporary.scss @@ -0,0 +1,32 @@ +.centered { + position: fixed; + margin-top: 15px; + left: 50%; + transform: translate(-50%); +} + +.bansho-title { + color: #ddd; + font-size: 300%; + padding-bottom: 0px; + margin-bottom: 0px; +} + +.form-group { + padding-top: 5px; + padding-bottom: 15px; +} + +.form-control { + width: 500px; +} + +.field { + float: right; + width: 400px; +} + +.label { + width: 85px; + padding-right: 15px; +} diff --git a/app/components/authentication/authentication.html b/app/components/authentication/authentication.html index b0d3df1..122f4d6 100644 --- a/app/components/authentication/authentication.html +++ b/app/components/authentication/authentication.html @@ -1,19 +1,31 @@ -
+
+

Bansho

+

Web client for Surveil

- - +

Login

+
+ - - +
+ + +
- - +
+ + +
- +
+ + +
- + + +
diff --git a/app/components/authentication/authentication.js b/app/components/authentication/authentication.js index 54a41c5..736160b 100644 --- a/app/components/authentication/authentication.js +++ b/app/components/authentication/authentication.js @@ -10,7 +10,7 @@ angular.module('bansho.authentication', []) }]) .controller('LoginController', ['$scope', '$rootScope', '$location', 'authService', 'configManager', function ($scope, $rootScope, $location, authService, configManager) { - var login = function (credentials) { + var login = function (credentials) { authService.login(credentials); }; @@ -25,27 +25,31 @@ angular.module('bansho.authentication', []) }; $scope.login = function() { - login($scope.credentials); - }; - - configManager.loadDevelopmentConfig().then(function () { - var devConfig = configManager.getDevelopmentConfig(); - if (devConfig.env === 'development') { - login({ - 'auth': { - 'tenantName': '', - 'passwordCredentials': { - 'username': devConfig.username, - 'password': devConfig.password - } - } - }); - } + login($scope.credentials); + }; + + if (authService.isAuthenticated()) { + login($scope.credentials); + } + + configManager.loadDevelopmentConfig().then(function () { + var devConfig = configManager.getDevelopmentConfig(); + if (devConfig.env === 'development') { + login({ + 'auth': { + 'tenantName': '', + 'passwordCredentials': { + 'username': devConfig.username, + 'password': devConfig.password + } + } + }); + } + + }, function () { + // Development config failed + }); - }, function () { - // Development config failed - }); - }]) .factory('authService', ['$http', '$location', '$rootScope', 'session', 'configManager', function ($http, $location, $rootScope, session, configManager) { @@ -73,21 +77,33 @@ angular.module('bansho.authentication', []) }; authService.isAuthenticated = function () { - return !!session.sessionId; + return !!session.isUserConnected(); }; + authService.logout = function () { + $rootScope.isAuthenticated = false; + session.destroy(); + $location.path('/login'); + }; + + return authService; }]) - .service('session', function () { + .service('session', ['$cookies', function ($cookies) { + this.isUserConnected = function () { + return $cookies.connected === 'true'; + }; this.create = function (sessionId, expirationTime) { this.sessionId = sessionId; this.expirationTime = expirationTime; + $cookies.connected = 'true'; }; this.destroy = function () { this.sessionId = null; this.expirationTime = null; + $cookies.connected = 'false'; }; - }); + }]); diff --git a/app/components/config/config.js b/app/components/config/config.js index f4d8b08..4f5cbf6 100644 --- a/app/components/config/config.js +++ b/app/components/config/config.js @@ -5,26 +5,26 @@ angular.module('bansho.config', []) .service('configManager', ['$http', '$q', function ($http, $q) { var config = {}, - developmentConfig = {}; + developmentConfig = {}; - this.loadDevelopmentConfig = function() { - var promise = $q.defer(); + this.loadDevelopmentConfig = function() { + var promise = $q.defer(); - $http.get('components/config/developmentConfig.json') - .success(function (config) { - developmentConfig = config; - promise.resolve(); - }) - .error(function() { - promise.reject(); - }); + $http.get('components/config/developmentConfig.json') + .success(function (config) { + developmentConfig = config; + promise.resolve(); + }) + .error(function() { + promise.reject(); + }); - return promise.promise; - }; + return promise.promise; + }; - this.getDevelopmentConfig = function () { - return developmentConfig; - }; + this.getDevelopmentConfig = function () { + return developmentConfig; + }; this.loadByTemplate = function (templateName, destination) { var viewsConfig = config.data; diff --git a/app/components/config/config.json b/app/components/config/config.json index 3550238..c06f47c 100644 --- a/app/components/config/config.json +++ b/app/components/config/config.json @@ -219,13 +219,13 @@ ] }, "host": { - "title": "Host", - "refreshInterval": 0, - "template": "host" + "title": "Host", + "refreshInterval": 0, + "template": "host" }, "service": { - "title": "Service", - "refreshInterval": 0, - "template": "service" + "title": "Service", + "refreshInterval": 0, + "template": "service" } } diff --git a/app/components/config/developmentConfig.json b/app/components/config/developmentConfig.json index c1ec75c..c71ac72 100644 --- a/app/components/config/developmentConfig.json +++ b/app/components/config/developmentConfig.json @@ -1,5 +1,5 @@ { - "env": "development", - "username":"", - "password":"" + "env": "production", + "username":"", + "password":"" } diff --git a/app/components/live/surveil.js b/app/components/live/surveil.js index 5fdc754..90294e1 100644 --- a/app/components/live/surveil.js +++ b/app/components/live/surveil.js @@ -324,20 +324,20 @@ angular.module('bansho.live', []) }; var acknowledge = function (host_name, service_description, attrs) { - var data = {}; + var data = {}; data.host_name = host_name; - if (attrs.sticky) { - data.sticky = parseInt(attrs.sticky, 10); - } + if (attrs.sticky) { + data.sticky = parseInt(attrs.sticky, 10); + } - if (attrs.notify) { - data.notify = parseInt(attrs.notify, 10); - } + if (attrs.notify) { + data.notify = parseInt(attrs.notify, 10); + } - if (attrs.persistent) { - data.persistent = parseInt(attrs.persistent, 10); - } + if (attrs.persistent) { + data.persistent = parseInt(attrs.persistent, 10); + } if (service_description !== undefined) { data.service_description = service_description; @@ -353,47 +353,47 @@ angular.module('bansho.live', []) }; var downtime = function (host_name, service_description, attrs) { - attrs.host_name = host_name; + attrs.host_name = host_name; if (service_description !== undefined) { attrs.service_description = service_description; } - return $http({ - url: '/surveil/v2/actions/downtime/', - method: 'POST', - data: attrs - }); + return $http({ + url: '/surveil/v2/actions/downtime/', + method: 'POST', + data: attrs + }); }; var recheck = function (host_name, service_description) { - var attrs = {}; - attrs.host_name = host_name; + var attrs = {}; + attrs.host_name = host_name; if (service_description !== undefined) { attrs.service_description = service_description; } - return $http({ - url: '/surveil/v2/actions/recheck/', - method: 'POST', - data: attrs - }); + return $http({ + url: '/surveil/v2/actions/recheck/', + method: 'POST', + data: attrs + }); }; - return { - getHost: getHost, - getObjects : getObjects, - getService : getService, - hostQueryTransform: hostQueryTransform, - acknowledge: acknowledge, - getHostOpenProblems: getHostOpenProblems, - hostMiddleware: hostMiddleware, - getServiceProblems: getServiceProblems, - getServiceOpenProblems: getServiceOpenProblems, - getHostProblems: getHostProblems, - getTableData: getTableData, - getTotalHosts: getTotalHosts, - getTotalServices: getTotalServices, - downtime: downtime, - recheck: recheck + return { + getHost: getHost, + getObjects : getObjects, + getService : getService, + hostQueryTransform: hostQueryTransform, + acknowledge: acknowledge, + getHostOpenProblems: getHostOpenProblems, + hostMiddleware: hostMiddleware, + getServiceProblems: getServiceProblems, + getServiceOpenProblems: getServiceOpenProblems, + getHostProblems: getHostProblems, + getTableData: getTableData, + getTotalHosts: getTotalHosts, + getTotalServices: getTotalServices, + downtime: downtime, + recheck: recheck }; }]); diff --git a/app/components/table/actionbar/actionbar.html b/app/components/table/actionbar/actionbar.html index 34f5d38..7a1a3f7 100644 --- a/app/components/table/actionbar/actionbar.html +++ b/app/components/table/actionbar/actionbar.html @@ -1,90 +1,90 @@ - - + - + diff --git a/app/components/table/actionbar/actionbar.js b/app/components/table/actionbar/actionbar.js index 2895a37..bae53c3 100644 --- a/app/components/table/actionbar/actionbar.js +++ b/app/components/table/actionbar/actionbar.js @@ -30,19 +30,19 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live']) .controller('TableActionbarCtrl', ['$scope', '$filter', 'backendClient', 'actionbarFilters', 'tablesConfig', function ($scope, $filter, backendClient, actionbarFilters, tablesConfig, actionbarSelectFilter) { $scope.isDowntimeShown = false; - $scope.isAcknowledgeShown = false; + $scope.isAcknowledgeShown = false; - $scope.switchDowntimeForm = function () { - $scope.isAcknowledgeShown = false; + $scope.switchDowntimeForm = function () { + $scope.isAcknowledgeShown = false; - $scope.isDowntimeShown = !$scope.isDowntimeShown; - }; + $scope.isDowntimeShown = !$scope.isDowntimeShown; + }; - $scope.switchAcknowledgeForm = function () { - $scope.isDowntimeShown = false; + $scope.switchAcknowledgeForm = function () { + $scope.isDowntimeShown = false; - $scope.isAcknowledgeShown = !$scope.isAcknowledgeShown; - }; + $scope.isAcknowledgeShown = !$scope.isAcknowledgeShown; + }; $scope.actionbarFilters = actionbarFilters; $scope.actionbarFilters.activeFilter = $scope.actionbarFilters.possibleFilters[0]; diff --git a/app/components/table/actionbar/actions/acknowledge_form.html b/app/components/table/actionbar/actions/acknowledge_form.html index 798e4ee..ec6f294 100644 --- a/app/components/table/actionbar/actions/acknowledge_form.html +++ b/app/components/table/actionbar/actions/acknowledge_form.html @@ -1,39 +1,39 @@

Acknowlege

-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
diff --git a/app/components/table/actionbar/actions/actions.js b/app/components/table/actionbar/actions/actions.js index 038ab73..3fbbd1e 100644 --- a/app/components/table/actionbar/actions/actions.js +++ b/app/components/table/actionbar/actions/actions.js @@ -2,134 +2,134 @@ angular.module('bansho.table.actionbar') - .directive('banshoAcknowledgeForm', function () { - return { - restrict: 'E', - templateUrl: 'components/table/actionbar/actions/acknowledge_form.html', - scope: { - isShown: '=' - }, - controller: 'banshoAcknowledgeFormCtrl' - }; - }) + .directive('banshoAcknowledgeForm', function () { + return { + restrict: 'E', + templateUrl: 'components/table/actionbar/actions/acknowledge_form.html', + scope: { + isShown: '=' + }, + controller: 'banshoAcknowledgeFormCtrl' + }; + }) - .controller('banshoAcknowledgeFormCtrl', - ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', - function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { + .controller('banshoAcknowledgeFormCtrl', + ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', + function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { - $scope.acknowledgeProblems = function () { - angular.forEach(tablesConfig, function (tableConfig) { - var entries = $filter('filter')(tableConfig.entries, - actionbarFilters.searchFilter); + $scope.acknowledgeProblems = function () { + angular.forEach(tablesConfig, function (tableConfig) { + var entries = $filter('filter')(tableConfig.entries, + actionbarFilters.searchFilter); - angular.forEach(entries, function (entry) { - var service_description; + angular.forEach(entries, function (entry) { + var service_description; - if (entry.is_checked) { - if ('description' in entry) { - service_description = entry.description; - } + if (entry.is_checked) { + if ('description' in entry) { + service_description = entry.description; + } - backendClient.acknowledge(entry.host_name, service_description, $scope.attrs).error(function (data) { - throw new Error('Acknowledge request failed'); - }); - } - }); - }); - }; - }]) + backendClient.acknowledge(entry.host_name, service_description, $scope.attrs).error(function (data) { + throw new Error('Acknowledge request failed'); + }); + } + }); + }); + }; + }]) - .directive('banshoDowntimeForm', function () { - return { - restrict: 'E', - templateUrl: 'components/table/actionbar/actions/downtime_form.html', - scope: { - isShown: '=' - }, - controller: 'banshoDowntimeFormCtrl' - }; - }) + .directive('banshoDowntimeForm', function () { + return { + restrict: 'E', + templateUrl: 'components/table/actionbar/actions/downtime_form.html', + scope: { + isShown: '=' + }, + controller: 'banshoDowntimeFormCtrl' + }; + }) - .controller('banshoDowntimeFormCtrl', - ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', - function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { + .controller('banshoDowntimeFormCtrl', + ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', + function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { - $scope.messages = []; + $scope.messages = []; - $scope.sendDowntime = function () { - angular.forEach(tablesConfig, function (table) { - var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); + $scope.sendDowntime = function () { + angular.forEach(tablesConfig, function (table) { + var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); - angular.forEach(entries, function (entry) { - var service_description; + angular.forEach(entries, function (entry) { + var service_description; - if (entry.is_checked) { - if ('description' in entry) { - service_description = entry.description; - } + if (entry.is_checked) { + if ('description' in entry) { + service_description = entry.description; + } - backendClient.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) { - $scope.messages.push({ - text: entry.host_name + " success ", - type: "success" - }); - $scope.isShown = false; - }, - function (error) { - $scope.messages.push({ - text: entry.host_name + " error", - type: "error" - }); - }); - } - }); - }); - }; - }]) + backendClient.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) { + $scope.messages.push({ + text: entry.host_name + " success ", + type: "success" + }); + $scope.isShown = false; + }, + function (error) { + $scope.messages.push({ + text: entry.host_name + " error", + type: "error" + }); + }); + } + }); + }); + }; + }]) - .directive('banshoRecheckButton', function () { - return { - restrict: 'E', - templateUrl: 'components/table/actionbar/actions/recheck_button.html', - scope: { - isShown: '=' - }, - controller: 'banshoRecheckButtonCtrl' - }; - }) + .directive('banshoRecheckButton', function () { + return { + restrict: 'E', + templateUrl: 'components/table/actionbar/actions/recheck_button.html', + scope: { + isShown: '=' + }, + controller: 'banshoRecheckButtonCtrl' + }; + }) - .controller('banshoRecheckButtonCtrl', - ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', - function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { + .controller('banshoRecheckButtonCtrl', + ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', + function ($scope, $filter, tablesConfig, actionbarFilters, backendClient) { - $scope.messages = []; + $scope.messages = []; - $scope.sendRecheck = function () { - angular.forEach(tablesConfig, function (table) { - var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); + $scope.sendRecheck = function () { + angular.forEach(tablesConfig, function (table) { + var entries = $filter('filter')(table.entries, actionbarFilters.searchFilter); - angular.forEach(entries, function (entry) { - var service_description; + angular.forEach(entries, function (entry) { + var service_description; - if (entry.is_checked) { - if ('description' in entry) { - service_description = entry.description; - } + if (entry.is_checked) { + if ('description' in entry) { + service_description = entry.description; + } - backendClient.recheck(entry.host_name, service_description).then(function (data) { - $scope.messages.push({ - text: entry.host_name + " success ", - type: "success" - }); - }, - function (error) { - $scope.messages.push({ - text: entry.host_name + " error", - type: "error" - }); - }); - } - }); - }); - }; - }]); + backendClient.recheck(entry.host_name, service_description).then(function (data) { + $scope.messages.push({ + text: entry.host_name + " success ", + type: "success" + }); + }, + function (error) { + $scope.messages.push({ + text: entry.host_name + " error", + type: "error" + }); + }); + } + }); + }); + }; + }]); diff --git a/app/components/table/actionbar/actions/downtime_form.html b/app/components/table/actionbar/actions/downtime_form.html index 183f93d..f0ab68b 100644 --- a/app/components/table/actionbar/actions/downtime_form.html +++ b/app/components/table/actionbar/actions/downtime_form.html @@ -1,28 +1,28 @@
{{message.text}} + {{message.type}}

Downtime

-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
diff --git a/app/components/table/actionbar/actions/recheck_button.html b/app/components/table/actionbar/actions/recheck_button.html index 83cad5c..847dafb 100644 --- a/app/components/table/actionbar/actions/recheck_button.html +++ b/app/components/table/actionbar/actions/recheck_button.html @@ -1,4 +1,4 @@ diff --git a/app/components/topbar/topbar.html b/app/components/topbar/topbar.html index 543f6e8..948cbb8 100644 --- a/app/components/topbar/topbar.html +++ b/app/components/topbar/topbar.html @@ -131,16 +131,7 @@
  • Missing Plugins
  • Object History
  • Configure
  • - - -
  • - Nagios - -
  • diff --git a/app/components/topbar/topbar.js b/app/components/topbar/topbar.js index 3b63bb4..ee0c636 100644 --- a/app/components/topbar/topbar.js +++ b/app/components/topbar/topbar.js @@ -2,27 +2,31 @@ angular.module('bansho.topbar', ['bansho.live']) - .controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager', - function ($rootScope, $scope, $interval, backendClient, promisesManager) { + .controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager', 'authService', + function ($rootScope, $scope, $interval, backendClient, promisesManager, authService) { var getData, hostProblems, serviceProblems; getData = function () { - if ($rootScope.isAuthenticated) { - backendClient.getServiceProblems().success(function (data) { - serviceProblems = data.length; - backendClient.getHostProblems().success(function (data) { - hostProblems = data.length; - $scope.allProblems = serviceProblems + hostProblems; - }); - }); - } + if ($rootScope.isAuthenticated) { + backendClient.getServiceProblems().success(function (data) { + serviceProblems = data.length; + backendClient.getHostProblems().success(function (data) { + hostProblems = data.length; + $scope.allProblems = serviceProblems + hostProblems; + }); + }); + } }; // TODO: Change hardcoded interval when the topbar dashboard will be implemented promisesManager.addAjaxPromise($interval(getData, 10000)); - getData(); + getData(); + + $scope.logout = function () { + authService.logout(); + }; }]) .directive('banshoTopbar', function () { diff --git a/app/index.html b/app/index.html index cbfd494..9c1e231 100644 --- a/app/index.html +++ b/app/index.html @@ -15,6 +15,7 @@ + diff --git a/bower.json b/bower.json index 8209b29..13ca753 100644 --- a/bower.json +++ b/bower.json @@ -5,15 +5,16 @@ "license": "AGPLv3", "private": true, "dependencies": { - "angular": "1.2.x", - "angular-route": "1.2.x", - "angular-loader": "1.2.x", - "angular-mocks": "~1.2.x", - "html5-boilerplate": "~4.3.0", + "angular": "~1.3.15", + "angular-route": "~1.3.15", + "angular-loader": "~1.3.15", + "angular-mocks": "~1.3.15", + "html5-boilerplate": "~5.2.0", "bootstrap-sass-official": "3.3.1", - "fontawesome": "4.2.0", + "fontawesome": "~4.3.0", "justgage-toorshia": "master", "moment": "~2.9.0", - "angular-filter": "~0.5.4" + "angular-filter": "~0.5.4", + "angular-cookies": "~1.3.15" } }