diff --git a/app/app.js b/app/app.js
index 8ec0950..0167912 100644
--- a/app/app.js
+++ b/app/app.js
@@ -9,6 +9,7 @@ angular.module('bansho', [
'bansho.utils.promiseManager',
'bansho.topbar',
'bansho.sidebar',
+ 'bansho.surveil',
'bansho.host',
'bansho.service',
'bansho.view',
diff --git a/app/components/host/host.js b/app/components/host/host.js
index bf8b1a8..01319f4 100644
--- a/app/components/host/host.js
+++ b/app/components/host/host.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.host', ['bansho.live',
+angular.module('bansho.host', ['bansho.surveil',
'bansho.host.main',
'bansho.host.load',
'bansho.host.cpu',
@@ -9,16 +9,16 @@ angular.module('bansho.host', ['bansho.live',
.value('hostConfig', {})
- .controller('HostCtrl', ['$scope', 'hostConfig', 'backendClient', function ($scope, hostConfig, backendClient) {
+ .controller('HostCtrl', ['$scope', 'hostConfig', 'surveilStatus', function ($scope, hostConfig, surveilStatus) {
var objectType = 'host',
objectIdentifier = {};
objectIdentifier.host_name = hostConfig.hostName;
- backendClient.getHost(objectType, objectIdentifier).then(function (data) {
+ surveilStatus.getHost(objectType, objectIdentifier).then(function (data) {
$scope.host = data;
$scope.data = data;
- backendClient.getServicesByHost($scope.hostName).success(function (data) {
+ surveilStatus.getServicesByHost($scope.hostName).success(function (data) {
var i,
service;
@@ -40,8 +40,8 @@ angular.module('bansho.host', ['bansho.live',
});
}])
- .directive('banshoHost', ['$http', '$compile', 'backendClient', 'hostConfig',
- function ($http, $compile, backendClient, hostConfig) {
+ .directive('banshoHost', ['$http', '$compile', 'surveilStatus', 'hostConfig',
+ function ($http, $compile, surveilStatus, hostConfig) {
return {
restrict: 'E',
compile: function () {
diff --git a/app/components/host/host_cpu/host_cpu.js b/app/components/host/host_cpu/host_cpu.js
index 74c268c..a530ed2 100644
--- a/app/components/host/host_cpu/host_cpu.js
+++ b/app/components/host/host_cpu/host_cpu.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.host.cpu', ['bansho.live'])
+angular.module('bansho.host.cpu', ['bansho.surveil'])
.directive('banshoHostCpu', function () {
return {
restrict: 'E',
diff --git a/app/components/service/service.js b/app/components/service/service.js
index 98b2941..1fb5eb4 100644
--- a/app/components/service/service.js
+++ b/app/components/service/service.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.service', ['bansho.live',
+angular.module('bansho.service', ['bansho.surveil',
'bansho.service.main',
'bansho.service.info',
'bansho.service.metrics',
@@ -8,12 +8,12 @@ angular.module('bansho.service', ['bansho.live',
.value('serviceConfig', {})
- .controller('ServiceCtrl', ['$scope', 'serviceConfig', 'backendClient',
- function ($scope, serviceConfig, backendClient) {
+ .controller('ServiceCtrl', ['$scope', 'serviceConfig', 'surveilStatus',
+ function ($scope, serviceConfig, surveilStatus) {
var hostName = serviceConfig.hostName,
description = serviceConfig.description;
- backendClient.getService(hostName, description).success(function (data) {
+ surveilStatus.getService(hostName, description).success(function (data) {
$scope.service = data[0];
});
}])
diff --git a/app/components/surveil/actions.js b/app/components/surveil/actions.js
new file mode 100644
index 0000000..901a21e
--- /dev/null
+++ b/app/components/surveil/actions.js
@@ -0,0 +1,67 @@
+/*global jQuery */
+
+'use strict';
+
+angular.module('bansho.surveil')
+ .service('surveilActions', ['$http', '$q',
+ function ($http, $q) {
+ var acknowledge = function (host_name, service_description, attrs) {
+ var data = {};
+
+ data.host_name = host_name;
+ if (attrs.sticky) {
+ data.sticky = parseInt(attrs.sticky, 10);
+ }
+
+ if (attrs.notify) {
+ data.notify = parseInt(attrs.notify, 10);
+ }
+
+ if (attrs.persistent) {
+ data.persistent = parseInt(attrs.persistent, 10);
+ }
+
+ if (service_description !== undefined) {
+ data.service_description = service_description;
+ }
+
+ return $http({
+ url: '/surveil/v2/actions/acknowledge/',
+ method: 'POST',
+ data: data
+ });
+ };
+
+ var downtime = function (host_name, service_description, attrs) {
+ 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
+ });
+ };
+
+ var recheck = function (host_name, service_description) {
+ 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 {
+ acknowledge: acknowledge,
+ downtime: downtime,
+ recheck: recheck
+ };
+ }]);
diff --git a/app/components/live/live.js b/app/components/surveil/status.js
similarity index 87%
rename from app/components/live/live.js
rename to app/components/surveil/status.js
index 27ac381..804316d 100644
--- a/app/components/live/live.js
+++ b/app/components/surveil/status.js
@@ -2,8 +2,8 @@
'use strict';
-angular.module('bansho.live', [])
- .service('backendClient', ['$http', '$q',
+angular.module('bansho.surveil')
+ .service('surveilStatus', ['$http', '$q',
function ($http, $q) {
var getObjects = function (fields, filters, apiName) {
var query = {},
@@ -339,66 +339,11 @@ angular.module('bansho.live', [])
return responsePromise.promise;
};
- var acknowledge = function (host_name, service_description, attrs) {
- var data = {};
-
- data.host_name = host_name;
- if (attrs.sticky) {
- data.sticky = parseInt(attrs.sticky, 10);
- }
-
- if (attrs.notify) {
- data.notify = parseInt(attrs.notify, 10);
- }
-
- if (attrs.persistent) {
- data.persistent = parseInt(attrs.persistent, 10);
- }
-
- if (service_description !== undefined) {
- data.service_description = service_description;
- }
-
- return $http({
- url: '/surveil/v2/actions/acknowledge/',
- method: 'POST',
- data: data
- });
- };
-
- var downtime = function (host_name, service_description, attrs) {
- 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
- });
- };
-
- var recheck = function (host_name, service_description) {
- 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 {
getHost: getHost,
getObjects : getObjects,
getService : getService,
hostQueryTransform: hostQueryTransform,
- acknowledge: acknowledge,
getHostOpenProblems: getHostOpenProblems,
hostMiddleware: hostMiddleware,
getServiceProblems: getServiceProblems,
@@ -407,8 +352,6 @@ angular.module('bansho.live', [])
getTableData: getTableData,
getTotalHosts: getTotalHosts,
getTotalServices: getTotalServices,
- downtime: downtime,
- recheck: recheck,
getServicesByHost: getServicesByHost
};
}]);
diff --git a/app/components/surveil/surveil.js b/app/components/surveil/surveil.js
new file mode 100644
index 0000000..20c99bf
--- /dev/null
+++ b/app/components/surveil/surveil.js
@@ -0,0 +1 @@
+angular.module('bansho.surveil', []);
diff --git a/app/components/table/actionbar/actionbar.js b/app/components/table/actionbar/actionbar.js
index 120975b..ee9f113 100644
--- a/app/components/table/actionbar/actionbar.js
+++ b/app/components/table/actionbar/actionbar.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live', 'bansho.notifications'])
+angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.surveil', 'bansho.notifications'])
.service('actionbarFilters', function () {
var actionbarFilters = {
@@ -27,8 +27,8 @@ angular.module('bansho.table.actionbar', ['bansho.table', 'bansho.live', 'bansho
return actionbarFilters;
})
- .controller('TableActionbarCtrl', ['$scope', '$filter', 'backendClient', 'actionbarFilters', 'tablesConfig',
- function ($scope, $filter, backendClient, actionbarFilters, tablesConfig, actionbarSelectFilter) {
+ .controller('TableActionbarCtrl', ['$scope', '$filter', 'surveilStatus', 'actionbarFilters', 'tablesConfig',
+ function ($scope, $filter, surveilStatus, actionbarFilters, tablesConfig, actionbarSelectFilter) {
$scope.isDowntimeShown = false;
$scope.isAcknowledgeShown = false;
diff --git a/app/components/table/actionbar/actions/actions.js b/app/components/table/actionbar/actions/actions.js
index b82e6f0..21109ef 100644
--- a/app/components/table/actionbar/actions/actions.js
+++ b/app/components/table/actionbar/actions/actions.js
@@ -14,8 +14,8 @@ angular.module('bansho.table.actionbar')
})
.controller('banshoAcknowledgeFormCtrl',
- ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', 'notifications',
- function ($scope, $filter, tablesConfig, actionbarFilters, backendClient, notifications) {
+ ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'surveilActions', 'notifications',
+ function ($scope, $filter, tablesConfig, actionbarFilters, surveilActions, notifications) {
$scope.acknowledgeProblems = function () {
angular.forEach(tablesConfig, function (table) {
@@ -32,7 +32,7 @@ angular.module('bansho.table.actionbar')
service_description = entry.description;
}
- backendClient.acknowledge(entry.host_name, service_description, $scope.attrs).then(function (data) {
+ surveilActions.acknowledge(entry.host_name, service_description, $scope.attrs).then(function (data) {
notifications.push('success', 'Acknowledgement', 'Acknowledged ' + entry.host_name);
},
function (error) {
@@ -57,8 +57,8 @@ angular.module('bansho.table.actionbar')
})
.controller('banshoDowntimeFormCtrl',
- ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', 'notifications',
- function ($scope, $filter, tablesConfig, actionbarFilters, backendClient, notifications) {
+ ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'surveilActions', 'notifications',
+ function ($scope, $filter, tablesConfig, actionbarFilters, surveilActions, notifications) {
$scope.sendDowntime = function () {
angular.forEach(tablesConfig, function (table) {
@@ -74,7 +74,7 @@ angular.module('bansho.table.actionbar')
service_description = entry.description;
}
- backendClient.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) {
+ surveilActions.downtime(entry.host_name, service_description, $scope.attrs).then(function (data) {
notifications.push('success', 'Downtime', 'Added downtime for ' + entry.host_name);
},
function (error) {
@@ -96,8 +96,8 @@ angular.module('bansho.table.actionbar')
})
.controller('banshoRecheckButtonCtrl',
- ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'backendClient', 'notifications',
- function ($scope, $filter, tablesConfig, actionbarFilters, backendClient, notifications) {
+ ['$scope', '$filter', 'tablesConfig', 'actionbarFilters', 'surveilActions', 'notifications',
+ function ($scope, $filter, tablesConfig, actionbarFilters, surveilActions, notifications) {
$scope.sendRecheck = function () {
angular.forEach(tablesConfig, function (table) {
@@ -113,7 +113,7 @@ angular.module('bansho.table.actionbar')
service_description = entry.description;
}
- backendClient.recheck(entry.host_name, service_description).then(function (data) {
+ surveilActions.recheck(entry.host_name, service_description).then(function (data) {
notifications.push('success', 'Recheck', 'Scheduled recheck for ' + entry.host_name);
},
function (error) {
diff --git a/app/components/table/table.js b/app/components/table/table.js
index 1731fdf..25a0ec4 100644
--- a/app/components/table/table.js
+++ b/app/components/table/table.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.table', ['bansho.live',
+angular.module('bansho.table', ['bansho.surveil',
'bansho.utils.promiseManager',
'bansho.table.actionbar',
'bansho.filters',
@@ -16,9 +16,9 @@ angular.module('bansho.table', ['bansho.live',
.value('tablesConfig', [])
- .controller('TableCtrl', ['$scope', '$interval', 'backendClient', 'tablesConfig',
+ .controller('TableCtrl', ['$scope', '$interval', 'surveilStatus', 'tablesConfig',
'actionbarFilters', 'promisesManager', 'tableGlobalConfig',
- function ($scope, $interval, backendClient, tablesConfig, actionbarFilters, promisesManager, tableGlobalConfig) {
+ function ($scope, $interval, surveilStatus, tablesConfig, actionbarFilters, promisesManager, tableGlobalConfig) {
var requestFields = [],
conf = tablesConfig[tableGlobalConfig.nextTableIndex],
getData,
@@ -53,7 +53,7 @@ angular.module('bansho.table', ['bansho.live',
});
getData = function (requestFields, filters, apiName) {
- var promise = backendClient.getTableData(requestFields, filters, apiName);
+ var promise = surveilStatus.getTableData(requestFields, filters, apiName);
promise.then(function (data) {
$scope.entries = data;
conf.entries = data;
diff --git a/app/components/tactical/current_health/current_health.js b/app/components/tactical/current_health/current_health.js
index 4d57905..6b04f51 100644
--- a/app/components/tactical/current_health/current_health.js
+++ b/app/components/tactical/current_health/current_health.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.tactical.current_health', ['bansho.live',
+angular.module('bansho.tactical.current_health', ['bansho.surveil',
'ngJustGage'])
.controller('TacticalCurrentHealth', ['$scope', function ($scope) {
diff --git a/app/components/tactical/tactical.js b/app/components/tactical/tactical.js
index 648788b..255299e 100644
--- a/app/components/tactical/tactical.js
+++ b/app/components/tactical/tactical.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.tactical', ['bansho.live',
+angular.module('bansho.tactical', ['bansho.surveil',
'bansho.utils.promiseManager',
'bansho.tactical.status_overview',
'bansho.tactical.current_health',
@@ -16,8 +16,8 @@ angular.module('bansho.tactical', ['bansho.live',
this.topAlertProducers = config.components.topAlertProducers;
})
- .controller('TacticalCtrl', ['$scope', '$interval', 'tacticalConfig', 'backendClient', 'promisesManager',
- function ($scope, $interval, tacticalConfig, backendClient, promisesManager) {
+ .controller('TacticalCtrl', ['$scope', '$interval', 'tacticalConfig', 'surveilStatus', 'promisesManager',
+ function ($scope, $interval, tacticalConfig, surveilStatus, promisesManager) {
var getData;
@@ -33,17 +33,17 @@ angular.module('bansho.tactical', ['bansho.live',
$scope.totalServices = undefined;
getData = function () {
- backendClient.getHostProblems().success(function (hostProblems) {
+ surveilStatus.getHostProblems().success(function (hostProblems) {
$scope.hostProblems = hostProblems.length;
- backendClient.getTotalHosts().success(function (allHosts) {
+ surveilStatus.getTotalHosts().success(function (allHosts) {
$scope.totalHosts = allHosts.length;
$scope.hostsRatio = ($scope.totalHosts - $scope.hostProblems) / $scope.totalHosts * 100;
});
});
- backendClient.getServiceProblems().success(function (serviceProblems) {
+ surveilStatus.getServiceProblems().success(function (serviceProblems) {
$scope.serviceProblems = serviceProblems.length;
- backendClient.getTotalServices().success(function (allServices) {
+ surveilStatus.getTotalServices().success(function (allServices) {
$scope.totalServices = allServices.length;
$scope.servicesRatio = ($scope.totalServices - $scope.serviceProblems) / $scope.totalServices * 100;
});
diff --git a/app/components/topbar/topbar.js b/app/components/topbar/topbar.js
index ee0c636..03f58ba 100644
--- a/app/components/topbar/topbar.js
+++ b/app/components/topbar/topbar.js
@@ -1,18 +1,18 @@
'use strict';
-angular.module('bansho.topbar', ['bansho.live'])
+angular.module('bansho.topbar', ['bansho.surveil'])
- .controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'backendClient', 'promisesManager', 'authService',
- function ($rootScope, $scope, $interval, backendClient, promisesManager, authService) {
+ .controller('TopBarCtrl', ['$rootScope', '$scope', '$interval', 'surveilStatus', 'promisesManager', 'authService',
+ function ($rootScope, $scope, $interval, surveilStatus, promisesManager, authService) {
var getData,
hostProblems,
serviceProblems;
getData = function () {
if ($rootScope.isAuthenticated) {
- backendClient.getServiceProblems().success(function (data) {
+ surveilStatus.getServiceProblems().success(function (data) {
serviceProblems = data.length;
- backendClient.getHostProblems().success(function (data) {
+ surveilStatus.getHostProblems().success(function (data) {
hostProblems = data.length;
$scope.allProblems = serviceProblems + hostProblems;
});
diff --git a/app/index.html b/app/index.html
index 61bbb78..279bebb 100644
--- a/app/index.html
+++ b/app/index.html
@@ -42,7 +42,12 @@
-
+
+
+
+
+
+
diff --git a/app/templates/dashboard/dashboard.js b/app/templates/dashboard/dashboard.js
index 543b4f4..d29b9b2 100644
--- a/app/templates/dashboard/dashboard.js
+++ b/app/templates/dashboard/dashboard.js
@@ -6,13 +6,13 @@ angular.module('bansho.view.dashboard', ['ngRoute',
'bansho.utils.promiseManager',
'bansho.tactical',
'bansho.table',
- 'bansho.live'
+ 'bansho.surveil'
])
.value('dashboardConfig', {})
- .controller('DashboardCtrl', ['$scope', '$routeParams', '$interval', 'configManager', 'dashboardConfig', 'TableConfigObj', 'TacticalConfigObj', 'backendClient', 'promisesManager',
- function ($scope, $routeParams, $interval, configManager, dashboardConfig, TableConfigObj, TacticalConfigObj, backendClient, promisesManager) {
+ .controller('DashboardCtrl', ['$scope', '$routeParams', '$interval', 'configManager', 'dashboardConfig', 'TableConfigObj', 'TacticalConfigObj', 'surveilStatus', 'promisesManager',
+ function ($scope, $routeParams, $interval, configManager, dashboardConfig, TableConfigObj, TacticalConfigObj, surveilStatus, promisesManager) {
var components = [],
component,
config,
@@ -45,17 +45,17 @@ angular.module('bansho.view.dashboard', ['ngRoute',
}
getData = function () {
- backendClient.getHostOpenProblems().success(function (data) {
+ surveilStatus.getHostOpenProblems().success(function (data) {
$scope.nbHostOpenProblems = data.length;
- backendClient.getServiceOpenProblems().then(function (openProblems) {
+ surveilStatus.getServiceOpenProblems().then(function (openProblems) {
$scope.nbServiceOpenProblems = openProblems.length;
$scope.totalOpenProblems = $scope.nbServiceOpenProblems + $scope.nbHostOpenProblems;
});
});
- backendClient.getHostProblems().success(function (data) {
+ surveilStatus.getHostProblems().success(function (data) {
$scope.nbHostProblems = data.length;
- backendClient.getServiceProblems().success(function (data) {
+ surveilStatus.getServiceProblems().success(function (data) {
$scope.nbServiceProblems = data.length;
$scope.totalProblems = $scope.nbHostProblems + $scope.nbServiceProblems;
});
diff --git a/app/templates/host/host.js b/app/templates/host/host.js
index b7570f0..d992f42 100644
--- a/app/templates/host/host.js
+++ b/app/templates/host/host.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('bansho.view.host', ['bansho.live'])
+angular.module('bansho.view.host', ['bansho.surveil'])
.controller('HostViewCtrl', ['$http', '$scope', '$routeParams',
function ($http, $scope, $routeParams) {
diff --git a/app/templates/service/service.js b/app/templates/service/service.js
index 20dd263..a6636cb 100644
--- a/app/templates/service/service.js
+++ b/app/templates/service/service.js
@@ -1,6 +1,6 @@
"use strict";
-angular.module("bansho.view.service", [ "bansho.live" ])
+angular.module("bansho.view.service", [ "bansho.surveil" ])
.controller("ServiceViewCtrl", [ "$scope", "$routeParams",
function ($scope, $routeParams) {