Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]).then(function(values) {
$scope.metrics = new Array();
$scope.metrics["mem.max"] = values[0].data['measurements'][0]['value'];
$scope.metrics["mem.used"] = values[1].data['measurements'][0]['value'];
$scope.metrics["mem.free"] = values[0].data['measurements'][0]['value'] - values[1].data['measurements'][0]['value'];
$scope.humanizedUptime = moment.duration(values[2].data['measurements'][0]['value'], 'seconds').humanize();
var max = 10;
var cur = $scope.memoryConfig.series[0].data.length;
if (cur === max) {
$scope.memoryConfig.series[0].data.splice(0, 1);
$scope.memoryConfig.series[1].data.splice(0, 1);
$scope.memoryConfig.xAxis.categories.splice(0, 1);
}
$scope.memoryConfig.series[0].data.push(formatKibiBytes($scope.metrics["mem.free"]));
$scope.memoryConfig.series[1].data.push(formatKibiBytes($scope.metrics["mem.used"]));
$scope.memoryConfig.xAxis.categories.push($filter('date')(new Date(), "HH:mm:ss"));
});