From dea9bd6521a7a0ba6048c2d52f8f28339ffea423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Vachon?= Date: Fri, 27 Mar 2015 16:37:43 -0400 Subject: [PATCH] Host submodules display data --- app/components/host/host.html | 20 ++++------- app/components/host/host.js | 8 ++++- app/components/host/host_cpu/host_cpu.html | 7 ++++ app/components/host/host_cpu/host_cpu.js | 14 ++++++-- app/components/host/host_info/host_info.html | 34 +++++++++++++++++++ app/components/host/host_info/host_info.js | 13 ++++--- app/components/host/host_load/host_load.html | 7 ++++ app/components/host/host_load/host_load.js | 14 ++++++-- app/components/host/host_main/host_main.html | 8 +++++ .../host_services_list.html | 5 +++ 10 files changed, 106 insertions(+), 24 deletions(-) diff --git a/app/components/host/host.html b/app/components/host/host.html index d60ba5d..5dc6c97 100644 --- a/app/components/host/host.html +++ b/app/components/host/host.html @@ -1,17 +1,9 @@
-
-

{{hostName}}

- - - - - - - - - - - -
{{key}}{{value}}
{{key}}{{value}}
+
+ + + + +
diff --git a/app/components/host/host.js b/app/components/host/host.js index 8e7bf04..7fecb8d 100644 --- a/app/components/host/host.js +++ b/app/components/host/host.js @@ -1,6 +1,11 @@ 'use strict'; -angular.module('adagios.host', ['adagios.live']) +angular.module('adagios.host', ['adagios.live', + 'adagios.host.main', + 'adagios.host.load', + 'adagios.host.cpu', + 'adagios.host.info', + 'adagios.host.services_list']) .value('hostConfig', {}) @@ -9,6 +14,7 @@ angular.module('adagios.host', ['adagios.live']) objectIdentifier = {}; objectIdentifier.host_name = hostConfig.hostName; + $scope.hostName = hostConfig.hostName; $scope.data = {}; addObjectToScope(objectType, objectIdentifier, $scope); diff --git a/app/components/host/host_cpu/host_cpu.html b/app/components/host/host_cpu/host_cpu.html index e69de29..3a11eed 100644 --- a/app/components/host/host_cpu/host_cpu.html +++ b/app/components/host/host_cpu/host_cpu.html @@ -0,0 +1,7 @@ +
+ +
diff --git a/app/components/host/host_cpu/host_cpu.js b/app/components/host/host_cpu/host_cpu.js index 07c3d47..594814a 100644 --- a/app/components/host/host_cpu/host_cpu.js +++ b/app/components/host/host_cpu/host_cpu.js @@ -2,8 +2,18 @@ angular.module('adagios.host.cpu', []) - .controller('TableCtrl', ['$scope', function ($scope) { - angular.noop(); + .controller('HostCpuCtrl', ['$scope', 'getObjects', function ($scope, getObjects) { + var hostName = $scope.hostName, + service = 'cpu', + fields = ['state', 'description', 'plugin_output'], + filters = {}, + apiName = 'services', + additionnalFields = {'host_name': hostName, 'description': service}; + + getObjects(fields, filters, apiName, additionnalFields) + .success(function (data) { + $scope.cpuData = data[0]; + }); }]) .directive('adgHostCpu', function () { diff --git a/app/components/host/host_info/host_info.html b/app/components/host/host_info/host_info.html index e69de29..a264971 100644 --- a/app/components/host/host_info/host_info.html +++ b/app/components/host/host_info/host_info.html @@ -0,0 +1,34 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Last check{{data.live.last_check | timeElapsed}}
Check period{{data.config.check_period}}
Notification period{{data.config.notification_period}}
Active checks{{active_checks}}
Notifications{{notifications_enabled}}
Event Handler{{event_handler_enabled}}
Flag detection{{flap_detection_enabled}}
+
diff --git a/app/components/host/host_info/host_info.js b/app/components/host/host_info/host_info.js index b178c1c..ad282af 100644 --- a/app/components/host/host_info/host_info.js +++ b/app/components/host/host_info/host_info.js @@ -1,14 +1,17 @@ 'use strict'; -angular.module('adagios.host.cpu', []) +angular.module('adagios.host.info', []) - .controller('HostCpuCtrl', ['$scope', function ($scope) { - angular.noop(); + .controller('HostInfoCtrl', ['$scope', function ($scope) { + $scope.active_checks = ($scope.data.live.active_checks_enabled === '1') ? 'Enabled': 'Disabled'; + $scope.notifications_enabled = ($scope.data.config.notifications_enabled === '1') ? 'Enabled': 'Disabled'; + $scope.event_handler_enabled = ($scope.data.config.event_handler_enabled === '1') ? 'Enabled': 'Disabled'; + $scope.flap_detection_enabled = ($scope.data.config.flap_detection_enabled === '1') ? 'Enabled': 'Disabled'; }]) - .directive('adgHostCpu', function () { + .directive('adgHostInfo', function () { return { restrict: 'E', - templateUrl: 'components/host/host_cpu/host_cpu.html' + templateUrl: 'components/host/host_info/host_info.html' }; }); diff --git a/app/components/host/host_load/host_load.html b/app/components/host/host_load/host_load.html index e69de29..8430147 100644 --- a/app/components/host/host_load/host_load.html +++ b/app/components/host/host_load/host_load.html @@ -0,0 +1,7 @@ +
+ +
diff --git a/app/components/host/host_load/host_load.js b/app/components/host/host_load/host_load.js index 6d1635c..40d35d3 100644 --- a/app/components/host/host_load/host_load.js +++ b/app/components/host/host_load/host_load.js @@ -2,8 +2,18 @@ angular.module('adagios.host.load', []) - .controller('HostLoadCtrl', ['$scope', function ($scope) { - angular.noop(); + .controller('HostLoadCtrl', ['$scope', 'getObjects', function ($scope, getObjects) { + var hostName = $scope.hostName, + service = 'load', + fields = ['state', 'description', 'plugin_output'], + filters = {}, + apiName = 'services', + additionnalFields = {'host_name': hostName, 'description': service}; + + getObjects(fields, filters, apiName, additionnalFields) + .success(function (data) { + $scope.loadData = data[0]; + }); }]) .directive('adgHostLoad', function () { diff --git a/app/components/host/host_main/host_main.html b/app/components/host/host_main/host_main.html index e69de29..3b1ace8 100644 --- a/app/components/host/host_main/host_main.html +++ b/app/components/host/host_main/host_main.html @@ -0,0 +1,8 @@ +
+ +
diff --git a/app/components/host/host_services_list/host_services_list.html b/app/components/host/host_services_list/host_services_list.html index e69de29..4b8e5a4 100644 --- a/app/components/host/host_services_list/host_services_list.html +++ b/app/components/host/host_services_list/host_services_list.html @@ -0,0 +1,5 @@ +
+ +