diff --git a/src/js/client.js b/src/js/client.js index 60f4c68fe..97f04481e 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1215,7 +1215,7 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N }); }; - Client.prototype.graphs = function (targets, from, callback) { + Client.prototype.graphs = function (targets, from, options, callback) { var config = { params: { target: targets, @@ -1224,6 +1224,8 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N } }; + if (options.noNullPoints) config.params.noNullPoints = true; + get('/api/v1/cloudron/graphs', config, function (error, data, status) { if (error) return callback(error); if (status !== 200) return callback(new ClientError(status, data)); diff --git a/src/views/graphs.js b/src/views/graphs.js index a8f731b3c..fea175156 100644 --- a/src/views/graphs.js +++ b/src/views/graphs.js @@ -43,7 +43,7 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati if (app === 'system') target = 'summarize(collectd.localhost.memory.memory-used, "' + timeBucketSize + 'min", "avg")'; else target = 'summarize(collectd.localhost.table-' + app.id + '-memory.gauge-rss, "' + timeBucketSize + 'min", "avg")'; - Client.graphs([target], '-' + timePeriod + 'min', function (error, result) { + Client.graphs([target], '-' + timePeriod + 'min', {}, function (error, result) { if (error) return console.log('Unable to get graphs.', error); // translate the data from bytes to MB @@ -137,7 +137,7 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati 'absolute(collectd.localhost.df-' + diskName + '.df_complex-free)', 'absolute(collectd.localhost.df-' + diskName + '.df_complex-reserved)', 'absolute(collectd.localhost.df-' + diskName + '.df_complex-used)' - ], '-1min', function (error, data) { + ], '-1min', {}, function (error, data) { if (error) return console.error(error); disk.size = bytesToGigaBytes(data[2].datapoints[0][0] + data[1].datapoints[0][0] + data[0].datapoints[0][0]); @@ -149,11 +149,11 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati return 'absolute(collectd.localhost.du-' + content.id + '.capacity-usage)'; }); - Client.graphs(graphiteQueries, '-1min', function (error, data) { + Client.graphs(graphiteQueries, '-1min', {}, function (error, data) { if (error) return console.error(error); disk.contains.forEach(function (content, index) { - content.usage = bytesToGigaBytes(data[index].datapoints[0][0]); + content.usage = bytesToGigaBytes(data[index].datapoints[0][1]); }); }); }); @@ -174,7 +174,7 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati targets.push('summarize(collectd.localhost.memory.memory-free, "1min", "avg")'); targetsInfo.push({ label: 'Free', color: '#27CE65' }); - Client.graphs(targets, '-1min', function (error, result) { + Client.graphs(targets, '-1min', {}, function (error, result) { if (error) return console.log(error); $scope.memoryUsageSystem = result.map(function (data, index) { @@ -223,7 +223,7 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati while (targets.length > 0) tmp.push(targets.splice(0, 10)); asyncForEach(tmp, function (targets, callback) { - Client.graphs(targets, '-1min', function (error, result) { + Client.graphs(targets, '-1min', {}, function (error, result) { if (error) return callback(error); aggregatedResult = aggregatedResult.concat(result);