Prepare graphs in service and host views

Change-Id: I425b5eeea77c88fe1295b0849079d6fede325e3c
This commit is contained in:
Thibault Cohen 2015-08-06 14:43:59 -04:00 committed by Alexandre Viau
parent 0931458d80
commit a87dc68828
4 changed files with 23 additions and 10 deletions

View File

@ -13,7 +13,9 @@ angular.module('bansho.host', ['bansho.datasource'])
function ($scope, templateManager, surveilStatus, iframeUrl) {
var hostname = templateManager.getPageParam('hostname');
$scope.param = {};
$scope.param = {
host: {}
};
surveilStatus.getHost(hostname).then(function (data) {
surveilStatus.getService(hostname).then(function(services) {
$scope.param.host = data[0];
@ -29,8 +31,20 @@ angular.module('bansho.host', ['bansho.datasource'])
}
});
});
});
surveilStatus.getHostMetricNames(hostname).then(function(metrics) {
$scope.param.host.metrics = metrics;
angular.forEach(metrics, function (metric) {
surveilStatus.getHostMetric(hostname, metric).then(function(data) {
// TODO: waiting for ORBER BY DESC support in InfluxDB
});
});
});
$scope.components = $scope.options.components;
}]
};

View File

@ -5,8 +5,8 @@ angular.module('bansho.host')
return {
restrict: 'E',
templateUrl: 'components/directive/host/host_live/host_live.html',
link: function (scope) {
scope.param = scope.$parent.param;
link: function ($scope) {
$scope.param = $scope.$parent.param;
}
};
});

View File

@ -19,13 +19,14 @@ angular.module('bansho.service', ['bansho.datasource'])
$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);
angular.forEach(metric_names, function (metricName) {
$scope.param.service.iframeUrls[metricName] = iframeUrl.getIFrameUrl("metric_" + metricName, hostname, serviceDescription);
surveilStatus.getServiceMetric(hostname, serviceDescription, metricName).then(function(data) {
// TODO: waiting for ORBER BY DESC support in InfluxDB
})
});
});
});
$scope.components = $scope.options.components;
}]
};

View File

@ -37,9 +37,7 @@ angular.module('bansho.surveil')
$http.get(url).success(function (metrics) {
var result = [];
for (var i = 0; i < metrics.length; i += 1) {
if (metrics[i].metric_name.indexOf("metric_") === 0) {
result.push(metrics[i]);
}
result.push(metrics[i].metric_name);
}
responsePromise.resolve(result);