diff --git a/app/components/config/defaultLayoutConfig.json b/app/components/config/defaultLayoutConfig.json index 3a13175..8bd9b2a 100644 --- a/app/components/config/defaultLayoutConfig.json +++ b/app/components/config/defaultLayoutConfig.json @@ -10,7 +10,7 @@ "type": "tabpanel", "attributes": { "navigation": { - "openProblems" : { + "openProblems": { "title": "Open problems", "provider": "nbServicesHostsOpenProblems" }, @@ -639,12 +639,16 @@ "attributes": {} }, { - "type": "host-info", + "type": "host-services-list", "attributes": {} }, { - "type": "host-services-list", - "attributes": {} + "type": "info", + "attributes": { + "datamodel": { + "Configuration": "configHost" + } + } } ] } diff --git a/app/components/directive/directive.js b/app/components/directive/directive.js index 414810f..c0f2b97 100644 --- a/app/components/directive/directive.js +++ b/app/components/directive/directive.js @@ -4,6 +4,7 @@ angular.module('bansho.directive', [ 'bansho.actionbar', 'bansho.host', 'bansho.hostTree', + 'bansho.info', 'bansho.service', 'bansho.table', 'bansho.tabpanel', diff --git a/app/components/directive/host/host.js b/app/components/directive/host/host.js index c75173b..48ed30f 100644 --- a/app/components/directive/host/host.js +++ b/app/components/directive/host/host.js @@ -9,13 +9,19 @@ angular.module('bansho.host', ['bansho.datasource']) options: '=' }, templateUrl: 'components/directive/host/host.html', - controller: ['$scope', 'templateManager', 'surveilStatus', 'iframeUrl', - function ($scope, templateManager, surveilStatus, iframeUrl) { + controller: ['$scope', 'templateManager', 'surveilStatus', 'surveilConfig', 'iframeUrl', + function ($scope, templateManager, surveilStatus, surveilConfig, iframeUrl) { var hostname = templateManager.getPageParam('hostname'); $scope.param = { - host: {} + host: {}, + configHost: {} }; + + surveilConfig.getHost(hostname).then(function (data) { + $scope.param.configHost = data[0]; + }); + surveilStatus.getHost(hostname).then(function (data) { surveilStatus.getService(hostname).then(function(services) { $scope.param.host = data[0]; @@ -43,8 +49,6 @@ angular.module('bansho.host', ['bansho.datasource']) }); }); - - $scope.components = $scope.options.components; }] }; diff --git a/app/components/directive/host/host_info/host_info.html b/app/components/directive/host/host_info/host_info.html deleted file mode 100644 index d45f56b..0000000 --- a/app/components/directive/host/host_info/host_info.html +++ /dev/null @@ -1,35 +0,0 @@ -
-

Info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Last check{{param.host.host_last_check | timeElapsed}}
Check period{{param.host.config_host_check_period}}
Notification period{{param.host.config_host_notification_period}}
Active checks{{param.host.config_host_active_checks}}
Notifications{{param.host.config_host_notifications_enabled}}
Event Handler{{param.host.config_host_event_handler_enabled}}
Flap detection{{param.host.config_host_flap_detection_enabled}}
-
diff --git a/app/components/directive/host/host_info/host_info.js b/app/components/directive/host/host_info/host_info.js deleted file mode 100644 index a310940..0000000 --- a/app/components/directive/host/host_info/host_info.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -angular.module('bansho.host') - .directive('banshoHostInfo', function () { - return { - restrict: 'E', - templateUrl: 'components/directive/host/host_info/host_info.html', - link: function (scope) { - scope.param = scope.$parent.param; - } - }; - }); diff --git a/app/components/directive/info/info.html b/app/components/directive/info/info.html new file mode 100644 index 0000000..308e877 --- /dev/null +++ b/app/components/directive/info/info.html @@ -0,0 +1,11 @@ +
+

{{key}}

+ + + + + + + +
{{key}}{{value}}
+
diff --git a/app/components/directive/info/info.js b/app/components/directive/info/info.js new file mode 100644 index 0000000..6b9096d --- /dev/null +++ b/app/components/directive/info/info.js @@ -0,0 +1,17 @@ +'use strict'; + +angular.module('bansho.info', []) + .directive('banshoInfo', function () { + return { + restrict: 'E', + templateUrl: 'components/directive/info/info.html', + link: function (scope) { + scope.param = scope.$parent.param; + angular.forEach(scope.components, function(component) { + if (component.type === 'info') { + scope.datamodels = component.attributes.datamodel; + } + }); + } + }; + }); diff --git a/app/components/surveil/config.js b/app/components/surveil/config.js index efa40dd..db57f35 100644 --- a/app/components/surveil/config.js +++ b/app/components/surveil/config.js @@ -50,6 +50,14 @@ angular.module('bansho.surveil') return { - getData: getData + getData: getData, + getHost: function (hostname) { + var promise = $q.defer(), query = {"hosts": {"is": {"host_name": [ hostname ] } } }; + getData([], query, "hosts") + .then(function (data) { + promise.resolve(data); + }); + return promise.promise; + }, }; }]); diff --git a/app/index.html b/app/index.html index 5cbfdda..7f0d384 100644 --- a/app/index.html +++ b/app/index.html @@ -79,6 +79,7 @@ + @@ -106,7 +107,6 @@ - diff --git a/app/templates/host/host.js b/app/templates/host/host.js index 548b1cf..69b3305 100644 --- a/app/templates/host/host.js +++ b/app/templates/host/host.js @@ -7,7 +7,6 @@ angular.module('bansho.view.host', ['bansho.datasource']) var hostname = $routeParams.host_name; $scope.components = configManager.getConfigData($scope.viewName).components; - if (!hostname) { throw new Error("ERROR :'host_name' GET parameter must be set"); } else {