Vincent Fournier c12dec323f Add refresh options in config.json
Change-Id: I1f8082e2de040f820c551b17eb838082e2053d05
2015-07-31 10:43:42 -04:00

33 lines
1.5 KiB
JavaScript

'use strict';
angular.module('bansho.service', ['bansho.datasource'])
.directive('banshoService', function () {
return {
restrict: 'E',
scope: {
options: '='
},
templateUrl: 'components/directive/service/service.html',
controller: ['$scope', 'templateManager', 'surveilStatus', 'iframeUrl',
function ($scope, templateManager, surveilStatus, iframeUrl) {
var hostname = templateManager.getPageParam('host_name'),
serviceDescription = templateManager.getPageParam('service_description');
$scope.param = {};
surveilStatus.getService(hostname, serviceDescription).then(function (data) {
$scope.param.service = data[0];
surveilStatus.getServiceMetricNames(hostname, serviceDescription).then(function(metric_names) {
$scope.param.service.iframeUrls = {};
angular.forEach(metric_names, function (metric) {
var metricName = metric.metric_name.substr(7);
$scope.param.service.iframeUrls[metricName] = iframeUrl.getIFrameUrl(metric.metric_name, hostname, serviceDescription);
});
});
});
$scope.components = $scope.options.components;
}]
};
});